[API] Add API to directly return ImVec2/ImVec4
This commit is contained in:
1 parent
d285bbfb34
commit
36415d60f3
12 files changed
+553
-1
No files matched your search
@@ -503,6 +503,15 @@ public class ImGui {
|
||||
return ImGui::GetWindowDpiScale();
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get current window position in screen space (useful if you want to do your own drawing via the DrawList API)
|
||||
*/
|
||||
public static ImVec2 getWindowPos() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getWindowPos(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current window position in screen space (useful if you want to do your own drawing via the DrawList API)
|
||||
*/
|
||||
@@ -524,6 +533,15 @@ public class ImGui {
|
||||
return ImGui::GetWindowPos().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get current window size
|
||||
*/
|
||||
public static ImVec2 getWindowSize() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getWindowSize(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current window size
|
||||
*/
|
||||
@@ -779,6 +797,15 @@ public class ImGui {
|
||||
// - Retrieve available space from a given point. GetContentRegionAvail() is frequently useful.
|
||||
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
||||
|
||||
/**
|
||||
* == GetContentRegionMax() - GetCursorPos()
|
||||
*/
|
||||
public static ImVec2 getContentRegionAvail() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getContentRegionAvail(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* == GetContentRegionMax() - GetCursorPos()
|
||||
*/
|
||||
@@ -800,6 +827,15 @@ public class ImGui {
|
||||
return ImGui::GetContentRegionAvail().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||
*/
|
||||
public static ImVec2 getContentRegionMax() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getContentRegionMax(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||
*/
|
||||
@@ -821,6 +857,15 @@ public class ImGui {
|
||||
return ImGui::GetContentRegionMax().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||
*/
|
||||
public static ImVec2 getWindowContentRegionMin() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getWindowContentRegionMin(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||
*/
|
||||
@@ -842,6 +887,12 @@ public class ImGui {
|
||||
return ImGui::GetWindowContentRegionMin().y;
|
||||
*/
|
||||
|
||||
public final ImVec2 getWindowContentRegionMax() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getWindowContentRegionMax(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static native void getWindowContentRegionMax(ImVec2 dstImVec2); /*
|
||||
Jni::ImVec2Cpy(env, ImGui::GetWindowContentRegionMax(), dstImVec2);
|
||||
*/
|
||||
@@ -1116,6 +1167,15 @@ public class ImGui {
|
||||
return ImGui::GetFontSize();
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||
*/
|
||||
public static ImVec2 getFontTexUvWhitePixel() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getFontTexUvWhitePixel(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||
*/
|
||||
@@ -1167,6 +1227,16 @@ public class ImGui {
|
||||
return ImGui::GetColorU32((ImU32)col);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(),
|
||||
* otherwise use GetColorU32() to get style color with style alpha baked in.
|
||||
*/
|
||||
public ImVec4 getStyleColorVec4(final int imGuiStyleVar) {
|
||||
final ImVec4 value = new ImVec4();
|
||||
getStyleColorVec4(imGuiStyleVar, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(),
|
||||
* otherwise use GetColorU32() to get style color with style alpha baked in.
|
||||
@@ -1279,6 +1349,15 @@ public class ImGui {
|
||||
// are using the main, absolute coordinate system.
|
||||
// GetWindowPos() + GetCursorPos() == GetCursorScreenPos() etc.)
|
||||
|
||||
/**
|
||||
* Cursor position in window coordinates (relative to window position)
|
||||
*/
|
||||
public static ImVec2 getCursorPos() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getCursorPos(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cursor position in window coordinates (relative to window position)
|
||||
*/
|
||||
@@ -1321,6 +1400,15 @@ public class ImGui {
|
||||
ImGui::SetCursorPosY(y);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initial cursor position in window coordinates
|
||||
*/
|
||||
public static ImVec2 getCursorStartPos() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getCursorStartPos(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial cursor position in window coordinates
|
||||
*/
|
||||
@@ -1342,6 +1430,17 @@ public class ImGui {
|
||||
return ImGui::GetCursorStartPos().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Cursor position in absolute coordinates (useful to work with ImDrawList API).
|
||||
* Generally top-left == GetMainViewport().Pos == (0,0) in single viewport mode,
|
||||
* and bottom-right == GetMainViewport().Pos+Size == io.DisplaySize in single-viewport mode.
|
||||
*/
|
||||
public static ImVec2 getCursorScreenPos() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getCursorScreenPos(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cursor position in absolute coordinates (useful to work with ImDrawList API).
|
||||
* Generally top-left == GetMainViewport().Pos == (0,0) in single viewport mode,
|
||||
@@ -5047,6 +5146,15 @@ public class ImGui {
|
||||
return ImGui::IsAnyItemFocused();
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get upper-left bounding rectangle of the last item (screen space)
|
||||
*/
|
||||
public static ImVec2 getItemRectMin() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getItemRectMin(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get upper-left bounding rectangle of the last item (screen space)
|
||||
*/
|
||||
@@ -5068,6 +5176,15 @@ public class ImGui {
|
||||
return ImGui::GetItemRectMin().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get lower-right bounding rectangle of the last item (screen space)
|
||||
*/
|
||||
public static ImVec2 getItemRectMax() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getItemRectMax(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lower-right bounding rectangle of the last item (screen space)
|
||||
*/
|
||||
@@ -5089,6 +5206,15 @@ public class ImGui {
|
||||
return ImGui::GetItemRectMax().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get size of last item
|
||||
*/
|
||||
public static ImVec2 getItemRectSize() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getItemRectSize(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get size of last item
|
||||
*/
|
||||
@@ -5275,6 +5401,24 @@ public class ImGui {
|
||||
|
||||
// Text Utilities
|
||||
|
||||
public final ImVec2 calcTextSize(final String text) {
|
||||
final ImVec2 value = new ImVec2();
|
||||
calcTextSize(value, text);
|
||||
return value;
|
||||
}
|
||||
|
||||
public final ImVec2 calcTextSize(final String text, final boolean hideTextAfterDoubleHash) {
|
||||
final ImVec2 value = new ImVec2();
|
||||
calcTextSize(value, text, hideTextAfterDoubleHash);
|
||||
return value;
|
||||
}
|
||||
|
||||
public final ImVec2 calcTextSize(final String text, final boolean hideTextAfterDoubleHash, final float wrapWidth) {
|
||||
final ImVec2 value = new ImVec2();
|
||||
calcTextSize(value, text, hideTextAfterDoubleHash, wrapWidth);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static native void calcTextSize(ImVec2 dstImVec2, String text); /*
|
||||
ImVec2 src = ImGui::CalcTextSize(text);
|
||||
Jni::ImVec2Cpy(env, src, dstImVec2);
|
||||
@@ -5297,6 +5441,12 @@ public class ImGui {
|
||||
|
||||
// Color Utilities
|
||||
|
||||
public final ImVec4 colorConvertU32ToFloat4(final int in) {
|
||||
final ImVec4 value = new ImVec4();
|
||||
colorConvertU32ToFloat4(in, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static native void colorConvertU32ToFloat4(int in, ImVec4 dstImVec4); /*
|
||||
Jni::ImVec4Cpy(env, ImGui::ColorConvertU32ToFloat4(in), dstImVec4);
|
||||
*/
|
||||
@@ -5465,6 +5615,15 @@ public class ImGui {
|
||||
return ImGui::IsMousePosValid(&pos);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||
*/
|
||||
public static ImVec2 getMousePos() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getMousePos(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||
*/
|
||||
@@ -5486,6 +5645,15 @@ public class ImGui {
|
||||
return ImGui::GetMousePos().y;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
|
||||
*/
|
||||
public static ImVec2 getMousePosOnOpeningCurrentPopup() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getMousePosOnOpeningCurrentPopup(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
|
||||
*/
|
||||
@@ -5507,6 +5675,16 @@ public class ImGui {
|
||||
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.
|
||||
*/
|
||||
public static ImVec2 getMouseDragDelta() {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getMouseDragDelta(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -5531,6 +5709,16 @@ public class ImGui {
|
||||
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.
|
||||
*/
|
||||
public static ImVec2 getMouseDragDelta(final int button) {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getMouseDragDelta(value, button);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -5555,6 +5743,16 @@ public class ImGui {
|
||||
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.
|
||||
*/
|
||||
public static ImVec2 getMouseDragDelta(final int button, final float lockThreshold) {
|
||||
final ImVec2 value = new ImVec2();
|
||||
getMouseDragDelta(value, button, lockThreshold);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
Reference in new issue
Block a user