|
@@ -140,12 +140,12 @@ struct ImVec4
|
|
|
#endif
|
|
#endif
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// ImGui end-user API
|
|
|
|
|
-// In a namespace so that user can add extra functions in your own separate file (please don't modify imgui.cpp/.h)
|
|
|
|
|
|
|
+// Dear ImGui end-user API
|
|
|
|
|
+// (In a namespace so you can add extra functions in your own separate file. Please don't modify imgui.cpp/.h!)
|
|
|
namespace ImGui
|
|
namespace ImGui
|
|
|
{
|
|
{
|
|
|
// Context creation and access
|
|
// Context creation and access
|
|
|
- // 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.
|
|
|
|
|
|
|
+ // Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between imgui contexts.
|
|
|
// All those functions are not reliant on the current context.
|
|
// All those functions are not reliant on the current context.
|
|
|
IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL);
|
|
IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL);
|
|
|
IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context
|
|
IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context
|
|
@@ -154,8 +154,8 @@ namespace ImGui
|
|
|
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert);
|
|
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert);
|
|
|
|
|
|
|
|
// Main
|
|
// Main
|
|
|
- IMGUI_API ImGuiIO& GetIO();
|
|
|
|
|
- IMGUI_API ImGuiStyle& GetStyle();
|
|
|
|
|
|
|
+ IMGUI_API ImGuiIO& GetIO(); // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
|
|
|
|
|
+ IMGUI_API ImGuiStyle& GetStyle(); // access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame.
|
|
|
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. (Obsolete: optionally call io.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.)
|
|
IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data. (Obsolete: optionally call io.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.)
|
|
|
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. (Obsolete: this used to be passed to your io.RenderDrawListsFn() function.)
|
|
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. (Obsolete: this used to be passed to your io.RenderDrawListsFn() function.)
|
|
@@ -315,10 +315,11 @@ namespace ImGui
|
|
|
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
|
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
|
|
|
|
|
|
|
// Widgets: Main
|
|
// Widgets: Main
|
|
|
|
|
+ // Most widgets return true when the value has been changed or when pressed/selected
|
|
|
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0)); // button
|
|
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0)); // button
|
|
|
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
|
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
|
|
- IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir);
|
|
|
|
|
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
|
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
|
|
|
|
+ IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
|
|
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
|
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
|
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
|
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
@@ -400,8 +401,9 @@ namespace ImGui
|
|
|
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.
|
|
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.
|
|
|
|
|
|
|
|
// Widgets: Trees
|
|
// Widgets: Trees
|
|
|
- IMGUI_API bool TreeNode(const char* label); // if returning 'true' the node is open and the tree id is pushed into the id stack. user is responsible for calling TreePop().
|
|
|
|
|
- IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().
|
|
|
|
|
|
|
+ // TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents.
|
|
|
|
|
+ IMGUI_API bool TreeNode(const char* label);
|
|
|
|
|
+ IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // helper variation to completely decorelate the id from the displayed string. Read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().
|
|
|
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // "
|
|
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // "
|
|
|
IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2);
|
|
IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2);
|
|
|
IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2);
|
|
IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2);
|
|
@@ -410,7 +412,7 @@ namespace ImGui
|
|
|
IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);
|
|
IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);
|
|
|
IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
|
IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
|
|
IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
|
IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
|
|
|
- IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call Push/Pop yourself for layout purpose
|
|
|
|
|
|
|
+ IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.
|
|
|
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
|
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
|
|
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
|
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
|
|
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
|
|
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
|
|
@@ -435,10 +437,10 @@ namespace ImGui
|
|
|
IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL);
|
|
IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL);
|
|
|
|
|
|
|
|
// Tooltips
|
|
// Tooltips
|
|
|
- IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set text tooltip under mouse-cursor, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip().
|
|
|
|
|
- IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);
|
|
|
|
|
- IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of contents).
|
|
|
|
|
|
|
+ IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items).
|
|
|
IMGUI_API void EndTooltip();
|
|
IMGUI_API void EndTooltip();
|
|
|
|
|
+ IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip().
|
|
|
|
|
+ IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);
|
|
|
|
|
|
|
|
// Menus
|
|
// Menus
|
|
|
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar.
|
|
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar.
|
|
@@ -501,11 +503,12 @@ namespace ImGui
|
|
|
|
|
|
|
|
// 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. This will continuously return true while holding mouse button on an item. 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 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) == IsMouseClicked(0) && IsItemHovered()
|
|
|
|
|
- IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.)
|
|
|
|
|
- IMGUI_API bool IsItemDeactivated(); // is the last item just made inactive (item was previously active), useful for Undo/Redo patterns.
|
|
|
|
|
|
|
+ IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered()
|
|
|
|
|
+ IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling)
|
|
|
|
|
+ IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.
|
|
|
|
|
+ IMGUI_API bool IsItemDeactivatedAfterChange(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
|
|
|
IMGUI_API bool IsAnyItemHovered();
|
|
IMGUI_API bool IsAnyItemHovered();
|
|
|
IMGUI_API bool IsAnyItemActive();
|
|
IMGUI_API bool IsAnyItemActive();
|
|
|
IMGUI_API bool IsAnyItemFocused();
|
|
IMGUI_API bool IsAnyItemFocused();
|
|
@@ -818,9 +821,9 @@ enum ImGuiConfigFlags_
|
|
|
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[].
|
|
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[].
|
|
|
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad.
|
|
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad.
|
|
|
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
|
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
|
|
- ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag with io.NavActive is set.
|
|
|
|
|
- ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information back-end
|
|
|
|
|
- ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility.
|
|
|
|
|
|
|
+ ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.
|
|
|
|
|
+ ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the back-end.
|
|
|
|
|
+ ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility. Use if the back-end cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead.
|
|
|
|
|
|
|
|
// User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui)
|
|
// User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui)
|
|
|
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware.
|
|
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware.
|
|
@@ -830,8 +833,8 @@ enum ImGuiConfigFlags_
|
|
|
// Back-end capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom back-end.
|
|
// Back-end capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom back-end.
|
|
|
enum ImGuiBackendFlags_
|
|
enum ImGuiBackendFlags_
|
|
|
{
|
|
{
|
|
|
- ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end supports and has a connected gamepad.
|
|
|
|
|
- ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end supports reading GetMouseCursor() to change the OS cursor shape.
|
|
|
|
|
|
|
+ ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end supports gamepad and currently has one connected.
|
|
|
|
|
+ ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end supports honoring GetMouseCursor() value to change the OS cursor shape.
|
|
|
ImGuiBackendFlags_HasSetMousePos = 1 << 2 // Back-end supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).
|
|
ImGuiBackendFlags_HasSetMousePos = 1 << 2 // Back-end supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).
|
|
|
};
|
|
};
|
|
|
|
|
|