feat(api): Dear ImGui v1.87 + ImPlot v0.13 (#252)

* build(deps): bump Dear ImGui from 1.86 to 1.87

* build(deps): bump implot from 0.12 to 0.13

* feat(api,binding): adapt API to Dear ImGui v1.87

* feat(api,binding): adapt API to implot v0.13

* build: generate API for latest changes

* chore(binding): add missing super call for ImGuiStructDestroyable constructor

* chore: minor code style

* feat: adapt ImGuiImplGlfw to 1.87

* feat: adapt ImGuiImplGl3 to 1.87

* feat: adapt imgui-app module to 1.87

* fix: javadoc for updated imgui-binding

* fix: loosing data when setting struct field of char* type

Since we manually release chars, to store them in field we need to do a local copy.

* fix: invalid methods to check program linking in OpenGL

* chore: remove dedicated method to check GLFW version

* fix: add missing include
This commit is contained in:
SpaiR authored and GitHub committed 2024-08-16 15:35:42 +03:00
1 parent 341b0af179
commit 47d97102f7
80 files changed
+12211 -7373

No files matched your search

@@ -71,7 +71,7 @@ private fun convertParams2jni(f: Factory, params: List<CtParameter<*>>, defaults
setType<Nothing>(f.createTypeParam("double"))
setSimpleName<Nothing>("${p.simpleName}Max")
}
} else if (p.isType("ImPlotLimits")) {
} else if (p.isType("ImPlotRect")) {
result += f.createParameter<Nothing>().apply {
setType<Nothing>(f.createTypeParam("double"))
setSimpleName<Nothing>("${p.simpleName}MinX")
@@ -155,8 +155,8 @@ private fun joinInBodyParams(params: List<CtParameter<*>>, defaults: IntArray):
"ImPlotRange(${p.simpleName}Min, ${p.simpleName}Max)"
}
"ImPlotLimits" -> {
"ImPlotLimits(${p.simpleName}MinX, ${p.simpleName}MinY, ${p.simpleName}MaxX, ${p.simpleName}MaxY)"
"ImPlotRect" -> {
"ImPlotRect(${p.simpleName}MinX, ${p.simpleName}MinY, ${p.simpleName}MaxX, ${p.simpleName}MaxY)"
}
"TextEditorCoordinates" -> {
@@ -281,8 +281,10 @@ private fun createMethod(mOrig: CtMethod<*>, params: List<CtParameter<*>>, defau
append(joinInBodyParams(params, defaults))
append(')')
mOrig.getAnnotation(A_NAME_RETURN_VALUE)?.let { a ->
append(a.getValueAsString(A_VALUE_CALL_SUFFIX))
if (!mOrig.isType("void")) {
mOrig.getAnnotation(A_NAME_RETURN_VALUE)?.let { a ->
append(a.getValueAsString(A_VALUE_CALL_SUFFIX))
}
}
if (jniCpyReturn) {
@@ -553,7 +555,7 @@ private fun createFieldGetContent(field: CtField<*>): List<String> {
)
}
"ImVec2", "ImVec4" -> {
else -> {
getArray.setBody<Nothing>(
f.createCodeSnippet(
"""
@@ -602,6 +604,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
setAccessor.setParent<Nothing>(field.parent)
setAccessor.setSimpleName<Nothing>("set${field.simpleName}")
setAccessor.addModifier<Nothing>(ModifierKind.PRIVATE)
setAccessor.setAnnotations<Nothing>(field.annotations)
val valueParam = f.createParameter<Nothing>().apply {
setType<Nothing>(field.type)
@@ -633,7 +636,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
)
}
"ImVec2", "ImVec4" -> {
else -> {
setArray.setBody<Nothing>(
f.createCodeSnippet("""
Jni::${arrayType}ArrayCpy(env, value, $PTR_JNI_THIS->${field.getCallName()}, $arraySize)
@@ -665,10 +668,16 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
}
} else {
result += transformMethodToContent(setAccessor, listOf(valueParam)).map {
it.replace(
"$PTR_JNI_THIS->${setAccessor.simpleName}\\((.+)\\)".toRegex(),
"$PTR_JNI_THIS->${field.getCallName()} = $1"
)
val fieldName = "$PTR_JNI_THIS->${field.getCallName()}"
val replaceTarget = "$PTR_JNI_THIS->${setAccessor.simpleName}\\((.+)\\)"
var replaceContent = "$fieldName = $1"
// When we set a string to a field we need to manually copy the string itself.
if (field.isType("String") && !field.hasAnnotation(A_NAME_TYPE_STD_STRING)) {
replaceContent = "SET_STRING_FIELD($fieldName, $1)"
}
it.replace(replaceTarget.toRegex(), replaceContent)
}
}
@@ -32,7 +32,7 @@ private fun joinInBodyParams(params: List<CtParameter<*>>, defaults: IntArray):
"ImPlotPoint" -> "${p.simpleName}.x, ${p.simpleName}.y"
"ImPlotRange" -> "${p.simpleName}.min, ${p.simpleName}.max"
"ImPlotLimits" -> "${p.simpleName}.x.min, ${p.simpleName}.y.min, ${p.simpleName}.x.max, ${p.simpleName}.y.max"
"ImPlotRect" -> "${p.simpleName}.x.min, ${p.simpleName}.y.min, ${p.simpleName}.x.max, ${p.simpleName}.y.max"
"TextEditorCoordinates" -> "${p.simpleName}.mLine, ${p.simpleName}.mColumn"
@@ -366,7 +366,7 @@ private fun methodPlotLimitsUnwrappedContent(method: CtMethod<*>): String {
val paramNames = mutableSetOf<String>()
for (p in newMethod.parameters) {
if (p.isType("ImPlotLimits")) {
if (p.isType("ImPlotRect")) {
paramNames += p.simpleName
val paramMinX = p.factory.createParameter<Nothing>()
@@ -527,7 +527,7 @@ private fun transformMethodToContent(
methodPlotRangeUnwrappedContent(mNew).takeIf(String::isNotEmpty)?.run(methods::add)
}
if (params.find { it.isType("ImPlotLimits") } != null) {
if (params.find { it.isType("ImPlotRect") } != null) {
methodPlotLimitsUnwrappedContent(mNew).takeIf(String::isNotEmpty)?.run(methods::add)
}
@@ -19,6 +19,7 @@ const val A_NAME_EXCLUDED_SOURCE = "ExcludedSource"
const val A_NAME_RETURN_VALUE = "ReturnValue"
const val A_NAME_ARG_VALUE = "ArgValue"
const val A_NAME_TYPE_ARRAY = "TypeArray"
const val A_NAME_TYPE_STD_STRING = "TypeStdString"
const val A_VALUE_CALL_PTR = "callPtr"
const val A_VALUE_CALL_OPERATOR = "callOperator"
@@ -55,6 +56,7 @@ val CLEANUP_ANNOTATIONS_LIST = listOf(
A_NAME_OPT_ARG,
A_NAME_ARG_VALUE,
A_NAME_TYPE_ARRAY,
A_NAME_TYPE_STD_STRING,
A_NAME_BINDING_AST_ENUM,
)
@@ -74,7 +76,7 @@ val DST_RETURN_TYPE_SET = setOf(
"ImRect",
"ImPlotPoint",
"ImPlotRange",
"ImPlotLimits",
"ImPlotRect",
"TextEditorCoordinates",
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+10 -7
View File
@@ -23,9 +23,8 @@ import java.util.Objects;
* When extended, life-cycle methods should be called manually.
*/
public abstract class Window {
private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw();
private final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3();
protected ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw();
protected ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3();
private String glslVersion = null;
@@ -55,8 +54,8 @@ public abstract class Window {
* Method to dispose all used application resources and destroy its window.
*/
protected void dispose() {
imGuiGl3.dispose();
imGuiGlfw.dispose();
imGuiGl3.shutdown();
imGuiGlfw.shutdown();
disposeImGui();
disposeWindow();
}
@@ -189,6 +188,7 @@ public abstract class Window {
*/
protected void startFrame() {
clearBuffer();
imGuiGl3.newFrame();
imGuiGlfw.newFrame();
ImGui.newFrame();
}
@@ -201,11 +201,14 @@ public abstract class Window {
ImGui.render();
imGuiGl3.renderDrawData(ImGui.getDrawData());
// Update and Render additional Platform Windows
// (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
// For this specific demo app we could also call glfwMakeContextCurrent(window) directly)
if (ImGui.getIO().hasConfigFlags(ImGuiConfigFlags.ViewportsEnable)) {
final long backupWindowPtr = GLFW.glfwGetCurrentContext();
final long backupCurrentContext = GLFW.glfwGetCurrentContext();
ImGui.updatePlatformWindows();
ImGui.renderPlatformWindowsDefault();
GLFW.glfwMakeContextCurrent(backupWindowPtr);
GLFW.glfwMakeContextCurrent(backupCurrentContext);
}
renderBuffer();
@@ -8,6 +8,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class ImFont extends ImGuiStructDestroyable {
public ImFont() {
super();
}
public ImFont(final long ptr) {
@@ -30,6 +30,7 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
private ByteBuffer rgba32pixels = null;
public ImFontAtlas() {
super();
}
public ImFontAtlas(final long ptr) {
@@ -8,6 +8,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class ImFontGlyph extends ImGuiStructDestroyable {
public ImFontGlyph() {
super();
}
public ImFontGlyph(final long ptr) {
@@ -11927,73 +11927,89 @@ public class ImGui {
*/
// Inputs Utilities: Keyboard
// - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
// - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.
// Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support)
// - For 'ImGuiKey key' you can still use your legacy native/user indices according to how your backend/engine stored them in io.KeysDown[].
// With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward)
// - Any use of 'ImGuiKey' will assert when key < 512 will be passed, previously reserved as native/user keys indices
// - GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined)
/**
* Map ImGuiKey_* values into user's key index. == io.KeyMap[key]
*/
public static int getKeyIndex(final int imguiKey) {
return nGetKeyIndex(imguiKey);
@Deprecated
public static int getKeyIndex(final int key) {
return nGetKeyIndex(key);
}
private static native int nGetKeyIndex(int imguiKey); /*
return ImGui::GetKeyIndex(imguiKey);
private static native int nGetKeyIndex(int key); /*
return ImGui::GetKeyIndex(static_cast<ImGuiKey>(key));
*/
/**
* Is key being held. == io.KeysDown[user_key_index].
*/
public static boolean isKeyDown(final int userKeyIndex) {
return nIsKeyDown(userKeyIndex);
public static boolean isKeyDown(final int key) {
return nIsKeyDown(key);
}
private static native boolean nIsKeyDown(int userKeyIndex); /*
return ImGui::IsKeyDown(userKeyIndex);
private static native boolean nIsKeyDown(int key); /*
return ImGui::IsKeyDown(static_cast<ImGuiKey>(key));
*/
/**
* Was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
*/
public static boolean isKeyPressed(final int userKeyIndex) {
return nIsKeyPressed(userKeyIndex);
public static boolean isKeyPressed(final int key) {
return nIsKeyPressed(key);
}
/**
* Was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
*/
public static boolean isKeyPressed(final int userKeyIndex, final boolean repeat) {
return nIsKeyPressed(userKeyIndex, repeat);
public static boolean isKeyPressed(final int key, final boolean repeat) {
return nIsKeyPressed(key, repeat);
}
private static native boolean nIsKeyPressed(int userKeyIndex); /*
return ImGui::IsKeyPressed(userKeyIndex);
private static native boolean nIsKeyPressed(int key); /*
return ImGui::IsKeyPressed(static_cast<ImGuiKey>(key));
*/
private static native boolean nIsKeyPressed(int userKeyIndex, boolean repeat); /*
return ImGui::IsKeyPressed(userKeyIndex, repeat);
private static native boolean nIsKeyPressed(int key, boolean repeat); /*
return ImGui::IsKeyPressed(static_cast<ImGuiKey>(key), repeat);
*/
/**
* Was key released (went from Down to !Down)..
* Was key released (went from Down to !Down)
*/
public static boolean isKeyReleased(final int userKeyIndex) {
return nIsKeyReleased(userKeyIndex);
public static boolean isKeyReleased(final int key) {
return nIsKeyReleased(key);
}
private static native boolean nIsKeyReleased(int userKeyIndex); /*
return ImGui::IsKeyReleased(userKeyIndex);
private static native boolean nIsKeyReleased(int key); /*
return ImGui::IsKeyReleased(static_cast<ImGuiKey>(key));
*/
/**
* Uses provided repeat rate/delay.
* Return a count, most often 0 or 1 but might be {@code >1} if RepeatRate is small enough that {@code DeltaTime > RepeatRate}
*/
public static boolean getKeyPressedAmount(final int keyIndex, final float repeatDelay, final float rate) {
return nGetKeyPressedAmount(keyIndex, repeatDelay, rate);
public static boolean getKeyPressedAmount(final int key, final float repeatDelay, final float rate) {
return nGetKeyPressedAmount(key, repeatDelay, rate);
}
private static native boolean nGetKeyPressedAmount(int keyIndex, float repeatDelay, float rate); /*
return ImGui::GetKeyPressedAmount(keyIndex, repeatDelay, rate);
private static native boolean nGetKeyPressedAmount(int key, float repeatDelay, float rate); /*
return ImGui::GetKeyPressedAmount(static_cast<ImGuiKey>(key), repeatDelay, rate);
*/
/**
* [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
*/
public static String getKeyName(final int key) {
return nGetKeyName(key);
}
private static native String nGetKeyName(int key); /*
return env->NewStringUTF(ImGui::GetKeyName(static_cast<ImGuiKey>(key)));
*/
/**
File diff suppressed because it is too large. Load diff
@@ -116,7 +116,7 @@ public class ImGuiInputTextCallbackData extends ImGuiStruct {
private native void nSetBuf(String value); /*MANUAL
auto value = obj_value == NULL ? NULL : (char*)env->GetStringUTFChars(obj_value, JNI_FALSE);
THIS->Buf = value;
SET_STRING_FIELD(THIS->Buf, value);
if (value != NULL) env->ReleaseStringUTFChars(obj_value, value);
*/
@@ -0,0 +1,123 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
/**
* [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions.
* If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key).DownDuration and not io.KeysData[key].DownDuration.
*/
public final class ImGuiKeyData extends ImGuiStructDestroyable {
public ImGuiKeyData() {
super();
}
public ImGuiKeyData(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImGuiKeyData*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImGuiKeyData());
*/
/**
* True for if key is down
*/
public boolean getDown() {
return nGetDown();
}
/**
* True for if key is down
*/
public void setDown(final boolean value) {
nSetDown(value);
}
private native boolean nGetDown(); /*
return THIS->Down;
*/
private native void nSetDown(boolean value); /*
THIS->Down = value;
*/
/**
* Duration the key has been down ({@code <}0.0f: not pressed, 0.0f: just pressed, {@code >}0.0f: time held)
*/
public float getDownDuration() {
return nGetDownDuration();
}
/**
* Duration the key has been down ({@code <}0.0f: not pressed, 0.0f: just pressed, {@code >}0.0f: time held)
*/
public void setDownDuration(final float value) {
nSetDownDuration(value);
}
private native float nGetDownDuration(); /*
return THIS->DownDuration;
*/
private native void nSetDownDuration(float value); /*
THIS->DownDuration = value;
*/
/**
* Last frame duration the key has been down
*/
public float getDownDurationPrev() {
return nGetDownDurationPrev();
}
/**
* Last frame duration the key has been down
*/
public void setDownDurationPrev(final float value) {
nSetDownDurationPrev(value);
}
private native float nGetDownDurationPrev(); /*
return THIS->DownDurationPrev;
*/
private native void nSetDownDurationPrev(float value); /*
THIS->DownDurationPrev = value;
*/
/**
* 0.0f..1.0f for gamepad values
*/
public float getAnalogValue() {
return nGetAnalogValue();
}
/**
* 0.0f..1.0f for gamepad values
*/
public void setAnalogValue(final float value) {
nSetAnalogValue(value);
}
private native float nGetAnalogValue(); /*
return THIS->AnalogValue;
*/
private native void nSetAnalogValue(float value); /*
THIS->AnalogValue = value;
*/
/*JNI
#undef THIS
*/
}
@@ -14,6 +14,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class ImGuiStorage extends ImGuiStructDestroyable {
public ImGuiStorage() {
super();
}
public ImGuiStorage(final long ptr) {
@@ -9,6 +9,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class ImGuiStyle extends ImGuiStructDestroyable {
public ImGuiStyle() {
super();
}
public ImGuiStyle(final long ptr) {
@@ -9,7 +9,6 @@ import imgui.binding.ImGuiStruct;
* Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame!
*/
public final class ImGuiTableSortSpecs extends ImGuiStruct {
public ImGuiTableSortSpecs(final long ptr) {
super(ptr);
}
@@ -23,8 +22,8 @@ public final class ImGuiTableSortSpecs extends ImGuiStruct {
* Pointer to sort spec array.
*/
public ImGuiTableColumnSortSpecs[] getSpecs() {
long[] specsPointers = nGetSpecs();
ImGuiTableColumnSortSpecs[] specs = new ImGuiTableColumnSortSpecs[specsPointers.length];
final long[] specsPointers = nGetSpecs();
final ImGuiTableColumnSortSpecs[] specs = new ImGuiTableColumnSortSpecs[specsPointers.length];
for (int i = 0; i < specsPointers.length; i++) {
specs[i] = new ImGuiTableColumnSortSpecs(specsPointers[i]);
}
@@ -45,7 +44,7 @@ public final class ImGuiTableSortSpecs extends ImGuiStruct {
*/
/**
* Sort spec count. Most often 1. May be {@code > } 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled.
* Sort spec count. Most often 1. May be {@code >} 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled.
*/
public int getSpecsCount() {
return nGetSpecsCount();
@@ -13,6 +13,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class ImGuiWindowClass extends ImGuiStructDestroyable {
public ImGuiWindowClass() {
super();
}
public ImGuiWindowClass(final long ptr) {
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,307 @@
package imgui.extension.implot;
import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotInputMap extends ImGuiStructDestroyable {
public ImPlotInputMap() {
super();
}
public ImPlotInputMap(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_implot.h"
#define THIS ((ImPlotInputMap*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImPlotInputMap());
*/
/**
* LMB enables panning when held
*/
public int getPan() {
return nGetPan();
}
/**
* LMB enables panning when held
*/
public void setPan(final int value) {
nSetPan(value);
}
private native int nGetPan(); /*
return THIS->Pan;
*/
private native void nSetPan(int value); /*
THIS->Pan = value;
*/
/**
* Optional modifier that must be held for panning/fitting
*/
public int getPanMod() {
return nGetPanMod();
}
/**
* Optional modifier that must be held for panning/fitting
*/
public void setPanMod(final int value) {
nSetPanMod(value);
}
private native int nGetPanMod(); /*
return THIS->PanMod;
*/
private native void nSetPanMod(int value); /*
THIS->PanMod = value;
*/
/**
* LMB initiates fit when double clicked
*/
public int getFit() {
return nGetFit();
}
/**
* LMB initiates fit when double clicked
*/
public void setFit(final int value) {
nSetFit(value);
}
private native int nGetFit(); /*
return THIS->Fit;
*/
private native void nSetFit(int value); /*
THIS->Fit = value;
*/
/**
* RMB begins box selection when pressed and confirms
* selection when released
*/
public int getSelect() {
return nGetSelect();
}
/**
* RMB begins box selection when pressed and confirms
* selection when released
*/
public void setSelect(final int value) {
nSetSelect(value);
}
private native int nGetSelect(); /*
return THIS->Select;
*/
private native void nSetSelect(int value); /*
THIS->Select = value;
*/
/**
* LMB cancels active box selection when pressed;
* cannot be the same as Select
*/
public int getSelectCancel() {
return nGetSelectCancel();
}
/**
* LMB cancels active box selection when pressed;
* cannot be the same as Select
*/
public void setSelectCancel(final int value) {
nSetSelectCancel(value);
}
private native int nGetSelectCancel(); /*
return THIS->SelectCancel;
*/
private native void nSetSelectCancel(int value); /*
THIS->SelectCancel = value;
*/
/**
* Optional modifier that must be held for box selection
*/
public int getSelectMod() {
return nGetSelectMod();
}
/**
* Optional modifier that must be held for box selection
*/
public void setSelectMod(final int value) {
nSetSelectMod(value);
}
private native int nGetSelectMod(); /*
return THIS->SelectMod;
*/
private native void nSetSelectMod(int value); /*
THIS->SelectMod = value;
*/
/**
* Alt expands active box selection horizontally
* to plot edge when held
*/
public int getSelectHorzMod() {
return nGetSelectHorzMod();
}
/**
* Alt expands active box selection horizontally
* to plot edge when held
*/
public void setSelectHorzMod(final int value) {
nSetSelectHorzMod(value);
}
private native int nGetSelectHorzMod(); /*
return THIS->SelectHorzMod;
*/
private native void nSetSelectHorzMod(int value); /*
THIS->SelectHorzMod = value;
*/
/**
* Shift expands active box selection vertically
* to plot edge when held
*/
public int getSelectVertMod() {
return nGetSelectVertMod();
}
/**
* Shift expands active box selection vertically
* to plot edge when held
*/
public void setSelectVertMod(final int value) {
nSetSelectVertMod(value);
}
private native int nGetSelectVertMod(); /*
return THIS->SelectVertMod;
*/
private native void nSetSelectVertMod(int value); /*
THIS->SelectVertMod = value;
*/
/**
* RMB opens context menus (if enabled) when clicked
*/
public int getMenu() {
return nGetMenu();
}
/**
* RMB opens context menus (if enabled) when clicked
*/
public void setMenu(final int value) {
nSetMenu(value);
}
private native int nGetMenu(); /*
return THIS->Menu;
*/
private native void nSetMenu(int value); /*
THIS->Menu = value;
*/
/**
* Ctrl when held, all input is ignored;
* used to enable axis/plots as DND sources
*/
public int getOverrideMod() {
return nGetOverrideMod();
}
/**
* Ctrl when held, all input is ignored;
* used to enable axis/plots as DND sources
*/
public void setOverrideMod(final int value) {
nSetOverrideMod(value);
}
private native int nGetOverrideMod(); /*
return THIS->OverrideMod;
*/
private native void nSetOverrideMod(int value); /*
THIS->OverrideMod = value;
*/
/**
* Optional modifier that must be held for scroll wheel zooming
*/
public int getZoomMod() {
return nGetZoomMod();
}
/**
* Optional modifier that must be held for scroll wheel zooming
*/
public void setZoomMod(final int value) {
nSetZoomMod(value);
}
private native int nGetZoomMod(); /*
return THIS->ZoomMod;
*/
private native void nSetZoomMod(int value); /*
THIS->ZoomMod = value;
*/
/**
* Zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click);
* make negative to invert
*/
public float getZoomRate() {
return nGetZoomRate();
}
/**
* Zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click);
* make negative to invert
*/
public void setZoomRate(final float value) {
nSetZoomRate(value);
}
private native float nGetZoomRate(); /*
return THIS->ZoomRate;
*/
private native void nSetZoomRate(float value); /*
THIS->ZoomRate = value;
*/
/*JNI
#undef THIS
*/
}
@@ -25,6 +25,10 @@ public final class ImPlotRange implements Cloneable {
return max - min;
}
public double clamp(final double value) {
return Math.max(min, Math.min(max, value));
}
public ImPlotRange set(final double min, final double max) {
this.min = min;
this.max = max;
@@ -4,22 +4,22 @@ import imgui.ImVec2;
import java.util.Objects;
public final class ImPlotLimits implements Cloneable {
public final class ImPlotRect implements Cloneable {
public final ImPlotRange x = new ImPlotRange();
public final ImPlotRange y = new ImPlotRange();
public ImPlotLimits() {
public ImPlotRect() {
}
public ImPlotLimits(final double xMin, final double yMin, final double xMax, final double yMax) {
public ImPlotRect(final double xMin, final double yMin, final double xMax, final double yMax) {
set(xMin, yMin, xMax, yMax);
}
public ImPlotLimits(final ImVec2 min, final ImVec2 max) {
public ImPlotRect(final ImVec2 min, final ImVec2 max) {
set(min, max);
}
public ImPlotLimits(final ImPlotLimits value) {
public ImPlotRect(final ImPlotRect value) {
set(value);
}
@@ -31,6 +31,18 @@ public final class ImPlotLimits implements Cloneable {
return contains(value.x, value.y);
}
public ImPlotPoint size() {
return new ImPlotPoint(x.size(), y.size());
}
public ImPlotPoint clamp(final double x, final double y) {
return new ImPlotPoint(this.x.clamp(x), this.y.clamp(y));
}
public ImPlotPoint clamp(ImPlotPoint p) {
return clamp(p.x, p.y);
}
public ImPlotPoint min() {
return new ImPlotPoint(x.min, y.min);
}
@@ -54,13 +66,13 @@ public final class ImPlotLimits implements Cloneable {
set(x.min, y.min, x.max, y.max);
}
public void set(final ImPlotLimits value) {
public void set(final ImPlotRect value) {
set(value.x, value.y);
}
@Override
public String toString() {
return "ImPlotLimits{"
return "ImPlotRect{"
+ "x=" + x
+ ", y=" + y
+ '}';
@@ -76,8 +88,8 @@ public final class ImPlotLimits implements Cloneable {
return false;
}
final ImPlotLimits imPlotLimits = (ImPlotLimits) o;
return Objects.equals(x, imPlotLimits.x) && Objects.equals(y, imPlotLimits.y);
final ImPlotRect imPlotRect = (ImPlotRect) o;
return Objects.equals(x, imPlotRect.x) && Objects.equals(y, imPlotRect.y);
}
@Override
@@ -87,7 +99,7 @@ public final class ImPlotLimits implements Cloneable {
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotLimits clone() {
return new ImPlotLimits(this);
public ImPlotRect clone() {
return new ImPlotRect(this);
}
}
@@ -6,6 +6,7 @@ import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotStyle extends ImGuiStructDestroyable {
public ImPlotStyle() {
super();
}
public ImPlotStyle(final long ptr) {
@@ -0,0 +1,44 @@
package imgui.extension.implot.flag;
public final class ImPlotAxis {
private ImPlotAxis() {
}
/**
* enabled by default
*
* <p>Definition: {@code 0}
*/
public static final int X1 = 0;
/**
* disabled by default
*/
public static final int X2 = 1;
/**
* disabled by default
*/
public static final int X3 = 2;
/**
* enabled by default
*/
public static final int Y1 = 3;
/**
* disabled by default
*/
public static final int Y2 = 4;
/**
* disabled by default
*/
public static final int Y3 = 5;
/**
* bookeeping
*/
public static final int COUNT = 6;
}
@@ -41,75 +41,94 @@ public final class ImPlotAxisFlags {
public static final int NoTickLabels = 8;
/**
* grid lines will be displayed in the foreground (i.e. on top of data) in stead of the background
* axis will not be initially fit to data extents on the first rendered frame
*
* <p>Definition: {@code 1 << 4}
*/
public static final int Foreground = 16;
public static final int NoInitialFit = 16;
/**
* the user will not be able to open context menus with right-click
*
* <p>Definition: {@code 1 << 5}
*/
public static final int NoMenus = 32;
/**
* axis ticks and labels will be rendered on conventionally opposite side (i.e, right or top)
*
* <p>Definition: {@code 1 << 6}
*/
public static final int Opposite = 64;
/**
* grid lines will be displayed in the foreground (i.e. on top of data) in stead of the background
*
* <p>Definition: {@code 1 << 7}
*/
public static final int Foreground = 128;
/**
* a logartithmic (base 10) axis scale will be used (mutually exclusive with ImPlotAxisFlags_Time)
*
* <p>Definition: {@code 1 << 5}
* <p>Definition: {@code 1 << 8}
*/
public static final int LogScale = 32;
public static final int LogScale = 256;
/**
* axis will display date/time formatted labels (mutually exclusive with ImPlotAxisFlags_LogScale)
*
* <p>Definition: {@code 1 << 6}
* <p>Definition: {@code 1 << 9}
*/
public static final int Time = 64;
public static final int Time = 512;
/**
* the axis will be inverted
*
* <p>Definition: {@code 1 << 7}
* <p>Definition: {@code 1 << 10}
*/
public static final int Invert = 128;
/**
* axis will not be initially fit to data extents on the first rendered frame (also the case if SetNextPlotLimits explicitly called)
*
* <p>Definition: {@code 1 << 8}
*/
public static final int NoInitialFit = 256;
public static final int Invert = 1024;
/**
* axis will be auto-fitting to data extents
*
* <p>Definition: {@code 1 << 9}
* <p>Definition: {@code 1 << 11}
*/
public static final int AutoFit = 512;
public static final int AutoFit = 2048;
/**
* axis will only fit points if the point is in the visible range of the **orthoganol** axis
* axis will only fit points if the point is in the visible range of the **orthogonal** axis
*
* <p>Definition: {@code 1 << 10}
* <p>Definition: {@code 1 << 12}
*/
public static final int RangeFit = 1024;
public static final int RangeFit = 4096;
/**
* the axis minimum value will be locked when panning/zooming
*
* <p>Definition: {@code 1 << 11}
* <p>Definition: {@code 1 << 13}
*/
public static final int LockMin = 2048;
public static final int LockMin = 8192;
/**
* the axis maximum value will be locked when panning/zooming
*
* <p>Definition: {@code 1 << 12}
* <p>Definition: {@code 1 << 14}
*/
public static final int LockMax = 4096;
public static final int LockMax = 16384;
/**
* Definition: {@code ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMax}
*/
public static final int Lock = 6144;
public static final int Lock = 24576;
/**
* Definition: {@code ImPlotAxisFlags_NoLabel | ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabels}
*/
public static final int NoDecorations = 15;
/**
* Definition: {@code ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_Opposite}
*/
public static final int AuxDefault = 66;
}
@@ -0,0 +1,21 @@
package imgui.extension.implot.flag;
public final class ImPlotBarGroupsFlags {
private ImPlotBarGroupsFlags() {
}
/**
* default
*
* <p>Definition: {@code 0}
*/
public static final int None = 0;
/**
* items in a group will be stacked on top of each other
*
* <p>Definition: {@code 1 << 0}
*/
public static final int Stacked = 1;
}
@@ -71,59 +71,44 @@ public final class ImPlotCol {
public static final int InlayText = 12;
/**
* x-axis label and tick lables color (defaults to ImGuiCol_Text)
* axis label and tick lables color (defaults to ImGuiCol_Text)
*/
public static final int XAxis = 13;
public static final int AxisText = 13;
/**
* x-axis grid color (defaults to 25% ImPlotCol_XAxis)
* axis grid color (defaults to 25% ImPlotCol_AxisText)
*/
public static final int XAxisGrid = 14;
public static final int AxisGrid = 14;
/**
* y-axis label and tick labels color (defaults to ImGuiCol_Text)
* axis tick color (defaults to AxisGrid)
*/
public static final int YAxis = 15;
public static final int AxisTick = 15;
/**
* y-axis grid color (defaults to 25% ImPlotCol_YAxis)
* background color of axis hover region (defaults to transparent)
*/
public static final int YAxisGrid = 16;
public static final int AxisBg = 16;
/**
* 2nd y-axis label and tick labels color (defaults to ImGuiCol_Text)
* axis hover color (defaults to ImGuiCol_ButtonHovered)
*/
public static final int YAxis2 = 17;
public static final int AxisBgHovered = 17;
/**
* 2nd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis2)
* axis active color (defaults to ImGuiCol_ButtonActive)
*/
public static final int YAxisGrid2 = 18;
/**
* 3rd y-axis label and tick labels color (defaults to ImGuiCol_Text)
*/
public static final int YAxis3 = 19;
/**
* 3rd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis3)
*/
public static final int YAxisGrid3 = 20;
public static final int AxisBgActive = 18;
/**
* box-selection color (defaults to yellow)
*/
public static final int Selection = 21;
/**
* box-query color (defaults to green)
*/
public static final int Query = 22;
public static final int Selection = 19;
/**
* crosshairs color (defaults to ImPlotCol_PlotBorder)
*/
public static final int Crosshairs = 23;
public static final int Crosshairs = 20;
public static final int COUNT = 24;
public static final int COUNT = 21;
}
@@ -0,0 +1,22 @@
package imgui.extension.implot.flag;
public final class ImPlotCond {
private ImPlotCond() {
}
/**
* No condition (always set the variable), same as _Always
*/
public static final int None = 0;
/**
* No condition (always set the variable)
*/
public static final int Always = 1;
/**
* Set the variable once per runtime session (only the first call will succeed)
*/
public static final int Once = 2;
}
@@ -0,0 +1,42 @@
package imgui.extension.implot.flag;
public final class ImPlotDragToolFlags {
private ImPlotDragToolFlags() {
}
/**
* default
*
* <p>Definition: {@code 0}
*/
public static final int None = 0;
/**
* drag tools won't change cursor icons when hovered or held
*
* <p>Definition: {@code 1 << 0}
*/
public static final int NoCursors = 1;
/**
* the drag tool won't be considered for plot fits
*
* <p>Definition: {@code 1 << 1}
*/
public static final int NoFit = 2;
/**
* lock the tool from user inputs
*
* <p>Definition: {@code 1 << 2}
*/
public static final int NoInputs = 4;
/**
* tool rendering will be delayed one frame; useful when applying position-constraints
*
* <p>Definition: {@code 1 << 3}
*/
public static final int Delayed = 8;
}
@@ -27,32 +27,32 @@ public final class ImPlotFlags {
public static final int NoLegend = 2;
/**
* the user will not be able to open context menus with right-click
* the mouse position, in plot coordinates, will not be displayed inside of the plot
*
* <p>Definition: {@code 1 << 2}
*/
public static final int NoMenus = 4;
public static final int NoMouseText = 4;
/**
* the user will not be able to box-select with right-click drag
* the user will not be able to interact with the plot
*
* <p>Definition: {@code 1 << 3}
*/
public static final int NoBoxSelect = 8;
public static final int NoInputs = 8;
/**
* the mouse position, in plot coordinates, will not be displayed inside of the plot
* the user will not be able to open context menus
*
* <p>Definition: {@code 1 << 4}
*/
public static final int NoMousePos = 16;
public static final int NoMenus = 16;
/**
* plot items will not be highlighted when their legend entry is hovered
* the user will not be able to box-select
*
* <p>Definition: {@code 1 << 5}
*/
public static final int NoHighlight = 32;
public static final int NoBoxSelect = 32;
/**
* a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications)
@@ -62,49 +62,35 @@ public final class ImPlotFlags {
public static final int NoChild = 64;
/**
* primary x and y axes will be constrained to have the same units/pixel (does not apply to auxiliary y-axes)
* the ImGui frame will not be rendered
*
* <p>Definition: {@code 1 << 7}
*/
public static final int Equal = 128;
public static final int NoFrame = 128;
/**
* enable a 2nd y-axis on the right side
* x and y axes pairs will be constrained to have the same units/pixel
*
* <p>Definition: {@code 1 << 8}
*/
public static final int YAxis2 = 256;
/**
* enable a 3rd y-axis on the right side
*
* <p>Definition: {@code 1 << 9}
*/
public static final int YAxis3 = 512;
/**
* the user will be able to draw query rects with middle-mouse or CTRL + right-click drag
*
* <p>Definition: {@code 1 << 10}
*/
public static final int Query = 1024;
public static final int Equal = 256;
/**
* the default mouse cursor will be replaced with a crosshair when hovered
*
* <p>Definition: {@code 1 << 11}
* <p>Definition: {@code 1 << 9}
*/
public static final int Crosshairs = 2048;
public static final int Crosshairs = 512;
/**
* plot lines will be software anti-aliased (not recommended for high density plots, prefer MSAA)
* plot items will be software anti-aliased (not recommended for high density plots, prefer MSAA)
*
* <p>Definition: {@code 1 << 12}
* <p>Definition: {@code 1 << 10}
*/
public static final int AntiAliased = 4096;
public static final int AntiAliased = 1024;
/**
* Definition: {@code ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMousePos}
* Definition: {@code ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText}
*/
public static final int CanvasOnly = 31;
public static final int CanvasOnly = 55;
}
@@ -0,0 +1,56 @@
package imgui.extension.implot.flag;
public final class ImPlotLegendFlags {
private ImPlotLegendFlags() {
}
/**
* default
*
* <p>Definition: {@code 0}
*/
public static final int None = 0;
/**
* legend icons will not function as hide/show buttons
*
* <p>Definition: {@code 1 << 0}
*/
public static final int NoButtons = 1;
/**
* plot items will not be highlighted when their legend entry is hovered
*
* <p>Definition: {@code 1 << 1}
*/
public static final int NoHighlightItem = 2;
/**
* axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count{@code >}1)
*
* <p>Definition: {@code 1 << 2}
*/
public static final int NoHighlightAxis = 4;
/**
* the user will not be able to open context menus with right-click
*
* <p>Definition: {@code 1 << 3}
*/
public static final int NoMenus = 8;
/**
* legend will be rendered outside of the plot area
*
* <p>Definition: {@code 1 << 4}
*/
public static final int Outside = 16;
/**
* legend entries will be displayed horizontally
*
* <p>Definition: {@code 1 << 5}
*/
public static final int Horizontal = 32;
}
@@ -0,0 +1,35 @@
package imgui.extension.implot.flag;
public final class ImPlotMouseTextFlags {
private ImPlotMouseTextFlags() {
}
/**
* default
*
* <p>Definition: {@code 0}
*/
public static final int None = 0;
/**
* only show the mouse position for primary axes
*
* <p>Definition: {@code 1 << 0}
*/
public static final int NoAuxAxes = 1;
/**
* axes label formatters won't be used to render text
*
* <p>Definition: {@code 1 << 1}
*/
public static final int NoFormat = 2;
/**
* always display mouse position even if plot not hovered
*
* <p>Definition: {@code 1 << 2}
*/
public static final int ShowAlways = 4;
}
@@ -1,17 +0,0 @@
package imgui.extension.implot.flag;
public final class ImPlotOrientation {
private ImPlotOrientation() {
}
/**
* left/right
*/
public static final int Horizontal = 0;
/**
* up/down
*/
public static final int Vertical = 1;
}
@@ -1,28 +0,0 @@
package imgui.extension.implot.flag;
public final class ImPlotYAxis {
private ImPlotYAxis() {
}
/**
* left (default)
*
* <p>Definition: {@code 0}
*/
public static final int YAxis_1 = 0;
/**
* first on right side
*
* <p>Definition: {@code 1}
*/
public static final int YAxis_2 = 1;
/**
* second on right side
*
* <p>Definition: {@code 2}
*/
public static final int YAxis_3 = 2;
}
@@ -8,6 +8,7 @@ import imgui.binding.ImGuiStructDestroyable;
*/
public final class MemoryEditor extends ImGuiStructDestroyable {
public MemoryEditor() {
super();
}
public MemoryEditor(final long ptr) {
@@ -4,6 +4,7 @@ import imgui.binding.ImGuiStructDestroyable;
public final class MemoryEditorSizes extends ImGuiStructDestroyable {
public MemoryEditorSizes() {
super();
}
public MemoryEditorSizes(final long ptr) {
@@ -31,7 +31,7 @@ public final class NodeEditorConfig extends ImGuiStructDestroyable {
private native void nSetSettingsFile(String value); /*MANUAL
auto value = obj_value == NULL ? NULL : (char*)env->GetStringUTFChars(obj_value, JNI_FALSE);
THIS->SettingsFile = value;
SET_STRING_FIELD(THIS->SettingsFile, value);
if (value != NULL) env->ReleaseStringUTFChars(obj_value, value);
*/
@@ -7,6 +7,7 @@ import java.util.Map;
public final class TextEditor extends ImGuiStructDestroyable {
public TextEditor() {
super();
}
public TextEditor(final long ptr) {
@@ -6,6 +6,7 @@ import java.util.Map;
public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
public TextEditorLanguageDefinition() {
super();
}
public TextEditorLanguageDefinition(final long ptr) {
@@ -49,7 +49,7 @@ public final class ImGuiBackendFlags {
public static final int PlatformHasViewports = 1024;
/**
* Backend Platform supports setting io.MouseHoveredViewport to the viewport directly under the mouse _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag and _REGARDLESS_ of whether another viewport is focused and may be capturing the mouse. This information is _NOT EASY_ to provide correctly with most high-level engines! Don't set this without studying _carefully_ how the backends handle ImGuiViewportFlags_NoInputs!
* Backend Platform supports calling io.AddMouseViewportEvent() with the viewport under the mouse. IF POSSIBLE, ignore viewports with the ImGuiViewportFlags_NoInputs flag (Win32 backend, GLFW 3.30+ backend can do this, SDL backend cannot). If this cannot be done, Dear ImGui needs to use a flawed heuristic to find the viewport under.
*
* <p>Definition: {@code 1 << 11}
*/
@@ -208,25 +208,4 @@ public final class ImGuiColorEditFlags {
* <p>Definition: {@code ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV}
*/
public static final int InputMask_ = 402653184;
/**
* [renamed in 1.69]
*
* <p>Definition: {@code ImGuiColorEditFlags_DisplayRGB}
*/
public static final int RGB = 1048576;
/**
* [renamed in 1.69]
*
* <p>Definition: {@code ImGuiColorEditFlags_DisplayHSV}
*/
public static final int HSV = 2097152;
/**
* [renamed in 1.69]
*
* <p>Definition: {@code ImGuiColorEditFlags_DisplayHex}
*/
public static final int HEX = 4194304;
}
@@ -14,7 +14,7 @@ public final class ImGuiConfigFlags {
public static final int None = 0;
/**
* Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[].
* Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.AddKeyEvent() calls
*
* <p>Definition: {@code 1 << 0}
*/
@@ -8,67 +8,445 @@ public final class ImGuiKey {
private ImGuiKey() {
}
public static final int Tab = 0;
public static final int LeftArrow = 1;
public static final int RightArrow = 2;
public static final int UpArrow = 3;
public static final int DownArrow = 4;
public static final int PageUp = 5;
public static final int PageDown = 6;
public static final int Home = 7;
public static final int End = 8;
public static final int Insert = 9;
public static final int Delete = 10;
public static final int Backspace = 11;
public static final int Space = 12;
public static final int Enter = 13;
public static final int Escape = 14;
public static final int KeyPadEnter = 15;
/**
* Keyboard
*
* <p>Definition: {@code 0}
*/
public static final int None = 0;
/**
* for text edit CTRL+A: select all
* == ImGuiKey_NamedKey_BEGIN
*
* <p>Definition: {@code 512}
*/
public static final int A = 16;
public static final int Tab = 512;
public static final int LeftArrow = 513;
public static final int RightArrow = 514;
public static final int UpArrow = 515;
public static final int DownArrow = 516;
public static final int PageUp = 517;
public static final int PageDown = 518;
public static final int Home = 519;
public static final int End = 520;
public static final int Insert = 521;
public static final int Delete = 522;
public static final int Backspace = 523;
public static final int Space = 524;
public static final int Enter = 525;
public static final int Escape = 526;
public static final int LeftCtrl = 527;
public static final int LeftShift = 528;
public static final int LeftAlt = 529;
public static final int LeftSuper = 530;
public static final int RightCtrl = 531;
public static final int RightShift = 532;
public static final int RightAlt = 533;
public static final int RightSuper = 534;
public static final int Menu = 535;
public static final int _0 = 536;
public static final int _1 = 537;
public static final int _2 = 538;
public static final int _3 = 539;
public static final int _4 = 540;
public static final int _5 = 541;
public static final int _6 = 542;
public static final int _7 = 543;
public static final int _8 = 544;
public static final int _9 = 545;
public static final int A = 546;
public static final int B = 547;
public static final int C = 548;
public static final int D = 549;
public static final int E = 550;
public static final int F = 551;
public static final int G = 552;
public static final int H = 553;
public static final int I = 554;
public static final int J = 555;
public static final int K = 556;
public static final int L = 557;
public static final int M = 558;
public static final int N = 559;
public static final int O = 560;
public static final int P = 561;
public static final int Q = 562;
public static final int R = 563;
public static final int S = 564;
public static final int T = 565;
public static final int U = 566;
public static final int V = 567;
public static final int W = 568;
public static final int X = 569;
public static final int Y = 570;
public static final int Z = 571;
public static final int F1 = 572;
public static final int F2 = 573;
public static final int F3 = 574;
public static final int F4 = 575;
public static final int F5 = 576;
public static final int F6 = 577;
public static final int F7 = 578;
public static final int F8 = 579;
public static final int F9 = 580;
public static final int F10 = 581;
public static final int F11 = 582;
public static final int F12 = 583;
/**
* for text edit CTRL+C: copy
* '
*/
public static final int C = 17;
public static final int Apostrophe = 584;
/**
* for text edit CTRL+V: paste
* ,
*/
public static final int V = 18;
public static final int Comma = 585;
/**
* for text edit CTRL+X: cut
* -
*/
public static final int X = 19;
public static final int Minus = 586;
/**
* for text edit CTRL+Y: redo
* .
*/
public static final int Y = 20;
public static final int Period = 587;
/**
* for text edit CTRL+Z: undo
* /
*/
public static final int Z = 21;
public static final int Slash = 588;
public static final int COUNT = 22;
/**
* ;
*/
public static final int Semicolon = 589;
/**
* =
*/
public static final int Equal = 590;
/**
* [
*/
public static final int LeftBracket = 591;
/**
* \ (this text inhibit multiline comment caused by backslash)
*/
public static final int Backslash = 592;
/**
* ]
*/
public static final int RightBracket = 593;
/**
* `
*/
public static final int GraveAccent = 594;
public static final int CapsLock = 595;
public static final int ScrollLock = 596;
public static final int NumLock = 597;
public static final int PrintScreen = 598;
public static final int Pause = 599;
public static final int Keypad0 = 600;
public static final int Keypad1 = 601;
public static final int Keypad2 = 602;
public static final int Keypad3 = 603;
public static final int Keypad4 = 604;
public static final int Keypad5 = 605;
public static final int Keypad6 = 606;
public static final int Keypad7 = 607;
public static final int Keypad8 = 608;
public static final int Keypad9 = 609;
public static final int KeypadDecimal = 610;
public static final int KeypadDivide = 611;
public static final int KeypadMultiply = 612;
public static final int KeypadSubtract = 613;
public static final int KeypadAdd = 614;
public static final int KeypadEnter = 615;
public static final int KeypadEqual = 616;
/**
* Menu (Xbox) + (Switch) Start/Options (PS) // --
*/
public static final int GamepadStart = 617;
/**
* View (Xbox) - (Switch) Share (PS) // --
*/
public static final int GamepadBack = 618;
/**
* Y (Xbox) X (Switch) Triangle (PS) // {@code ->} ImGuiNavInput_Input
*/
public static final int GamepadFaceUp = 619;
/**
* A (Xbox) B (Switch) Cross (PS) // {@code ->} ImGuiNavInput_Activate
*/
public static final int GamepadFaceDown = 620;
/**
* X (Xbox) Y (Switch) Square (PS) // {@code ->} ImGuiNavInput_Menu
*/
public static final int GamepadFaceLeft = 621;
/**
* B (Xbox) A (Switch) Circle (PS) // {@code ->} ImGuiNavInput_Cancel
*/
public static final int GamepadFaceRight = 622;
/**
* D-pad Up // {@code ->} ImGuiNavInput_DpadUp
*/
public static final int GamepadDpadUp = 623;
/**
* D-pad Down // {@code ->} ImGuiNavInput_DpadDown
*/
public static final int GamepadDpadDown = 624;
/**
* D-pad Left // {@code ->} ImGuiNavInput_DpadLeft
*/
public static final int GamepadDpadLeft = 625;
/**
* D-pad Right // {@code ->} ImGuiNavInput_DpadRight
*/
public static final int GamepadDpadRight = 626;
/**
* L Bumper (Xbox) L (Switch) L1 (PS) // {@code ->} ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow
*/
public static final int GamepadL1 = 627;
/**
* R Bumper (Xbox) R (Switch) R1 (PS) // {@code ->} ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast
*/
public static final int GamepadR1 = 628;
/**
* L Trigger (Xbox) ZL (Switch) L2 (PS) [Analog]
*/
public static final int GamepadL2 = 629;
/**
* R Trigger (Xbox) ZR (Switch) R2 (PS) [Analog]
*/
public static final int GamepadR2 = 630;
/**
* L Thumbstick (Xbox) L3 (Switch) L3 (PS)
*/
public static final int GamepadL3 = 631;
/**
* R Thumbstick (Xbox) R3 (Switch) R3 (PS)
*/
public static final int GamepadR3 = 632;
/**
* [Analog] // {@code ->} ImGuiNavInput_LStickUp
*/
public static final int GamepadLStickUp = 633;
/**
* [Analog] // {@code ->} ImGuiNavInput_LStickDown
*/
public static final int GamepadLStickDown = 634;
/**
* [Analog] // {@code ->} ImGuiNavInput_LStickLeft
*/
public static final int GamepadLStickLeft = 635;
/**
* [Analog] // {@code ->} ImGuiNavInput_LStickRight
*/
public static final int GamepadLStickRight = 636;
/**
* [Analog]
*/
public static final int GamepadRStickUp = 637;
/**
* [Analog]
*/
public static final int GamepadRStickDown = 638;
/**
* [Analog]
*/
public static final int GamepadRStickLeft = 639;
/**
* [Analog]
*/
public static final int GamepadRStickRight = 640;
/**
* Keyboard Modifiers - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiKey_ModCtrl). - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
*/
public static final int ModCtrl = 641;
/**
* Keyboard Modifiers - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiKey_ModCtrl). - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
*/
public static final int ModShift = 642;
/**
* Keyboard Modifiers - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiKey_ModCtrl). - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
*/
public static final int ModAlt = 643;
/**
* Keyboard Modifiers - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiKey_ModCtrl). - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
*/
public static final int ModSuper = 644;
/**
* No valid ImGuiKey is ever greater than this value
*/
public static final int COUNT = 645;
/**
* [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array. We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
*
* <p>Definition: {@code 512}
*/
public static final int NamedKey_BEGIN = 512;
/**
* [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array. We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
*
* <p>Definition: {@code ImGuiKey_COUNT}
*/
public static final int NamedKey_END = 645;
/**
* [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array. We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
*
* <p>Definition: {@code ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN}
*/
public static final int NamedKey_COUNT = 133;
/**
* Size of KeysData[]: hold legacy 0..512 keycodes + named keys
*
* <p>Definition: {@code ImGuiKey_COUNT}
*/
public static final int KeysData_SIZE = 645;
/**
* First key stored in KeysData[0]
*
* <p>Definition: {@code 0}
*/
public static final int KeysData_OFFSET = 0;
/**
* Renamed in 1.87
*
* <p>Definition: {@code ImGuiKey_KeypadEnter}
*/
public static final int KeyPadEnter = 615;
}
@@ -29,7 +29,9 @@ public final class ImGuiKeyModFlags {
public static final int Alt = 4;
/**
* Definition: {@code 1 << 3}
* Cmd/Super/Windows key
*
* <p>Definition: {@code 1 << 3}
*/
public static final int Super = 8;
}
@@ -15,27 +15,27 @@ public final class ImGuiNavInput {
}
/**
* activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
* Activate / Open / Toggle / Tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
*/
public static final int Activate = 0;
/**
* cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
* Cancel / Close / Exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
*/
public static final int Cancel = 1;
/**
* text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
* Text input / On-Screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
*/
public static final int Input = 2;
/**
* tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
* Tap: Toggle menu / Hold: Focus, Move, Resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
*/
public static final int Menu = 3;
/**
* move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
* Move / Tweak / Resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
*/
public static final int DpadLeft = 4;
@@ -46,7 +46,7 @@ public final class ImGuiNavInput {
public static final int DpadDown = 7;
/**
* scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down
* Scroll / Move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down
*/
public static final int LStickLeft = 8;
@@ -57,49 +57,44 @@ public final class ImGuiNavInput {
public static final int LStickDown = 11;
/**
* next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
* Focus Next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
*/
public static final int FocusPrev = 12;
/**
* prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
* Focus Prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
*/
public static final int FocusNext = 13;
/**
* slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
* Slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
*/
public static final int TweakSlow = 14;
/**
* faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
* Faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
*/
public static final int TweakFast = 15;
/**
* move left // = Arrow keys
* Move left // = Arrow keys
*/
public static final int KeyLeft_ = 16;
/**
* move right
* Move right
*/
public static final int KeyRight_ = 17;
/**
* move up
* Move up
*/
public static final int KeyUp_ = 18;
/**
* move down
* Move down
*/
public static final int KeyDown_ = 19;
public static final int COUNT = 20;
/**
* Definition: {@code ImGuiNavInput_KeyLeft_}
*/
public static final int InternalStart_ = 16;
}
@@ -14,7 +14,7 @@ public final class ImGuiTableRowFlags {
public static final int None = 0;
/**
* Identify header row (set default background color + width of its contents accounted different for auto column width)
* Identify header row (set default background color + width of its contents accounted differently for auto column width)
*
* <p>Definition: {@code 1 << 0}
*/
@@ -15,6 +15,7 @@ import imgui.binding.annotation.ReturnValue;
@BindingSource
public final class ImFont extends ImGuiStructDestroyable {
public ImFont() {
super();
}
public ImFont(final long ptr) {
@@ -36,6 +36,7 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
private ByteBuffer rgba32pixels = null;
public ImFontAtlas() {
super();
}
public ImFontAtlas(final long ptr) {
@@ -11,6 +11,7 @@ import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImFontGlyph extends ImGuiStructDestroyable {
public ImFontGlyph() {
super();
}
public ImFontGlyph(final long ptr) {
+19 -8
View File
@@ -2572,38 +2572,49 @@ public class ImGui {
*/
// Inputs Utilities: Keyboard
// - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
// - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.
// Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support)
// - For 'ImGuiKey key' you can still use your legacy native/user indices according to how your backend/engine stored them in io.KeysDown[].
// With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward)
// - Any use of 'ImGuiKey' will assert when key < 512 will be passed, previously reserved as native/user keys indices
// - GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined)
/**
* Map ImGuiKey_* values into user's key index. == io.KeyMap[key]
*/
@BindingMethod
public static native int GetKeyIndex(int imguiKey);
@Deprecated
public static native int GetKeyIndex(@ArgValue(staticCast = "ImGuiKey") int key);
/**
* Is key being held. == io.KeysDown[user_key_index].
*/
@BindingMethod
public static native boolean IsKeyDown(int userKeyIndex);
public static native boolean IsKeyDown(@ArgValue(staticCast = "ImGuiKey") int key);
/**
* Was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
*/
@BindingMethod
public static native boolean IsKeyPressed(int userKeyIndex, @OptArg boolean repeat);
public static native boolean IsKeyPressed(@ArgValue(staticCast = "ImGuiKey") int key, @OptArg boolean repeat);
/**
* Was key released (went from Down to !Down)..
* Was key released (went from Down to !Down)
*/
@BindingMethod
public static native boolean IsKeyReleased(int userKeyIndex);
public static native boolean IsKeyReleased(@ArgValue(staticCast = "ImGuiKey") int key);
/**
* Uses provided repeat rate/delay.
* Return a count, most often 0 or 1 but might be {@code >1} if RepeatRate is small enough that {@code DeltaTime > RepeatRate}
*/
@BindingMethod
public static native boolean GetKeyPressedAmount(int keyIndex, float repeatDelay, float rate);
public static native boolean GetKeyPressedAmount(@ArgValue(staticCast = "ImGuiKey") int key, float repeatDelay, float rate);
/**
* [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
*/
@BindingMethod
public static native String GetKeyName(@ArgValue(staticCast = "ImGuiKey") int key);
/**
* Attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle).
+141 -83
View File
@@ -5,6 +5,7 @@ import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
import imgui.binding.annotation.TypeArray;
import imgui.callback.ImStrConsumer;
@@ -89,13 +90,6 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingField
public float MouseDragThreshold;
/**
* Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state.
*/
@BindingField
@TypeArray(type = "int", size = "ImGuiKey_COUNT")
public int[] KeyMap;
/**
* When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
*/
@@ -205,6 +199,12 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingField
public boolean ConfigMacOSXBehaviors;
/**
* Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
*/
@BindingField
public boolean ConfigInputTrickleEventQueue;
/**
* Set to false to disable blinking cursor, for users who consider it distracting.
*/
@@ -285,82 +285,52 @@ public final class ImGuiIO extends ImGuiStruct {
*/
//------------------------------------------------------------------
// Input - Fill before calling NewFrame()
// Input - Call before calling NewFrame()
//------------------------------------------------------------------
/**
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
*/
@BindingField
public ImVec2 MousePos;
// Input Functions
/**
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
* Queue a new key down/up event. Key should be "translated" (as in, generally ImGuiKey_A matches the key end-user would use to emit an 'A' character)
*/
@BindingField
@TypeArray(type = "boolean", size = "5")
public boolean[] MouseDown;
@BindingMethod
public native void AddKeyEvent(@ArgValue(staticCast = "ImGuiKey") int key, boolean down);
/**
* Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
* Queue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). Dead-zones should be handled by the backend.
*/
@BindingField
public float MouseWheel;
@BindingMethod
public native void AddKeyAnalogEvent(@ArgValue(staticCast = "ImGuiKey") int key, boolean down, float v);
/**
* Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends.
* Queue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. app not focused and not hovered)
*/
@BindingField
public float MouseWheelH;
@BindingMethod
public native void AddMousePosEvent(float x, float y);
/**
* (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag,
* and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info.
* If you don't imgui will infer the value using the rectangles and last focused time of the viewports it knows about (ignoring other OS windows).
* Queue a mouse button change
*/
@BindingField
public int MouseHoveredViewport;
@BindingMethod
public native void AddMouseButtonEvent(int button, boolean down);
/**
* Keyboard modifier pressed: Control
* Queue a mouse wheel update
*/
@BindingField
public boolean KeyCtrl;
@BindingMethod
public native void AddMouseWheelEvent(float whX, float whY);
/**
* Keyboard modifier pressed: Shift
* Queue a mouse hovered viewport. Requires backend to set ImGuiBackendFlags_HasMouseHoveredViewport to call this (for multi-viewport support).
*/
@BindingField
public boolean KeyShift;
@BindingMethod
public native void AddMouseViewportEvent(@ArgValue(staticCast = "ImGuiID") int id);
/**
* Keyboard modifier pressed: Alt
* Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window)
*/
@BindingField
public boolean KeyAlt;
/**
* Keyboard modifier pressed: Cmd/Super/Windows
*/
@BindingField
public boolean KeySuper;
/**
* Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys).
*/
@BindingField
@TypeArray(type = "boolean", size = "512")
public boolean[] KeysDown;
/**
* Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().
*/
@BindingField
@TypeArray(type = "float", size = "512")
public float[] NavInputs;
// Functions
@BindingMethod
public native void AddFocusEvent(boolean focused);
/**
* Queue new character input.
@@ -380,12 +350,6 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingMethod
public native void AddInputCharactersUTF8(String str);
/**
* Notifies Dear ImGui when hosting platform windows lose or gain input focus
*/
@BindingMethod
public native void AddFocusEvent(boolean focused);
/**
* [Internal] Clear the text input buffer manually
*/
@@ -398,6 +362,12 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingMethod
public native void ClearInputKeys();
/**
* [Optional] Specify index for legacy before 1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode.
*/
@BindingMethod
public native void SetKeyEventNativeData(@ArgValue(staticCast = "ImGuiKey") int key, int nativeKeycode, int nativeScancode, @OptArg int nativeLegacyIndex);
//------------------------------------------------------------------
// Output - Updated by NewFrame() or EndFrame()/Render()
// (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is
@@ -496,15 +466,92 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingField
public ImVec2 MouseDelta;
/**
* Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state.
*/
@BindingField
@TypeArray(type = "int", size = "ImGuiKey_COUNT")
@Deprecated
public int[] KeyMap;
/**
* Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys).
*/
@BindingField
@TypeArray(type = "boolean", size = "512")
@Deprecated
public boolean[] KeysDown;
//------------------------------------------------------------------
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
//------------------------------------------------------------------
/**
* Alternative to WantCaptureMouse: (WantCaptureMouse == true {@code &&} WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
*/
@BindingField
public boolean WantCaptureMouseUnlessPopupClose;
public ImVec2 MousePos;
/**
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
*/
@BindingField
@TypeArray(type = "boolean", size = "5")
public boolean[] MouseDown;
/**
* Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
*/
@BindingField
public float MouseWheel;
/**
* Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends.
*/
@BindingField
public float MouseWheelH;
/**
* (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag,
* and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info.
* If you don't imgui will infer the value using the rectangles and last focused time of the viewports it knows about (ignoring other OS windows).
*/
@BindingField
public int MouseHoveredViewport;
/**
* Keyboard modifier pressed: Control
*/
@BindingField
public boolean KeyCtrl;
/**
* Keyboard modifier pressed: Shift
*/
@BindingField
public boolean KeyShift;
/**
* Keyboard modifier pressed: Alt
*/
@BindingField
public boolean KeyAlt;
/**
* Keyboard modifier pressed: Cmd/Super/Windows
*/
@BindingField
public boolean KeySuper;
/**
* Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().
*/
@BindingField
@TypeArray(type = "float", size = "512")
public float[] NavInputs;
// Other state maintained from data above + IO function calls
/**
* Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
@@ -513,11 +560,24 @@ public final class ImGuiIO extends ImGuiStruct {
public int KeyMods;
/**
* Previous key mods
* Key mods flags (from previous frame)
*/
@BindingField
public int KeyModsPrev;
/**
* Key state for all known keys. Use IsKeyXXX() functions to access this.
*/
@BindingField
@TypeArray(type = "ImGuiKeyData", size = "ImGuiKey_KeysData_SIZE")
public ImGuiKeyData[] KeysData;
/**
* Alternative to WantCaptureMouse: (WantCaptureMouse == true {@code &&} WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
*/
@BindingField
public boolean WantCaptureMouseUnlessPopupClose;
/**
* Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
*/
@@ -615,20 +675,6 @@ public final class ImGuiIO extends ImGuiStruct {
@TypeArray(type = "float", size = "5")
public float[] MouseDragMaxDistanceSqr;
/**
* Duration the keyboard key has been down (0.0f == just pressed)
*/
@BindingField
@TypeArray(type = "float", size = "512")
public float[] KeysDownDuration;
/**
* Previous duration the key has been down
*/
@BindingField
@TypeArray(type = "float", size = "512")
public float[] KeysDownDurationPrev;
@BindingField
@TypeArray(type = "float", size = "ImGuiNavInput_COUNT")
public float[] NavInputsDownDuration;
@@ -646,6 +692,18 @@ public final class ImGuiIO extends ImGuiStruct {
@BindingField
public boolean AppFocusLost;
/**
* -1: unknown, 0: using AddKeyEvent(), 1: using legacy io.KeysDown[]
*/
@BindingField
public short BackendUsingLegacyKeyArrays;
/**
* 0: using AddKeyAnalogEvent(), 1: writing to legacy io.NavInputs[] directly
*/
@BindingField
public boolean BackendUsingLegacyNavInputArray;
/**
* For AddInputCharacterUTF16
*/
@@ -0,0 +1,62 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
/**
* [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions.
* If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key).DownDuration and not io.KeysData[key].DownDuration.
*/
@BindingSource
public final class ImGuiKeyData extends ImGuiStructDestroyable {
public ImGuiKeyData() {
super();
}
public ImGuiKeyData(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImGuiKeyData*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImGuiKeyData());
*/
/**
* True for if key is down
*/
@BindingField
public boolean Down;
/**
* Duration the key has been down ({@code <}0.0f: not pressed, 0.0f: just pressed, {@code >}0.0f: time held)
*/
@BindingField
public float DownDuration;
/**
* Last frame duration the key has been down
*/
@BindingField
public float DownDurationPrev;
/**
* 0.0f..1.0f for gamepad values
*/
@BindingField
public float AnalogValue;
/*JNI
#undef THIS
*/
}
@@ -18,6 +18,7 @@ import imgui.binding.annotation.OptArg;
@BindingSource
public final class ImGuiStorage extends ImGuiStructDestroyable {
public ImGuiStorage() {
super();
}
public ImGuiStorage(final long ptr) {
@@ -14,6 +14,7 @@ import imgui.binding.annotation.TypeArray;
@BindingSource
public final class ImGuiStyle extends ImGuiStructDestroyable {
public ImGuiStyle() {
super();
}
public ImGuiStyle(final long ptr) {
@@ -13,7 +13,6 @@ import imgui.binding.annotation.BindingSource;
*/
@BindingSource
public final class ImGuiTableSortSpecs extends ImGuiStruct {
public ImGuiTableSortSpecs(final long ptr) {
super(ptr);
}
@@ -27,8 +26,8 @@ public final class ImGuiTableSortSpecs extends ImGuiStruct {
* Pointer to sort spec array.
*/
public ImGuiTableColumnSortSpecs[] getSpecs() {
long[] specsPointers = nGetSpecs();
ImGuiTableColumnSortSpecs[] specs = new ImGuiTableColumnSortSpecs[specsPointers.length];
final long[] specsPointers = nGetSpecs();
final ImGuiTableColumnSortSpecs[] specs = new ImGuiTableColumnSortSpecs[specsPointers.length];
for (int i = 0; i < specsPointers.length; i++) {
specs[i] = new ImGuiTableColumnSortSpecs(specsPointers[i]);
}
@@ -16,6 +16,7 @@ import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiWindowClass extends ImGuiStructDestroyable {
public ImGuiWindowClass() {
super();
}
public ImGuiWindowClass(final long ptr) {
@@ -0,0 +1,15 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker interface for string types, which a represented in native with std::string instead of char*.
*/
@ExcludedSource
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
public @interface TypeStdString {
}
@@ -23,7 +23,7 @@ public final class ImPlot {
*/
//-----------------------------------------------------------------------------
// ImPlot Context
// [SECTION] Contexts
//-----------------------------------------------------------------------------
/**
@@ -54,42 +54,28 @@ public final class ImPlot {
public static native void SetImGuiContext(ImGuiContext ctx);
//-----------------------------------------------------------------------------
// Begin/End Plot
// [SECTION] Begin/End Plot
//-----------------------------------------------------------------------------
// Starts a 2D plotting context. If this function returns true, EndPlot() MUST
// be called! You are encouraged to use the following convention:
//
// if (ImPlot.beginPlot(...)) {
// ImPlot.plotLine(...);
// if (BeginPlot(...)) {
// PlotLine(...);
// ...
// ImPlot.endPlot();
// EndPlot();
// }
//
// Important notes:
//
// - #titleID must be unique to the current ImGui ID scope. If you need to avoid ID
// - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID
// collisions or don't want to display a title in the plot, use double hashes
// (e.g. "MyPlot##HiddenIdText" or "##NoTitle").
// - If #xLabel and/or #yLabel are provided, axes labels will be displayed.
// - #size is the **frame** size of the plot widget, not the plot area. The default
// size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle
// (default is 400x300 px).
// - Auxiliary y-axes must be enabled with ImPlotFlags_YAxis2/3 to be displayed.
// - See ImPlotFlags and ImPlotAxisFlags for more available options.
// size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle.
@BindingMethod
public static native boolean BeginPlot(String titleID,
@OptArg String xLabel,
@OptArg String yLabel,
@OptArg(callValue = "ImVec2(-1,0)") ImVec2 size,
@OptArg int flags,
@OptArg int xFlags,
@OptArg int yFlags,
@OptArg int y2Flags,
@OptArg int y3Flags,
@OptArg String y2Label,
@OptArg String y3Label);
public static native boolean BeginPlot(String titleId, @OptArg(callValue = "ImVec2(-1,0)") ImVec2 size, @OptArg int flags);
/**
* Only call EndPlot() if beginPlot() returns true! Typically called at the end
@@ -99,7 +85,7 @@ public final class ImPlot {
public static native void EndPlot();
//-----------------------------------------------------------------------------
// Begin/EndSubplots
// [SECTION] Begin/End Subplots
//-----------------------------------------------------------------------------
// Starts a subdivided plotting context. If the function returns true,
@@ -122,14 +108,15 @@ public final class ImPlot {
//
// Produces:
//
// [0][1][2]
// [3][4][5]
// [0] | [1] | [2]
// ----|-----|----
// [3] | [4] | [5]
//
// Important notes:
//
// - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID
// collisions or don't want to display a title in the plot, use double hashes
// (e.g. "MyPlot##HiddenIdText" or "##NoTitle").
// (e.g. "MySubplot##HiddenIdText" or "##NoTitle").
// - #rows and #cols must be greater than 0.
// - #size is the size of the entire grid of subplots, not the individual plots
// - #row_ratios and #col_ratios must have AT LEAST #rows and #cols elements,
@@ -164,16 +151,174 @@ public final class ImPlot {
public static native void EndSubplots();
//-----------------------------------------------------------------------------
// Plot Items
// [SECTION] Setup
//-----------------------------------------------------------------------------
/*JNI
// For a proper type conversion, since C++ doesn't have a "long" type.
#define long ImS64
#define LEN(arg) (int)env->GetArrayLength(obj_##arg)
*/
// The following API allows you to setup and customize various aspects of the
// current plot. The functions should be called immediately after BeginPlot
// and before any other API calls. Typical usage is as follows:
// The template functions below are explicitly instantiated in implot_items.cpp.
// if (BeginPlot(...)) { 1) begin a new plot
// SetupAxis(ImAxis_X1, "My X-Axis"); 2) make Setup calls
// SetupAxis(ImAxis_Y1, "My Y-Axis");
// SetupLegend(ImPlotLocation_North);
// ...
// SetupFinish(); 3) [optional] explicitly finish setup
// PlotLine(...); 4) plot items
// ...
// EndPlot(); 5) end the plot
// }
//
// Important notes:
//
// - Always call Setup code at the top of your BeginPlot conditional statement.
// - Setup is locked once you start plotting or explicitly call SetupFinish.
// Do NOT call Setup code after you begin plotting or after you make
// any non-Setup API calls (e.g. utils like PlotToPixels also lock Setup)
// - Calling SetupFinish is OPTIONAL, but probably good practice. If you do not
// call it yourself, then the first subsequent plotting or utility function will
// call it for you.
/**
* Enables an axis or sets the label and/or flags for an existing axis.
* Leave `label` as NULL for no label.
*/
@BindingMethod
public static native void SetupAxis(int axis, @OptArg(callValue = "NULL") String label, @OptArg int flags);
/**
* Sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
*/
@BindingMethod
public static native void SetupAxisLimits(int axis, double vMin, double vMax, @OptArg int cond);
/**
* Links an axis range limits to external values. Set to NULL for no linkage.
* The pointer data must remain valid until EndPlot.
*/
@BindingMethod
public static native void SetupAxisLinks(int axis, ImDouble linkMin, ImDouble linkMax);
/**
* Sets the format of numeric axis labels via formatter specifier (default="%g").
* Formatted values will be double (i.e. use %f).
*/
@BindingMethod
public static native void SetupAxisFormat(int axis, String fmt);
// TODO: support ImPlotFormatter
/**
* Sets an axis' ticks and optionally the labels. To keep the default ticks,
* set `keepDefault=true`.
*/
@BindingMethod
public static native void SetupAxisTicks(int axis, double[] values, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg boolean keepDefault);
/**
* Sets an axis' ticks and optionally the labels for the next plot.
* To keep the default ticks, set `keepDefault=true`.
*/
@BindingMethod
public static native void SetupAxisTicks(int axis, double vMin, double vMax, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg boolean keepDefault);
/**
* Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis).
*/
@BindingMethod
public static native void SetupAxes(String xLabel, String yLabel, @OptArg int xFlags, @OptArg int yFlags);
/**
* Sets the primary X and Y axes range limits. If ImPlotCond_Always is used,
* the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
*/
@BindingMethod
public static native void SetupAxesLimits(double xMin, double xMax, double yMin, double yMax, @OptArg int cond);
/**
* Sets up the plot legend.
*/
@BindingMethod
public static native void SetupLegend(int location, @OptArg int flags);
/**
* Sets the location of the current plot's mouse position text (default = South|East).
*/
@BindingMethod
public static native void SetupMouseText(int location, @OptArg int flags);
/**
* Explicitly finalize plot setup. Once you call this, you cannot make any more
* Setup calls for the current plot! Note that calling this function is OPTIONAL;
* it will be called by the first subsequent setup-locking API call.
*/
@BindingMethod
public static native void SetupFinish();
//-----------------------------------------------------------------------------
// [SECTION] SetNext
//-----------------------------------------------------------------------------
// Though you should default to the `Setup` API above, there are some scenarios
// where (re)configuring a plot or axis before `BeginPlot` is needed (e.g. if
// using a preceding button or slider widget to change the plot limits). In
// this case, you can use the `SetNext` API below. While this is not as feature
// rich as the Setup API, most common needs are provided. These functions can be
// called anwhere except for inside of `Begin/EndPlot`. For example:
// if (ImGui::Button("Center Plot"))
// ImPlot::SetNextPlotLimits(-1,1,-1,1);
// if (ImPlot::BeginPlot(...)) {
// ...
// ImPlot::EndPlot();
// }
//
// Important notes:
//
// - You must still enable non-default axes with SetupAxis for these functions
// to work properly.
/**
* Sets an upcoming axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
*/
@BindingMethod
public static native void SetNextAxisLimits(int axis, double vMin, double vMax, @OptArg int cond);
/**
* Links an upcoming axis range limits to external values. Set to NULL for no linkage.
* The pointer data must remain valid until EndPlot!
*/
@BindingMethod
public static native void SetNextAxisLinks(int axis, ImDouble linkMin, ImDouble linkMax);
/**
* Set an upcoming axis to auto fit to its data.
*/
@BindingMethod
public static native void SetNextAxisToFit(int axis);
/**
* Sets the upcoming primary X and Y axes range limits. If ImPlotCond_Always is used,
* the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
*/
@BindingMethod
public static native void SetNextAxesLimits(double xMin, double xMax, double yMin, double yMax, @OptArg int cond);
/**
* Sets all upcoming axes to auto fit to their data.
*/
@BindingMethod
public static native void SetNextAxesToFit();
//-----------------------------------------------------------------------------
// [SECTION] Plot Items
//-----------------------------------------------------------------------------
// The main plotting API is provied below. Call these functions between
// Begin/EndPlot and after any Setup API calls. Each plots data on the current
// x and y axes, which can be changed with `SetAxis/Axes`.
//
// The templated functions are explicitly instantiated in implot_items.cpp.
// They are not intended to be used generically with custom types. You will get
// a linker error if you try! All functions support the following scalar types:
//
@@ -217,6 +362,12 @@ public final class ImPlot {
// NB: All types are converted to double before plotting. You may lose information
// if you try plotting extremely large 64-bit integral types. Proceed with caution!
/*JNI
// For a proper type conversion, since C++ doesn't have a "long" type.
#define long ImS64
#define LEN(arg) (int)env->GetArrayLength(obj_##arg)
*/
// values
/**
@@ -1170,7 +1321,7 @@ public final class ImPlot {
@OptArg int xBins,
@OptArg int yBins,
@OptArg(callValue = "false") boolean density,
@OptArg(callValue = "ImPlotLimits()") ImPlotLimits range,
@OptArg(callValue = "ImPlotRect()") ImPlotRect range,
@OptArg boolean outliers);
/**
@@ -1186,7 +1337,7 @@ public final class ImPlot {
@OptArg int xBins,
@OptArg int yBins,
@OptArg(callValue = "false") boolean density,
@OptArg(callValue = "ImPlotLimits()") ImPlotLimits range,
@OptArg(callValue = "ImPlotRect()") ImPlotRect range,
@OptArg boolean outliers);
/**
@@ -1202,7 +1353,7 @@ public final class ImPlot {
@OptArg int xBins,
@OptArg int yBins,
@OptArg(callValue = "false") boolean density,
@OptArg(callValue = "ImPlotLimits()") ImPlotLimits range,
@OptArg(callValue = "ImPlotRect()") ImPlotRect range,
@OptArg boolean outliers);
/**
@@ -1218,7 +1369,7 @@ public final class ImPlot {
@OptArg int xBins,
@OptArg int yBins,
@OptArg(callValue = "false") boolean density,
@OptArg(callValue = "ImPlotLimits()") ImPlotLimits range,
@OptArg(callValue = "ImPlotRect()") ImPlotRect range,
@OptArg boolean outliers);
/**
@@ -1234,7 +1385,7 @@ public final class ImPlot {
@OptArg int xBins,
@OptArg int yBins,
@OptArg(callValue = "false") boolean density,
@OptArg(callValue = "ImPlotLimits()") ImPlotLimits range,
@OptArg(callValue = "ImPlotRect()") ImPlotRect range,
@OptArg boolean outliers);
/**
@@ -1291,111 +1442,130 @@ public final class ImPlot {
*/
//-----------------------------------------------------------------------------
// Plot Utils
// [SECTION] Plot Tools
//-----------------------------------------------------------------------------
// The following can be used to render interactive elements and/or annotations.
// Like the item plotting functions above, they apply to the current x and y
// axes, which can be changed with `SetAxis/SetAxes`.
/**
* Shows a draggable point at x, y. `col` defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragPoint(int id, ImDouble x, ImDouble y, ImVec4 col, @OptArg(callValue = "4") float size, @OptArg int flags);
/**
* Shows a draggable vertical guide line at an x-value. `col` defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragLineX(int id, ImDouble x, ImVec4 col, @OptArg(callValue = "1") float thickness, @OptArg int flags);
/**
* Shows a draggable horizontal guide line at a y-value. `col` defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragLineY(int id, ImDouble y, ImVec4 col, @OptArg(callValue = "1") float thickness, @OptArg int flags);
/**
* Shows a draggable and resizeable rectangle.
*/
@BindingMethod
public static native boolean DragRect(int id, ImDouble xMin, ImDouble yMin, ImDouble xMax, ImDouble yMax, ImVec4 col, @OptArg int flags);
/**
* Shows an annotation callout at a chosen point. Clamping keeps annotations in the plot area.
* Annotations are always rendered on top.
*/
@BindingMethod
public static native void Annotation(double x, double y, ImVec4 color, ImVec2 pixOffset, boolean clamp, @OptArg boolean round);
/**
* Shows an annotation callout at a chosen point with formatted text.
* Clamping keeps annotations in the plot area. Annotations are always rendered on top.
*/
@BindingMethod
public static native void Annotation(double x, double y, ImVec4 color, ImVec2 pixOffset, boolean clamp, String fmt, Void NULL);
/**
* Shows a x-axis tag at the specified coordinate value.
*/
@BindingMethod
public static native void TagX(double x, ImVec4 color, @OptArg boolean round);
/**
* Shows a x-axis tag at the specified coordinate value with formatted text.
*/
@BindingMethod
public static native void TagX(double x, ImVec4 color, String fmt, Void NULL);
/**
* Shows a y-axis tag at the specified coordinate value.
*/
@BindingMethod
public static native void TagY(double y, ImVec4 color, @OptArg boolean round);
/**
* Shows a y-axis tag at the specified coordinate value with formatted text.
*/
@BindingMethod
public static native void TagY(double y, ImVec4 color, String fmt, Void NULL);
//-----------------------------------------------------------------------------
// [SECTION] Plot Utils
//-----------------------------------------------------------------------------
/**
* Set the axes range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the axes limits will be locked.
* Selects which axis will be used for subsequent plot elements.
*/
@BindingMethod
public static native void SetNextPlotLimits(double xMin, double xMax, double yMin, double yMax, @OptArg int cond);
public static native void SetAxis(int axis);
/**
* Set the X axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the X axis limits will be locked.
* Selects which axes will be used for subsequent plot elements.
*/
@BindingMethod
public static native void SetNextPlotLimitsX(double xMin, double xMax, @OptArg int cond);
public static native void SetAxes(int xAxis, int yAxis);
/**
* Set the Y axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the Y axis limits will be locked.
* Converts pixels to a position in the current plot's coordinate system.
* Passing IMPLOT_AUTO uses the current axes.
*/
@BindingMethod
public static native void SetNextPlotLimitsY(double yMin, double yMax, @OptArg int cond);
public static native ImPlotPoint PixelsToPlot(ImVec2 pix, @OptArg int xAxis, @OptArg int yAxis);
/**
* Links the next plot limits to external values. Set to NULL for no linkage. The pointer data must remain valid until the matching call to EndPlot.
* Converts a position in the current plot's coordinate system to pixels.
* Passing IMPLOT_AUTO uses the current axes.
*/
@BindingMethod
public static native void LinkNextPlotLimits(ImDouble xMin, ImDouble xMax, ImDouble yMin, ImDouble yMax, @OptArg ImDouble yMin2, @OptArg ImDouble yMax2, @OptArg ImDouble yMin3, @OptArg ImDouble yMax3);
public static native ImVec2 PlotToPixels(ImPlotPoint plt, @OptArg int xAxis, @OptArg int yAxis);
/**
* Fits the next plot axes to all plotted data if they are unlocked (equivalent to double-clicks).
*/
@BindingMethod
public static native void FitNextPlotAxes(@OptArg boolean x, @OptArg boolean y, @OptArg boolean y2, @OptArg boolean y3);
/**
* Set the X axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
*/
@BindingMethod
public static native void SetNextPlotTicksX(double[] values, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg boolean keepDefault);
/**
* Set the X axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
*/
@BindingMethod
public static native void SetNextPlotTicksX(double xMin, double xMax, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg boolean keepDefault);
/**
* Set the Y axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
*/
@BindingMethod
public static native void SetNextPlotTicksY(double[] values, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg(callValue = "false") boolean keepDefault, @OptArg int yAxis);
/**
* Set the Y axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
*/
@BindingMethod
public static native void SetNextPlotTicksY(double yMin, double yMax, int nTicks, @OptArg(callValue = "NULL") String[] labels, @OptArg(callValue = "false") boolean keepDefault, @OptArg int yAxis);
/**
* Set the format for numeric X axis labels (default="%g"). Formated values will be doubles (i.e. don't supply %d, %i, etc.). Not applicable if ImPlotAxisFlags_Time enabled.
*/
@BindingMethod
public static native void SetNextPlotFormatX(String fmt);
/**
* Set the format for numeric Y axis labels (default="%g"). Formated values will be doubles (i.e. don't supply %d, %i, etc.).
*/
@BindingMethod
public static native void SetNextPlotFormatY(String fmt, @OptArg int yAxis);
/**
* Select which Y axis will be used for subsequent plot elements. The default is ImPlotYAxis_1, or the first (left) Y axis. Enable 2nd and 3rd axes with ImPlotFlags_YAxisX.
*/
@BindingMethod
public static native void SetPlotYAxis(int yAxis);
/**
* Hides the next plot item. Use ImGuiCond.Always if you need to forcefully set this every frame (default ImGuiCond.Once).
*/
@BindingMethod
public static native void HideNextItem(@OptArg(callValue = "true") boolean hidden, @OptArg int cond);
/**
* Convert pixels to a position in the current plot's coordinate system. A negative yAxis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
*/
@BindingMethod
public static native ImPlotPoint PixelsToPlot(ImVec2 pix, @OptArg int yAxis);
/**
* Convert a position in the current plot's coordinate system to pixels. A negative yAxis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
*/
@BindingMethod
public static native ImVec2 PlotToPixels(ImPlotPoint plt, @OptArg int yAxis);
/**
* Get the current Plot position (top-left) in pixels.
* Gets the current Plot position (top-left) in pixels.
*/
@BindingMethod
public static native ImVec2 GetPlotPos();
/**
* Get the current Plot size in pixels.
* Gets the current Plot size in pixels.
*/
@BindingMethod
public static native ImVec2 GetPlotSize();
/**
* Returns the mouse position in x, y coordinates of the current plot.
* Passing IMPLOT_AUTO uses the current axes.
*/
@BindingMethod
public static native ImPlotPoint GetPlotMousePos(@OptArg int xAxis, @OptArg int yAxis);
/**
* Returns the current plot axis range.
*/
@BindingMethod
public static native ImPlotRect GetPlotLimits(@OptArg int xAxis, @OptArg int yAxis);
/**
* Returns true if the plot area in the current plot is hovered.
*/
@@ -1403,28 +1573,16 @@ public final class ImPlot {
public static native boolean IsPlotHovered();
/**
* Returns true if the XAxis plot area in the current plot is hovered.
* Returns true if the axis label area in the current plot is hovered.
*/
@BindingMethod
public static native boolean IsPlotXAxisHovered();
public static native boolean IsAxisHovered(int axis);
/**
* Returns true if the YAxis[n] plot area in the current plot is hovered.
* Returns true if the bounding frame of a subplot is hovered.
*/
@BindingMethod
public static native boolean IsPlotYAxisHovered(@OptArg int yAxis);
/**
* Returns the mouse position in x,y coordinates of the current plot. A negative yAxis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
*/
@BindingMethod
public static native ImPlotPoint GetPlotMousePos(@OptArg int yAxis);
/**
* Returns the current plot axis range. A negative yAxis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially).
*/
@BindingMethod
public static native ImPlotLimits GetPlotLimits(@OptArg int yAxis);
public static native boolean IsSubplotsHovered();
/**
* Returns true if the current plot is being box selected.
@@ -1434,115 +1592,57 @@ public final class ImPlot {
/**
* Returns the current plot box selection bounds.
* Passing IMPLOT_AUTO uses the current axes.
*/
@BindingMethod
public static native ImPlotLimits GetPlotSelection(@OptArg int yAxis);
public static native ImPlotRect GetPlotSelection(@OptArg int xAxis, @OptArg int yAxis);
/**
* Returns true if the current plot is being queried or has an active query. Query must be enabled with ImPlotFlags_Query.
* Cancels the current plot box selection.
*/
@BindingMethod
public static native boolean IsPlotQueried();
public static native void CancelPlotSelection();
/**
* Returns the current plot query bounds. Query must be enabled with ImPlotFlags_Query.
* Hides or shows the next plot item (i.e. as if it were toggled from the legend).
* Use ImPlotCond_Always if you need to forcefully set this every frame.
*/
@BindingMethod
public static native ImPlotLimits GetPlotQuery(@OptArg int yAxis);
/**
* Set the current plot query bounds. Query must be enabled with ImPlotFlags_Query.
*/
@BindingMethod
public static native void SetPlotQuery(ImPlotLimits query, @OptArg int yAxis);
/**
* Returns true if the bounding frame of a subplot is hovered
*/
@BindingMethod
public static native boolean IsSubplotsHovered();
//-----------------------------------------------------------------------------
// Aligned Plots
//-----------------------------------------------------------------------------
public static native void HideNextItem(@OptArg(callValue = "true") boolean hidden, @OptArg int cond);
// Use the following around calls to Begin/EndPlot to align l/r/t/b padding.
// Consider using Begin/EndSubplots first. They are more feature rich and
// accomplish the same behaviour by default. The functions below offer lower
// level control of plot alignment.
/**
* Align axis padding over multiple plots in a single row or column. If this function returns true, EndAlignedPlots() must be called. #group_id must be unique.
* Aligns axis padding over multiple plots in a single row or column.
* `group_id` must be unique. If this function returns true, EndAlignedPlots() must be called.
*/
@BindingMethod
public static native boolean BeginAlignedPlots(String groupId, @OptArg int orientation);
public static native boolean BeginAlignedPlots(String groupId, @OptArg boolean vertical);
/**
* Only call EndAlignedPlots() if BeginAlignedPlots() returns true!
* Ends aligned plots. Only call EndAlignedPlots() if BeginAlignedPlots() returns true.
*/
@BindingMethod
public static native void EndAlignedPlots();
//-----------------------------------------------------------------------------
// Plot Tools
// [SECTION] Legend Utils
//-----------------------------------------------------------------------------
/**
* Shows an annotation callout at a chosen point.
* Begins a popup for a legend entry.
*/
@BindingMethod
public static native void Annotate(double x, double y, ImVec2 pixOffset, String fmt, Void NULL);
public static native boolean BeginLegendPopup(String labelId, @OptArg int mouseButton);
/**
* Shows an annotation callout at a chosen point.
* Ends a popup for a legend entry.
*/
@BindingMethod
public static native void Annotate(double x, double y, ImVec2 pixOffset, ImVec4 color, String fmt, Void NULL);
/**
* Same as above, but the annotation will always be clamped to stay inside the plot area.
*/
@BindingMethod
public static native void AnnotateClamped(double x, double y, ImVec2 pixOffset, String fmt, Void NULL);
/**
* Same as above, but the annotation will always be clamped to stay inside the plot area.
*/
@BindingMethod
public static native void AnnotateClamped(double x, double y, ImVec2 pixOffset, ImVec4 color, String fmt, Void NULL);
/**
* Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragLineX(String id, ImDouble xValue, @OptArg(callValue = "true") boolean showLabel, @OptArg(callValue = "IMPLOT_AUTO_COL") ImVec4 color, @OptArg float thickness);
/**
* Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragLineY(String id, ImDouble yValue, @OptArg(callValue = "true") boolean showLabel, @OptArg(callValue = "IMPLOT_AUTO_COL") ImVec4 color, @OptArg float thickness);
/**
* Shows a draggable point at x,y. #col defaults to ImGuiCol_Text.
*/
@BindingMethod
public static native boolean DragPoint(String id, ImDouble x, ImDouble y, @OptArg(callValue = "true") boolean showLabel, @OptArg(callValue = "IMPLOT_AUTO_COL") ImVec4 color, @OptArg float radius);
//-----------------------------------------------------------------------------
// Legend Utils and Tools
//-----------------------------------------------------------------------------
/**
* Set the location of the current plot's legend
*/
@BindingMethod
public static native void SetLegendLocation(int location, @OptArg(callValue = "ImPlotOrientation_Vertical") int orientation, @OptArg boolean outside);
/**
* Set the location of the current plot's mouse position text
*/
@BindingMethod
public static native void SetMousePosLocation(int location);
public static native void EndLegendPopup();
/**
* Returns true if a plot item legend entry is hovered.
@@ -1550,48 +1650,33 @@ public final class ImPlot {
@BindingMethod
public static native boolean IsLegendEntryHovered(String labelId);
/**
* Begin a popup for a legend entry.
*/
@BindingMethod
public static native boolean BeginLegendPopup(String labelID, @OptArg int mouseButton);
/**
* End a popup for a legend entry.
*/
@BindingMethod
public static native void EndLegendPopup();
//-----------------------------------------------------------------------------
// Drag and Drop Utils
// [SECTION] Drag and Drop
//-----------------------------------------------------------------------------
/**
* Turns the current plot's plotting area into a drag and drop target. Don't forget to call EndDragDropTarget!
* Turns the current plot's plotting area into a drag and drop target.
* Don't forget to call EndDragDropTarget!
*/
@BindingMethod
public static native boolean BeginDragDropTarget();
public static native boolean BeginDragDropTargetPlot();
/**
* Turns the current plot's X-axis into a drag and drop target. Don't forget to call EndDragDropTarget!
* Turns the current plot's X-axis into a drag and drop target.
* Don't forget to call EndDragDropTarget!
*/
@BindingMethod
public static native boolean BeginDragDropTargetX();
public static native boolean BeginDragDropTargetAxis(int axis);
/**
* Turns the current plot's Y-Axis into a drag and drop target. Don't forget to call EndDragDropTarget!
*/
@BindingMethod
public static native boolean BeginDragDropTargetY(@OptArg int yAxis);
/**
* Turns the current plot's legend into a drag and drop target. Don't forget to call EndDragDropTarget!
* Turns the current plot's legend into a drag and drop target.
* Don't forget to call EndDragDropTarget!
*/
@BindingMethod
public static native boolean BeginDragDropTargetLegend();
/**
* Ends a drag and drop target.
* Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget).
*/
@BindingMethod
public static native void EndDragDropTarget();
@@ -1600,37 +1685,34 @@ public final class ImPlot {
// You can change the modifier if desired. If ImGuiKeyModFlags_None is provided, the axes will be locked from panning.
/**
* Turns the current plot's plotting area into a drag and drop source. Don't forget to call EndDragDropSource!
* Turns the current plot's plotting area into a drag and drop source.
* You must hold Ctrl. Don't forget to call EndDragDropSource!
*/
@BindingMethod
public static native boolean BeginDragDropSource(@OptArg int keyMods, @OptArg int dragDropFlags);
public static native boolean BeginDragDropSourcePlot(@OptArg int flags);
/**
* Turns the current plot's X-axis into a drag and drop source. Don't forget to call EndDragDropSource!
* Turns the current plot's X-axis into a drag and drop source.
* You must hold Ctrl. Don't forget to call EndDragDropSource!
*/
@BindingMethod
public static native boolean BeginDragDropSourceX(@OptArg int keyMods, @OptArg int dragDropFlags);
public static native boolean BeginDragDropSourceAxis(int axis, @OptArg int flags);
/**
* Turns the current plot's Y-axis into a drag and drop source. Don't forget to call EndDragDropSource!
* Turns an item in the current plot's legend into a drag and drop source.
* Don't forget to call EndDragDropSource!
*/
@BindingMethod
public static native boolean BeginDragDropSourceY(@OptArg int yAxis, @OptArg int keyMods, @OptArg int dragDropFlags);
public static native boolean BeginDragDropSourceItem(String labelId, @OptArg int flags);
/**
* Turns an item in the current plot's legend into drag and drop source. Don't forget to call EndDragDropSource!
*/
@BindingMethod
public static native boolean BeginDragDropSourceItem(String labelID, @OptArg int dragDropFlags);
/**
* Ends a drag and drop source.
* Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).
*/
@BindingMethod
public static native void EndDragDropSource();
//-----------------------------------------------------------------------------
// Plot and Item Styling
// [SECTION] Styling
//-----------------------------------------------------------------------------
// Styling colors in ImPlot works similarly to styling colors in ImGui, but
@@ -1785,7 +1867,7 @@ public final class ImPlot {
public static native String GetMarkerName(int idx);
//-----------------------------------------------------------------------------
// Colormaps
// [SECTION] Colormaps
//-----------------------------------------------------------------------------
// Item styling is based on colormaps when the relevant ImPlotCol_XXX is set to
@@ -1875,7 +1957,7 @@ public final class ImPlot {
* Shows a vertical color scale with linear spaced ticks using the specified color map. Use double hashes to hide label (e.g. "##NoLabel").
*/
@BindingMethod
public static native void ColormapScale(String label, double scaleMin, double scaleMax, @OptArg(callValue = "ImVec2(0,0)") ImVec2 size, @OptArg(callValue = "IMPLOT_AUTO") int cmap, @OptArg String fmt);
public static native void ColormapScale(String label, double scaleMin, double scaleMax, @OptArg(callValue = "ImVec2(0,0)") ImVec2 size, @OptArg(callValue = "IMPLOT_AUTO") int cmap, @OptArg String format);
/**
* Shows a horizontal slider with a colormap gradient background.
@@ -1903,7 +1985,32 @@ public final class ImPlot {
public static native void BustColorCache(@OptArg String plotTitleId);
//-----------------------------------------------------------------------------
// Miscellaneous
// [SECTION] Input Mapping
//-----------------------------------------------------------------------------
/**
* Provides access to the input mapping structure for permanent modifications to controls for pan, select, etc.
*/
@BindingMethod
@ReturnValue(callPrefix = "&", isStatic = true)
public static native ImPlotInputMap GetInputMap();
/**
* Default input mapping: pan = LMB drag, box select = RMB drag,
* fit = LMB double click, context menu = RMB click, zoom = scroll.
*/
@BindingMethod
public static native void MapInputDefault(@OptArg ImPlotInputMap dst);
/**
* Reverse input mapping: pan = RMB drag, box select = LMB drag,
* fit = LMB double click, context menu = RMB click, zoom = scroll.
*/
@BindingMethod
public static native void MapInputReverse(@OptArg ImPlotInputMap dst);
//-----------------------------------------------------------------------------
// [SECTION] Miscellaneous
//-----------------------------------------------------------------------------
// Render icons similar to those that appear in legends (nifty for data lists).
@@ -1947,6 +2054,12 @@ public final class ImPlot {
@BindingMethod
public static native boolean ShowColormapSelector(String label);
/**
* Shows ImPlot input map selector dropdown menu.
*/
@BindingMethod
public static native boolean ShowInputMapSelector(String label);
/**
* Shows ImPlot style editor block (not a window).
*/
@@ -1966,7 +2079,7 @@ public final class ImPlot {
public static native void ShowMetricsWindow(@OptArg ImBoolean pOpen);
//-----------------------------------------------------------------------------
// Demo
// [SECTION] Demo
//-----------------------------------------------------------------------------
/**
@@ -0,0 +1,112 @@
package imgui.extension.implot;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotInputMap extends ImGuiStructDestroyable {
public ImPlotInputMap() {
super();
}
public ImPlotInputMap(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_implot.h"
#define THIS ((ImPlotInputMap*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImPlotInputMap());
*/
/**
* LMB enables panning when held
*/
@BindingField
public int Pan;
/**
* Optional modifier that must be held for panning/fitting
*/
@BindingField
public int PanMod;
/**
* LMB initiates fit when double clicked
*/
@BindingField
public int Fit;
/**
* RMB begins box selection when pressed and confirms
* selection when released
*/
@BindingField
public int Select;
/**
* LMB cancels active box selection when pressed;
* cannot be the same as Select
*/
@BindingField
public int SelectCancel;
/**
* Optional modifier that must be held for box selection
*/
@BindingField
public int SelectMod;
/**
* Alt expands active box selection horizontally
* to plot edge when held
*/
@BindingField
public int SelectHorzMod;
/**
* Shift expands active box selection vertically
* to plot edge when held
*/
@BindingField
public int SelectVertMod;
/**
* RMB opens context menus (if enabled) when clicked
*/
@BindingField
public int Menu;
/**
* Ctrl when held, all input is ignored;
* used to enable axis/plots as DND sources
*/
@BindingField
public int OverrideMod;
/**
* Optional modifier that must be held for scroll wheel zooming
*/
@BindingField
public int ZoomMod;
/**
* Zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click);
* make negative to invert
*/
@BindingField
public float ZoomRate;
/*JNI
#undef THIS
*/
}
@@ -25,6 +25,10 @@ public final class ImPlotRange implements Cloneable {
return max - min;
}
public double clamp(final double value) {
return Math.max(min, Math.min(max, value));
}
public ImPlotRange set(final double min, final double max) {
this.min = min;
this.max = max;
@@ -4,22 +4,22 @@ import imgui.ImVec2;
import java.util.Objects;
public final class ImPlotLimits implements Cloneable {
public final class ImPlotRect implements Cloneable {
public final ImPlotRange x = new ImPlotRange();
public final ImPlotRange y = new ImPlotRange();
public ImPlotLimits() {
public ImPlotRect() {
}
public ImPlotLimits(final double xMin, final double yMin, final double xMax, final double yMax) {
public ImPlotRect(final double xMin, final double yMin, final double xMax, final double yMax) {
set(xMin, yMin, xMax, yMax);
}
public ImPlotLimits(final ImVec2 min, final ImVec2 max) {
public ImPlotRect(final ImVec2 min, final ImVec2 max) {
set(min, max);
}
public ImPlotLimits(final ImPlotLimits value) {
public ImPlotRect(final ImPlotRect value) {
set(value);
}
@@ -31,6 +31,18 @@ public final class ImPlotLimits implements Cloneable {
return contains(value.x, value.y);
}
public ImPlotPoint size() {
return new ImPlotPoint(x.size(), y.size());
}
public ImPlotPoint clamp(final double x, final double y) {
return new ImPlotPoint(this.x.clamp(x), this.y.clamp(y));
}
public ImPlotPoint clamp(ImPlotPoint p) {
return clamp(p.x, p.y);
}
public ImPlotPoint min() {
return new ImPlotPoint(x.min, y.min);
}
@@ -54,13 +66,13 @@ public final class ImPlotLimits implements Cloneable {
set(x.min, y.min, x.max, y.max);
}
public void set(final ImPlotLimits value) {
public void set(final ImPlotRect value) {
set(value.x, value.y);
}
@Override
public String toString() {
return "ImPlotLimits{"
return "ImPlotRect{"
+ "x=" + x
+ ", y=" + y
+ '}';
@@ -76,8 +88,8 @@ public final class ImPlotLimits implements Cloneable {
return false;
}
final ImPlotLimits imPlotLimits = (ImPlotLimits) o;
return Objects.equals(x, imPlotLimits.x) && Objects.equals(y, imPlotLimits.y);
final ImPlotRect imPlotRect = (ImPlotRect) o;
return Objects.equals(x, imPlotRect.x) && Objects.equals(y, imPlotRect.y);
}
@Override
@@ -87,7 +99,7 @@ public final class ImPlotLimits implements Cloneable {
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotLimits clone() {
return new ImPlotLimits(this);
public ImPlotRect clone() {
return new ImPlotRect(this);
}
}
@@ -10,6 +10,7 @@ import imgui.binding.annotation.TypeArray;
@BindingSource
public final class ImPlotStyle extends ImGuiStructDestroyable {
public ImPlotStyle() {
super();
}
public ImPlotStyle(final long ptr) {
@@ -0,0 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotAxis {
private ImPlotAxis() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImAxis_")
public Void __;
}
@@ -0,0 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotBarGroupsFlags {
private ImPlotBarGroupsFlags() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotBarGroupsFlags_")
public Void __;
}
@@ -4,10 +4,10 @@ import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotOrientation {
private ImPlotOrientation() {
public final class ImPlotCond {
private ImPlotCond() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotOrientation_")
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotCond_")
public Void __;
}
@@ -4,10 +4,10 @@ import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotYAxis {
private ImPlotYAxis() {
public final class ImPlotDragToolFlags {
private ImPlotDragToolFlags() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotYAxis_", sanitizeName = "ImPlot")
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotDragToolFlags_")
public Void __;
}
@@ -0,0 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotLegendFlags {
private ImPlotLegendFlags() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotLegendFlags_")
public Void __;
}
@@ -0,0 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotMouseTextFlags {
private ImPlotMouseTextFlags() {
}
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotMouseTextFlags_")
public Void __;
}
@@ -14,6 +14,7 @@ import imgui.binding.annotation.OptArg;
@BindingSource
public final class MemoryEditor extends ImGuiStructDestroyable {
public MemoryEditor() {
super();
}
public MemoryEditor(final long ptr) {
@@ -7,6 +7,7 @@ import imgui.binding.annotation.BindingSource;
@BindingSource
public final class MemoryEditorSizes extends ImGuiStructDestroyable {
public MemoryEditorSizes() {
super();
}
public MemoryEditorSizes(final long ptr) {
@@ -13,6 +13,7 @@ import java.util.Map;
@BindingSource
public final class TextEditor extends ImGuiStructDestroyable {
public TextEditor() {
super();
}
public TextEditor(final long ptr) {
@@ -5,12 +5,14 @@ import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.ReturnValue;
import imgui.binding.annotation.TypeStdString;
import java.util.Map;
@BindingSource
public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
public TextEditorLanguageDefinition() {
super();
}
public TextEditorLanguageDefinition(final long ptr) {
@@ -33,6 +35,7 @@ public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
*/
@BindingField(callName = "mName")
@TypeStdString
@ReturnValue(callSuffix = ".c_str()")
public String Name;
@@ -96,14 +99,17 @@ public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
*/
@BindingField(callName = "mCommentStart")
@TypeStdString
@ReturnValue(callSuffix = ".c_str()")
public String CommentStart;
@BindingField(callName = "mCommentEnd")
@TypeStdString
@ReturnValue(callSuffix = ".c_str()")
public String CommentEnd;
@BindingField(callName = "mSingleLineComment")
@TypeStdString
@ReturnValue(callSuffix = ".c_str()")
public String SingleLineComment;
+24 -2
View File
@@ -1,4 +1,5 @@
#include "jni_common.h"
#include "jni_binding_struct.h"
static jfieldID imVec2XID;
static jfieldID imVec2YID;
@@ -62,7 +63,7 @@ namespace Jni
jclass cls = env->FindClass("imgui/ImVec2");
jmethodID cstr = env->GetMethodID(cls, "<init>", "(FF)V");
jobjectArray dst = env->NewObjectArray(size, cls, NULL);
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; i++) {
jobject vec = env->NewObject(cls, cstr, src[i].x, src[i].y);
env->SetObjectArrayElement(dst, i, vec);
env->DeleteLocalRef(vec);
@@ -74,7 +75,7 @@ namespace Jni
jclass cls = env->FindClass("imgui/ImVec4");
jmethodID cstr = env->GetMethodID(cls, "<init>", "(FFFF)V");
jobjectArray dst = env->NewObjectArray(size, cls, NULL);
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; i++) {
jobject vec = env->NewObject(cls, cstr, src[i].x, src[i].y, src[i].z, src[i].w);
env->SetObjectArrayElement(dst, i, vec);
env->DeleteLocalRef(vec);
@@ -97,4 +98,25 @@ namespace Jni
env->DeleteLocalRef(value);
}
}
jobjectArray NewImGuiKeyDataArray(JNIEnv* env, const ImGuiKeyData* src, int size) {
jclass cls = env->FindClass("imgui/ImGuiKeyData");
jmethodID cstr = env->GetMethodID(cls, "<init>", "(J)V");
jobjectArray dst = env->NewObjectArray(size, cls, NULL);
for (int i = 0; i < size; i++) {
jobject obj = env->NewObject(cls, cstr, (jlong)(intptr_t)&src[i]);
env->SetObjectArrayElement(dst, i, obj);
env->DeleteLocalRef(obj);
}
return dst;
}
void ImGuiKeyDataArrayCpy(JNIEnv* env, jobjectArray src, ImGuiKeyData* dst, int size) {
for (int i = 0; i < size; i++) {
jobject value = env->GetObjectArrayElement(src, i);
jlong ptr = env->GetLongField(value, Jni::GetBindingStructPtrID());
dst[i] = *reinterpret_cast<ImGuiKeyData*>(ptr);
env->DeleteLocalRef(value);
}
}
}
@@ -1,8 +1,32 @@
#pragma once
#include "stdlib.h"
#include "stdint.h"
#include "jni.h"
#include "imgui.h"
#ifndef SET_STRING_FIELD
#define SET_STRING_FIELD(field, value) \
do { \
static bool freeField = false; \
if (freeField) { \
free((void*)(field)); \
} \
if ((value) != NULL) { \
size_t length = strlen(value) + 1; \
(field) = (char*)malloc(length); \
if ((field) != NULL) { \
strcpy((char*)(field), value); \
freeField = true; \
} \
} else { \
(field) = NULL; \
freeField = false; \
} \
} while (0)
#endif
namespace Jni
{
void InitCommon(JNIEnv* env);
@@ -20,4 +44,7 @@ namespace Jni
void ImVec2ArrayCpy(JNIEnv* env, jobjectArray src, ImVec2* dst, int size);
void ImVec4ArrayCpy(JNIEnv* env, jobjectArray src, ImVec4* dst, int size);
jobjectArray NewImGuiKeyDataArray(JNIEnv* env, const ImGuiKeyData* src, int size);
void ImGuiKeyDataArrayCpy(JNIEnv* env, jobjectArray src, ImGuiKeyData* dst, int size);
}
+14 -14
View File
@@ -6,8 +6,8 @@ static jfieldID imPlotPointYID;
static jfieldID imPlotRangeMinID;
static jfieldID imPlotRangeMaxID;
static jfieldID imPlotLimitsX;
static jfieldID imPlotLimitsY;
static jfieldID imPlotRectX;
static jfieldID imPlotRectY;
static void initialize(JNIEnv* env) {
static bool initialized = false;
@@ -23,9 +23,9 @@ static void initialize(JNIEnv* env) {
imPlotRangeMinID = env->GetFieldID(jImPlotRangeClass, "min", "D");
imPlotRangeMaxID = env->GetFieldID(jImPlotRangeClass, "max", "D");
jclass jImPlotLimitsClass = env->FindClass("imgui/extension/implot/ImPlotLimits");
imPlotLimitsX = env->GetFieldID(jImPlotLimitsClass, "x", "Limgui/extension/implot/ImPlotRange;");
imPlotLimitsY = env->GetFieldID(jImPlotLimitsClass, "y", "Limgui/extension/implot/ImPlotRange;");
jclass jImPlotRectClass = env->FindClass("imgui/extension/implot/ImPlotRect");
imPlotRectX = env->GetFieldID(jImPlotRectClass, "x", "Limgui/extension/implot/ImPlotRange;");
imPlotRectY = env->GetFieldID(jImPlotRectClass, "y", "Limgui/extension/implot/ImPlotRange;");
initialized = true;
}
@@ -68,26 +68,26 @@ namespace Jni
dst->Max = env->GetDoubleField(src, imPlotRangeMaxID);
}
void ImPlotLimitsCpy(JNIEnv* env, ImPlotLimits* src, jobject dst) {
void ImPlotRectCpy(JNIEnv* env, ImPlotRect* src, jobject dst) {
initialize(env);
jobject x = env->GetObjectField(dst, imPlotLimitsX);
jobject y = env->GetObjectField(dst, imPlotLimitsY);
jobject x = env->GetObjectField(dst, imPlotRectX);
jobject y = env->GetObjectField(dst, imPlotRectY);
Jni::ImPlotRangeCpy(env, src->X, x);
Jni::ImPlotRangeCpy(env, src->Y, y);
}
void ImPlotLimitsCpy(JNIEnv* env, ImPlotLimits src, jobject dst) {
void ImPlotRectCpy(JNIEnv* env, ImPlotRect src, jobject dst) {
initialize(env);
jobject x = env->GetObjectField(dst, imPlotLimitsX);
jobject y = env->GetObjectField(dst, imPlotLimitsY);
jobject x = env->GetObjectField(dst, imPlotRectX);
jobject y = env->GetObjectField(dst, imPlotRectY);
Jni::ImPlotRangeCpy(env, src.X, x);
Jni::ImPlotRangeCpy(env, src.Y, y);
}
void ImPlotLimitsCpy(JNIEnv* env, jobject src, ImPlotLimits* dst) {
void ImPlotRectCpy(JNIEnv* env, jobject src, ImPlotRect* dst) {
initialize(env);
jobject x = env->GetObjectField(src, imPlotLimitsX);
jobject y = env->GetObjectField(src, imPlotLimitsY);
jobject x = env->GetObjectField(src, imPlotRectX);
jobject y = env->GetObjectField(src, imPlotRectY);
Jni::ImPlotRangeCpy(env, x, &dst->X);
Jni::ImPlotRangeCpy(env, y, &dst->Y);
}
+3 -3
View File
@@ -13,7 +13,7 @@ namespace Jni
void ImPlotRangeCpy(JNIEnv* env, ImPlotRange src, jobject dst);
void ImPlotRangeCpy(JNIEnv* env, jobject src, ImPlotRange* dst);
void ImPlotLimitsCpy(JNIEnv* env, ImPlotLimits* src, jobject dst);
void ImPlotLimitsCpy(JNIEnv* env, ImPlotLimits src, jobject dst);
void ImPlotLimitsCpy(JNIEnv* env, jobject src, ImPlotLimits* dst);
void ImPlotRectCpy(JNIEnv* env, ImPlotRect* src, jobject dst);
void ImPlotRectCpy(JNIEnv* env, ImPlotRect src, jobject dst);
void ImPlotRectCpy(JNIEnv* env, jobject src, ImPlotRect* dst);
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff