Move libs to top level

This commit is contained in:
Willem Cazander 2022-03-02 02:23:25 +01:00
parent 87ce108bd1
commit 57f46b2210
212 changed files with 16 additions and 29 deletions

View file

@ -0,0 +1,36 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>love.distributedrebirth.gdxapp4d</groupId>
<artifactId>gdxapp4d</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>gdxapp4d-lib-imxmi</artifactId>
<dependencies>
<dependency>
<groupId>love.distributedrebirth.gdxapp4d</groupId>
<artifactId>gdxapp4d-lib-bassboonyd</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-binding</artifactId>
</dependency>
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-lwjgl3</artifactId>
</dependency>
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-natives-linux</artifactId>
</dependency>
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-natives-macos</artifactId>
</dependency>
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-natives-windows</artifactId>
</dependency>
</dependencies>
</project>

View file

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

View file

@ -0,0 +1,29 @@
package love.distributedrebirth.imxmi.lang;
import java.util.function.Function;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
abstract public class AbstractImComponentDataˣᴹᴵ implements ImComponentDataˣᴹᴵ {
private Function<Object, Object> dataExtractor;
@Override
public void setDataExtractor(Function<Object, Object> dataExtractor) {
this.dataExtractor = dataExtractor;
}
@Override
public Function<Object, Object> getDataExtractor() {
return dataExtractor;
}
@Override
public void renderBegin() {
}
@Override
public void renderEnd() {
}
}

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

@ -0,0 +1,41 @@
package love.distributedrebirth.imxmi.lang;
import imgui.ImGui;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImButtonˣᴹᴵ extends AbstractImComponentˣᴹᴵ {
private String label;
private Runnable callback;
public ImButtonˣᴹᴵ() {
}
public ImButtonˣᴹᴵ(String label) {
setLabel(label);
}
@Override
public void renderComponent() {
if (ImGui.button(label) && callback != null) {
callback.run();
}
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Runnable getCallback() {
return callback;
}
public void setCallback(Runnable callback) {
this.callback = callback;
}
}

View file

@ -0,0 +1,56 @@
package love.distributedrebirth.imxmi.lang;
import imgui.ImGui;
import imgui.type.ImInt;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImComboˣᴹᴵ extends AbstractImComponentˣᴹᴵ {
private String label;
private final ImInt currentItem = new ImInt();
private String[] items;
private Runnable callback;
public ImComboˣᴹᴵ() {
}
public ImComboˣᴹᴵ(String label) {
setLabel(label);
}
@Override
public void renderComponent() {
if (ImGui.combo(label, currentItem, items) && callback != null) {
callback.run();
}
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Runnable getCallback() {
return callback;
}
public void setCallback(Runnable callback) {
this.callback = callback;
}
public ImInt getCurrentItem() {
return currentItem;
}
public String[] getItems() {
return items;
}
public void setItems(String[] items) {
this.items = items;
}
}

View file

@ -0,0 +1,15 @@
package love.distributedrebirth.imxmi.lang;
import java.util.function.Function;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public interface ImComponentDataˣᴹᴵ extends ImComponentˣᴹᴵ {
void setDataExtractor(Function<Object, Object> dataExtractor);
Function<Object, Object> getDataExtractor();
void setData(Object value);
}

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

@ -0,0 +1,126 @@
package love.distributedrebirth.imxmi.lang;
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);
}
@Override
public void renderComponent() {
if (ImGui.begin(title, frameOpen)) {
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 void setNextWindowPos(float nextWindowPosX, float nextWindowPosY) {
setNextWindowPosX(nextWindowPosX);
setNextWindowPosY(nextWindowPosY);
}
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 void setNextWindowSize(float nextWindowSizeWidth, float nextWindowSizeHeight) {
setNextWindowSizeWidth(nextWindowSizeWidth);
setNextWindowSizeHeight(nextWindowSizeHeight);
}
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,16 @@
package love.distributedrebirth.imxmi.lang;
import imgui.ImGui;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImSameLineˣᴹᴵ extends AbstractImComponentˣᴹᴵ {
public ImSameLineˣᴹᴵ() {
}
@Override
public void renderComponent() {
ImGui.sameLine();
}
}

View file

@ -0,0 +1,16 @@
package love.distributedrebirth.imxmi.lang;
import imgui.ImGui;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImSeparatorˣᴹᴵ extends AbstractImComponentˣᴹᴵ {
public ImSeparatorˣᴹᴵ() {
}
@Override
public void renderComponent() {
ImGui.separator();
}
}

View file

@ -0,0 +1,71 @@
package love.distributedrebirth.imxmi.lang;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import imgui.ImGui;
import imgui.flag.ImGuiTableFlags;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImTableˣᴹᴵ extends AbstractImComponentˣᴹᴵ {
private String id;
private int flags;
private List<String> columns;
private Supplier<List<Object>> dataSupplier;
private List<ImComponentDataˣᴹᴵ> components = new ArrayList<>();
public ImTableˣᴹᴵ() {
this(null);
}
public ImTableˣᴹᴵ(String id) {
this.id = id;
this.columns = new ArrayList<>();
this.flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
}
@Override
public void renderBegin() {
ImGui.beginTable(id, columns.size(), flags);
for (String column:columns) {
ImGui.tableSetupColumn(column);
}
ImGui.tableHeadersRow();
}
@Override
public void renderComponent() {
List<Object> rows = dataSupplier.get();
for (Object row:rows) {
ImGui.tableNextRow();
for (ImComponentDataˣᴹᴵ comp:getComponents()) {
ImGui.tableNextColumn();
comp.setData(row);
comp.renderBegin();
comp.renderComponent();
comp.renderEnd();
}
}
}
@Override
public void renderEnd() {
ImGui.endTable();
}
public void addComponent(ImComponentDataˣᴹᴵ comp) {
components.add(comp);
}
public void removeComponent(ImComponentDataˣᴹᴵ comp) {
components.remove(comp);
}
public List<ImComponentDataˣᴹᴵ> getComponents() {
return components;
}
}

View file

@ -0,0 +1,29 @@
package love.distributedrebirth.imxmi.lang;
import java.util.function.Function;
import imgui.ImGui;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImTextDataˣᴹᴵ extends AbstractImComponentDataˣᴹᴵ {
private String text;
public ImTextDataˣᴹᴵ() {
}
public ImTextDataˣᴹᴵ(Function<Object, Object> dataExtractor) {
setDataExtractor(dataExtractor);
}
@Override
public void renderComponent() {
ImGui.text(text);
}
@Override
public void setData(Object value) {
text = String.class.cast(getDataExtractor().apply(value));
}
}

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