Difference between revisions of "Dear ImGui"

From GiderosMobile
Line 6: Line 6:
 
=== Description ===
 
=== Description ===
 
This is an implementation of the '''Dear ImGui''' library: '''https://github.com/ocornut/imgui'''.
 
This is an implementation of the '''Dear ImGui''' library: '''https://github.com/ocornut/imgui'''.
 +
 +
Dear ImGui is licensed under the '''MIT License''', see '''https://github.com/ocornut/imgui/blob/master/LICENSE.txt''' for more information.
  
 
To use Dear ImGui in your project you need to add the ImGui plugin and call require like so:
 
To use Dear ImGui in your project you need to add the ImGui plugin and call require like so:
Line 14: Line 16:
 
Current Gideros Dear ImGui version: '''1.89.6'''.
 
Current Gideros Dear ImGui version: '''1.89.6'''.
  
See introduction documentation here: https://pixtur.github.io/mkdocs-for-imgui/site/
+
=== User Guide ===
 
+
* Double-click on title bar to collapse window
and the full Dear ImGui demo here: https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html
+
* Click and drag on lower corner to resize window (double-click to auto fit window to its contents)
 
+
* CTRL+Click on a slider or drag box to input value as text
= Dear ImGui =
+
* TAB/SHIFT+TAB to cycle through keyboard editable fields
Dear ImGui is a '''bloat-free graphical user interface library for C++'''. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline-enabled application. It is fast, portable, renderer agnostic, and self-contained (no external dependencies).
+
* CTRL+Tab to select a window
 
+
* CTRL+Mouse Wheel to zoom window contents if ''io.FontAllowUserScaling'' is enabled
Dear ImGui is designed to '''enable fast iterations''' and to '''empower programmers''' to create '''content creation tools and visualization / debug tools''' (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal and lacks certain features commonly found in more high-level libraries. Among other things, full internationalization (right-to-left text, bidirectional text, text shaping etc.) and accessibility features are not supported.
+
* While inputing text:
 +
** CTRL+Left/Right to word jump
 +
** CTRL+A or double-click to select all
 +
** CTRL+X/C/V to use clipboard cut/copy/paste
 +
** CTRL+Z,CTRL+Y to undo/redo
 +
** ESCAPE to revert
 +
* With keyboard navigation enabled:
 +
** Arrow keys to navigate
 +
** Space to activate a widget
 +
** Return to input text into a widget
 +
** Escape to deactivate a widget, close popup, exit child window
 +
** Alt to jump to the menu layer of a window
  
Dear ImGui is particularly suited to integration in game engines (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on console platforms where operating system features are non-standard.
+
==== Widgets ====
 
 
Code sample (Lua):
 
<syntaxhighlight lang="lua">
 
imgui:text("Hello World!")
 
if imgui:button("button 01", 64, 16) then
 
print("button 01 clicked")
 
end
 
text, ischanged = imgui:inputText("text", text, 128, 0)
 
value, ischanged = imgui:sliderFloat("slider", value, 0, 30, "%.3f", 0)
 
</syntaxhighlight>
 
 
 
== License ==
 
Dear ImGui is licensed under the '''MIT License''', see https://github.com/ocornut/imgui/blob/master/LICENSE.txt for more information.
 
 
 
== Widgets ==
 
 
  '''Widgets: Color Editor/Picker'''
 
  '''Widgets: Color Editor/Picker'''
 
  * tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu
 
  * tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu
Line 63: Line 61:
 
  * We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
 
  * We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
  
 
+
=== Gideros Dear ImGui Documentation ===
----
 
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
*'''[[Dear ImGui FAQ]]'''
 
*'''[[Dear ImGui FAQ]]'''
Line 80: Line 77:
 
'''[[ImGui.Style]]'''<br/><!--GIDEROSOBJ:ImGui.Style-->
 
'''[[ImGui.Style]]'''<br/><!--GIDEROSOBJ:ImGui.Style-->
 
</div>
 
</div>
 
+
<!--introduction documentation (c++): https://pixtur.github.io/mkdocs-for-imgui/site/-->
 +
<!--Dear ImGui demo (c++): https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html-->
 
<!--=== Methods ===-->
 
<!--=== Methods ===-->
 
<!--GIDEROSMTD:ImGui.new() initializes ImGui-->
 
<!--GIDEROSMTD:ImGui.new() initializes ImGui-->

Revision as of 02:58, 9 October 2024

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2020.9

Description

This is an implementation of the Dear ImGui library: https://github.com/ocornut/imgui.

Dear ImGui is licensed under the MIT License, see https://github.com/ocornut/imgui/blob/master/LICENSE.txt for more information.

To use Dear ImGui in your project you need to add the ImGui plugin and call require like so:

require "ImGui"

Current Gideros Dear ImGui version: 1.89.6.

User Guide

  • Double-click on title bar to collapse window
  • Click and drag on lower corner to resize window (double-click to auto fit window to its contents)
  • CTRL+Click on a slider or drag box to input value as text
  • TAB/SHIFT+TAB to cycle through keyboard editable fields
  • CTRL+Tab to select a window
  • CTRL+Mouse Wheel to zoom window contents if io.FontAllowUserScaling is enabled
  • While inputing text:
    • CTRL+Left/Right to word jump
    • CTRL+A or double-click to select all
    • CTRL+X/C/V to use clipboard cut/copy/paste
    • CTRL+Z,CTRL+Y to undo/redo
    • ESCAPE to revert
  • With keyboard navigation enabled:
    • Arrow keys to navigate
    • Space to activate a widget
    • Return to input text into a widget
    • Escape to deactivate a widget, close popup, exit child window
    • Alt to jump to the menu layer of a window

Widgets

Widgets: Color Editor/Picker
* tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu
Widgets: Input with Keyboard
* If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.
* Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
Widgets: Regular Sliders
* CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
* Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
* Format string may also be set to NULL or use the default format ("%f" or "%d").

If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
Widgets: Drag Sliders
* CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and 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
* Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
* Format string may also be set to NULL or use the default format ("%f" or "%d").
* 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).
* Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
* Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
* We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.

Gideros Dear ImGui Documentation

OLD DOC TO BE MERGED SOMEHOW