Skip to content

Commit 50ce76a

Browse files
committed
Add ImGuiIO helper methods to get ImVec2 values
1 parent f013696 commit 50ce76a

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

imgui-binding/src/main/java/imgui/ImGuiIO.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,24 @@ void setClipboardTextStub(void* userData, const char* text) {
436436
Jni::ImVec2Cpy(env, &ImGui::GetIO().DisplaySize, dstImVec2);
437437
*/
438438

439+
/**
440+
* Main display size, in pixels.
441+
* <p>
442+
* 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.
443+
*/
444+
public native float getDisplaySizeX(); /*
445+
return ImGui::GetIO().DisplaySize.x;
446+
*/
447+
448+
/**
449+
* Main display size, in pixels.
450+
* <p>
451+
* 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.
452+
*/
453+
public native float getDisplaySizeY(); /*
454+
return ImGui::GetIO().DisplaySize.y;
455+
*/
456+
439457
/**
440458
* Main display size, in pixels.
441459
* <p>
@@ -455,6 +473,24 @@ void setClipboardTextStub(void* userData, const char* text) {
455473
Jni::ImVec2Cpy(env, &ImGui::GetIO().DisplayFramebufferScale, dstImVec2);
456474
*/
457475

476+
/**
477+
* For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale.
478+
* <p>
479+
* 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.
480+
*/
481+
public native float getDisplayFramebufferScaleX(); /*
482+
return ImGui::GetIO().DisplayFramebufferScale.x;
483+
*/
484+
485+
/**
486+
* For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale.
487+
* <p>
488+
* 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.
489+
*/
490+
public native float getDisplayFramebufferScaleY(); /*
491+
return ImGui::GetIO().DisplayFramebufferScale.y;
492+
*/
493+
458494
/**
459495
* For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale.
460496
* <p>
@@ -552,6 +588,20 @@ void setClipboardTextStub(void* userData, const char* text) {
552588
Jni::ImVec2Cpy(env, &ImGui::GetIO().MousePos, dstImVec2);
553589
*/
554590

591+
/**
592+
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
593+
*/
594+
public native float getMousePosX(); /*
595+
return ImGui::GetIO().MousePos.x;
596+
*/
597+
598+
/**
599+
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
600+
*/
601+
public native float getMousePosY(); /*
602+
return ImGui::GetIO().MousePos.y;
603+
*/
604+
555605
/**
556606
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
557607
*/
@@ -949,6 +999,20 @@ void setClipboardTextStub(void* userData, const char* text) {
949999
Jni::ImVec2Cpy(env, &ImGui::GetIO().MouseDelta, dstImVec2);
9501000
*/
9511001

1002+
/**
1003+
* 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.
1004+
*/
1005+
public native float getMouseDeltaX(); /*
1006+
return ImGui::GetIO().MouseDelta.x;
1007+
*/
1008+
1009+
/**
1010+
* 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.
1011+
*/
1012+
public native float getMouseDeltaY(); /*
1013+
return ImGui::GetIO().MouseDelta.y;
1014+
*/
1015+
9521016
/**
9531017
* 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.
9541018
*/

0 commit comments

Comments
 (0)