Difference between revisions of "Dear ImGui"
From GiderosMobile
(wip) |
|||
Line 85: | Line 85: | ||
<!--GIDEROSMTD:ImGui:setTouchGesturesEnabled(bool)--> | <!--GIDEROSMTD:ImGui:setTouchGesturesEnabled(bool)--> | ||
<!--GIDEROSMTD:ImGui:isTouchGesturesEnabled() bool = ImGui:isTouchGesturesEnabled()--> | <!--GIDEROSMTD:ImGui:isTouchGesturesEnabled() bool = ImGui:isTouchGesturesEnabled()--> | ||
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:Imgui:getIO() local IO = Imgui:getIO()--> |
− | <!--GIDEROSMTD:IO:getFonts() FontAtlas = IO:getFonts()--> | + | <!--GIDEROSMTD:IO:getFonts() local FontAtlas = IO:getFonts()--> |
− | <!--GIDEROSMTD:FontAtlas:addFont(ttf_font_path, font_size [, options]) Font = FontAtlas:addFont(...)--> | + | <!--GIDEROSMTD:FontAtlas:addFont(ttf_font_path, font_size [, options]) local Font = FontAtlas:addFont(...)--> |
<!--GIDEROSMTD:FontAtlas:addFonts(fontsDescription)--> | <!--GIDEROSMTD:FontAtlas:addFonts(fontsDescription)--> | ||
− | <!--GIDEROSMTD:FontAtlas:getFont([index]) Font = FontAtlas:getFont(...) gets font by index (if index is 0 or nil | + | <!--GIDEROSMTD:FontAtlas:getFont([index]) local Font = FontAtlas:getFont(...) gets font by index (if index is 0 or nil get default font instance)--> |
<!--GIDEROSMTD:FontAtlas:build() call after multiple FontAtlas:addFont(...) calls to update ImGui font atlas--> | <!--GIDEROSMTD:FontAtlas:build() call after multiple FontAtlas:addFont(...) calls to update ImGui font atlas--> | ||
<!--GIDEROSMTD:FontAtlas:clearInputData()--> | <!--GIDEROSMTD:FontAtlas:clearInputData()--> | ||
Line 213: | Line 213: | ||
<!--GIDEROSMTD:Style:setSeparatorTextPadding(x, y)--> | <!--GIDEROSMTD:Style:setSeparatorTextPadding(x, y)--> | ||
<!--GIDEROSMTD:Style:getSeparatorTextPadding() x, y = Style:getSeparatorTextPadding()--> | <!--GIDEROSMTD:Style:getSeparatorTextPadding() x, y = Style:getSeparatorTextPadding()--> | ||
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui:setDarkStyle()--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui:setLightStyle()--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui:setClassicStyle()--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertHEXtoRGB(color [, alpha = 1]) r, g, b, a = ImGui.colorConvertHEXtoRGB(color [, alpha = 1])--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertRGBtoHEX(r, g, b) hex = ImGui.colorConvertRGBtoHEX(r, g, b)--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertRGBtoHSV(r, g, b) h, s, v = ImGui.colorConvertRGBtoHSV(r, g, b)--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertHSVtoRGB(h, s, v) r, g, b = ImGui.colorConvertHSVtoRGB(h, s, v)--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertHEXtoHSV(hex) h, s, v = ImGui.colorConvertHEXtoHSV(hex)--> |
− | <!--GIDEROSMTD: | + | <!--GIDEROSMTD:ImGui.colorConvertHSVtoHEX(h, s, v) hex = ImGui.colorConvertHSVtoHEX(h, s, v)--> |
− | <!--GIDEROSMTD: | + | |
+ | |||
+ | <!--GIDEROSMTD:ImGui:getIO() local IO = ImGui:getIO()--> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <!--GIDEROSMTD:IO:setFontDefault(font)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigFlags() local ImGuiConfigFlag = IO:getConfigFlags()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigFlags(ImGui.ConfigFlag)--> | ||
+ | <!--GIDEROSMTD:IO:addConfigFlags(ImGui.ConfigFlag)--> | ||
+ | <!--GIDEROSMTD:IO:getBackendFlags() local ImGuiBackendFlag = IO:getBackendFlags()--> | ||
+ | <!--GIDEROSMTD:IO:setBackendFlags(ImGui.BackendFlag)--> | ||
+ | <!--GIDEROSMTD:IO:getIniSavingRate() number = IO:getIniSavingRate()--> | ||
+ | <!--GIDEROSMTD:IO:setIniSavingRate(number)--> | ||
+ | <!--GIDEROSMTD:IO:getIniFilename() string = IO:getIniFilename()--> | ||
+ | <!--GIDEROSMTD:IO:setIniFilename(string)--> | ||
+ | <!--GIDEROSMTD:IO:saveIniSettings([path]) -- if path is not defined it uses default path, which is set by IO:setIniFilename()--> | ||
+ | <!--GIDEROSMTD:IO:loadIniSettings([path])--> | ||
+ | <!--GIDEROSMTD:IO:getLogFilename() string = IO:getLogFilename()--> | ||
+ | <!--GIDEROSMTD:IO:setLogFilename(string)--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDoubleClickTime() number = IO:getMouseDoubleClickTime()--> | ||
+ | <!--GIDEROSMTD:IO:setMouseDoubleClickTime(number)--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDragThreshold() number = IO:getMouseDragThreshold()--> | ||
+ | <!--GIDEROSMTD:IO:setMouseDragThreshold(number)--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDrawCursor() flag = IO:getMouseDrawCursor()--> | ||
+ | <!--GIDEROSMTD:IO:setMouseDrawCursor(flag)--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDoubleClickMaxDist() number = IO:getMouseDoubleClickMaxDist()--> | ||
+ | <!--GIDEROSMTD:IO:setMouseDoubleClickMaxDist(number)--> | ||
+ | <!--GIDEROSMTD:IO:getKeyRepeatDelay() number = IO:getKeyRepeatDelay()--> | ||
+ | <!--GIDEROSMTD:IO:setKeyRepeatDelay(number)--> | ||
+ | <!--GIDEROSMTD:IO:getKeyRepeatRate() number = IO:getKeyRepeatRate()--> | ||
+ | <!--GIDEROSMTD:IO:setKeyRepeatRate(number)--> | ||
+ | <!--GIDEROSMTD:IO:getFontGlobalScale() number = IO:getFontGlobalScale()--> | ||
+ | <!--GIDEROSMTD:IO:setFontGlobalScale(number)--> | ||
+ | <!--GIDEROSMTD:IO:getFontAllowUserScaling() bool = IO:getFontAllowUserScaling()--> | ||
+ | <!--GIDEROSMTD:IO:setFontAllowUserScaling(bool)--> | ||
+ | <!--GIDEROSMTD:IO:getDisplayFramebufferScale() number, number = IO:getDisplayFramebufferScale()--> | ||
+ | <!--GIDEROSMTD:IO:setDisplayFramebufferScale(number, number)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigMacOSXBehaviors() bool = IO:getConfigMacOSXBehaviors()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigMacOSXBehaviors(bool)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigInputTextCursorBlink() bool = IO:getConfigInputTextCursorBlink()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigInputTextCursorBlink(bool)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigWindowsResizeFromEdges() bool = IO:getConfigWindowsResizeFromEdges()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigWindowsResizeFromEdges(bool)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigWindowsMoveFromTitleBarOnly() bool = IO:getConfigWindowsMoveFromTitleBarOnly()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigWindowsMoveFromTitleBarOnly(bool)--> | ||
+ | <!--GIDEROSMTD:IO:getConfigWindowsMemoryCompactTimer() number = IO:getConfigWindowsMemoryCompactTimer()--> | ||
+ | <!--GIDEROSMTD:IO:setConfigWindowsMemoryCompactTimer(number)--> | ||
+ | <!--GIDEROSMTD:IO:getBackendPlatformName() string = IO:getBackendPlatformName()--> | ||
+ | <!--GIDEROSMTD:IO:getBackendRendererName() string = IO:getBackendRendererName()--> | ||
+ | <!--GIDEROSMTD:IO:IsMouseDown(button) bool = IO:IsMouseDown(button)--> | ||
+ | <!--GIDEROSMTD:IO:getMouseWheel() number = IO:getMouseWheel()--> | ||
+ | <!--GIDEROSMTD:IO:getMouseWheelH() number = IO:getMouseWheelH()--> | ||
+ | <!--GIDEROSMTD:IO:wantCaptureMouse() flag = IO:wantCaptureMouse()--> | ||
+ | <!--GIDEROSMTD:IO:wantCaptureKeyboard() flag = IO:wantCaptureKeyboard()--> | ||
+ | <!--GIDEROSMTD:IO:wantTextInput() flag = IO:wantTextInput()--> | ||
+ | <!--GIDEROSMTD:IO:wantSetMousePos() flag = IO:wantSetMousePos()--> | ||
+ | <!--GIDEROSMTD:IO:wantSaveIniSettings() flag = IO:wantSaveIniSettings()--> | ||
+ | <!--GIDEROSMTD:IO:getFramerate() number = IO:getFramerate()--> | ||
+ | <!--GIDEROSMTD:IO:getMetricsRenderVertices() number = IO:getMetricsRenderVertices()--> | ||
+ | <!--GIDEROSMTD:IO:getMetricsRenderIndices() number = IO:getMetricsRenderIndices()--> | ||
+ | <!--GIDEROSMTD:IO:getMetricsRenderWindows() number = IO:getMetricsRenderWindows()--> | ||
+ | <!--GIDEROSMTD:IO:getMetricsActiveWindows() number = IO:getMetricsActiveWindows()--> | ||
+ | <!--GIDEROSMTD:IO:getMetricsActiveAllocations() number = IO:getMetricsActiveAllocations()--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDelta() x, y = IO:getMouseDelta()--> | ||
+ | <!--GIDEROSMTD:IO:getMouseDownSec(mouse_button) number = IO:getMouseDownSec(mouse_button)--> | ||
+ | <!--GIDEROSMTD:IO:setDisplaySize(w, h)--> | ||
+ | <!--GIDEROSMTD:IO:getDisplaySize() w, h = IO:getDisplaySize()--> | ||
+ | <!--GIDEROSMTD:IO:getDeltaTime() number = IO:getDeltaTime()--> | ||
+ | <!--GIDEROSMTD:IO:resetMouseDown() reset mouse buttons state--> | ||
+ | <!--GIDEROSMTD:IO:resetKeysDown() reset key states (including ALT/SHIFT/CTRL/SUPER (META))--> | ||
+ | <!--GIDEROSMTD:IO:setModKeyDown(key_code, bool) set ALT/SHIFT/CTRL/SUPER (META) key state ("key_code" is a gideros MOD key)--> | ||
+ | <!--GIDEROSMTD:IO:setKeysDown(key_code, bool) set any key state ("key_code" is a Gideros regular "keyCode")--> | ||
+ | <!--GIDEROSMTD:IO:addInputCharactersUTF8(text) adds text to active text input widget--> | ||
+ | <!--GIDEROSMTD:IO:setMouseWheel(number) emulate wheel scrolling--> | ||
+ | <!--GIDEROSMTD:IO:setMousePos(x, y) sets mouse position (data only, no visual changes)--> | ||
+ | <!--GIDEROSMTD:IO:setMouseDown(mouse_button, state) set mouse state, where index: 0 - left mouse, 1 - right, 2 - middle, 3 - unused, 4 - unused ("mouse_button" is a Gideros mouse button code)--> | ||
+ | <!--GIDEROSMTD:IO:addKeyEvent(key, down) "key" is any ImGui KeyCode (check keyboard-keys), "down" is a boolean--> | ||
+ | <!--GIDEROSMTD:IO:addKeyAnalogEvent(key, down, number) "key" is any ImGui KeyCode (check keyboard-keys), "down" is a boolean--> | ||
+ | <!--GIDEROSMTD:IO:addMousePosEvent(x, y)--> | ||
+ | <!--GIDEROSMTD:IO:addMouseButtonEvent(button, down) "button" is any ImGui button (check MouseButton), "down" is a boolean--> | ||
+ | <!--GIDEROSMTD:IO:addMouseWheelEvent(x, y)--> | ||
+ | <!--GIDEROSMTD:IO:setAppAcceptingEvents([accepting_events = true])--> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
<!--GIDEROSMTD:imgui:getIO() IO = imgui:getIO()--> | <!--GIDEROSMTD:imgui:getIO() IO = imgui:getIO()--> | ||
<!--GIDEROSMTD:imgui:getIO() IO = imgui:getIO()--> | <!--GIDEROSMTD:imgui:getIO() IO = imgui:getIO()--> |
Revision as of 19:42, 9 October 2024
Supported platforms:
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