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;
import imgui.type.ImInt;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -311,7 +313,7 @@ public final class ImFontAtlas implements ImGuiDestroyableStruct {
* 1 byte-per-pixel
*/
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());
buffer.put(tmpBuff);
buffer.flip();
@@ -338,7 +340,7 @@ public final class ImFontAtlas implements ImGuiDestroyableStruct {
* 4 bytes-per-pixel
*/
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());
buffer.put(tmpBuff);
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;
public final class ImBool implements Cloneable {
final boolean[] data = new boolean[]{false};
private final boolean[] data = new boolean[]{false};
public ImBool() {
}
@@ -20,6 +20,10 @@ public final class ImBool implements Cloneable {
return data[0];
}
public boolean[] getData() {
return data;
}
public void set(final boolean value) {
data[0] = value;
}
@@ -1,9 +1,9 @@
package imgui;
package imgui.type;
import java.util.Objects;
public final class ImDouble implements Cloneable {
final double[] data = new double[]{0.0d};
private final double[] data = new double[]{0.0d};
public ImDouble() {
}
@@ -20,6 +20,10 @@ public final class ImDouble implements Cloneable {
return this.data[0];
}
public double[] getData() {
return data;
}
public void set(final double value) {
this.data[0] = value;
}
@@ -1,9 +1,9 @@
package imgui;
package imgui.type;
import java.util.Objects;
public final class ImFloat implements Cloneable {
final float[] data = new float[]{0};
private final float[] data = new float[]{0};
public ImFloat() {
}
@@ -20,6 +20,10 @@ public final class ImFloat implements Cloneable {
return this.data[0];
}
public float[] getData() {
return data;
}
public void set(final float value) {
this.data[0] = value;
}
@@ -1,4 +1,4 @@
package imgui;
package imgui.type;
/**
* Use this class to customize your ImGui input.
@@ -7,13 +7,13 @@ public final class ImGuiInputTextData {
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}
* and {@link ImGui#inputTextMultiline} methods.
* If not empty, then other chars which are different from provided will be filtered during the {@link imgui.ImGui#inputText}
* and {@link imgui.ImGui#inputTextMultiline} methods.
*/
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.
* 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;
public final class ImInt implements Cloneable {
final int[] data = new int[]{0};
private final int[] data = new int[]{0};
public ImInt() {
}
@@ -20,6 +20,10 @@ public final class ImInt implements Cloneable {
return this.data[0];
}
public int[] getData() {
return data;
}
public void set(final int value) {
this.data[0] = value;
}
@@ -1,9 +1,9 @@
package imgui;
package imgui.type;
import java.util.Objects;
public final class ImLong implements Cloneable {
final long[] data = new long[]{0};
private final long[] data = new long[]{0};
public ImLong() {
}
@@ -20,6 +20,10 @@ public final class ImLong implements Cloneable {
return this.data[0];
}
public long[] getData() {
return data;
}
public void set(final long value) {
this.data[0] = value;
}
@@ -1,9 +1,9 @@
package imgui;
package imgui.type;
import java.util.Objects;
public final class ImShort implements Cloneable {
final short[] data = new short[]{0};
private final short[] data = new short[]{0};
public ImShort() {
}
@@ -20,6 +20,10 @@ public final class ImShort implements Cloneable {
return this.data[0];
}
public short[] getData() {
return data;
}
public void set(final short value) {
this.data[0] = value;
}
@@ -1,4 +1,4 @@
package imgui;
package imgui.type;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
@@ -22,7 +22,7 @@ public final class ImString implements Cloneable {
*/
public final ImGuiInputTextData inputData = new ImGuiInputTextData();
byte[] data;
private byte[] data;
private String text = "";
/**
@@ -77,6 +77,10 @@ public final class ImString implements Cloneable {
return text;
}
public byte[] getData() {
return data;
}
public void set(final String value) {
set(value, inputData.isResizable, inputData.resizeFactor);
}
@@ -1,5 +1,6 @@
package imgui;
import imgui.type.ImString;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -4,7 +4,7 @@ import imgui.ImDrawData;
import imgui.ImFontAtlas;
import imgui.ImGui;
import imgui.ImGuiIO;
import imgui.ImInt;
import imgui.type.ImInt;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.flag.ImGuiBackendFlags;
+2 -2
View File
@@ -1,7 +1,7 @@
import imgui.ImBool;
import imgui.type.ImBool;
import imgui.ImColor;
import imgui.ImGui;
import imgui.ImString;
import imgui.type.ImString;
import imgui.ImVec2;
import imgui.flag.ImGuiColorEditFlags;
import imgui.flag.ImGuiCond;