diff --git a/build.gradle b/build.gradle index 500ac8f8..77162875 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,11 @@ project(":lib-imxmi") { apply plugin: "java-library" dependencies { api project(":lib-basicwd") + api "io.github.spair:imgui-java-binding:$spairVersion" + api "io.github.spair:imgui-java-lwjgl3:$spairVersion" + api "io.github.spair:imgui-java-natives-linux:$spairVersion" + api "io.github.spair:imgui-java-natives-macos:$spairVersion" + api "io.github.spair:imgui-java-natives-windows:$spairVersion" testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" } tasks.named('test') { @@ -95,11 +100,6 @@ project(":main-gdxapp") { dependencies { api project(":lib-imxmi") api "com.badlogicgames.gdx:gdx:$gdxVersion" - api "io.github.spair:imgui-java-binding:$spairVersion" - api "io.github.spair:imgui-java-lwjgl3:$spairVersion" - api "io.github.spair:imgui-java-natives-linux:$spairVersion" - api "io.github.spair:imgui-java-natives-macos:$spairVersion" - api "io.github.spair:imgui-java-natives-windows:$spairVersion" api "games.spooky.gdx:gdx-nativefilechooser:$nativefilechooserVersion" } } diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/ImXmiSetup.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/ImXmiSetup.java index b099c550..fdcfc054 100644 --- a/lib-imxmi/src/main/love/distributedrebirth/imxmi/ImXmiSetup.java +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/ImXmiSetup.java @@ -1,5 +1,8 @@ package love.distributedrebirth.imxmi; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ImXmiSetup { } diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentSetˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentSetˣᴹᴵ.java new file mode 100644 index 00000000..01663ff4 --- /dev/null +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentSetˣᴹᴵ.java @@ -0,0 +1,27 @@ +package love.distributedrebirth.imxmi.lang; + +import java.util.ArrayList; +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +abstract public class AbstractImComponentSetˣᴹᴵ implements ImComponentSetˣᴹᴵ { + + protected List components = new ArrayList<>(); + + @Override + public void addComponent(ImComponentˣᴹᴵ comp) { + components.add(comp); + } + + @Override + public void removeComponent(ImComponentˣᴹᴵ comp) { + components.remove(comp); + } + + @Override + public List getComponents() { + return components; + } +} diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentˣᴹᴵ.java new file mode 100644 index 00000000..c046b1c7 --- /dev/null +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/AbstractImComponentˣᴹᴵ.java @@ -0,0 +1,15 @@ +package love.distributedrebirth.imxmi.lang; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +abstract public class AbstractImComponentˣᴹᴵ implements ImComponentˣᴹᴵ { + + @Override + public void renderBegin() { + } + + @Override + public void renderEnd() { + } +} diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImButtonˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImButtonˣᴹᴵ.java index 7142ab64..e63cf4a5 100644 --- a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImButtonˣᴹᴵ.java +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImButtonˣᴹᴵ.java @@ -1,5 +1,8 @@ package love.distributedrebirth.imxmi.lang; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ImButtonˣᴹᴵ { } diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentSetˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentSetˣᴹᴵ.java new file mode 100644 index 00000000..d1066134 --- /dev/null +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentSetˣᴹᴵ.java @@ -0,0 +1,21 @@ +package love.distributedrebirth.imxmi.lang; + +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public interface ImComponentSetˣᴹᴵ extends ImComponentˣᴹᴵ { + + void addComponent(ImComponentˣᴹᴵ comp); + void removeComponent(ImComponentˣᴹᴵ comp); + List getComponents(); + + default void renderComponents() { + for (ImComponentˣᴹᴵ comp:getComponents()) { + comp.renderBegin(); + comp.renderComponent(); + comp.renderEnd(); + } + } +} diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentˣᴹᴵ.java new file mode 100644 index 00000000..af06b493 --- /dev/null +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImComponentˣᴹᴵ.java @@ -0,0 +1,13 @@ +package love.distributedrebirth.imxmi.lang; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public interface ImComponentˣᴹᴵ { + + void renderBegin(); + + void renderComponent(); + + void renderEnd(); +} diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImFrameˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImFrameˣᴹᴵ.java index 8c37933f..d044d724 100644 --- a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImFrameˣᴹᴵ.java +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImFrameˣᴹᴵ.java @@ -1,5 +1,115 @@ package love.distributedrebirth.imxmi.lang; -public class ImFrameˣᴹᴵ { +import imgui.ImGui; +import imgui.flag.ImGuiCond; +import imgui.type.ImBoolean; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class ImFrameˣᴹᴵ extends AbstractImComponentSetˣᴹᴵ { + + private String title; + private ImBoolean frameOpen; + private float nextWindowPosX; + private float nextWindowPosY; + private int nextWindowPosCond; + private float nextWindowSizeWidth; + private float nextWindowSizeHeight; + private int nextWindowSizeCond; + + public ImFrameˣᴹᴵ() { + this(null, null); + } + + public ImFrameˣᴹᴵ(String title, ImBoolean frameOpen) { + this.title = title; + this.frameOpen = frameOpen; + nextWindowPosX = 320; + nextWindowPosY = 240; + nextWindowPosCond = ImGuiCond.FirstUseEver; + nextWindowSizeWidth = 640; + nextWindowSizeHeight = 480; + nextWindowSizeCond = ImGuiCond.FirstUseEver; + } + + @Override + public void renderBegin() { + ImGui.setNextWindowPos(nextWindowPosX, nextWindowPosY, nextWindowPosCond); + ImGui.setNextWindowSize(nextWindowSizeWidth, nextWindowSizeHeight, nextWindowSizeCond); + ImGui.begin(title, frameOpen); + } + + @Override + public void renderComponent() { + renderComponents(); + } + + @Override + public void renderEnd() { + ImGui.end(); + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public ImBoolean getFrameOpen() { + return frameOpen; + } + + public void setFrameOpen(ImBoolean frameOpen) { + this.frameOpen = frameOpen; + } + + public float getNextWindowPosX() { + return nextWindowPosX; + } + + public void setNextWindowPosX(float nextWindowPosX) { + this.nextWindowPosX = nextWindowPosX; + } + + public float getNextWindowPosY() { + return nextWindowPosY; + } + + public void setNextWindowPosY(float nextWindowPosY) { + this.nextWindowPosY = nextWindowPosY; + } + + public int getNextWindowPosCond() { + return nextWindowPosCond; + } + + public void setNextWindowPosCond(int nextWindowPosCond) { + this.nextWindowPosCond = nextWindowPosCond; + } + + public float getNextWindowSizeWidth() { + return nextWindowSizeWidth; + } + + public void setNextWindowSizeWidth(float nextWindowSizeWidth) { + this.nextWindowSizeWidth = nextWindowSizeWidth; + } + + public float getNextWindowSizeHeight() { + return nextWindowSizeHeight; + } + + public void setNextWindowSizeHeight(float nextWindowSizeHeight) { + this.nextWindowSizeHeight = nextWindowSizeHeight; + } + + public int getNextWindowSizeCond() { + return nextWindowSizeCond; + } + + public void setNextWindowSizeCond(int nextWindowSizeCond) { + this.nextWindowSizeCond = nextWindowSizeCond; + } } diff --git a/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImTextˣᴹᴵ.java b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImTextˣᴹᴵ.java new file mode 100644 index 00000000..6c47a18f --- /dev/null +++ b/lib-imxmi/src/main/love/distributedrebirth/imxmi/lang/ImTextˣᴹᴵ.java @@ -0,0 +1,30 @@ +package love.distributedrebirth.imxmi.lang; + +import imgui.ImGui; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class ImTextˣᴹᴵ extends AbstractImComponentˣᴹᴵ { + + private String text; + + public ImTextˣᴹᴵ() { + } + + public ImTextˣᴹᴵ(String text) { + setText(text); + } + + @Override + public void renderComponent() { + ImGui.text(text); + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +}