Add checkstyle to imgui-binding and make everything compliant to Java codestyle

This commit is contained in:
SpaiR committed 2020-01-01 15:50:24 +03:00
1 parent 3f7698fc67
commit 2b8828dda4
20 files changed
+1646 -1584

No files matched your search

+9 -2
View File
@@ -91,6 +91,10 @@
<!-- Suppress warnings by using -->
<module name="SuppressWarningsFilter"/>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml" />
</module>
<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
@@ -160,7 +164,10 @@
<!-- See https://checkstyle.org/config_coding.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="HiddenField" >
<property name="ignoreSetter" value="true" />
<property name="ignoreConstructorParameter" value="true" />
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
@@ -182,7 +189,7 @@
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<module name="FinalLocalVariable"/>
<module name="TodoComment"/>
<!-- <module name="TodoComment"/> -->
<module name="UpperEll"/>
<!-- See https://checkstyle.sourceforge.io/config_annotation.html#SuppressWarningsHolder -->
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="MagicNumber" files="[\\/]imgui[\\/]"/>
<suppress checks="LineLength" files="[\\/]imgui[\\/]"/>
<suppress checks="ConstantName" files="[\\/]imgui[\\/]"/>
<suppress checks="VisibilityModifier" files="[\\/]imgui[\\/]"/>
<suppress checks="ParameterNumber" files="[\\/]imgui[\\/]"/>
<suppress checks="FileLength" files="[\\/]imgui[\\/]"/>
<suppress checks="FinalParameters" files="ImGui.java"/>
</suppressions>
+1
View File
@@ -2,6 +2,7 @@ import imgui.generate.GenerateLibs
plugins {
id 'java'
id 'checkstyle'
id 'com.jfrog.bintray' version '1.8.4'
id 'maven-publish'
}
+11 -7
View File
@@ -3,12 +3,12 @@ package imgui;
import java.util.Objects;
public final class ImBool {
boolean[] data = new boolean[]{false};
final boolean[] data = new boolean[]{false};
public ImBool() {
}
public ImBool(boolean value) {
public ImBool(final boolean value) {
data[0] = value;
}
@@ -16,7 +16,7 @@ public final class ImBool {
return data[0];
}
public void set(boolean value) {
public void set(final boolean value) {
data[0] = value;
}
@@ -26,10 +26,14 @@ public final class ImBool {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImBool imBool = (ImBool) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImBool imBool = (ImBool) o;
return data[0] == imBool.data[0];
}
@@ -3,12 +3,12 @@ package imgui;
import java.util.Objects;
public final class ImDouble {
double[] data = new double[]{0.0d};
final double[] data = new double[]{0.0d};
public ImDouble() {
}
public ImDouble(double value) {
public ImDouble(final double value) {
set(value);
}
@@ -16,7 +16,7 @@ public final class ImDouble {
return this.data[0];
}
public void set(double value) {
public void set(final double value) {
this.data[0] = value;
}
@@ -26,10 +26,14 @@ public final class ImDouble {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImDouble imDouble = (ImDouble) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImDouble imDouble = (ImDouble) o;
return data[0] == imDouble.data[0];
}
@@ -9,9 +9,9 @@ import java.nio.ByteOrder;
* BINDING NOTICE: DO NOT TRY TO MODIFY FIELDS OF THIS CLASS MANUALLY! You should only access their values after {@link ImGui#Render()} call.
*/
public final class ImDrawData {
public static int V_BUFFER_SIZE = (4 + 1) * 4;
public static int I_BUFFER_SIZE = 2;
public static int CMD_BUFFER_SIZE = (1 + 4 + 1) * 4;
public static final int V_BUFFER_SIZE = (4 + 1) * 4;
public static final int I_BUFFER_SIZE = 2;
public static final int CMD_BUFFER_SIZE = (1 + 4 + 1) * 4;
public ByteBuffer vByteBuffer;
public ByteBuffer iByteBuffer;
@@ -37,7 +37,7 @@ public final class ImDrawData {
public float framebufferScaleX;
public float framebufferScaleY;
ImDrawData(int maxVertices, int maxIndices, int maxCmd) {
ImDrawData(final int maxVertices, final int maxIndices, final int maxCmd) {
vByteBuffer = ByteBuffer.allocateDirect(maxVertices * V_BUFFER_SIZE).order(ByteOrder.nativeOrder());
iByteBuffer = ByteBuffer.allocateDirect(maxIndices * I_BUFFER_SIZE).order(ByteOrder.nativeOrder());
cmdByteBuffer = ByteBuffer.allocateDirect(maxCmd * CMD_BUFFER_SIZE).order(ByteOrder.nativeOrder());
+107 -107
View File
@@ -18,7 +18,7 @@ public final class ImDrawList {
private final int drawListType;
ImDrawList(int drawListType) {
ImDrawList(final int drawListType) {
this.drawListType = drawListType;
}
@@ -61,103 +61,103 @@ public final class ImDrawList {
*/
// Primitives
// - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners.
// - For rectangular primitives, "pMin" and "pMax" represent the upper-left and lower-right corners.
public native void AddLine(float p1_x, float p1_y, float p2_x, float p2_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddLine(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), col);
public native void addLine(float p1X, float p1Y, float p2X, float p2Y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddLine(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), col);
*/
public native void AddLine(float p1_x, float p1_y, float p2_x, float p2_y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddLine(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), col, thickness);
public native void addLine(float p1X, float p1Y, float p2X, float p2Y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddLine(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), col, thickness);
*/
public native void AddRect(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col);
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col);
*/
public native void AddRect(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col, rounding);
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, long col, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding);
*/
public native void AddRect(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col, float rounding, int rounding_corners_flags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col, rounding, rounding_corners_flags);
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, long col, float rounding, int roundingCornersFlags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, roundingCornersFlags);
*/
public native void AddRect(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col, float rounding, int rounding_corners_flags, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col, rounding, rounding_corners_flags, thickness);
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, long col, float rounding, int roundingCornersFlags, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, roundingCornersFlags, thickness);
*/
public native void AddRectFilled(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col);
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col);
*/
public native void AddRectFilled(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col, rounding);
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, long col, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding);
*/
public native void AddRectFilled(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col, float rounding, int rounding_corners_flags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col, rounding, rounding_corners_flags);
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, long col, float rounding, int roundingCornersFlags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, roundingCornersFlags);
*/
public native void AddRectFilledMultiColor(float p_min_x, float p_min_y, float p_max_x, float p_max_y, long col_upr_left, long col_upr_right, long col_bot_right, long col_bot_left); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilledMultiColor(ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), col_upr_left, col_upr_right, col_bot_right, col_bot_left);
public native void addRectFilledMultiColor(float pMinX, float pMinY, float pMaxX, float pMaxY, long colUprLeft, long colUprRight, long colBotRight, long colBotLeft); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddRectFilledMultiColor(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), colUprLeft, colUprRight, colBotRight, colBotLeft);
*/
public native void AddQuad(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuad(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), col);
public native void addQuad(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuad(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col);
*/
public native void AddQuad(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuad(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), col, thickness);
public native void addQuad(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuad(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col, thickness);
*/
public native void AddQuadFilled(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuadFilled(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), col);
public native void addQuadFilled(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddQuadFilled(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col);
*/
public native void AddTriangle(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangle(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), col);
public native void addTriangle(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangle(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col);
*/
public native void AddTriangle(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangle(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), col, thickness);
public native void addTriangle(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangle(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col, thickness);
*/
public native void AddTriangleFilled(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangleFilled(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), col);
public native void addTriangleFilled(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddTriangleFilled(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col);
*/
public native void AddCircle(float centre_x, float centre_y, float radius, float col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centre_x, centre_y), radius, col);
public native void addCircle(float centreX, float centreY, float radius, float col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centreX, centreY), radius, col);
*/
public native void AddCircle(float centre_x, float centre_y, float radius, float col, int num_segments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centre_x, centre_y), radius, col, num_segments);
public native void addCircle(float centreX, float centreY, float radius, float col, int numSegments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void AddCircle(float centre_x, float centre_y, float radius, float col, int num_segments, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centre_x, centre_y), radius, col, num_segments, thickness);
public native void addCircle(float centreX, float centreY, float radius, float col, int numSegments, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircle(ImVec2(centreX, centreY), radius, col, numSegments, thickness);
*/
public native void AddCircleFilled(float centre_x, float centre_y, float radius, float col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircleFilled(ImVec2(centre_x, centre_y), radius, col);
public native void addCircleFilled(float centreX, float centreY, float radius, float col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircleFilled(ImVec2(centreX, centreY), radius, col);
*/
public native void AddCircleFilled(float centre_x, float centre_y, float radius, float col, int num_segments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircleFilled(ImVec2(centre_x, centre_y), radius, col, num_segments);
public native void addCircleFilled(float centreX, float centreY, float radius, float col, int numSegments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddCircleFilled(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void AddText(float pos_x, float pos_y, int col, String text_begin); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddText(ImVec2(pos_x, pos_y), col, text_begin);
public native void addText(float posX, float posY, int col, String textBegin); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddText(ImVec2(posX, posY), col, textBegin);
*/
public native void AddText(float pos_x, float pos_y, int col, String text_begin, String text_end); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddText(ImVec2(pos_x, pos_y), col, text_begin, text_end);
public native void addText(float posX, float posY, int col, String textBegin, String textEnd); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddText(ImVec2(posX, posY), col, textBegin, textEnd);
*/
// TODO add text with font support
public native void AddPolyline(ImVec2[] points, int num_points, long col, boolean closed, float thickness); /*
public native void addPolyline(ImVec2[] points, int numPoints, long col, boolean closed, float thickness); /*
int points_num = env->GetArrayLength(points);
ImVec2 _points[points_num];
for (int i = 0; i < points_num; i++) {
@@ -166,11 +166,11 @@ public final class ImDrawList {
Jni::ImVec2Cpy(env, jImVec2, &dst);
_points[i] = dst;
}
getDrawList(env->GetIntField(object, drawListTypeID))->AddPolyline(_points, num_points, col, closed, thickness);
getDrawList(env->GetIntField(object, drawListTypeID))->AddPolyline(_points, numPoints, col, closed, thickness);
*/
// Note: Anti-aliased filling requires points to be in clockwise order.
public native void AddConvexPolyFilled(ImVec2[] points, int num_points, long col); /*
public native void addConvexPolyFilled(ImVec2[] points, int numPoints, long col); /*
int points_num = env->GetArrayLength(points);
ImVec2 _points[points_num];
for (int i = 0; i < points_num; i++) {
@@ -179,153 +179,153 @@ public final class ImDrawList {
Jni::ImVec2Cpy(env, jImVec2, &dst);
_points[i] = dst;
}
getDrawList(env->GetIntField(object, drawListTypeID))->AddConvexPolyFilled(_points, num_points, col);
getDrawList(env->GetIntField(object, drawListTypeID))->AddConvexPolyFilled(_points, numPoints, col);
*/
public native void AddBezierCurve(float pos0_x, float pos0_y, float cp0_x, float cp0_y, float cp1_x, float cp1_y, float pos1_x, float pos1_y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddBezierCurve(ImVec2(pos0_x, pos0_y), ImVec2(cp0_x, cp0_y), ImVec2(cp1_x, cp1_y), ImVec2(pos1_x, pos1_y), col, thickness);
public native void addBezierCurve(float pos0X, float pos0Y, float cp0X, float cp0Y, float cp1X, float cp1Y, float pos1X, float pos1Y, long col, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddBezierCurve(ImVec2(pos0X, pos0Y), ImVec2(cp0X, cp0Y), ImVec2(cp1X, cp1Y), ImVec2(pos1X, pos1Y), col, thickness);
*/
public native void AddBezierCurve(float pos0_x, float pos0_y, float cp0_x, float cp0_y, float cp1_x, float cp1_y, float pos1_x, float pos1_y, long col, float thickness, int num_segments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddBezierCurve(ImVec2(pos0_x, pos0_y), ImVec2(cp0_x, cp0_y), ImVec2(cp1_x, cp1_y), ImVec2(pos1_x, pos1_y), col, thickness, num_segments);
public native void addBezierCurve(float pos0X, float pos0Y, float cp0X, float cp0Y, float cp1X, float cp1Y, float pos1X, float pos1Y, long col, float thickness, int numSegments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->AddBezierCurve(ImVec2(pos0X, pos0Y), ImVec2(cp0X, cp0Y), ImVec2(cp1X, cp1Y), ImVec2(pos1X, pos1Y), col, thickness, numSegments);
*/
// Image primitives
// - Read FAQ to understand what ImTextureID is.
// - "p_min" and "p_max" represent the upper-left and lower-right corners of the rectangle.
// - "uv_min" and "uv_max" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture.
// - "pMin" and "pMax" represent the upper-left and lower-right corners of the rectangle.
// - "uvMin" and "uvMax" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture.
public native void AddImage(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y); /*
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImage((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y));
drawList->AddImage((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY));
*/
public native void AddImage(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y, float uv_min_x, float uv_min_y); /*
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImage((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), ImVec2(uv_min_x, uv_min_y));
drawList->AddImage((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY));
*/
public native void AddImage(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y, float uv_min_x, float uv_min_y, float uv_max_x, float uv_max_y); /*
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImage((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), ImVec2(uv_min_x, uv_min_y), ImVec2(uv_max_x, uv_max_y));
drawList->AddImage((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY));
*/
public native void AddImage(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y, float uv_min_x, float uv_min_y, float uv_max_x, float uv_max_y, long col); /*
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, long col); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImage((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), ImVec2(uv_min_x, uv_min_y), ImVec2(uv_max_x, uv_max_y), col);
drawList->AddImage((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col);
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y));
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, float uv1_x, float uv1_y); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), ImVec2(uv1_x, uv1_y));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y));
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, float uv1_x, float uv1_y, float uv2_x, float uv2_y); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), ImVec2(uv1_x, uv1_y), ImVec2(uv2_x, uv2_y));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y));
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, float uv1_x, float uv1_y, float uv2_x, float uv2_y, float uv3_x, float uv3_y); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), ImVec2(uv1_x, uv1_y), ImVec2(uv2_x, uv2_y), ImVec2(uv3_x, uv3_y));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y));
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, float uv1_x, float uv1_y, float uv2_x, float uv2_y, float uv3_x, float uv3_y, float uv4_x, float uv4_y); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y, float uv4X, float uv4Y); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), ImVec2(uv1_x, uv1_y), ImVec2(uv2_x, uv2_y), ImVec2(uv3_x, uv3_y), ImVec2(uv4_x, uv4_y));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y), ImVec2(uv4X, uv4Y));
*/
public native void AddImageQuad(int textureID, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, float p4_x, float p4_y, float uv1_x, float uv1_y, float uv2_x, float uv2_y, float uv3_x, float uv3_y, float uv4_x, float uv4_y, long col); /*
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y, float uv4X, float uv4Y, long col); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), ImVec2(p4_x, p4_y), ImVec2(uv1_x, uv1_y), ImVec2(uv2_x, uv2_y), ImVec2(uv3_x, uv3_y), ImVec2(uv4_x, uv4_y), col);
drawList->AddImageQuad((ImTextureID)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y), ImVec2(uv4X, uv4Y), col);
*/
public native void AddImageRounded(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y, float uv_min_x, float uv_min_y, float uv_max_x, float uv_max_y, long col, float rounding); /*
public native void addImageRounded(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, long col, float rounding); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageRounded((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), ImVec2(uv_min_x, uv_min_y), ImVec2(uv_max_x, uv_max_y), col, rounding);
drawList->AddImageRounded((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col, rounding);
*/
public native void AddImageRounded(int textureID, float p_min_x, float p_min_y, float p_max_x, float p_max_y, float uv_min_x, float uv_min_y, float uv_max_x, float uv_max_y, long col, float rounding, int imDrawCornerFlags); /*
public native void addImageRounded(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, long col, float rounding, int imDrawCornerFlags); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->AddImageRounded((ImTextureID)textureID, ImVec2(p_min_x, p_min_y), ImVec2(p_max_x, p_max_y), ImVec2(uv_min_x, uv_min_y), ImVec2(uv_max_x, uv_max_y), col, rounding, imDrawCornerFlags);
drawList->AddImageRounded((ImTextureID)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col, rounding, imDrawCornerFlags);
*/
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
public native void PathClear(); /*
public native void pathClear(); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathClear();
*/
public native void PathLineTo(float pos_x, float pos_y); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathLineTo(ImVec2(pos_x, pos_y));
public native void pathLineTo(float posX, float posY); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathLineTo(ImVec2(posX, posY));
*/
public native void PathLineToMergeDuplicate(float pos_x, float pos_y); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathLineToMergeDuplicate(ImVec2(pos_x, pos_y));
public native void pathLineToMergeDuplicate(float posX, float posY); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathLineToMergeDuplicate(ImVec2(posX, posY));
*/
// Note: Anti-aliased filling requires points to be in clockwise order.
public native void PathFillConvex(long col); /*
public native void pathFillConvex(long col); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathFillConvex(col);
*/
public native void PathStroke(long col, boolean closed); /*
public native void pathStroke(long col, boolean closed); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathStroke(col, closed);
*/
public native void PathStroke(long col, boolean closed, float thickness); /*
public native void pathStroke(long col, boolean closed, float thickness); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathStroke(col, closed, thickness);
*/
public native void PathArcTo(float center_x, float center_y, float radius, float a_min, float a_max); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcTo(ImVec2(center_x, center_y), radius, a_min, a_max);
public native void pathArcTo(float centerX, float centerY, float radius, float aMin, float aMax); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcTo(ImVec2(centerX, centerY), radius, aMin, aMax);
*/
public native void PathArcTo(float center_x, float center_y, float radius, float a_min, float a_max, int num_segments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcTo(ImVec2(center_x, center_y), radius, a_min, a_max, num_segments);
public native void pathArcTo(float centerX, float centerY, float radius, float aMin, float aMax, int numSegments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcTo(ImVec2(centerX, centerY), radius, aMin, aMax, numSegments);
*/
// Use precomputed angles for a 12 steps circle
public native void PathArcToFast(float center_x, float center_y, float radius, int a_min_of_12, int a_max_of_12); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcToFast(ImVec2(center_x, center_y), radius, a_min_of_12, a_max_of_12);
public native void pathArcToFast(float centerX, float centerY, float radius, int aMinOf12, int aMaxOf12); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathArcToFast(ImVec2(centerX, centerY), radius, aMinOf12, aMaxOf12);
*/
public native void PathBezierCurveTo(float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y, int num_segments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathBezierCurveTo(ImVec2(p1_x, p1_y), ImVec2(p2_x, p2_y), ImVec2(p3_x, p3_y), num_segments);
public native void pathBezierCurveTo(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int numSegments); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathBezierCurveTo(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), numSegments);
*/
public native void PathRect(float rect_min_x, float rect_min_y, float rect_max_x, float rect_max_y); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rect_min_x, rect_min_y), ImVec2(rect_max_x, rect_max_y));
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY));
*/
public native void PathRect(float rect_min_x, float rect_min_y, float rect_max_x, float rect_max_y, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rect_min_x, rect_min_y), ImVec2(rect_max_x, rect_max_y), rounding);
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY, float rounding); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY), rounding);
*/
public native void PathRect(float rect_min_x, float rect_min_y, float rect_max_x, float rect_max_y, float rounding, int imDrawCornerFlags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rect_min_x, rect_min_y), ImVec2(rect_max_x, rect_max_y), rounding, imDrawCornerFlags);
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY, float rounding, int imDrawCornerFlags); /*
getDrawList(env->GetIntField(object, drawListTypeID))->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY), rounding, imDrawCornerFlags);
*/
// Advanced: Channels
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
// - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)
public native void ChannelsSplit(int count); /*
public native void channelsSplit(int count); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->ChannelsSplit(count);
*/
public native void ChannelsMerge(); /*
public native void channelsMerge(); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->ChannelsMerge();
*/
public native void ChannelsSetCurrent(int n); /*
public native void channelsSetCurrent(int n); /*
ImDrawList* drawList = getDrawList(env->GetIntField(object, drawListTypeID));
drawList->ChannelsSetCurrent(n);
*/
+11 -7
View File
@@ -3,12 +3,12 @@ package imgui;
import java.util.Objects;
public final class ImFloat {
float[] data = new float[]{0.0f};
final float[] data = new float[]{0};
public ImFloat() {
}
public ImFloat(float value) {
public ImFloat(final float value) {
set(value);
}
@@ -16,7 +16,7 @@ public final class ImFloat {
return this.data[0];
}
public void set(float value) {
public void set(final float value) {
this.data[0] = value;
}
@@ -26,10 +26,14 @@ public final class ImFloat {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImFloat imFloat = (ImFloat) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImFloat imFloat = (ImFloat) o;
return data[0] == imFloat.data[0];
}
File diff suppressed because it is too large. Load diff
@@ -151,7 +151,7 @@ public final class ImGuiIO {
// TODO fonts configuration
// BINDING NOTICE: this is a stub to pass important for ImGui info
public native void SetFontsTexID(int id); /*
public native void setFontsTexID(int id); /*
ImGui::GetIO().Fonts->TexID = (ImTextureID)id;
*/
@@ -587,22 +587,22 @@ public final class ImGuiIO {
/**
* Queue new character input.
*/
public native void AddInputCharacter(int c); /*
public native void addInputCharacter(int c); /*
if (c > 0 && c < 0x10000)
ImGui::GetIO().AddInputCharacter((unsigned short)c);
*/;
*/
/**
* Queue new characters input from an UTF-8 string.
*/
public native void AddInputCharactersUTF8(String str); /*
public native void addInputCharactersUTF8(String str); /*
ImGui::GetIO().AddInputCharactersUTF8(str);
*/
/**
* Clear the text input buffer manually.
*/
public native void ClearInputCharacters(); /*
public native void clearInputCharacters(); /*
ImGui::GetIO().ClearInputCharacters();
*/
}
@@ -4,7 +4,7 @@ package imgui;
* You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame().
* During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values,
* and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors.
*
* <p>
* BINDING NOTICE: This is not a fully featured representation of ImGuiStyle struct from C++.
* Mostly it's a stub which communicates with default ImGuiStyle used by ImGuiIO.
* Still can be used to make your interface look different, since all of the fields from the original header file are represented here.
@@ -187,6 +187,7 @@ public final class ImGuiStyle {
ImGui::GetStyle().ItemSpacing.x = x;
ImGui::GetStyle().ItemSpacing.y = y;
*/
// ItemInnerSpacing
// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
//
@@ -198,6 +199,7 @@ public final class ImGuiStyle {
ImGui::GetStyle().ItemInnerSpacing.x = x;
ImGui::GetStyle().ItemInnerSpacing.y = y;
*/
// TouchExtraPadding
// Expand reactive bounding box for touch-based system where touch position is not accurate enough.
// Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
@@ -305,6 +307,7 @@ public final class ImGuiStyle {
public native int getColorButtonPosition(); /*
return ImGui::GetStyle().ColorButtonPosition;
*/
public native void setColorButtonPosition(int colorButtonPosition); /*
ImGui::GetStyle().ColorButtonPosition = colorButtonPosition;
*/
+11 -7
View File
@@ -3,12 +3,12 @@ package imgui;
import java.util.Objects;
public final class ImInt {
int[] data = new int[]{0};
final int[] data = new int[]{0};
public ImInt() {
}
public ImInt(int value) {
public ImInt(final int value) {
set(value);
}
@@ -16,7 +16,7 @@ public final class ImInt {
return this.data[0];
}
public void set(int value) {
public void set(final int value) {
this.data[0] = value;
}
@@ -26,10 +26,14 @@ public final class ImInt {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImInt imInt = (ImInt) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImInt imInt = (ImInt) o;
return data[0] == imInt.data[0];
}
+12 -8
View File
@@ -2,13 +2,13 @@ package imgui;
import java.util.Objects;
public class ImLong {
long[] data = new long[]{0};
public final class ImLong {
final long[] data = new long[]{0};
public ImLong() {
}
public ImLong(long value) {
public ImLong(final long value) {
set(value);
}
@@ -16,7 +16,7 @@ public class ImLong {
return this.data[0];
}
public void set(long value) {
public void set(final long value) {
this.data[0] = value;
}
@@ -26,10 +26,14 @@ public class ImLong {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImLong imLong = (ImLong) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImLong imLong = (ImLong) o;
return data[0] == imLong.data[0];
}
+12 -8
View File
@@ -2,13 +2,13 @@ package imgui;
import java.util.Objects;
public class ImShort {
short[] data = new short[]{0};
public final class ImShort {
final short[] data = new short[]{0};
public ImShort() {
}
public ImShort(short value) {
public ImShort(final short value) {
set(value);
}
@@ -16,7 +16,7 @@ public class ImShort {
return this.data[0];
}
public void set(short value) {
public void set(final short value) {
this.data[0] = value;
}
@@ -26,10 +26,14 @@ public class ImShort {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImShort imShort = (ImShort) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImShort imShort = (ImShort) o;
return data[0] == imShort.data[0];
}
+16 -12
View File
@@ -23,16 +23,16 @@ public final class ImString {
this(DEFAULT_LENGTH);
}
public ImString(int length) {
public ImString(final int length) {
data = new byte[length + CARET_LEN];
}
public ImString(String text) {
public ImString(final String text) {
this(text.length());
set(text);
}
public ImString(String text, int length) {
public ImString(final String text, final int length) {
this(length);
set(text);
}
@@ -45,12 +45,12 @@ public final class ImString {
return text;
}
public void set(String value) {
public void set(final String value) {
set(value.getBytes());
}
public void set(String value, boolean resize) {
byte[] str = value.getBytes();
public void set(final String value, final boolean resize) {
final byte[] str = value.getBytes();
if (resize && data.length - CARET_LEN < str.length) {
data = new byte[str.length + resizeFactor + CARET_LEN];
}
@@ -73,8 +73,8 @@ public final class ImString {
return data.length;
}
private void set(byte[] str) {
int len = Math.min(str.length, data.length);
private void set(final byte[] str) {
final int len = Math.min(str.length, data.length);
System.arraycopy(str, 0, data, 0, len);
inputData.isDirty = true;
inputData.size = len;
@@ -86,10 +86,14 @@ public final class ImString {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImString imString = (ImString) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImString imString = (ImString) o;
return Objects.equals(text, imString.text);
}
+13 -9
View File
@@ -9,24 +9,28 @@ public final class ImVec2 {
public ImVec2() {
}
public ImVec2(float x, float y) {
public ImVec2(final float x, final float y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "ImVec2{" +
"x=" + x +
", y=" + y +
'}';
return "ImVec2{"
+ "x=" + x
+ ", y=" + y
+ '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImVec2 imVec2 = (ImVec2) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImVec2 imVec2 = (ImVec2) o;
return Float.compare(imVec2.x, x) == 0 && Float.compare(imVec2.y, y) == 0;
}
+15 -11
View File
@@ -11,7 +11,7 @@ public final class ImVec4 {
public ImVec4() {
}
public ImVec4(float x, float y, float z, float w) {
public ImVec4(final float x, final float y, final float z, final float w) {
this.x = x;
this.y = y;
this.z = z;
@@ -20,19 +20,23 @@ public final class ImVec4 {
@Override
public String toString() {
return "ImVec4{" +
"x=" + x +
", y=" + y +
", z=" + z +
", w=" + w +
'}';
return "ImVec4{"
+ "x=" + x
+ ", y=" + y
+ ", z=" + z
+ ", w=" + w
+ '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImVec4 imVec4 = (ImVec4) o;
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImVec4 imVec4 = (ImVec4) o;
return Float.compare(imVec4.x, x) == 0 && Float.compare(imVec4.y, y) == 0 && Float.compare(imVec4.z, z) == 0 && Float.compare(imVec4.w, w) == 0;
}
@@ -11,12 +11,12 @@ public final class TexDataRGBA32 {
public ByteBuffer pixelBuffer;
private TexDataRGBA32() {
int pixelMax = 131072;
final int pixelMax = 131072;
pixelBuffer = ByteBuffer.allocateDirect(pixelMax).order(ByteOrder.nativeOrder());
}
public static TexDataRGBA32 create() {
TexDataRGBA32 data = new TexDataRGBA32();
final TexDataRGBA32 data = new TexDataRGBA32();
data.nFillData(data.pixelBuffer);
return data;
}
@@ -25,7 +25,7 @@ public final class TexDataRGBA32 {
#include <imgui.h>
*/
private native void nFillData(Buffer pixelBuffer); /*
private native void nFillData(Buffer pixelBuf); /*
jclass jTexDataClass = env->GetObjectClass(object);
if(jTexDataClass == NULL)
@@ -43,6 +43,6 @@ public final class TexDataRGBA32 {
env->SetIntField(object, widthID, width);
env->SetIntField(object, heightID, height);
memcpy(pixelBuffer, pixels, width * height * 4);
memcpy(pixelBuf, pixels, width * height * 4);
*/
}
@@ -15,7 +15,7 @@ import static org.lwjgl.opengl.GL30.*;
/**
* This class mostly a straightforward port of the
* <a href="https://raw.githubusercontent.com/ocornut/imgui/v1.74/examples/imgui_impl_opengl3.cpp">https://raw.githubusercontent.com/ocornut/imgui/v1.74/examples/imgui_impl_opengl3.cpp</a>
* <a href="https://raw.githubusercontent.com/ocornut/imgui/v1.74/examples/imgui_impl_opengl3.cpp">imgui_impl_opengl3.cpp</a>
* adapted for Java and LWJGL realms.
* <p>
* It do support a backup of the current GL state before rendering and restoring of its initial state after.
@@ -202,7 +202,7 @@ public final class ImGuiImplGl3 {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texData.width, texData.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texData.pixelBuffer);
ImGui.GetIO().SetFontsTexID(gFontTexture);
ImGui.getIO().setFontsTexID(gFontTexture);
}
private void backupGlState() {
@@ -121,15 +121,15 @@ public final class ImGuiGlfwExample {
private void initImGui() {
// IMPORTANT!!
// This line is critical for ImGui to work.
ImGui.CreateContext();
ImGui.createContext();
// ImGui provides three different color schemas for styling. We will use the classic one here.
ImGui.StyleColorsClassic();
ImGui.styleColorsClassic();
// ImGui.StyleColorsDark(); // This is a default style for ImGui
// ImGui.StyleColorsLight();
// Initialize ImGuiIO config
final ImGuiIO io = ImGui.GetIO();
final ImGuiIO io = ImGui.getIO();
io.setIniFilename(null);
io.setConfigFlags(ImGuiConfigFlags.NavEnableKeyboard);
@@ -189,7 +189,7 @@ public final class ImGuiGlfwExample {
glfwSetCharCallback(window, (w, c) -> {
if (c != GLFW_KEY_DELETE) {
io.AddInputCharacter(c);
io.addInputCharacter(c);
}
});
@@ -205,7 +205,7 @@ public final class ImGuiGlfwExample {
io.setMouseDown(mouseDown);
if (!io.getWantCaptureMouse() && mouseDown[1]) {
ImGui.SetWindowFocus(null);
ImGui.setWindowFocus(null);
}
});
@@ -238,14 +238,14 @@ public final class ImGuiGlfwExample {
// IMPORTANT!!
// We SHOULD call those methods to update ImGui state for current frame
final ImGuiIO io = ImGui.GetIO();
final ImGuiIO io = ImGui.getIO();
io.setDisplaySize(winWidth[0], winHeight[0]);
io.setDisplayFramebufferScale((float) fbWidth[0] / winWidth[0], (float) fbHeight[0] / winHeight[0]);
io.setMousePos((float) mousePosX[0], (float) mousePosY[0]);
io.setDeltaTime((float) deltaTime);
// Update mouse cursor
final int imguiCursor = ImGui.GetMouseCursor();
final int imguiCursor = ImGui.getMouseCursor();
glfwSetCursor(window, mouseCursors[imguiCursor]);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
@@ -254,17 +254,17 @@ public final class ImGuiGlfwExample {
// IMPORTANT!!
// Any ImGui code SHOULD go between NewFrame()/Render() methods
ImGui.NewFrame();
ImGui.newFrame();
showUi();
ImGui.End();
ImGui.end();
if (showDemoWindow.get()) {
ImGui.ShowDemoWindow(showDemoWindow);
ImGui.showDemoWindow(showDemoWindow);
}
ImGui.Render();
ImGui.render();
imGuiGl3.render(ImGui.GetDrawData()); // render DrawData from ImGui into our OpenGL context
imGuiGl3.render(ImGui.getDrawData()); // render DrawData from ImGui into our OpenGL context
glfwSwapBuffers(window); // swap the color buffers
@@ -274,62 +274,62 @@ public final class ImGuiGlfwExample {
}
private void showUi() {
ImGui.SetNextWindowSize(600, 300, ImGuiCond.Once);
ImGui.SetNextWindowPos(10, 10, ImGuiCond.Once);
ImGui.setNextWindowSize(600, 300, ImGuiCond.Once);
ImGui.setNextWindowPos(10, 10, ImGuiCond.Once);
ImGui.Begin("Custom window");
ImGui.Text("Hello from Java!");
ImGui.begin("Custom window");
ImGui.text("Hello from Java!");
ImGui.Button("Drag me");
if (ImGui.BeginDragDropSource()) {
ImGui.SetDragDropPayload("payload_type", testPayload, testPayload.length);
ImGui.Text("Drag started");
ImGui.EndDragDropSource();
ImGui.button("Drag me");
if (ImGui.beginDragDropSource()) {
ImGui.setDragDropPayload("payload_type", testPayload, testPayload.length);
ImGui.text("Drag started");
ImGui.endDragDropSource();
}
ImGui.SameLine();
ImGui.Text(dropTargetText);
if (ImGui.BeginDragDropTarget()) {
final byte[] payload = ImGui.AcceptDragDropPayload("payload_type");
ImGui.sameLine();
ImGui.text(dropTargetText);
if (ImGui.beginDragDropTarget()) {
final byte[] payload = ImGui.acceptDragDropPayload("payload_type");
if (payload != null) {
dropTargetText = new String(payload);
}
ImGui.EndDragDropTarget();
ImGui.endDragDropTarget();
}
ImGui.AlignTextToFramePadding();
ImGui.Text("Background color:");
ImGui.SameLine();
ImGui.ColorEdit3("##click_counter_col", backgroundColor, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoDragDrop);
ImGui.alignTextToFramePadding();
ImGui.text("Background color:");
ImGui.sameLine();
ImGui.colorEdit3("##click_counter_col", backgroundColor, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoDragDrop);
if (ImGui.Button("Click")) {
if (ImGui.button("Click")) {
clickCount++;
}
if (ImGui.IsItemHovered()) {
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.isItemHovered()) {
ImGui.setMouseCursor(ImGuiMouseCursor.Hand);
}
ImGui.SameLine();
ImGui.Text("Count: " + clickCount);
ImGui.Checkbox("Show demo window", showDemoWindow);
ImGui.NewLine();
ImGui.sameLine();
ImGui.text("Count: " + clickCount);
ImGui.checkbox("Show demo window", showDemoWindow);
ImGui.newLine();
ImGui.InputText("Resizable input", resizableStr, ImGuiInputTextFlags.CallbackResize);
ImGui.Text(String.format("text len: %d | buffer size: %d", resizableStr.getLength(), resizableStr.getBufferSize()));
ImGui.NewLine();
ImGui.inputText("Resizable input", resizableStr, ImGuiInputTextFlags.CallbackResize);
ImGui.text(String.format("text len: %d | buffer size: %d", resizableStr.getLength(), resizableStr.getBufferSize()));
ImGui.newLine();
ImGui.Separator();
ImGui.Text("Consider to look the original ImGui demo: ");
ImGui.SetNextItemWidth(500);
ImGui.TextColored(0, .8f, 0, 1, imguiDemoLink);
ImGui.SameLine();
if (ImGui.Button("Copy")) {
ImGui.SetClipboardText(imguiDemoLink);
ImGui.separator();
ImGui.text("Consider to look the original ImGui demo: ");
ImGui.setNextItemWidth(500);
ImGui.textColored(0, .8f, 0, 1, imguiDemoLink);
ImGui.sameLine();
if (ImGui.button("Copy")) {
ImGui.setClipboardText(imguiDemoLink);
}
}
// If you want to clean a room after yourself - do it by yourself
private void destroyImGui() {
imGuiGl3.dispose();
ImGui.DestroyContext();
ImGui.destroyContext();
}
private void destroyGlfw() {