Skip to content

Commit

Permalink
[API] Implement binding for ImGui::getWindowScrollbarRect (#81)
Browse files Browse the repository at this point in the history
* Implemented binding for ImGui::getWindowScrollbarRect

* checkstyle fixes

* more logic naming for boolean fields in ImGuiWindow struct

Co-authored-by: aleksandr.cayun <aleksandr.cayun@vizor-games.com>
  • Loading branch information
AlTsayun and AleksandrCayun authored Sep 24, 2021
1 parent 2d2e917 commit 326594f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
23 changes: 23 additions & 0 deletions imgui-binding/src/main/java/imgui/internal/ImGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
public final class ImGui extends imgui.ImGui {
private static final ImGuiDockNode DOCK_NODE = new ImGuiDockNode(0);

private static final ImGuiWindow IMGUI_CURRENT_WINDOW = new ImGuiWindow(0);

/*JNI
#include "_common.h"
#include <imgui_internal.h>
Expand Down Expand Up @@ -172,4 +174,25 @@ public static boolean splitterBehavior(float bbMinX, float bbMinY, float bbMaxX,
private static native boolean nSplitterBehaviour(float bbMinX, float bbMinY, float bbMaxX, float bbMaxY, int id, int imGuiAxis, float[] size1, float[] size2, float minSize1, float minSize2, float hoverExtend, float hoverVisibilityDelay); /*
return ImGui::SplitterBehavior(ImRect(bbMinX, bbMinY, bbMaxX, bbMaxY), id, (ImGuiAxis)imGuiAxis, &size1[0], &size2[0], minSize1, minSize2, hoverExtend, hoverVisibilityDelay);
*/

public static ImGuiWindow getCurrentWindow() {
IMGUI_CURRENT_WINDOW.ptr = nGetCurrentWindow();
return IMGUI_CURRENT_WINDOW;
}

private static native long nGetCurrentWindow(); /*
return (intptr_t)ImGui::GetCurrentWindow();
*/

public static ImRect getWindowScrollbarRect(final ImGuiWindow imGuiWindow, int axis) {
final ImRect imRect = new ImRect();
nGetWindowScrollbarRect(imGuiWindow.ptr, axis, imRect.min, imRect.max);
return imRect;
}

private static native void nGetWindowScrollbarRect(long windowPtr, int axis, ImVec2 minDstImVec2, ImVec2 maxDstImVec2); /*
ImRect rect = ImGui::GetWindowScrollbarRect((ImGuiWindow*)windowPtr, static_cast<ImGuiAxis>(axis));
Jni::ImVec2Cpy(env, &rect.Min, minDstImVec2);
Jni::ImVec2Cpy(env, &rect.Max, maxDstImVec2);
*/
}
31 changes: 31 additions & 0 deletions imgui-binding/src/main/java/imgui/internal/ImGuiWindow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package imgui.internal;

import imgui.binding.ImGuiStruct;

public class ImGuiWindow extends ImGuiStruct {
public ImGuiWindow(final long ptr) {
super(ptr);
}

/*JNI
#include "_common.h"
#include <imgui_internal.h>
#define IMGUI_WINDOW ((ImGuiWindow*)STRUCT_PTR)
*/

/**
* Is scrollbar visible?
*/
public native boolean isScrollbarX(); /*
return IMGUI_WINDOW->ScrollbarX;
*/

/**
* Is scrollbar visible?
*/
public native boolean isScrollbarY(); /*
return IMGUI_WINDOW->ScrollbarY;
*/

}

0 comments on commit 326594f

Please sign in to comment.