From 50ce76a5d438abbfc0130d3a78afe8738029d6f8 Mon Sep 17 00:00:00 2001 From: SpaiR Date: Thu, 9 Jul 2020 13:28:58 +0300 Subject: [PATCH] Add ImGuiIO helper methods to get ImVec2 values --- .../src/main/java/imgui/ImGuiIO.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/imgui-binding/src/main/java/imgui/ImGuiIO.java b/imgui-binding/src/main/java/imgui/ImGuiIO.java index 5d868ff..e4e3de2 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiIO.java +++ b/imgui-binding/src/main/java/imgui/ImGuiIO.java @@ -436,6 +436,24 @@ public final class ImGuiIO { Jni::ImVec2Cpy(env, &ImGui::GetIO().DisplaySize, dstImVec2); */ + /** + * Main display size, in pixels. + *

+ * BINDING NOTICE: This should be a "Config" part, but since those values may be different for every frame I don't see how it is possible to set them only once. + */ + public native float getDisplaySizeX(); /* + return ImGui::GetIO().DisplaySize.x; + */ + + /** + * Main display size, in pixels. + *

+ * BINDING NOTICE: This should be a "Config" part, but since those values may be different for every frame I don't see how it is possible to set them only once. + */ + public native float getDisplaySizeY(); /* + return ImGui::GetIO().DisplaySize.y; + */ + /** * Main display size, in pixels. *

@@ -455,6 +473,24 @@ public final class ImGuiIO { Jni::ImVec2Cpy(env, &ImGui::GetIO().DisplayFramebufferScale, dstImVec2); */ + /** + * For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale. + *

+ * BINDING NOTICE: This should be a "Config" part, but since those values may be different for every frame I don't see how it is possible to set them only once. + */ + public native float getDisplayFramebufferScaleX(); /* + return ImGui::GetIO().DisplayFramebufferScale.x; + */ + + /** + * For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale. + *

+ * BINDING NOTICE: This should be a "Config" part, but since those values may be different for every frame I don't see how it is possible to set them only once. + */ + public native float getDisplayFramebufferScaleY(); /* + return ImGui::GetIO().DisplayFramebufferScale.y; + */ + /** * For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale. *

@@ -552,6 +588,20 @@ public final class ImGuiIO { Jni::ImVec2Cpy(env, &ImGui::GetIO().MousePos, dstImVec2); */ + /** + * Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) + */ + public native float getMousePosX(); /* + return ImGui::GetIO().MousePos.x; + */ + + /** + * Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) + */ + public native float getMousePosY(); /* + return ImGui::GetIO().MousePos.y; + */ + /** * Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) */ @@ -949,6 +999,20 @@ public final class ImGuiIO { Jni::ImVec2Cpy(env, &ImGui::GetIO().MouseDelta, dstImVec2); */ + /** + * Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + */ + public native float getMouseDeltaX(); /* + return ImGui::GetIO().MouseDelta.x; + */ + + /** + * Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + */ + public native float getMouseDeltaY(); /* + return ImGui::GetIO().MouseDelta.y; + */ + /** * Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. */