From 7ddf242ab491815ea5bbc4bb10cf17e93fdce1fb Mon Sep 17 00:00:00 2001 From: SpaiR Date: Fri, 14 Feb 2020 22:43:37 +0300 Subject: [PATCH] Natively mapped ImGuiStyle class --- imgui-binding/src/main/java/imgui/ImGui.java | 45 +- .../src/main/java/imgui/ImGuiStyle.java | 549 +++++++++++------- 2 files changed, 385 insertions(+), 209 deletions(-) diff --git a/imgui-binding/src/main/java/imgui/ImGui.java b/imgui-binding/src/main/java/imgui/ImGui.java index ccd7354..0291a27 100644 --- a/imgui-binding/src/main/java/imgui/ImGui.java +++ b/imgui-binding/src/main/java/imgui/ImGui.java @@ -19,13 +19,13 @@ public final class ImGui { private static final ImDrawData DRAW_DATA; private static final ImGuiIO IMGUI_IO; - private static final ImGuiStyle IMGUI_STYLE; private static final ImDrawList IM_DRAW_LIST_WINDOW = new ImDrawList(ImDrawList.TYPE_WINDOW); private static final ImDrawList IM_DRAW_LIST_BACKGROUND = new ImDrawList(ImDrawList.TYPE_BACKGROUND); private static final ImDrawList IM_DRAW_LIST_FOREGROUND = new ImDrawList(ImDrawList.TYPE_FOREGROUND); private static ImFont font; + private static ImGuiStyle style; static { final String libPath = System.getProperty(LIB_PATH_PROP); @@ -44,7 +44,6 @@ public final class ImGui { DRAW_DATA = new ImDrawData(100_000, 100_000, 1000); IMGUI_IO = new ImGuiIO(); - IMGUI_STYLE = new ImGuiStyle(); nInitJni(); ImDrawList.nInit(); @@ -53,6 +52,7 @@ public final class ImGui { ImFontConfig.nInit(); ImFontGlyph.nInit(); ImFont.nInit(); + ImGuiStyle.nInit(); nInitInputTextData(); } @@ -150,9 +150,16 @@ public final class ImGui { * Access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame. */ public static ImGuiStyle getStyle() { - return IMGUI_STYLE; + if (style == null) { + style = new ImGuiStyle(nGetStyle()); + } + return style; } + private static native long nGetStyle(); /* + return (long)(intptr_t)&ImGui::GetStyle(); + */ + /** * Start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame(). */ @@ -248,6 +255,14 @@ public final class ImGui { ImGui::ShowStyleEditor(); */ + public static void showStyleEditor(ImGuiStyle ref) { + nShowStyleEditor(ref.ptr); + } + + private static native void nShowStyleEditor(long ref); /* + ImGui::ShowStyleEditor((ImGuiStyle*)ref); + */ + /** * Add style selector block (not a window), essentially a combo listing the default styles. */ @@ -285,6 +300,14 @@ public final class ImGui { ImGui::StyleColorsDark(); */ + public static void styleColorsDark(ImGuiStyle ref) { + nStyleColorsDark(ref.ptr); + } + + private static native void nStyleColorsDark(long ref); /* + ImGui::StyleColorsDark((ImGuiStyle*)ref); + */ + /** * Classic imgui style */ @@ -292,6 +315,14 @@ public final class ImGui { ImGui::StyleColorsClassic(); */ + public static void styleColorsClassic(ImGuiStyle ref) { + nStyleColorsClassic(ref.ptr); + } + + private static native void nStyleColorsClassic(long ref); /* + ImGui::StyleColorsClassic((ImGuiStyle*)ref); + */ + /** * Best used with borders and a custom, thicker font */ @@ -299,6 +330,14 @@ public final class ImGui { ImGui::StyleColorsLight(); */ + public static void styleColorsLight(ImGuiStyle ref) { + nStyleColorsLight(ref.ptr); + } + + private static native void nStyleColorsLight(long ref); /* + ImGui::StyleColorsLight((ImGuiStyle*)ref); + */ + // Windows // - Begin() = push window to the stack and start appending to it. End() = pop window from the stack. // - You may append multiple times to the same window during the same frame. diff --git a/imgui-binding/src/main/java/imgui/ImGuiStyle.java b/imgui-binding/src/main/java/imgui/ImGuiStyle.java index c6bd46f..0dcb800 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiStyle.java +++ b/imgui-binding/src/main/java/imgui/ImGuiStyle.java @@ -4,406 +4,543 @@ 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. - *

- * 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. */ -public final class ImGuiStyle { - ImGuiStyle() { +public final class ImGuiStyle implements ImDestroyable { + final long ptr; + + /** + * This class will create a native structure. + * Call {@link #destroy()} method to manually free used memory. + */ + public ImGuiStyle() { + ImGui.touch(); + ptr = nCreate(); + } + + ImGuiStyle(final long ptr) { + this.ptr = ptr; + } + + @Override + public void destroy() { + nDestroy(ptr); } /*JNI #include + #include #include "jni_common.h" + + jfieldID imGuiStylePtrID; + + #define IMGUI_STYLE ((ImGuiStyle*)env->GetLongField(object, imGuiStylePtrID)) */ - // Alpha - // Global alpha applies to everything in Dear ImGui. - // + static native void nInit(); /* + jclass jImGuiStyleClass = env->FindClass("imgui/ImGuiStyle"); + imGuiStylePtrID = env->GetFieldID(jImGuiStyleClass, "ptr", "J"); + */ + + private native long nCreate(); /* + ImGuiStyle* imGuiStyle = new ImGuiStyle(); + return (long)(intptr_t)imGuiStyle; + */ + + private native void nDestroy(long ptr); /* + delete (ImGuiStyle*)ptr; + */ + + /** + * Global alpha applies to everything in Dear ImGui. + */ public native float getAlpha(); /* - return ImGui::GetStyle().Alpha; + return IMGUI_STYLE->Alpha; */ + /** + * Global alpha applies to everything in Dear ImGui. + */ public native void setAlpha(float alpha); /* - ImGui::GetStyle().Alpha = alpha; + IMGUI_STYLE->Alpha = alpha; */ - // WindowPadding - // Padding within a window. - // + /** + * Padding within a window. + */ public native void getWindowPadding(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().WindowPadding, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowPadding, dstImVec2); */ + /** + * Padding within a window. + */ public native void setWindowPadding(float x, float y); /* - ImGui::GetStyle().WindowPadding.x = x; - ImGui::GetStyle().WindowPadding.y = y; + IMGUI_STYLE->WindowPadding.x = x; + IMGUI_STYLE->WindowPadding.y = y; */ - // WindowRounding - // Radius of window corners rounding. Set to 0.0f to have rectangular windows. - // + /** + * Radius of window corners rounding. Set to 0.0f to have rectangular windows. + */ public native float getWindowRounding(); /* - return ImGui::GetStyle().WindowRounding; + return IMGUI_STYLE->WindowRounding; */ + /** + * Radius of window corners rounding. Set to 0.0f to have rectangular windows. + */ public native void setWindowRounding(float windowRounding); /* - ImGui::GetStyle().WindowRounding = windowRounding; + IMGUI_STYLE->WindowRounding = windowRounding; */ - // WindowBorderSize - // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). - // + /** + * Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native float getWindowBorderSize(); /* - return ImGui::GetStyle().WindowBorderSize; + return IMGUI_STYLE->WindowBorderSize; */ + /** + * Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native void setWindowBorderSize(float windowBorderSize); /* - ImGui::GetStyle().WindowBorderSize = windowBorderSize; + IMGUI_STYLE->WindowBorderSize = windowBorderSize; */ - // WindowMinSize - // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). - // + /** + * Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). + */ public native void getWindowMinSize(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().WindowMinSize, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowMinSize, dstImVec2); */ + /** + * Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). + */ public native void setWindowMinSize(float x, float y); /* - ImGui::GetStyle().WindowMinSize.x = x; - ImGui::GetStyle().WindowMinSize.y = y; + IMGUI_STYLE->WindowMinSize.x = x; + IMGUI_STYLE->WindowMinSize.y = y; */ - // WindowTitleAlign - // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. - // + /** + * Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. + */ public native void getWindowTitleAlign(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().WindowTitleAlign, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->WindowTitleAlign, dstImVec2); */ + /** + * Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. + */ public native void setWindowTitleAlign(float x, float y); /* - ImGui::GetStyle().WindowTitleAlign.x = x; - ImGui::GetStyle().WindowTitleAlign.y = y; + IMGUI_STYLE->WindowTitleAlign.x = x; + IMGUI_STYLE->WindowTitleAlign.y = y; */ - // WindowMenuButtonPosition - // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. - // + /** + * Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. + */ public native int getWindowMenuButtonPosition(); /* - return (int)ImGui::GetStyle().WindowMenuButtonPosition; + return (int)IMGUI_STYLE->WindowMenuButtonPosition; */ + /** + * Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. + */ public native void setWindowMenuButtonPosition(int windowMenuButtonPosition); /* - ImGui::GetStyle().WindowMenuButtonPosition = windowMenuButtonPosition; + IMGUI_STYLE->WindowMenuButtonPosition = windowMenuButtonPosition; */ - // ChildRounding - // Radius of child window corners rounding. Set to 0.0f to have rectangular windows. - // + /** + * Radius of child window corners rounding. Set to 0.0f to have rectangular windows. + */ public native float getChildRounding(); /* - return ImGui::GetStyle().ChildRounding; + return IMGUI_STYLE->ChildRounding; */ + /** + * Radius of child window corners rounding. Set to 0.0f to have rectangular windows. + */ public native void setChildRounding(float childRounding); /* - ImGui::GetStyle().ChildRounding = childRounding; + IMGUI_STYLE->ChildRounding = childRounding; */ - // ChildBorderSize - // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). - // + /** + * Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native float getChildBorderSize(); /* - return ImGui::GetStyle().ChildBorderSize; + return IMGUI_STYLE->ChildBorderSize; */ + /** + * Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native void setChildBorderSize(float childBorderSize); /* - ImGui::GetStyle().ChildBorderSize = childBorderSize; + IMGUI_STYLE->ChildBorderSize = childBorderSize; */ - // PopupRounding - // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) - // + /** + * Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) + */ public native float getPopupRounding(); /* - return ImGui::GetStyle().PopupRounding; + return IMGUI_STYLE->PopupRounding; */ + /** + * Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) + */ public native void setPopupRounding(float popupRounding); /* - ImGui::GetStyle().PopupRounding = popupRounding; + IMGUI_STYLE->PopupRounding = popupRounding; */ - // PopupBorderSize - // Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). - // + /** + * Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native float getPopupBorderSize(); /* - return ImGui::GetStyle().PopupBorderSize; + return IMGUI_STYLE->PopupBorderSize; */ + /** + * Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native void setPopupBorderSize(float popupBorderSize); /* - ImGui::GetStyle().PopupBorderSize = popupBorderSize; + IMGUI_STYLE->PopupBorderSize = popupBorderSize; */ - // FramePadding - // Padding within a framed rectangle (used by most widgets). - // + /** + * Padding within a framed rectangle (used by most widgets). + */ public native void getFramePadding(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().FramePadding, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->FramePadding, dstImVec2); */ + /** + * Padding within a framed rectangle (used by most widgets). + */ public native void setFramePadding(float x, float y); /* - ImGui::GetStyle().FramePadding.x = x; - ImGui::GetStyle().FramePadding.y = y; + IMGUI_STYLE->FramePadding.x = x; + IMGUI_STYLE->FramePadding.y = y; */ - // FrameRounding - // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). - // + /** + * Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). + */ public native float getFrameRounding(); /* - return ImGui::GetStyle().FrameRounding; + return IMGUI_STYLE->FrameRounding; */ + /** + * Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). + */ public native void setFrameRounding(float frameRounding); /* - ImGui::GetStyle().FrameRounding = frameRounding; + IMGUI_STYLE->FrameRounding = frameRounding; */ - // FrameBorderSize - // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). - // + /** + * Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native float getFrameBorderSize(); /* - return ImGui::GetStyle().FrameBorderSize; + return IMGUI_STYLE->FrameBorderSize; */ + /** + * Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + */ public native void setFrameBorderSize(float frameBorderSize); /* - ImGui::GetStyle().FrameBorderSize = frameBorderSize; + IMGUI_STYLE->FrameBorderSize = frameBorderSize; */ - // ItemSpacing - // Horizontal and vertical spacing between widgets/lines. - // + /** + * Horizontal and vertical spacing between widgets/lines. + */ public native void getItemSpacing(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().ItemSpacing, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->ItemSpacing, dstImVec2); */ + /** + * Horizontal and vertical spacing between widgets/lines. + */ public native void setItemSpacing(float x, float y); /* - ImGui::GetStyle().ItemSpacing.x = x; - ImGui::GetStyle().ItemSpacing.y = y; + IMGUI_STYLE->ItemSpacing.x = x; + IMGUI_STYLE->ItemSpacing.y = y; */ - // ItemInnerSpacing - // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). - // + /** + * Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). + */ public native void getItemInnerSpacing(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().ItemInnerSpacing, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->ItemInnerSpacing, dstImVec2); */ + /** + * Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). + */ public native void setItemInnerSpacing(float x, float y); /* - ImGui::GetStyle().ItemInnerSpacing.x = x; - ImGui::GetStyle().ItemInnerSpacing.y = y; + IMGUI_STYLE->ItemInnerSpacing.x = x; + IMGUI_STYLE->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! - // + /** + * 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! + */ public native void getTouchExtraPadding(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().TouchExtraPadding, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->TouchExtraPadding, dstImVec2); */ + /** + * 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! + */ public native void setTouchExtraPadding(float x, float y); /* - ImGui::GetStyle().TouchExtraPadding.x = x; - ImGui::GetStyle().TouchExtraPadding.y = y; + IMGUI_STYLE->TouchExtraPadding.x = x; + IMGUI_STYLE->TouchExtraPadding.y = y; */ - // IndentSpacing - // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). - // + /** + * Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + */ public native float getIndentSpacing(); /* - return ImGui::GetStyle().IndentSpacing; + return IMGUI_STYLE->IndentSpacing; */ + /** + * Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + */ public native void setIndentSpacing(float indentSpacing); /* - ImGui::GetStyle().IndentSpacing = indentSpacing; + IMGUI_STYLE->IndentSpacing = indentSpacing; */ - // ColumnsMinSpacing - // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). - // + /** + * Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). + */ public native float getColumnsMinSpacing(); /* - return ImGui::GetStyle().ColumnsMinSpacing; + return IMGUI_STYLE->ColumnsMinSpacing; */ + /** + * Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). + */ public native void setColumnsMinSpacing(float columnsMinSpacing); /* - ImGui::GetStyle().ColumnsMinSpacing = columnsMinSpacing; + IMGUI_STYLE->ColumnsMinSpacing = columnsMinSpacing; */ - // ScrollbarSize - // Width of the vertical scrollbar, Height of the horizontal scrollbar. - // + /** + * Width of the vertical scrollbar, Height of the horizontal scrollbar. + */ public native float getScrollbarSize(); /* - return ImGui::GetStyle().ScrollbarSize; + return IMGUI_STYLE->ScrollbarSize; */ + /** + * Width of the vertical scrollbar, Height of the horizontal scrollbar. + */ public native void setScrollbarSize(float scrollbarSize); /* - ImGui::GetStyle().ScrollbarSize = scrollbarSize; + IMGUI_STYLE->ScrollbarSize = scrollbarSize; */ - // ScrollbarRounding - // Radius of grab corners for scrollbar. - // + /** + * Radius of grab corners for scrollbar. + */ public native float getScrollbarRounding(); /* - return ImGui::GetStyle().ScrollbarRounding; + return IMGUI_STYLE->ScrollbarRounding; */ + /** + * Radius of grab corners for scrollbar. + */ public native void setScrollbarRounding(float scrollbarRounding); /* - ImGui::GetStyle().ScrollbarRounding = scrollbarRounding; + IMGUI_STYLE->ScrollbarRounding = scrollbarRounding; */ - // GrabMinSize - // Minimum width/height of a grab box for slider/scrollbar. - // + /** + * Minimum width/height of a grab box for slider/scrollbar. + */ public native float getGrabMinSize(); /* - return ImGui::GetStyle().GrabMinSize; + return IMGUI_STYLE->GrabMinSize; */ + /** + * Minimum width/height of a grab box for slider/scrollbar. + */ public native void setGrabMinSize(float grabMinSize); /* - ImGui::GetStyle().GrabMinSize = grabMinSize; + IMGUI_STYLE->GrabMinSize = grabMinSize; */ - // GrabRounding - // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. - // + /** + * Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + */ public native float getGrabRounding(); /* - return ImGui::GetStyle().GrabRounding; + return IMGUI_STYLE->GrabRounding; */ + /** + * Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + */ public native void setGrabRounding(float grabRounding); /* - ImGui::GetStyle().GrabRounding = grabRounding; + IMGUI_STYLE->GrabRounding = grabRounding; */ - // TabRounding - // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. - // + /** + * Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. + */ public native float getTabRounding(); /* - return ImGui::GetStyle().TabRounding; + return IMGUI_STYLE->TabRounding; */ + /** + * Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. + */ public native void setTabRounding(float tabRounding); /* - ImGui::GetStyle().TabRounding = tabRounding; + IMGUI_STYLE->TabRounding = tabRounding; */ - // TabBorderSize - // Thickness of border around tabs. - // + /** + * Thickness of border around tabs. + */ public native float getTabBorderSize(); /* - return ImGui::GetStyle().TabBorderSize; + return IMGUI_STYLE->TabBorderSize; */ + /** + * Thickness of border around tabs. + */ public native void setTabBorderSize(float tabBorderSize); /* - ImGui::GetStyle().TabBorderSize = tabBorderSize; + IMGUI_STYLE->TabBorderSize = tabBorderSize; */ - // ColorButtonPosition - // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. - // + /** + * Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. + */ public native int getColorButtonPosition(); /* - return ImGui::GetStyle().ColorButtonPosition; + return IMGUI_STYLE->ColorButtonPosition; */ + /** + * Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. + */ public native void setColorButtonPosition(int colorButtonPosition); /* - ImGui::GetStyle().ColorButtonPosition = colorButtonPosition; + IMGUI_STYLE->ColorButtonPosition = colorButtonPosition; */ - // ButtonTextAlign - // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). - // + /** + * Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). + */ public native void getButtonTextAlign(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().ButtonTextAlign, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->ButtonTextAlign, dstImVec2); */ + /** + * Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). + */ public native void setButtonTextAlign(float x, float y); /* - ImGui::GetStyle().ButtonTextAlign.x = x; - ImGui::GetStyle().ButtonTextAlign.y = y; + IMGUI_STYLE->ButtonTextAlign.x = x; + IMGUI_STYLE->ButtonTextAlign.y = y; */ - // SelectableTextAlign - // Alignment of selectable text when selectable is larger than text. Defaults to (0.0f, 0.0f) (top-left aligned). - // + /** + * Alignment of selectable text when selectable is larger than text. Defaults to (0.0f, 0.0f) (top-left aligned). + */ public native void getSelectableTextAlign(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().SelectableTextAlign, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->SelectableTextAlign, dstImVec2); */ + /** + * Alignment of selectable text when selectable is larger than text. Defaults to (0.0f, 0.0f) (top-left aligned). + */ public native void setSelectableTextAlign(float x, float y); /* - ImGui::GetStyle().SelectableTextAlign.x = x; - ImGui::GetStyle().SelectableTextAlign.y = y; + IMGUI_STYLE->SelectableTextAlign.x = x; + IMGUI_STYLE->SelectableTextAlign.y = y; */ - // DisplayWindowPadding - // Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. - // + /** + * Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. + */ public native void getDisplayWindowPadding(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().DisplayWindowPadding, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->DisplayWindowPadding, dstImVec2); */ + /** + * Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. + */ public native void setDisplayWindowPadding(float x, float y); /* - ImGui::GetStyle().DisplayWindowPadding.x = x; - ImGui::GetStyle().DisplayWindowPadding.y = y; + IMGUI_STYLE->DisplayWindowPadding.x = x; + IMGUI_STYLE->DisplayWindowPadding.y = y; */ - // DisplaySafeAreaPadding - // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. - // Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! - // + /** + * If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. + * Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! + */ public native void getDisplaySafeAreaPadding(ImVec2 dstImVec2); /* - Jni::ImVec2Cpy(env, &ImGui::GetStyle().DisplaySafeAreaPadding, dstImVec2); + Jni::ImVec2Cpy(env, &IMGUI_STYLE->DisplaySafeAreaPadding, dstImVec2); */ + /** + * If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. + * Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! + */ public native void setDisplaySafeAreaPadding(float x, float y); /* - ImGui::GetStyle().DisplaySafeAreaPadding.x = x; - ImGui::GetStyle().DisplaySafeAreaPadding.y = y; + IMGUI_STYLE->DisplaySafeAreaPadding.x = x; + IMGUI_STYLE->DisplaySafeAreaPadding.y = y; */ - // MouseCursorScale - // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. - // + /** + * Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + */ public native float getMouseCursorScale(); /* - return ImGui::GetStyle().MouseCursorScale; + return IMGUI_STYLE->MouseCursorScale; */ + /** + * Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + */ public native void setMouseCursorScale(float mouseCursorScale); /* - ImGui::GetStyle().MouseCursorScale = mouseCursorScale; + IMGUI_STYLE->MouseCursorScale = mouseCursorScale; */ - // AntiAliasedLines - // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. - // + /** + * Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. + */ public native boolean getAntiAliasedLines(); /* - return ImGui::GetStyle().AntiAliasedLines; + return IMGUI_STYLE->AntiAliasedLines; */ + /** + * Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. + */ public native void setAntiAliasedLines(boolean antiAliasedLines); /* - ImGui::GetStyle().AntiAliasedLines = antiAliasedLines; + IMGUI_STYLE->AntiAliasedLines = antiAliasedLines; */ - // AntiAliasedFill - // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) - // + /** + * Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) + */ public native boolean getAntiAliasedFill(); /* - return ImGui::GetStyle().AntiAliasedFill; + return IMGUI_STYLE->AntiAliasedFill; */ + /** + * Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) + */ public native void setAntiAliasedFill(boolean antiAliasedFill); /* - ImGui::GetStyle().AntiAliasedFill = antiAliasedFill; + IMGUI_STYLE->AntiAliasedFill = antiAliasedFill; */ - // CurveTessellationTol - // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. - // Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. - // + /** + * Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. + * Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + */ public native float getCurveTessellationTol(); /* - return ImGui::GetStyle().CurveTessellationTol; + return IMGUI_STYLE->CurveTessellationTol; */ + /** + * Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. + * Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + */ public native void setCurveTessellationTol(float curveTessellationTol); /* - ImGui::GetStyle().CurveTessellationTol = curveTessellationTol; + IMGUI_STYLE->CurveTessellationTol = curveTessellationTol; */ /** @@ -411,7 +548,7 @@ public final class ImGuiStyle { * Decrease for higher quality but more geometry. */ public native float getCircleSegmentMaxError(); /* - return ImGui::GetStyle().CircleSegmentMaxError; + return IMGUI_STYLE->CircleSegmentMaxError; */ /** @@ -419,7 +556,7 @@ public final class ImGuiStyle { * Decrease for higher quality but more geometry. */ public native void setCircleSegmentMaxError(float circleSegmentMaxError); /* - ImGui::GetStyle().CircleSegmentMaxError = circleSegmentMaxError; + IMGUI_STYLE->CircleSegmentMaxError = circleSegmentMaxError; */ /** @@ -430,10 +567,10 @@ public final class ImGuiStyle { jfloatArray jColors = (jfloatArray)env->GetObjectArrayElement(buff, i); jfloat* jBuffColor = env->GetFloatArrayElements(jColors, 0); - jBuffColor[0] = ImGui::GetStyle().Colors[i].x; - jBuffColor[1] = ImGui::GetStyle().Colors[i].y; - jBuffColor[2] = ImGui::GetStyle().Colors[i].z; - jBuffColor[3] = ImGui::GetStyle().Colors[i].w; + jBuffColor[0] = IMGUI_STYLE->Colors[i].x; + jBuffColor[1] = IMGUI_STYLE->Colors[i].y; + jBuffColor[2] = IMGUI_STYLE->Colors[i].z; + jBuffColor[3] = IMGUI_STYLE->Colors[i].w; env->ReleaseFloatArrayElements(jColors, jBuffColor, 0); env->DeleteLocalRef(jColors); @@ -448,25 +585,25 @@ public final class ImGuiStyle { jfloatArray jColors = (jfloatArray)env->GetObjectArrayElement(colors, i); jfloat* jColor = env->GetFloatArrayElements(jColors, 0); - ImGui::GetStyle().Colors[i].x = jColor[0]; - ImGui::GetStyle().Colors[i].y = jColor[1]; - ImGui::GetStyle().Colors[i].z = jColor[2]; - ImGui::GetStyle().Colors[i].w = jColor[3]; + IMGUI_STYLE->Colors[i].x = jColor[0]; + IMGUI_STYLE->Colors[i].y = jColor[1]; + IMGUI_STYLE->Colors[i].z = jColor[2]; + IMGUI_STYLE->Colors[i].w = jColor[3]; env->ReleaseFloatArrayElements(jColors, jColor, 0); env->DeleteLocalRef(jColors); } */ - public native void scaleAllSizes(float scaleFactor); /* - ImGui::GetStyle().ScaleAllSizes(scaleFactor); - */ - public native void getColor(int imGuiCol, ImVec4 dstImVec4); /* - Jni::ImVec4Cpy(env, ImGui::GetStyle().Colors[imGuiCol], dstImVec4); + Jni::ImVec4Cpy(env, IMGUI_STYLE->Colors[imGuiCol], dstImVec4); */ public native void setColor(int imGuiCol, float r, float g, float b, float a); /* - ImGui::GetStyle().Colors[imGuiCol] = ImVec4(r, g, b, a); + IMGUI_STYLE->Colors[imGuiCol] = ImVec4(r, g, b, a); + */ + + public native void scaleAllSizes(float scaleFactor); /* + IMGUI_STYLE->ScaleAllSizes(scaleFactor); */ }