Remove internal and extension API

This commit is contained in:
SpaiR committed 2019-12-29 23:59:36 +03:00
1 parent f6e9712b38
commit b59aea96d9
7 files changed
-1010

No files matched your search

@@ -5,8 +5,6 @@ import imgui.enums.*;
import java.nio.Buffer;
import java.nio.ByteBuffer;
//import com.badlogic.gdx.jnigen.JniGenSharedLibraryLoader;
public class ImGui {
private static final String LIB_NAME_PROP = "imgui.library.name";
private static final String LIB_NAME_DEFAULT = "imgui-java";
@@ -1575,18 +1573,4 @@ public class ImGui {
public static void SetMouseCursor(ImGuiMouseCursor type) {
Native.SetMouseCursor(type.getValue());
}
// Internal methods
public static void PushMultiItemsWidths(int components, float w_full) {
NativeInternal.PushMultiItemsWidths(components, w_full);
}
public static void ItemAdd(float x1, float y1, float x2, float y2, String id) {
NativeInternal.ItemAdd(x1, y1, x2, y2, id);
}
public static void ItemSize(float x1, float y1, float x2, float y2, float text_offset_y) {
NativeInternal.ItemSize(x1, y1, x2, y2, text_offset_y);
}
}
@@ -1,103 +0,0 @@
package imgui;
import imgui.NativeCustomWidget.ImGuiCollapseLayoutOptions;
public class ImGuiEx {
protected ImGuiEx() {
}
public static void ShowLayoutDebug() {
NativeCustomWidget.ShowLayoutDebug();
}
public static void BeginLayout(String id, float sizeX, float sizeY) {
NativeCustomWidget.BeginLayout(id, sizeX, sizeY);
}
public static void BeginLayout(String id, float sizeX, float sizeY, float paddingLeft, float paddingRight, float paddingTop, float paddingBottom) {
NativeCustomWidget.BeginLayout(id, sizeX, sizeY, paddingLeft, paddingRight, paddingTop, paddingBottom);
}
public static void EndLayout() {
NativeCustomWidget.EndLayout();
}
public static boolean BeginCollapseLayoutEx(String title, float sizeX, float sizeY) {
return NativeCustomWidget.BeginCollapseLayoutEx2(title, sizeX, sizeY, NativeCustomWidget.defaultOptions);
}
public static boolean BeginCollapseLayoutEx(String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions options) {
return NativeCustomWidget.BeginCollapseLayoutEx2(title, sizeX, sizeY, options);
}
public static void BeginCollapseLayoutEx(ImGuiBoolean isOpen, String title, float sizeX, float sizeY) {
NativeCustomWidget.BeginCollapseLayoutEx(isOpen.data, title, sizeX, sizeY, NativeCustomWidget.defaultOptions);
}
public static void BeginCollapseLayoutEx(ImGuiBoolean isOpen, String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions options) {
NativeCustomWidget.BeginCollapseLayoutEx(isOpen.data, title, sizeX, sizeY, options);
}
public static boolean BeginCollapseLayout(String title, float sizeX, float sizeY) {
return NativeCustomWidget.BeginCollapseLayout2(title, sizeX, sizeY, NativeCustomWidget.defaultOptions);
}
public static boolean BeginCollapseLayout(String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions options) {
return NativeCustomWidget.BeginCollapseLayout2(title, sizeX, sizeY, options);
}
public static void BeginCollapseLayout(ImGuiBoolean isOpen, String title, float sizeX, float sizeY) {
NativeCustomWidget.BeginCollapseLayout(isOpen.data, title, sizeX, sizeY, NativeCustomWidget.defaultOptions);
}
public static void BeginCollapseLayout(ImGuiBoolean isOpen, String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions options) {
NativeCustomWidget.BeginCollapseLayout(isOpen.data, title, sizeX, sizeY, options);
}
public static void EndCollapseFrameLayout() {
NativeCustomWidget.EndCollapseFrameLayout();
}
public static void EndCollapseLayout() {
NativeCustomWidget.EndCollapseLayout();
}
public static void BeginAlign(String id, float sizeX, float sizeY, float alignX, float alignY) {
NativeCustomWidget.BeginAlign(id, sizeX, sizeY, alignX, alignY);
}
public static void BeginAlign(String id, float sizeX, float sizeY, float alignX, float alignY, float offsetX, float offsetY) {
NativeCustomWidget.BeginAlign(id, sizeX, sizeY, alignX, alignY, offsetX, offsetY);
}
public static void EndAlign() {
NativeCustomWidget.EndAlign();
}
public static void AlignLayout(float alignX, float alignY) {
NativeCustomWidget.AlignLayout(alignX, alignY);
}
public static void AlignLayout(float alignX, float alignY, float offsetX, float offsetY) {
NativeCustomWidget.AlignLayout(alignX, alignY, offsetX, offsetY);
}
// Helper methods
/**
* Packs the color components into a 32-bit integer with the format ABGR. Note that no range checking is performed for higher
* performance.
*
* @param r the red component, 0 - 255
* @param g the green component, 0 - 255
* @param b the blue component, 0 - 255
* @param a the alpha component, 0 - 255
* @return the packed color as a 32-bit int
*/
public static int colorToIntBits(int r, int g, int b, int a) {
return (a << 24) | (b << 16) | (g << 8) | r;
}
}
@@ -1,168 +0,0 @@
package imgui;
import imgui.enums.ImDrawCornerFlags;
class NativeCustomWidget {
public static ImGuiCollapseLayoutOptions defaultOptions = new ImGuiCollapseLayoutOptions();
// @formatter:off
/*JNI
#include <imgui_layout_widget.h>
jfieldID paddingLeftID;
jfieldID paddingRightID;
jfieldID paddingTopID;
jfieldID paddingBottomID;
jfieldID arrowColorID;
jfieldID arrowBackgroundHoveredColorID;
jfieldID arrowBackgroundClickedColorID;
jfieldID frameColorID;
jfieldID borderColorID;
jfieldID borderRoundID;
jfieldID roundingCornersID;
*/
static native void init() /*-{ }-*/; /*
jclass jLayoutOptionsClass = env->FindClass("imgui/NativeCustomWidget");
paddingLeftID = env->GetFieldID(jLayoutOptionsClass, "paddingLeft", "F");
paddingRightID = env->GetFieldID(jLayoutOptionsClass, "paddingRight", "F");
paddingTopID = env->GetFieldID(jLayoutOptionsClass, "paddingTop", "F");
paddingBottomID = env->GetFieldID(jLayoutOptionsClass, "paddingBottom", "F");
arrowColorID = env->GetFieldID(jLayoutOptionsClass, "arrowColor", "I");
arrowBackgroundHoveredColorID = env->GetFieldID(jLayoutOptionsClass, "arrowBackgroundHoveredColor", "I");
arrowBackgroundClickedColorID = env->GetFieldID(jLayoutOptionsClass, "arrowBackgroundClickedColor", "I");
frameColorID = env->GetFieldID(jLayoutOptionsClass, "frameColor", "I");
borderColorID = env->GetFieldID(jLayoutOptionsClass, "borderColor", "I");
borderRoundID = env->GetFieldID(jLayoutOptionsClass, "borderRound", "I");
roundingCornersID = env->GetFieldID(jLayoutOptionsClass, "roundingCorners", "I");
*/
static {
init();
}
static native void ShowLayoutDebug() /*-{ }-*/; /*
ImGuiEx::ShowLayoutDebug();
*/
static native void BeginLayout(String id, float sizeX, float sizeY); /*-{ }-*/; /*
ImGuiEx::BeginLayout(id, sizeX, sizeY);
*/
static native void BeginLayout(String id, float sizeX, float sizeY, float paddingLeft, float paddingRight, float paddingTop, float paddingBottom); /*-{ }-*/; /*
ImGuiEx::BeginLayout(id, sizeX, sizeY, paddingLeft, paddingRight, paddingTop, paddingBottom);
*/
static native void EndLayout(); /*-{ }-*/; /*
ImGuiEx::EndLayout();
*/
static native boolean BeginCollapseLayoutEx2(String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions jOptions); /*-{ }-*/; /*
ImGuiCollapseLayoutOptions options;
options.paddingLeft = env->GetFloatField (jOptions, paddingLeftID);
options.paddingRight = env->GetFloatField (jOptions, paddingRightID);
options.paddingTop = env->GetFloatField (jOptions, paddingTopID);
options.paddingBottom = env->GetFloatField (jOptions, paddingBottomID);
options.arrowColor = env->GetIntField (jOptions, arrowColorID);
options.arrowBackgroundHoveredColor = env->GetIntField (jOptions, arrowBackgroundHoveredColorID);
options.arrowBackgroundClickedColor = env->GetIntField (jOptions, arrowBackgroundClickedColorID);
options.frameColor = env->GetIntField (jOptions, frameColorID);
options.borderColor = env->GetIntField (jOptions, borderColorID);
options.borderRound = env->GetIntField (jOptions, borderRoundID);
options.roundingCorners = env->GetIntField (jOptions, roundingCornersID);
return ImGuiEx::BeginCollapseLayoutEx(title, sizeX, sizeY, options);
*/
static native void BeginCollapseLayoutEx(boolean [] isOpen, String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions jOptions); /*-{ }-*/; /*
ImGuiCollapseLayoutOptions options;
options.paddingLeft = env->GetFloatField (jOptions, paddingLeftID);
options.paddingRight = env->GetFloatField (jOptions, paddingRightID);
options.paddingTop = env->GetFloatField (jOptions, paddingTopID);
options.paddingBottom = env->GetFloatField (jOptions, paddingBottomID);
options.arrowColor = env->GetIntField (jOptions, arrowColorID);
options.arrowBackgroundHoveredColor = env->GetIntField (jOptions, arrowBackgroundHoveredColorID);
options.arrowBackgroundClickedColor = env->GetIntField (jOptions, arrowBackgroundClickedColorID);
options.frameColor = env->GetIntField (jOptions, frameColorID);
options.borderColor = env->GetIntField (jOptions, borderColorID);
options.borderRound = env->GetIntField (jOptions, borderRoundID);
options.roundingCorners = env->GetIntField (jOptions, roundingCornersID);
ImGuiEx::BeginCollapseLayoutEx(&isOpen[0], title, sizeX, sizeY, options);
*/
static native boolean BeginCollapseLayout2(String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions jOptions); /*-{ }-*/; /*
ImGuiCollapseLayoutOptions options;
options.paddingLeft = env->GetFloatField (jOptions, paddingLeftID);
options.paddingRight = env->GetFloatField (jOptions, paddingRightID);
options.paddingTop = env->GetFloatField (jOptions, paddingTopID);
options.paddingBottom = env->GetFloatField (jOptions, paddingBottomID);
options.arrowColor = env->GetIntField (jOptions, arrowColorID);
options.arrowBackgroundHoveredColor = env->GetIntField (jOptions, arrowBackgroundHoveredColorID);
options.arrowBackgroundClickedColor = env->GetIntField (jOptions, arrowBackgroundClickedColorID);
options.frameColor = env->GetIntField (jOptions, frameColorID);
options.borderColor = env->GetIntField (jOptions, borderColorID);
options.borderRound = env->GetIntField (jOptions, borderRoundID);
options.roundingCorners = env->GetIntField (jOptions, roundingCornersID);
return ImGuiEx::BeginCollapseLayout(title, sizeX, sizeY, options);
*/
static native void BeginCollapseLayout(boolean [] isOpen, String title, float sizeX, float sizeY, ImGuiCollapseLayoutOptions jOptions); /*-{ }-*/; /*
ImGuiCollapseLayoutOptions options;
options.paddingLeft = env->GetFloatField (jOptions, paddingLeftID);
options.paddingRight = env->GetFloatField (jOptions, paddingRightID);
options.paddingTop = env->GetFloatField (jOptions, paddingTopID);
options.paddingBottom = env->GetFloatField (jOptions, paddingBottomID);
options.arrowColor = env->GetIntField (jOptions, arrowColorID);
options.arrowBackgroundHoveredColor = env->GetIntField (jOptions, arrowBackgroundHoveredColorID);
options.arrowBackgroundClickedColor = env->GetIntField (jOptions, arrowBackgroundClickedColorID);
options.frameColor = env->GetIntField (jOptions, frameColorID);
options.borderColor = env->GetIntField (jOptions, borderColorID);
options.borderRound = env->GetIntField (jOptions, borderRoundID);
options.roundingCorners = env->GetIntField (jOptions, roundingCornersID);
ImGuiEx::BeginCollapseLayout(&isOpen[0], title, sizeX, sizeY, options);
*/
static native void EndCollapseFrameLayout(); /*-{ }-*/; /*
ImGuiEx::EndCollapseFrameLayout();
*/
static native void EndCollapseLayout(); /*-{ }-*/; /*
ImGuiEx::EndCollapseLayout();
*/
static native void BeginAlign(String id, float sizeX, float sizeY, float alignX, float alignY) /*-{ }-*/; /*
ImGuiEx::BeginAlign(id, sizeX, sizeY, alignX, alignY);
*/
static native void BeginAlign(String id, float sizeX, float sizeY, float alignX, float alignY, float offsetX, float offsetY) /*-{ }-*/; /*
ImGuiEx::BeginAlign(id, sizeX, sizeY, alignX, alignY, offsetX, offsetY);
*/
static native void EndAlign() /*-{ }-*/; /*
ImGuiEx::EndAlign();
*/
static native void AlignLayout(float alignX, float alignY) /*-{ }-*/; /*
ImGuiEx::AlignLayout(alignX, alignY);
*/
static native void AlignLayout(float alignX, float alignY, float offsetX, float offsetY) /*-{ }-*/; /*
ImGuiEx::AlignLayout(alignX, alignY, offsetX, offsetY);
*/
// @formatter:on
public static class ImGuiCollapseLayoutOptions {
public float paddingLeft = 2;
public float paddingRight = 2;
public float paddingTop = 2;
public float paddingBottom = 2;
public int arrowColor = ImGuiEx.colorToIntBits(0xFF, 0xFF, 0xFF, 0xFF);
public int arrowBackgroundHoveredColor = ImGuiEx.colorToIntBits(0x77, 0x77, 0x77, 0xFF);
public int arrowBackgroundClickedColor = ImGuiEx.colorToIntBits(0x55, 0x55, 0x55, 0xFF);
public int frameColor = ImGuiEx.colorToIntBits(0x24, 0x24, 0x24, 0xFF);
public int borderColor = ImGuiEx.colorToIntBits(0x40, 0x40, 0x49, 0xFF);
public int borderRound = 4;
public int roundingCorners = ImDrawCornerFlags.TopLeft.or(ImDrawCornerFlags.TopRight).getValue();
}
}
@@ -1,28 +0,0 @@
package imgui;
/**
* Same as {@link Native} but "imgui_internal.h" API.
*/
class NativeInternal {
// @formatter:off
/*JNI
#include <imgui.h>
#include <imgui_internal.h>
*/
public static native void PushMultiItemsWidths(int components, float w_full) /*-{ }-*/; /*
ImGui::PushMultiItemsWidths(components, w_full);
*/
public static native boolean ItemAdd(float x1, float y1, float x2, float y2, String id) /*-{ }-*/; /*
ImGuiID imGuiID = ImGui::GetID(id);
return ImGui::ItemAdd(ImRect(x1, y1, x2, y2), imGuiID);
*/
public static native void ItemSize(float x1, float y1, float x2, float y2, float text_offset_y) /*-{ }-*/; /*
ImGui::ItemSize(ImRect(x1, y1, x2, y2), text_offset_y);
*/
// @formatter:on
}