From 8e604fd8020646b9c7a4fa616a86e9c7ae0fde6e Mon Sep 17 00:00:00 2001 From: SpaiR Date: Thu, 9 Jul 2020 13:28:29 +0300 Subject: [PATCH] Add ImDrawData helper methods to get ImVec2 values --- .../src/main/java/imgui/ImDrawData.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/imgui-binding/src/main/java/imgui/ImDrawData.java b/imgui-binding/src/main/java/imgui/ImDrawData.java index e49fb03..21c48da 100644 --- a/imgui-binding/src/main/java/imgui/ImDrawData.java +++ b/imgui-binding/src/main/java/imgui/ImDrawData.java @@ -184,6 +184,20 @@ public final class ImDrawData implements ImGuiDestroyableStruct { Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplayPos, dstImVec2); */ + /** + * Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use) + */ + public native float getDisplayPosX(); /* + return IM_DRAW_DATA->DisplayPos.x; + */ + + /** + * Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use) + */ + public native float getDisplayPosY(); /* + return IM_DRAW_DATA->DisplayPos.y; + */ + /** * Size of the viewport to render (== io.DisplaySize for the main viewport) * (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use) @@ -192,6 +206,22 @@ public final class ImDrawData implements ImGuiDestroyableStruct { Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplaySize, dstImVec2); */ + /** + * Size of the viewport to render (== io.DisplaySize for the main viewport) + * (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use) + */ + public native float getDisplaySizeX(); /* + return IM_DRAW_DATA->DisplaySize.x; + */ + + /** + * Size of the viewport to render (== io.DisplaySize for the main viewport) + * (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use) + */ + public native float getDisplaySizeY(); /* + return IM_DRAW_DATA->DisplaySize.y; + */ + /** * Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. */ @@ -199,6 +229,20 @@ public final class ImDrawData implements ImGuiDestroyableStruct { Jni::ImVec2Cpy(env, &IM_DRAW_DATA->FramebufferScale, dstImVec2); */ + /** + * Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. + */ + public native float getFramebufferScaleX(); /* + return IM_DRAW_DATA->FramebufferScale.x; + */ + + /** + * Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. + */ + public native float getFramebufferScaleY(); /* + return IM_DRAW_DATA->FramebufferScale.y; + */ + // Functions /**