|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.54 WIP
|
|
|
|
|
|
|
+// dear imgui, v1.60 WIP
|
|
|
// (headers)
|
|
// (headers)
|
|
|
|
|
|
|
|
// See imgui.cpp file for documentation.
|
|
// See imgui.cpp file for documentation.
|
|
@@ -21,7 +21,7 @@
|
|
|
#include <stddef.h> // ptrdiff_t, NULL
|
|
#include <stddef.h> // ptrdiff_t, NULL
|
|
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
|
|
|
|
|
|
|
-#define IMGUI_VERSION "1.54 WIP"
|
|
|
|
|
|
|
+#define IMGUI_VERSION "1.60 WIP"
|
|
|
|
|
|
|
|
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
|
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
|
|
#ifndef IMGUI_API
|
|
#ifndef IMGUI_API
|
|
@@ -82,6 +82,7 @@ typedef void* ImTextureID; // user data to identify a texture (this is
|
|
|
typedef int ImGuiCol; // enum: a color identifier for styling // enum ImGuiCol_
|
|
typedef int ImGuiCol; // enum: a color identifier for styling // enum ImGuiCol_
|
|
|
typedef int ImGuiCond; // enum: a condition for Set*() // enum ImGuiCond_
|
|
typedef int ImGuiCond; // enum: a condition for Set*() // enum ImGuiCond_
|
|
|
typedef int ImGuiKey; // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_
|
|
typedef int ImGuiKey; // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_
|
|
|
|
|
+typedef int ImGuiNavInput; // enum: an input identifier for navigation // enum ImGuiNavInput_
|
|
|
typedef int ImGuiMouseCursor; // enum: a mouse cursor identifier // enum ImGuiMouseCursor_
|
|
typedef int ImGuiMouseCursor; // enum: a mouse cursor identifier // enum ImGuiMouseCursor_
|
|
|
typedef int ImGuiStyleVar; // enum: a variable identifier for styling // enum ImGuiStyleVar_
|
|
typedef int ImGuiStyleVar; // enum: a variable identifier for styling // enum ImGuiStyleVar_
|
|
|
typedef int ImDrawCornerFlags; // flags: for ImDrawList::AddRect*() etc. // enum ImDrawCornerFlags_
|
|
typedef int ImDrawCornerFlags; // flags: for ImDrawList::AddRect*() etc. // enum ImDrawCornerFlags_
|
|
@@ -93,6 +94,7 @@ typedef int ImGuiComboFlags; // flags: for BeginCombo()
|
|
|
typedef int ImGuiFocusedFlags; // flags: for IsWindowFocused() // enum ImGuiFocusedFlags_
|
|
typedef int ImGuiFocusedFlags; // flags: for IsWindowFocused() // enum ImGuiFocusedFlags_
|
|
|
typedef int ImGuiHoveredFlags; // flags: for IsItemHovered() etc. // enum ImGuiHoveredFlags_
|
|
typedef int ImGuiHoveredFlags; // flags: for IsItemHovered() etc. // enum ImGuiHoveredFlags_
|
|
|
typedef int ImGuiInputTextFlags; // flags: for InputText*() // enum ImGuiInputTextFlags_
|
|
typedef int ImGuiInputTextFlags; // flags: for InputText*() // enum ImGuiInputTextFlags_
|
|
|
|
|
+typedef int ImGuiNavFlags; // flags: for io.NavFlags // enum ImGuiNavFlags_
|
|
|
typedef int ImGuiSelectableFlags; // flags: for Selectable() // enum ImGuiSelectableFlags_
|
|
typedef int ImGuiSelectableFlags; // flags: for Selectable() // enum ImGuiSelectableFlags_
|
|
|
typedef int ImGuiTreeNodeFlags; // flags: for TreeNode*(),CollapsingHeader()// enum ImGuiTreeNodeFlags_
|
|
typedef int ImGuiTreeNodeFlags; // flags: for TreeNode*(),CollapsingHeader()// enum ImGuiTreeNodeFlags_
|
|
|
typedef int ImGuiWindowFlags; // flags: for Begin*() // enum ImGuiWindowFlags_
|
|
typedef int ImGuiWindowFlags; // flags: for Begin*() // enum ImGuiWindowFlags_
|
|
@@ -113,6 +115,7 @@ struct ImVec2
|
|
|
float x, y;
|
|
float x, y;
|
|
|
ImVec2() { x = y = 0.0f; }
|
|
ImVec2() { x = y = 0.0f; }
|
|
|
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
|
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
|
|
|
|
+ float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return *(&x + idx); } // We very rarely use this [] operator, thus an assert is fine.
|
|
|
#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
|
|
#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
|
|
|
IM_VEC2_CLASS_EXTRA
|
|
IM_VEC2_CLASS_EXTRA
|
|
|
#endif
|
|
#endif
|
|
@@ -132,6 +135,14 @@ struct ImVec4
|
|
|
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
|
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
|
|
namespace ImGui
|
|
namespace ImGui
|
|
|
{
|
|
{
|
|
|
|
|
+ // Context creation and access, if you want to use multiple context, share context between modules (e.g. DLL).
|
|
|
|
|
+ // All contexts share a same ImFontAtlas by default. If you want different font atlas, you can new() them and overwrite the GetIO().Fonts variable of an ImGui context.
|
|
|
|
|
+ // All those functions are not reliant on the current context.
|
|
|
|
|
+ IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL);
|
|
|
|
|
+ IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = Destroy current context
|
|
|
|
|
+ IMGUI_API ImGuiContext* GetCurrentContext();
|
|
|
|
|
+ IMGUI_API void SetCurrentContext(ImGuiContext* ctx);
|
|
|
|
|
+
|
|
|
// Main
|
|
// Main
|
|
|
IMGUI_API ImGuiIO& GetIO();
|
|
IMGUI_API ImGuiIO& GetIO();
|
|
|
IMGUI_API ImGuiStyle& GetStyle();
|
|
IMGUI_API ImGuiStyle& GetStyle();
|
|
@@ -139,7 +150,6 @@ namespace ImGui
|
|
|
IMGUI_API void NewFrame(); // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame().
|
|
IMGUI_API void NewFrame(); // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame().
|
|
|
IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data, then call your io.RenderDrawListsFn() function if set.
|
|
IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data, then call your io.RenderDrawListsFn() function if set.
|
|
|
IMGUI_API void EndFrame(); // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead!
|
|
IMGUI_API void EndFrame(); // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead!
|
|
|
- IMGUI_API void Shutdown();
|
|
|
|
|
|
|
|
|
|
// Demo, Debug, Informations
|
|
// Demo, Debug, Informations
|
|
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
|
@@ -148,6 +158,7 @@ namespace ImGui
|
|
|
IMGUI_API bool ShowStyleSelector(const char* label);
|
|
IMGUI_API bool ShowStyleSelector(const char* label);
|
|
|
IMGUI_API void ShowFontSelector(const char* label);
|
|
IMGUI_API void ShowFontSelector(const char* label);
|
|
|
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
|
|
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
|
|
|
|
|
+ IMGUI_API const char* GetVersion();
|
|
|
|
|
|
|
|
// Window
|
|
// Window
|
|
|
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // push window to the stack and start appending to it. see .cpp for details. return false when window is collapsed (so you can early out in your code) but you always need to call End() regardless. 'bool* p_open' creates a widget on the upper-right to close the window (which sets your bool to false).
|
|
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // push window to the stack and start appending to it. see .cpp for details. return false when window is collapsed (so you can early out in your code) but you always need to call End() regardless. 'bool* p_open' creates a widget on the upper-right to close the window (which sets your bool to false).
|
|
@@ -316,6 +327,7 @@ namespace ImGui
|
|
|
|
|
|
|
|
// Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds)
|
|
// Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds)
|
|
|
// For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
|
// For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
|
|
|
|
+ // Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
|
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
|
|
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
|
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
@@ -450,19 +462,20 @@ namespace ImGui
|
|
|
IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL);
|
|
IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL);
|
|
|
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL);
|
|
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL);
|
|
|
|
|
|
|
|
- // Focus
|
|
|
|
|
- // (FIXME: Those functions will be reworked after we merge the navigation branch + have a pass at focusing/tabbing features.)
|
|
|
|
|
|
|
+ // Focus, Activation
|
|
|
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged)
|
|
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged)
|
|
|
- IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window (WIP navigation branch only). Pleaase use instead of SetScrollHere().
|
|
|
|
|
|
|
+ IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item".
|
|
|
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
|
|
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
|
|
|
|
|
|
|
|
// Utilities
|
|
// Utilities
|
|
|
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
|
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
|
|
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
|
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
|
|
|
|
+ IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
|
|
IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on)
|
|
IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on)
|
|
|
IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.)
|
|
IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.)
|
|
|
IMGUI_API bool IsAnyItemHovered();
|
|
IMGUI_API bool IsAnyItemHovered();
|
|
|
IMGUI_API bool IsAnyItemActive();
|
|
IMGUI_API bool IsAnyItemActive();
|
|
|
|
|
+ IMGUI_API bool IsAnyItemFocused();
|
|
|
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rectangle of last item, in screen space
|
|
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rectangle of last item, in screen space
|
|
|
IMGUI_API ImVec2 GetItemRectMax(); // "
|
|
IMGUI_API ImVec2 GetItemRectMax(); // "
|
|
|
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space
|
|
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space
|
|
@@ -509,20 +522,13 @@ namespace ImGui
|
|
|
IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered.
|
|
IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered.
|
|
|
IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle).
|
|
IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle).
|
|
|
|
|
|
|
|
- // Helpers functions to access functions pointers in ImGui::GetIO()
|
|
|
|
|
- IMGUI_API void* MemAlloc(size_t sz);
|
|
|
|
|
|
|
+ // Helpers functions to access memory allocators and clipboard functions.
|
|
|
|
|
+ IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void(*free_func)(void* ptr, void* user_data), void* user_data = NULL);
|
|
|
|
|
+ IMGUI_API void* MemAlloc(size_t size);
|
|
|
IMGUI_API void MemFree(void* ptr);
|
|
IMGUI_API void MemFree(void* ptr);
|
|
|
IMGUI_API const char* GetClipboardText();
|
|
IMGUI_API const char* GetClipboardText();
|
|
|
IMGUI_API void SetClipboardText(const char* text);
|
|
IMGUI_API void SetClipboardText(const char* text);
|
|
|
|
|
|
|
|
- // Internal context access - if you want to use multiple context, share context between modules (e.g. DLL). There is a default context created and active by default.
|
|
|
|
|
- // All contexts share a same ImFontAtlas by default. If you want different font atlas, you can new() them and overwrite the GetIO().Fonts variable of an ImGui context.
|
|
|
|
|
- IMGUI_API const char* GetVersion();
|
|
|
|
|
- IMGUI_API ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void (*free_fn)(void*) = NULL);
|
|
|
|
|
- IMGUI_API void DestroyContext(ImGuiContext* ctx);
|
|
|
|
|
- IMGUI_API ImGuiContext* GetCurrentContext();
|
|
|
|
|
- IMGUI_API void SetCurrentContext(ImGuiContext* ctx);
|
|
|
|
|
-
|
|
|
|
|
} // namespace ImGui
|
|
} // namespace ImGui
|
|
|
|
|
|
|
|
// Flags for ImGui::Begin()
|
|
// Flags for ImGui::Begin()
|
|
@@ -546,8 +552,12 @@ enum ImGuiWindowFlags_
|
|
|
ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x)
|
|
ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x)
|
|
|
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
|
|
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
|
|
|
ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // (WIP) Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui.
|
|
ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // (WIP) Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui.
|
|
|
|
|
+ ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
|
|
|
|
+ ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
|
|
|
|
+ ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
|
|
|
|
|
|
|
// [Internal]
|
|
// [Internal]
|
|
|
|
|
+ ImGuiWindowFlags_NavFlattened = 1 << 23, // (WIP) Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
|
|
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
|
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
|
|
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
|
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
|
|
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
|
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
|
@@ -595,6 +605,7 @@ enum ImGuiTreeNodeFlags_
|
|
|
ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
|
|
ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
|
|
|
//ImGuITreeNodeFlags_SpanAllAvailWidth = 1 << 11, // FIXME: TODO: Extend hit box horizontally even if not framed
|
|
//ImGuITreeNodeFlags_SpanAllAvailWidth = 1 << 11, // FIXME: TODO: Extend hit box horizontally even if not framed
|
|
|
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 12, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
|
|
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 12, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
|
|
|
|
|
+ ImGuiTreeNodeFlags_NavCloseFromChild = 1 << 13, // (WIP) Nav: left direction may close this TreeNode() when focusing on any child (items submitted between TreeNode and TreePop)
|
|
|
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog
|
|
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog
|
|
|
|
|
|
|
|
// Obsolete names (will be removed)
|
|
// Obsolete names (will be removed)
|
|
@@ -668,20 +679,21 @@ enum ImGuiDragDropFlags_
|
|
|
// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
|
|
// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
|
|
|
enum ImGuiKey_
|
|
enum ImGuiKey_
|
|
|
{
|
|
{
|
|
|
- ImGuiKey_Tab, // for tabbing through fields
|
|
|
|
|
- ImGuiKey_LeftArrow, // for text edit
|
|
|
|
|
- ImGuiKey_RightArrow,// for text edit
|
|
|
|
|
- ImGuiKey_UpArrow, // for text edit
|
|
|
|
|
- ImGuiKey_DownArrow, // for text edit
|
|
|
|
|
|
|
+ ImGuiKey_Tab,
|
|
|
|
|
+ ImGuiKey_LeftArrow,
|
|
|
|
|
+ ImGuiKey_RightArrow,
|
|
|
|
|
+ ImGuiKey_UpArrow,
|
|
|
|
|
+ ImGuiKey_DownArrow,
|
|
|
ImGuiKey_PageUp,
|
|
ImGuiKey_PageUp,
|
|
|
ImGuiKey_PageDown,
|
|
ImGuiKey_PageDown,
|
|
|
- ImGuiKey_Home, // for text edit
|
|
|
|
|
- ImGuiKey_End, // for text edit
|
|
|
|
|
- ImGuiKey_Insert, // for text edit
|
|
|
|
|
- ImGuiKey_Delete, // for text edit
|
|
|
|
|
- ImGuiKey_Backspace, // for text edit
|
|
|
|
|
- ImGuiKey_Enter, // for text edit
|
|
|
|
|
- ImGuiKey_Escape, // for text edit
|
|
|
|
|
|
|
+ ImGuiKey_Home,
|
|
|
|
|
+ ImGuiKey_End,
|
|
|
|
|
+ ImGuiKey_Insert,
|
|
|
|
|
+ ImGuiKey_Delete,
|
|
|
|
|
+ ImGuiKey_Backspace,
|
|
|
|
|
+ ImGuiKey_Space,
|
|
|
|
|
+ ImGuiKey_Enter,
|
|
|
|
|
+ ImGuiKey_Escape,
|
|
|
ImGuiKey_A, // for text edit CTRL+A: select all
|
|
ImGuiKey_A, // for text edit CTRL+A: select all
|
|
|
ImGuiKey_C, // for text edit CTRL+C: copy
|
|
ImGuiKey_C, // for text edit CTRL+C: copy
|
|
|
ImGuiKey_V, // for text edit CTRL+V: paste
|
|
ImGuiKey_V, // for text edit CTRL+V: paste
|
|
@@ -691,6 +703,50 @@ enum ImGuiKey_
|
|
|
ImGuiKey_COUNT
|
|
ImGuiKey_COUNT
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// [BETA] Gamepad/Keyboard directional navigation
|
|
|
|
|
+// Keyboard: Set io.NavFlags |= ImGuiNavFlags_EnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
|
|
|
|
+// Gamepad: Set io.NavFlags |= ImGuiNavFlags_EnableGamepad to enable. Fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
|
|
|
|
+// Read instructions in imgui.cpp for more details.
|
|
|
|
|
+enum ImGuiNavInput_
|
|
|
|
|
+{
|
|
|
|
|
+ // Gamepad Mapping
|
|
|
|
|
+ ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Circle (PS4), A (Xbox), B (Switch), Space (Keyboard)
|
|
|
|
|
+ ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Cross (PS4), B (Xbox), A (Switch), Escape (Keyboard)
|
|
|
|
|
+ ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
|
|
|
|
|
+ ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
|
|
|
|
|
+ ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
|
|
|
|
|
+ ImGuiNavInput_DpadRight, //
|
|
|
|
|
+ ImGuiNavInput_DpadUp, //
|
|
|
|
|
+ ImGuiNavInput_DpadDown, //
|
|
|
|
|
+ ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down
|
|
|
|
|
+ ImGuiNavInput_LStickRight, //
|
|
|
|
|
+ ImGuiNavInput_LStickUp, //
|
|
|
|
|
+ ImGuiNavInput_LStickDown, //
|
|
|
|
|
+ ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
|
|
|
|
+ ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
|
|
|
|
+ ImGuiNavInput_TweakSlow, // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
|
|
|
|
+ ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
|
|
|
|
+
|
|
|
|
|
+ // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
|
|
|
|
+ // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) may be directly reading from io.KeyDown[] instead of io.NavInputs[].
|
|
|
|
|
+ ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
|
|
|
|
|
+ ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
|
|
|
|
+ ImGuiNavInput_KeyRight_, // move right
|
|
|
|
|
+ ImGuiNavInput_KeyUp_, // move up
|
|
|
|
|
+ ImGuiNavInput_KeyDown_, // move down
|
|
|
|
|
+ ImGuiNavInput_COUNT,
|
|
|
|
|
+ ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyMenu_
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// [BETA] Gamepad/Keyboard directional navigation options
|
|
|
|
|
+enum ImGuiNavFlags_
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiNavFlags_EnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeyDown[].
|
|
|
|
|
+ ImGuiNavFlags_EnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[].
|
|
|
|
|
+ ImGuiNavFlags_MoveMouse = 1 << 2, // Request navigation to allow moving the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantMoveMouse=true. If enabled you MUST honor io.WantMoveMouse requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
|
|
|
|
+ ImGuiNavFlags_NoCaptureKeyboard = 1 << 3 // Do not set the io.WantCaptureKeyboard flag with io.NavActive is set.
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// Enumeration for PushStyleColor() / PopStyleColor()
|
|
// Enumeration for PushStyleColor() / PopStyleColor()
|
|
|
enum ImGuiCol_
|
|
enum ImGuiCol_
|
|
|
{
|
|
{
|
|
@@ -737,6 +793,8 @@ enum ImGuiCol_
|
|
|
ImGuiCol_TextSelectedBg,
|
|
ImGuiCol_TextSelectedBg,
|
|
|
ImGuiCol_ModalWindowDarkening, // darken entire screen when a modal window is active
|
|
ImGuiCol_ModalWindowDarkening, // darken entire screen when a modal window is active
|
|
|
ImGuiCol_DragDropTarget,
|
|
ImGuiCol_DragDropTarget,
|
|
|
|
|
+ ImGuiCol_NavHighlight, // gamepad/keyboard: current highlighted item
|
|
|
|
|
+ ImGuiCol_NavWindowingHighlight, // gamepad/keyboard: when holding NavMenu to focus/move/resize windows
|
|
|
ImGuiCol_COUNT
|
|
ImGuiCol_COUNT
|
|
|
|
|
|
|
|
// Obsolete names (will be removed)
|
|
// Obsolete names (will be removed)
|
|
@@ -894,6 +952,7 @@ struct ImGuiIO
|
|
|
float IniSavingRate; // = 5.0f // Maximum time between saving positions/sizes to .ini file, in seconds.
|
|
float IniSavingRate; // = 5.0f // Maximum time between saving positions/sizes to .ini file, in seconds.
|
|
|
const char* IniFilename; // = "imgui.ini" // Path to .ini file. NULL to disable .ini saving.
|
|
const char* IniFilename; // = "imgui.ini" // Path to .ini file. NULL to disable .ini saving.
|
|
|
const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
|
const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
|
|
|
|
+ ImGuiNavFlags NavFlags; // = 0 // See ImGuiNavFlags_. Gamepad/keyboard navigation options.
|
|
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
|
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
|
|
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
|
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
|
@@ -929,11 +988,6 @@ struct ImGuiIO
|
|
|
void (*SetClipboardTextFn)(void* user_data, const char* text);
|
|
void (*SetClipboardTextFn)(void* user_data, const char* text);
|
|
|
void* ClipboardUserData;
|
|
void* ClipboardUserData;
|
|
|
|
|
|
|
|
- // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.
|
|
|
|
|
- // (default to posix malloc/free)
|
|
|
|
|
- void* (*MemAllocFn)(size_t sz);
|
|
|
|
|
- void (*MemFreeFn)(void* ptr);
|
|
|
|
|
-
|
|
|
|
|
// Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)
|
|
// Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)
|
|
|
// (default to use native imm32 api on Windows)
|
|
// (default to use native imm32 api on Windows)
|
|
|
void (*ImeSetInputScreenPosFn)(int x, int y);
|
|
void (*ImeSetInputScreenPosFn)(int x, int y);
|
|
@@ -943,17 +997,18 @@ struct ImGuiIO
|
|
|
// Input - Fill before calling NewFrame()
|
|
// Input - Fill before calling NewFrame()
|
|
|
//------------------------------------------------------------------
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
- ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
|
|
|
|
- bool MouseDown[5]; // Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
|
|
|
|
- float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text.
|
|
|
|
|
- float MouseWheelH; // Mouse wheel (Horizontal). Most users don't have a mouse with an horizontal wheel, may not be filled by all back ends.
|
|
|
|
|
- bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
|
|
|
|
- bool KeyCtrl; // Keyboard modifier pressed: Control
|
|
|
|
|
- bool KeyShift; // Keyboard modifier pressed: Shift
|
|
|
|
|
- bool KeyAlt; // Keyboard modifier pressed: Alt
|
|
|
|
|
- bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows
|
|
|
|
|
- bool KeysDown[512]; // 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).
|
|
|
|
|
- ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
|
|
|
|
|
|
+ ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
|
|
|
|
+ bool MouseDown[5]; // Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
|
|
|
|
+ float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text.
|
|
|
|
|
+ float MouseWheelH; // Mouse wheel (Horizontal). Most users don't have a mouse with an horizontal wheel, may not be filled by all back ends.
|
|
|
|
|
+ bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
|
|
|
|
+ bool KeyCtrl; // Keyboard modifier pressed: Control
|
|
|
|
|
+ bool KeyShift; // Keyboard modifier pressed: Shift
|
|
|
|
|
+ bool KeyAlt; // Keyboard modifier pressed: Alt
|
|
|
|
|
+ bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows
|
|
|
|
|
+ bool KeysDown[512]; // 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).
|
|
|
|
|
+ ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
|
|
|
|
+ float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs (keyboard keys will be auto-mapped and be written here by ImGui::NewFrame)
|
|
|
|
|
|
|
|
// Functions
|
|
// Functions
|
|
|
IMGUI_API void AddInputCharacter(ImWchar c); // Add new character into InputCharacters[]
|
|
IMGUI_API void AddInputCharacter(ImWchar c); // Add new character into InputCharacters[]
|
|
@@ -967,9 +1022,10 @@ struct ImGuiIO
|
|
|
bool WantCaptureMouse; // When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. This is set by ImGui when it wants to use your mouse (e.g. unclicked mouse is hovering a window, or a widget is active).
|
|
bool WantCaptureMouse; // When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. This is set by ImGui when it wants to use your mouse (e.g. unclicked mouse is hovering a window, or a widget is active).
|
|
|
bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. This is set by ImGui when it wants to use your keyboard inputs.
|
|
bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. This is set by ImGui when it wants to use your keyboard inputs.
|
|
|
bool WantTextInput; // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
|
|
bool WantTextInput; // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
|
|
|
- bool WantMoveMouse; // [BETA-NAV] MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'.
|
|
|
|
|
|
|
+ bool WantMoveMouse; // MousePos has been altered, back-end should reposition mouse on next frame. Set only when ImGuiNavFlags_MoveMouse flag is enabled in io.NavFlags.
|
|
|
|
|
+ bool NavActive; // Directional navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
|
|
|
|
|
+ bool NavVisible; // Directional navigation is visible and allowed (will handle ImGuiKey_NavXXX events).
|
|
|
float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames
|
|
float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames
|
|
|
- int MetricsAllocs; // Number of active memory allocations
|
|
|
|
|
int MetricsRenderVertices; // Vertices output during last call to Render()
|
|
int MetricsRenderVertices; // Vertices output during last call to Render()
|
|
|
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
|
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
|
|
int MetricsActiveWindows; // Number of visible root windows (exclude child windows)
|
|
int MetricsActiveWindows; // Number of visible root windows (exclude child windows)
|
|
@@ -992,6 +1048,8 @@ struct ImGuiIO
|
|
|
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point
|
|
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point
|
|
|
float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed)
|
|
float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed)
|
|
|
float KeysDownDurationPrev[512]; // Previous duration the key has been down
|
|
float KeysDownDurationPrev[512]; // Previous duration the key has been down
|
|
|
|
|
+ float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
|
|
|
|
+ float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
|
|
|
|
|
|
|
IMGUI_API ImGuiIO();
|
|
IMGUI_API ImGuiIO();
|
|
|
};
|
|
};
|
|
@@ -1003,7 +1061,7 @@ struct ImGuiIO
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
namespace ImGui
|
|
namespace ImGui
|
|
|
{
|
|
{
|
|
|
- // OBSOLETED in 1.54 (from Dec 2017)
|
|
|
|
|
|
|
+ // OBSOLETED in 1.60 (from Dec 2017)
|
|
|
static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }
|
|
static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }
|
|
|
static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }
|
|
static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }
|
|
|
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; }
|
|
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; }
|