Add ImGui helper methods to get ImVec2 values

This commit is contained in:
SpaiR committed 2020-07-11 18:50:57 +03:00
1 parent 50ce76a5d4
commit 640f56b4be
1 file changed
+253
@@ -519,6 +519,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetWindowPos(), dstImVec2);
*/
/**
* Get current window position in screen space (useful if you want to do your own drawing via the DrawList API)
*/
public static native float getWindowPosX(); /*
return ImGui::GetWindowPos().x;
*/
/**
* Get current window position in screen space (useful if you want to do your own drawing via the DrawList API)
*/
public static native float getWindowPosY(); /*
return ImGui::GetWindowPos().y;
*/
/**
* Get current window size
*/
@@ -526,6 +540,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetWindowSize(), dstImVec2);
*/
/**
* Get current window size
*/
public static native float getWindowSizeX(); /*
return ImGui::GetWindowSize().x;
*/
/**
* Get current window size
*/
public static native float getWindowSizeY(); /*
return ImGui::GetWindowSize().y;
*/
/**
* Get current window width (shortcut for GetWindowSize().x)
*/
@@ -747,6 +775,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetContentRegionMax(), dstImVec2);
*/
/**
* Current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
*/
public static native float getContentRegionMaxX(); /*
return ImGui::GetContentRegionMax().x;
*/
/**
* Current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
*/
public static native float getContentRegionMaxY(); /*
return ImGui::GetContentRegionMax().y;
*/
/**
* == GetContentRegionMax() - GetCursorPos()
*/
@@ -754,6 +796,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetContentRegionAvail(), dstImVec2);
*/
/**
* == GetContentRegionMax() - GetCursorPos()
*/
public static native float getContentRegionAvailX(); /*
return ImGui::GetContentRegionAvail().x;
*/
/**
* == GetContentRegionMax() - GetCursorPos()
*/
public static native float getContentRegionAvailY(); /*
return ImGui::GetContentRegionAvail().y;
*/
/**
* Content boundaries min (roughly (0,0)-Scroll), in window coordinates
*/
@@ -768,10 +824,32 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetWindowContentRegionMin(), dstImVec2);
*/
/**
* Content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
*/
public static native float getWindowContentRegionMinX(); /*
return ImGui::GetWindowContentRegionMin().x;
*/
/**
* Content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
*/
public static native float getWindowContentRegionMinY(); /*
return ImGui::GetWindowContentRegionMin().y;
*/
public static native void getWindowContentRegionMax(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, ImGui::GetWindowContentRegionMax(), dstImVec2);
*/
public static native float getWindowContentRegionMaxX(); /*
return ImGui::GetWindowContentRegionMax().x;
*/
public static native float getWindowContentRegionMaxY(); /*
return ImGui::GetWindowContentRegionMax().y;
*/
// Windows Scrolling
/**
@@ -962,6 +1040,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetFontTexUvWhitePixel(), dstImVec2);
*/
/**
* Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
*/
public static native float getFontTexUvWhitePixelX(); /*
return ImGui::GetFontTexUvWhitePixel().x;
*/
/**
* Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
*/
public static native float getFontTexUvWhitePixelY(); /*
return ImGui::GetFontTexUvWhitePixel().y;
*/
/**
* Retrieve given style color with style alpha applied and optional extra alpha multiplier
*/
@@ -1175,22 +1267,37 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetCursorPos(), dstImVec2);
*/
/**
* Cursor position in window coordinates (relative to window position)
*/
public static native float getCursorPosX(); /*
return ImGui::GetCursorPosX();
*/
/**
* Cursor position in window coordinates (relative to window position)
*/
public static native float getCursorPosY(); /*
return ImGui::GetCursorPosY();
*/
/**
* Cursor position in window coordinates (relative to window position)
*/
public static native void setCursorPos(float x, float y); /*
ImGui::SetCursorPos(ImVec2(x, y));
*/
/**
* Cursor position in window coordinates (relative to window position)
*/
public static native void setCursorPosX(float x); /*
ImGui::SetCursorPosX(x);
*/
/**
* Cursor position in window coordinates (relative to window position)
*/
public static native void setCursorPosY(float y); /*
ImGui::SetCursorPosY(y);
*/
@@ -1202,6 +1309,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetCursorStartPos(), dstImVec2);
*/
/**
* Initial cursor position in window coordinates
*/
public static native float getCursorStartPosX(); /*
return ImGui::GetCursorStartPos().x;
*/
/**
* Initial cursor position in window coordinates
*/
public static native float getCursorStartPosY(); /*
return ImGui::GetCursorStartPos().y;
*/
/**
* Cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API)
*/
@@ -1209,6 +1330,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetCursorScreenPos(), dstImVec2);
*/
/**
* Cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API)
*/
public static native float getCursorScreenPosX(); /*
return ImGui::GetCursorScreenPos().x;
*/
/**
* Cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API)
*/
public static native float getCursorScreenPosY(); /*
return ImGui::GetCursorScreenPos().y;
*/
/**
* Cursor position in absolute screen coordinates [0..io.DisplaySize]
*/
@@ -4664,6 +4799,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetItemRectMin(), dstImVec2);
*/
/**
* Get upper-left bounding rectangle of the last item (screen space)
*/
public static native float getItemRectMinX(); /*
return ImGui::GetItemRectMin().x;
*/
/**
* Get upper-left bounding rectangle of the last item (screen space)
*/
public static native float getItemRectMinY(); /*
return ImGui::GetItemRectMin().y;
*/
/**
* Get lower-right bounding rectangle of the last item (screen space)
*/
@@ -4671,6 +4820,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetItemRectMax(), dstImVec2);
*/
/**
* Get lower-right bounding rectangle of the last item (screen space)
*/
public static native float getItemRectMaxX(); /*
return ImGui::GetItemRectMax().x;
*/
/**
* Get lower-right bounding rectangle of the last item (screen space)
*/
public static native float getItemRectMaxY(); /*
return ImGui::GetItemRectMax().y;
*/
/**
* Get size of last item
*/
@@ -4678,6 +4841,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetItemRectSize(), dstImVec2);
*/
/**
* Get size of last item
*/
public static native float getItemRectSizeX(); /*
return ImGui::GetItemRectSize().x;
*/
/**
* Get size of last item
*/
public static native float getItemRectSizeY(); /*
return ImGui::GetItemRectSize().y;
*/
/**
* Allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
*/
@@ -5034,6 +5211,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetMousePos(), dstImVec2);
*/
/**
* Shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
*/
public static native float getMousePosX(); /*
return ImGui::GetMousePos().x;
*/
/**
* Shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
*/
public static native float getMousePosY(); /*
return ImGui::GetMousePos().y;
*/
/**
* Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
*/
@@ -5041,6 +5232,20 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetMousePosOnOpeningCurrentPopup(), dstImVec2);
*/
/**
* Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
*/
public static native float getMousePosOnOpeningCurrentPopupX(); /*
return ImGui::GetMousePosOnOpeningCurrentPopup().x;
*/
/**
* Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
*/
public static native float getMousePosOnOpeningCurrentPopupY(); /*
return ImGui::GetMousePosOnOpeningCurrentPopup().y;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
@@ -5049,6 +5254,22 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetMouseDragDelta(), dstImVec2);
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaX(); /*
return ImGui::GetMouseDragDelta().x;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaY(); /*
return ImGui::GetMouseDragDelta().y;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
@@ -5057,6 +5278,22 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetMouseDragDelta(button), dstImVec2);
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaX(int button); /*
return ImGui::GetMouseDragDelta(button).x;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaY(int button); /*
return ImGui::GetMouseDragDelta(button).y;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
@@ -5065,6 +5302,22 @@ public final class ImGui {
Jni::ImVec2Cpy(env, ImGui::GetMouseDragDelta(button, lockThreshold), dstImVec2);
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaX(int button, float lockThreshold); /*
return ImGui::GetMouseDragDelta(button, lockThreshold).x;
*/
/**
* Return the delta from the initial clicking position while the mouse button is pressed or was just released.
* This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lockThreshold {@code < -1.0f} uses io.MouseDraggingThreshold.
*/
public static native float getMouseDragDeltaY(int button, float lockThreshold); /*
return ImGui::GetMouseDragDelta(button, lockThreshold).y;
*/
public static native void resetMouseDragDelta(); /*
ImGui::ResetMouseDragDelta();
*/