Move primitive wrappers into its own package "imgui.type"

This commit is contained in:
SpaiR committed 2020-06-16 17:07:21 +03:00
1 parent 52f0343ac4
commit e60f56beb7
13 files changed
+247 -208

No files matched your search

@@ -1,5 +1,7 @@
package imgui; package imgui;
import imgui.type.ImInt;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@@ -311,7 +313,7 @@ public final class ImFontAtlas implements ImGuiDestroyableStruct {
* 1 byte-per-pixel * 1 byte-per-pixel
*/ */
public ByteBuffer getTexDataAsAlpha8(final ImInt outWidth, final ImInt outHeight, final ImInt outBytesPerPixel) { public ByteBuffer getTexDataAsAlpha8(final ImInt outWidth, final ImInt outHeight, final ImInt outBytesPerPixel) {
final byte[] tmpBuff = getTexDataAsAlpha8(outWidth.data, outHeight.data, outBytesPerPixel.data); final byte[] tmpBuff = getTexDataAsAlpha8(outWidth.getData(), outHeight.getData(), outBytesPerPixel.getData());
final ByteBuffer buffer = ByteBuffer.allocateDirect(tmpBuff.length).order(ByteOrder.nativeOrder()); final ByteBuffer buffer = ByteBuffer.allocateDirect(tmpBuff.length).order(ByteOrder.nativeOrder());
buffer.put(tmpBuff); buffer.put(tmpBuff);
buffer.flip(); buffer.flip();
@@ -338,7 +340,7 @@ public final class ImFontAtlas implements ImGuiDestroyableStruct {
* 4 bytes-per-pixel * 4 bytes-per-pixel
*/ */
public ByteBuffer getTexDataAsRGBA32(final ImInt outWidth, final ImInt outHeight, final ImInt outBytesPerPixel) { public ByteBuffer getTexDataAsRGBA32(final ImInt outWidth, final ImInt outHeight, final ImInt outBytesPerPixel) {
final byte[] tmpBuff = nGetTexDataAsRGBA32(outWidth.data, outHeight.data, outBytesPerPixel.data); final byte[] tmpBuff = nGetTexDataAsRGBA32(outWidth.getData(), outHeight.getData(), outBytesPerPixel.getData());
final ByteBuffer buffer = ByteBuffer.allocateDirect(tmpBuff.length).order(ByteOrder.nativeOrder()); final ByteBuffer buffer = ByteBuffer.allocateDirect(tmpBuff.length).order(ByteOrder.nativeOrder());
buffer.put(tmpBuff); buffer.put(tmpBuff);
buffer.flip(); buffer.flip();
File diff suppressed because it is too large. Load diff
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImBool implements Cloneable { public final class ImBool implements Cloneable {
final boolean[] data = new boolean[]{false}; private final boolean[] data = new boolean[]{false};
public ImBool() { public ImBool() {
} }
@@ -20,6 +20,10 @@ public final class ImBool implements Cloneable {
return data[0]; return data[0];
} }
public boolean[] getData() {
return data;
}
public void set(final boolean value) { public void set(final boolean value) {
data[0] = value; data[0] = value;
} }
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImDouble implements Cloneable { public final class ImDouble implements Cloneable {
final double[] data = new double[]{0.0d}; private final double[] data = new double[]{0.0d};
public ImDouble() { public ImDouble() {
} }
@@ -20,6 +20,10 @@ public final class ImDouble implements Cloneable {
return this.data[0]; return this.data[0];
} }
public double[] getData() {
return data;
}
public void set(final double value) { public void set(final double value) {
this.data[0] = value; this.data[0] = value;
} }
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImFloat implements Cloneable { public final class ImFloat implements Cloneable {
final float[] data = new float[]{0}; private final float[] data = new float[]{0};
public ImFloat() { public ImFloat() {
} }
@@ -20,6 +20,10 @@ public final class ImFloat implements Cloneable {
return this.data[0]; return this.data[0];
} }
public float[] getData() {
return data;
}
public void set(final float value) { public void set(final float value) {
this.data[0] = value; this.data[0] = value;
} }
@@ -1,4 +1,4 @@
package imgui; package imgui.type;
/** /**
* Use this class to customize your ImGui input. * Use this class to customize your ImGui input.
@@ -7,13 +7,13 @@ public final class ImGuiInputTextData {
private static final short DEFAULT_RESIZE_FACTOR = 10; private static final short DEFAULT_RESIZE_FACTOR = 10;
/** /**
* If not empty, then other chars which are different from provided will be filtered during the {@link ImGui#inputText} * If not empty, then other chars which are different from provided will be filtered during the {@link imgui.ImGui#inputText}
* and {@link ImGui#inputTextMultiline} methods. * and {@link imgui.ImGui#inputTextMultiline} methods.
*/ */
public String allowedChars = ""; public String allowedChars = "";
/** /**
* If true, then string will be resized during the the {@link ImGui#inputText} and {@link ImGui#inputTextMultiline} methods. * If true, then string will be resized during the the {@link imgui.ImGui#inputText} and {@link imgui.ImGui#inputTextMultiline} methods.
* Alternatively you can provide {@link imgui.flag.ImGuiInputTextFlags#CallbackResize} flag to the input text widgets to enable string resizing. * Alternatively you can provide {@link imgui.flag.ImGuiInputTextFlags#CallbackResize} flag to the input text widgets to enable string resizing.
* Resize factor of the string could be modified by changing {@link #resizeFactor} field. * Resize factor of the string could be modified by changing {@link #resizeFactor} field.
*/ */
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImInt implements Cloneable { public final class ImInt implements Cloneable {
final int[] data = new int[]{0}; private final int[] data = new int[]{0};
public ImInt() { public ImInt() {
} }
@@ -20,6 +20,10 @@ public final class ImInt implements Cloneable {
return this.data[0]; return this.data[0];
} }
public int[] getData() {
return data;
}
public void set(final int value) { public void set(final int value) {
this.data[0] = value; this.data[0] = value;
} }
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImLong implements Cloneable { public final class ImLong implements Cloneable {
final long[] data = new long[]{0}; private final long[] data = new long[]{0};
public ImLong() { public ImLong() {
} }
@@ -20,6 +20,10 @@ public final class ImLong implements Cloneable {
return this.data[0]; return this.data[0];
} }
public long[] getData() {
return data;
}
public void set(final long value) { public void set(final long value) {
this.data[0] = value; this.data[0] = value;
} }
@@ -1,9 +1,9 @@
package imgui; package imgui.type;
import java.util.Objects; import java.util.Objects;
public final class ImShort implements Cloneable { public final class ImShort implements Cloneable {
final short[] data = new short[]{0}; private final short[] data = new short[]{0};
public ImShort() { public ImShort() {
} }
@@ -20,6 +20,10 @@ public final class ImShort implements Cloneable {
return this.data[0]; return this.data[0];
} }
public short[] getData() {
return data;
}
public void set(final short value) { public void set(final short value) {
this.data[0] = value; this.data[0] = value;
} }
@@ -1,4 +1,4 @@
package imgui; package imgui.type;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Objects; import java.util.Objects;
@@ -22,7 +22,7 @@ public final class ImString implements Cloneable {
*/ */
public final ImGuiInputTextData inputData = new ImGuiInputTextData(); public final ImGuiInputTextData inputData = new ImGuiInputTextData();
byte[] data; private byte[] data;
private String text = ""; private String text = "";
/** /**
@@ -77,6 +77,10 @@ public final class ImString implements Cloneable {
return text; return text;
} }
public byte[] getData() {
return data;
}
public void set(final String value) { public void set(final String value) {
set(value, inputData.isResizable, inputData.resizeFactor); set(value, inputData.isResizable, inputData.resizeFactor);
} }
@@ -1,5 +1,6 @@
package imgui; package imgui;
import imgui.type.ImString;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -4,7 +4,7 @@ import imgui.ImDrawData;
import imgui.ImFontAtlas; import imgui.ImFontAtlas;
import imgui.ImGui; import imgui.ImGui;
import imgui.ImGuiIO; import imgui.ImGuiIO;
import imgui.ImInt; import imgui.type.ImInt;
import imgui.ImVec2; import imgui.ImVec2;
import imgui.ImVec4; import imgui.ImVec4;
import imgui.flag.ImGuiBackendFlags; import imgui.flag.ImGuiBackendFlags;
+2 -2
View File
@@ -1,7 +1,7 @@
import imgui.ImBool; import imgui.type.ImBool;
import imgui.ImColor; import imgui.ImColor;
import imgui.ImGui; import imgui.ImGui;
import imgui.ImString; import imgui.type.ImString;
import imgui.ImVec2; import imgui.ImVec2;
import imgui.flag.ImGuiColorEditFlags; import imgui.flag.ImGuiColorEditFlags;
import imgui.flag.ImGuiCond; import imgui.flag.ImGuiCond;