Skip to content

Commit

Permalink
Merge pull request #187 from kyay10/1.89.2
Browse files Browse the repository at this point in the history
Remove global mutable fields and reduce data-type related duplication
  • Loading branch information
elect86 committed May 17, 2023
2 parents 0c65ed8 + 032bf8a commit 9813d37
Show file tree
Hide file tree
Showing 57 changed files with 2,564 additions and 5,262 deletions.
26 changes: 13 additions & 13 deletions core/src/main/java/imgui/Jdsl.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public static void window(String name, Runnable block) {
window(name, null, Flag.empty(), block);
}

public static void window(String name, MutableProperty0<Boolean> open, Runnable block) {
public static void window(String name, MutableReference<Boolean> open, Runnable block) {
window(name, open, Flag.empty(), block);
}

public static void window(String name, MutableProperty0<Boolean> open, Flag<WindowFlag> windowFlags, Runnable block) {
public static void window(String name, MutableReference<Boolean> open, Flag<WindowFlag> windowFlags, Runnable block) {
if (imgui.begin(name, open, windowFlags)) // ~open
block.run();
imgui.end();
Expand Down Expand Up @@ -255,12 +255,12 @@ public static void imageButton(String srtId, int userTextureId, Vec2 size, Vec2
block.run();
}

public static void checkbox(String label, MutableProperty0<Boolean> vPtr, Runnable block) {
public static void checkbox(String label, MutableReference<Boolean> vPtr, Runnable block) {
if (imgui.checkbox(label, vPtr))
block.run();
}

public static <F extends Flag<F>> void checkboxFlags(String label, MutableProperty0<Flag<F>> vPtr, Flag<F> flagsValue, Runnable block) {
public static <F extends Flag<F>> void checkboxFlags(String label, MutableReference<Flag<F>> vPtr, Flag<F> flagsValue, Runnable block) {
if (imgui.checkboxFlags(label, vPtr, flagsValue))
block.run();
}
Expand All @@ -275,7 +275,7 @@ public static void radioButton(String label, boolean active, Runnable block) {
block.run();
}

public static void radioButton(String label, MutableProperty0<Integer> v, int vButton, Runnable block) {
public static void radioButton(String label, MutableReference<Integer> v, int vButton, Runnable block) {
if (imgui.radioButton(label, v, vButton))
block.run();
}
Expand All @@ -295,11 +295,11 @@ public static void useCombo(String label, String previewValue, Flag<ComboFlag> c
}
}

public static void combo(String label, MutableProperty0<Integer> currentItem, String itemsSeparatedByZeros, Runnable block) {
public static void combo(String label, MutableReference<Integer> currentItem, String itemsSeparatedByZeros, Runnable block) {
combo(label, currentItem, itemsSeparatedByZeros, -1, block);
}

public static void combo(String label, MutableProperty0<Integer> currentItem, String itemsSeparatedByZeros, int heightInItems, Runnable block) {
public static void combo(String label, MutableReference<Integer> currentItem, String itemsSeparatedByZeros, int heightInItems, Runnable block) {
if (imgui.combo(label, currentItem, itemsSeparatedByZeros, heightInItems))
block.run();
}
Expand Down Expand Up @@ -370,11 +370,11 @@ public static void collapsingHeader(String label, Flag<TreeNodeFlag> treeNodeFla
block.run();
}

public static void collapsingHeader(String label, MutableProperty0<Boolean> open, Runnable block) {
public static void collapsingHeader(String label, MutableReference<Boolean> open, Runnable block) {
collapsingHeader(label, open, Flag.empty(), block);
}

public static void collapsingHeader(String label, MutableProperty0<Boolean> open, Flag<TreeNodeFlag> treeNodeFlags, Runnable block) {
public static void collapsingHeader(String label, MutableReference<Boolean> open, Flag<TreeNodeFlag> treeNodeFlags, Runnable block) {
if (imgui.collapsingHeader(label, open, treeNodeFlags))
block.run();
}
Expand Down Expand Up @@ -504,11 +504,11 @@ public static void popupModal(String name, Runnable block) {
popupModal(name, null, Flag.empty(), block);
}

public static void popupModal(String name, MutableProperty0<Boolean> pOpen, Runnable block) {
public static void popupModal(String name, MutableReference<Boolean> pOpen, Runnable block) {
popupModal(name, pOpen, Flag.empty(), block);
}

public static void popupModal(String name, MutableProperty0<Boolean> pOpen, Flag<WindowFlag> windowFlags, Runnable block) {
public static void popupModal(String name, MutableReference<Boolean> pOpen, Flag<WindowFlag> windowFlags, Runnable block) {
if (imgui.beginPopupModal(name, pOpen, windowFlags)) {
block.run();
imgui.endPopup();
Expand All @@ -532,11 +532,11 @@ public static void tabItem(String label, Runnable block) {
tabItem(label, null, Flag.empty(), block);
}

public static void tabItem(String label, MutableProperty0<Boolean> pOpen, Runnable block) {
public static void tabItem(String label, MutableReference<Boolean> pOpen, Runnable block) {
tabItem(label, pOpen, Flag.empty(), block);
}

public static void tabItem(String label, MutableProperty0<Boolean> pOpen, Flag<TabItemFlag.ItemOnly> tabItemFlags, Runnable block) {
public static void tabItem(String label, MutableReference<Boolean> pOpen, Flag<TabItemFlag.ItemOnly> tabItemFlags, Runnable block) {
if (imgui.beginTabItem(label, pOpen, tabItemFlags))
block.run();
imgui.endTabItem();
Expand Down
134 changes: 0 additions & 134 deletions core/src/main/java/imgui/MutableProperty0.java

This file was deleted.

Loading

0 comments on commit 9813d37

Please sign in to comment.