Start with imxmi

This commit is contained in:
Willem 2022-02-07 15:30:07 +01:00
parent ea5d955a4d
commit fa1da00d4d
9 changed files with 228 additions and 6 deletions

View file

@ -83,6 +83,11 @@ project(":lib-imxmi") {
apply plugin: "java-library" apply plugin: "java-library"
dependencies { dependencies {
api project(":lib-basicwd") 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" testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
} }
tasks.named('test') { tasks.named('test') {
@ -95,11 +100,6 @@ project(":main-gdxapp") {
dependencies { dependencies {
api project(":lib-imxmi") api project(":lib-imxmi")
api "com.badlogicgames.gdx:gdx:$gdxVersion" 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" api "games.spooky.gdx:gdx-nativefilechooser:$nativefilechooserVersion"
} }
} }

View file

@ -1,5 +1,8 @@
package love.distributedrebirth.imxmi; package love.distributedrebirth.imxmi;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImXmiSetup { public class ImXmiSetup {
} }

View file

@ -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<ImComponentˣᴹᴵ> components = new ArrayList<>();
@Override
public void addComponent(ImComponentˣᴹᴵ comp) {
components.add(comp);
}
@Override
public void removeComponent(ImComponentˣᴹᴵ comp) {
components.remove(comp);
}
@Override
public List<ImComponentˣᴹᴵ> getComponents() {
return components;
}
}

View file

@ -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() {
}
}

View file

@ -1,5 +1,8 @@
package love.distributedrebirth.imxmi.lang; package love.distributedrebirth.imxmi.lang;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImButtonˣᴹᴵ { public class ImButtonˣᴹᴵ {
} }

View file

@ -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<ImComponentˣᴹᴵ> getComponents();
default void renderComponents() {
for (ImComponentˣᴹᴵ comp:getComponents()) {
comp.renderBegin();
comp.renderComponent();
comp.renderEnd();
}
}
}

View file

@ -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();
}

View file

@ -1,5 +1,115 @@
package love.distributedrebirth.imxmi.lang; 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;
}
} }

View file

@ -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;
}
}