diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b0f421..7c6bd53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,9 +47,6 @@ jobs: run: | cmake -DCMAKE_CXX_FLAGS='-DIMGUI_USE_WCHAR32' . cmake --build . -j4 - - name: Build docs - run: | - tools/build_docs.sh - name: Set up environment if: runner.os != 'Windows' working-directory: ./cimgui @@ -68,11 +65,6 @@ jobs: - name: Build demo run: | crystal build --cross-compile examples/demo_sfml.cr - - name: Deploy docs to gh-pages - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && runner.os == 'Linux' - uses: oprypin/push-to-gh-pages@v3 - with: - publish_dir: ./docs - name: Check formatting if: matrix.crystal == 'latest' run: | diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..708afa1 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,27 @@ +name: Deploy docs +on: + push: + pull_request: + schedule: + - cron: '0 6 * * 6' +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + steps: + - name: Download source + uses: actions/checkout@v2 + - name: Install Crystal + uses: oprypin/install-crystal@v1 + - name: Install Python + uses: actions/setup-python@v2 + - name: Install dependencies + run: pip install --no-deps -r docs/requirements.txt + - name: Build site + run: mkdocs build + - name: Deploy to gh-pages + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: oprypin/push-to-gh-pages@v3 + with: + publish_dir: site + commit_message: 'Generate docs: ' diff --git a/.gitignore b/.gitignore index efe03d2..374698c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/docs/ +/site/ lib/ /bin/ /.shards/ diff --git a/docs/css/mkdocstrings.css b/docs/css/mkdocstrings.css new file mode 100644 index 0000000..dff97be --- /dev/null +++ b/docs/css/mkdocstrings.css @@ -0,0 +1,14 @@ +/* https://mkdocstrings.github.io/crystal/styling.html#recommended-styles */ + +/* Indent and distinguish sub-items */ +div.doc-contents { + padding-left: 15px; + border-left: 4px solid rgba(230, 230, 230); +} + +.doc-heading { + background-color: var(--md-code-bg-color); +} +h4.doc-heading { + font-weight: initial; +} diff --git a/docs/drawing.md b/docs/drawing.md new file mode 100644 index 0000000..ed60be7 --- /dev/null +++ b/docs/drawing.md @@ -0,0 +1,306 @@ +# Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData) +Hold a series of drawing commands. The user provides a renderer for [`ImDrawData`][ImGui::ImDrawData] which essentially contains an array of [`ImDrawList`][ImGui::ImDrawList]. + +The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking. + +ImDrawCallback: Draw callbacks for advanced uses [configurable type: override in imconfig.h] +NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering, +you can poke into the draw list for that! Draw callback may be useful for example to: + A) Change your GPU render state, + B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc. + +The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }' +If you want to override the signature of ImDrawCallback, you can simply use e.g. '#define ImDrawCallback MyDrawCallback' (in imconfig.h) + update rendering backend accordingly. + +Special Draw callback value to request renderer backend to reset the graphics/render state. +The renderer backend needs to handle this special value, otherwise it will crash trying to call a function at this address. +This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored. +It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an [`image`][ImGui.image] call). + +## Typically, 1 command = 1 GPU draw call (unless command is a callback) + +- VtxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled, + this fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices. + Backends made for <1.71. will typically ignore the VtxOffset fields. +- The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for). + +### ::: ImGui::ImDrawCmd + +##### ::: ImGui::ImDrawCmd.clip_rect + + 4*4 // Clipping rectangle (x1, y1, x2, y2). Subtract [`ImDrawData`][ImGui::ImDrawData]->DisplayPos to get clipping rectangle in "viewport" coordinates + +##### ::: ImGui::ImDrawCmd.texture_id + + 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to [`image`][ImGui.image]*() functions. Ignore if never using images or multiple fonts atlas. + +##### ::: ImGui::ImDrawCmd.vtx_offset + + 4 // Start offset in vertex buffer. ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to support meshes larger than 64K vertices with 16-bit indices. + +##### ::: ImGui::ImDrawCmd.idx_offset + + 4 // Start offset in index buffer. + +##### ::: ImGui::ImDrawCmd.elem_count + + 4 // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee [`ImDrawList`][ImGui::ImDrawList]'s vtx_buffer[] array, indices in idx_buffer[]. + +##### ::: ImGui::ImDrawCmd.user_callback + + 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. + +##### ::: ImGui::ImDrawCmd.user_callback_data + + 4-8 // The draw callback code can access this. + + Also ensure our padding fields are zeroed + +Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function for an upcoming feature) + +## Vertex layout + +### ::: ImGui::ImDrawVert + +##### ::: ImGui::ImDrawVert.pos + +##### ::: ImGui::ImDrawVert.uv + +##### ::: ImGui::ImDrawVert.col + +You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h +The code expect [`ImVec2`][ImGui::ImVec2] pos (8 bytes), [`ImVec2`][ImGui::ImVec2] uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. +The type has to be described within the macro (you can either declare the struct or use a typedef). This is because [`ImVec2`][ImGui::ImVec2]/ImU32 are likely not declared a the time you'd want to set your type up. +NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. + +## [Internal] For use by [`ImDrawList`][ImGui::ImDrawList] + +### ::: ImGui::ImDrawCmdHeader + +##### ::: ImGui::ImDrawCmdHeader.clip_rect + +##### ::: ImGui::ImDrawCmdHeader.texture_id + +##### ::: ImGui::ImDrawCmdHeader.vtx_offset + +## [Internal] For use by [`ImDrawListSplitter`][ImGui::ImDrawListSplitter] + +### ::: ImGui::ImDrawChannel + +Split/Merge functions are used to split the draw list into different layers which can be drawn into out of order. +This is used by the [`columns`][ImGui.columns]/Tables API, so items of each column can be batched together in a same draw call. + +### ::: ImGui::ImDrawListSplitter + + Current channel number (0) + Number of active channels (1+) + Draw channels (not resized down so _Count might be < Channels.Size) + + Do not clear Channels[] so our allocations are reused next frame + +## Flags for [`ImDrawList`][ImGui::ImDrawList] functions +(Legacy: bit 0 must always correspond to ImDrawFlags_Closed to be backward compatible with old API using a bool. Bits 1..3 must be unused) + +### ::: ImGui::ImDrawFlags + +- `None` + +- `Closed` + PathStroke(), AddPolyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason) + +- `RoundCornersTopLeft` + AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners). Was 0x01. + +- `RoundCornersTopRight` + AddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners). Was 0x02. + +- `RoundCornersBottomLeft` + AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners). Was 0x04. + +- `RoundCornersBottomRight` + AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding > 0.0f, we default to all corners). Wax 0x08. + +- `RoundCornersNone` + AddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag! + +- `RoundCornersTopLeft`, `RoundCornersTopRight`, `RoundCornersTop` + +- `RoundCornersBottomLeft`, `RoundCornersBottomRight`, `RoundCornersBottom` + +- `RoundCornersTopLeft`, `RoundCornersBottomLeft`, `RoundCornersLeft` + +- `RoundCornersTopRight`, `RoundCornersBottomRight`, `RoundCornersRight` + +- `RoundCornersTopLeft`, `RoundCornersTopRight`, `RoundCornersBottomLeft`, `RoundCornersBottomRight`, `RoundCornersAll` + +- `RoundCornersAll`, `RoundCornersDefault_` + Default to ALL corners if none of the _RoundCornersXX flags are specified. + +- `RoundCornersNone`, `RoundCornersAll`, `RoundCornersMask_` + +Flags for [`ImDrawList`][ImGui::ImDrawList] instance. Those are set automatically by ImGui:: functions from [`ImGuiIO`][ImGui::ImGuiIO] settings, and generally not manipulated directly. +It is however possible to temporarily alter flags between calls to [`ImDrawList`][ImGui::ImDrawList]:: functions. + +### ::: ImGui::ImDrawListFlags + +- `None` + +- `AntiAliasedLines` + Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) + +- `AntiAliasedLinesUseTex` + Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). + +- `AntiAliasedFill` + Enable anti-aliased edge around filled shapes (rounded rectangles, circles). + +- `AllowVtxOffset` + Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. + +## Draw command list +This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame, +all command lists are passed to your [`ImGuiIO`][ImGui::ImGuiIO]::RenderDrawListFn function for rendering. +Each dear imgui window contains its own [`ImDrawList`][ImGui::ImDrawList]. You can use [`get_window_draw_list`][ImGui.get_window_draw_list] to +access the current window draw list and draw custom primitives. +You can interleave normal ImGui:: calls and adding primitives to the current draw list. +In single viewport mode, top-left is == [`get_main_viewport`][ImGui.get_main_viewport]->Pos (generally 0,0), bottom-right is == [`get_main_viewport`][ImGui.get_main_viewport]->Pos+Size (generally io.DisplaySize). +You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!) +Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects. + +### ::: ImGui::ImDrawList + +#### This is what you have to render + +##### ::: ImGui::ImDrawList.cmd_buffer + + Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback. + +##### ::: ImGui::ImDrawList.idx_buffer + + Index buffer. Each command consume [`ImDrawCmd`][ImGui::ImDrawCmd]::ElemCount of those + +##### ::: ImGui::ImDrawList.vtx_buffer + + Vertex buffer. + +##### ::: ImGui::ImDrawList.flags + + Flags, you may poke into these to adjust anti-aliasing settings per-primitive. + +#### [Internal, used while building lists] + [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0. + Pointer to shared draw data (you can use [`get_draw_list_shared_data`][ImGui.get_draw_list_shared_data] to get the one from current ImGui context) + Pointer to owner window's name for debugging + [Internal] point within VtxBuffer.Data after each add command (to avoid using the [`ImVector`][ImGui::ImVector]<> operators too much) + [Internal] point within IdxBuffer.Data after each add command (to avoid using the [`ImVector`][ImGui::ImVector]<> operators too much) + [Internal] + [Internal] + [Internal] current path building + [Internal] template of active commands. Fields should match those of CmdBuffer.back(). + [Internal] for channels api (note: prefer using your own persistent instance of [`ImDrawListSplitter`][ImGui::ImDrawListSplitter]!) + [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content + +#### If you want to create [`ImDrawList`][ImGui::ImDrawList] instances, pass them [`get_draw_list_shared_data`][ImGui.get_draw_list_shared_data] or create and use your own ImDrawListSharedData (so you can use [`ImDrawList`][ImGui::ImDrawList] without ImGui) + + [`render`][ImGui.render]-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level [`push_clip_rect`][ImGui.push_clip_rect] to affect logic (hit-testing and widget culling) + +#### Primitives + +- Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. +- For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners. +- For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred). + In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12. + In future versions we will use textures to provide cheaper and higher-quality circles. + Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides. + + a: upper-left, b: lower-right (== upper-left + size) + a: upper-left, b: lower-right (== upper-left + size) + + Cubic Bezier (4 control points) + Quadratic Bezier (3 control points) + +#### [`image`][ImGui.image] primitives + +- Read FAQ to understand what ImTextureID is. +- "p_min" and "p_max" represent the upper-left and lower-right corners of the rectangle. +- "uv_min" and "uv_max" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture. + +#### Stateful path API, add points then finish with PathFillConvex() or PathStroke() + +- Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. + + Use precomputed angles for a 12 steps circle + Cubic Bezier (4 control points) + Quadratic Bezier (3 control points) + +#### Advanced + Your rendering function must check for 'UserCallback' in [`ImDrawCmd`][ImGui::ImDrawCmd] and call the function instead of rendering triangles. + This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible + Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. + +#### Advanced: Channels + +- Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives) +- Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end) +- FIXME-OBSOLETE: This API shouldn't have been in [`ImDrawList`][ImGui::ImDrawList] in the first place! + Prefer using your own persistent instance of [`ImDrawListSplitter`][ImGui::ImDrawListSplitter] as you can stack them. + Using the [`ImDrawList`][ImGui::ImDrawList]::ChannelsXXXX you cannot stack a split over another. + +#### Advanced: Primitives allocations + +- We render triangles (three vertices) +- All primitives needs to be reserved via PrimReserve() beforehand. + + Axis aligned rectangle (composed of two triangles) + + Write vertex with unique index + + OBSOLETED in 1.80 (Jan 2021) + OBSOLETED in 1.80 (Jan 2021) + +#### [Internal helpers] + +## All draw data to render a Dear ImGui frame +(NB: the style and the naming convention here is a little inconsistent, we currently preserve them for backward compatibility purpose, +as this is one of the oldest structure exposed by the library! Basically, [`ImDrawList`][ImGui::ImDrawList] == CmdList) + +### ::: ImGui::ImDrawData + +##### ::: ImGui::ImDrawData.valid + + Only valid after [`render`][ImGui.render] is called and before the next [`new_frame`][ImGui.new_frame] is called. + +##### ::: ImGui::ImDrawData.cmd_lists_count + + Number of [`ImDrawList`][ImGui::ImDrawList]* to render + +##### ::: ImGui::ImDrawData.total_idx_count + + For convenience, sum of all [`ImDrawList`][ImGui::ImDrawList]'s IdxBuffer.Size + +##### ::: ImGui::ImDrawData.total_vtx_count + + For convenience, sum of all [`ImDrawList`][ImGui::ImDrawList]'s VtxBuffer.Size + +##### ::: ImGui::ImDrawData.cmd_lists + + Array of [`ImDrawList`][ImGui::ImDrawList]* to render. The [`ImDrawList`][ImGui::ImDrawList] are owned by ImGuiContext and only pointed to from here. + +##### ::: ImGui::ImDrawData.display_pos + + Top-left position of the viewport to render (== top-left of the orthogonal projection matrix to use) (== [`get_main_viewport`][ImGui.get_main_viewport]->Pos for the main viewport, == (0.0) in most single-viewport applications) + +##### ::: ImGui::ImDrawData.display_size + + Size of the viewport to render (== [`get_main_viewport`][ImGui.get_main_viewport]->Size for the main viewport, == io.DisplaySize in most single-viewport applications) + +##### ::: ImGui::ImDrawData.framebuffer_scale + + Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. + +#### Functions + + The [`ImDrawList`][ImGui::ImDrawList] are owned by ImGuiContext! + Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! + Helper to scale the ClipRect field of each [`ImDrawCmd`][ImGui::ImDrawCmd]. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. + diff --git a/docs/flags.md b/docs/flags.md new file mode 100644 index 0000000..85680ec --- /dev/null +++ b/docs/flags.md @@ -0,0 +1,1618 @@ +# Flags & Enumerations + +## Flags for [`begin`][ImGui.begin] + +### ::: ImGui::ImGuiWindowFlags + +- `None` + +- `NoTitleBar` + Disable title-bar + +- `NoResize` + Disable user resizing with the lower-right grip + +- `NoMove` + Disable user moving the window + +- `NoScrollbar` + Disable scrollbars (window can still scroll with mouse or programmatically) + +- `NoScrollWithMouse` + Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. + +- `NoCollapse` + Disable user collapsing window by double-clicking on it. Also referred to as Window Menu [`button`][ImGui.button] (e.g. within a docking node). + +- `AlwaysAutoResize` + Resize every window to its content every frame + +- `NoBackground` + Disable drawing background color (WindowBg, etc.) and outside border. Similar as using [`set_next_window_bg_alpha`][ImGui.set_next_window_bg_alpha](0.0f). + +- `NoSavedSettings` + Never load/save settings in .ini file + +- `NoMouseInputs` + Disable catching mouse, hovering test with pass through. + +- `MenuBar` + Has a menu-bar + +- `HorizontalScrollbar` + Allow horizontal scrollbar to appear (off by default). You may use [`set_next_window_content_size`][ImGui.set_next_window_content_size]([`ImVec2`][ImGui::ImVec2](width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. + +- `NoFocusOnAppearing` + Disable taking focus when transitioning from hidden to visible state + +- `NoBringToFrontOnFocus` + Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) + +- `AlwaysVerticalScrollbar` + Always show vertical scrollbar (even if ContentSize.y < Size.y) + +- `AlwaysHorizontalScrollbar` + Always show horizontal scrollbar (even if ContentSize.x < Size.x) + +- `AlwaysUseWindowPadding` + Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) + +- `NoNavInputs` + No gamepad/keyboard navigation within the window + +- `NoNavFocus` + No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) + +- `UnsavedDocument` + Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. + +- `NoNavInputs`, `NoNavFocus`, `NoNav` + +- `NoTitleBar`, `NoResize`, `NoScrollbar`, `NoCollapse`, `NoDecoration` + +- `NoMouseInputs`, `NoNavInputs`, `NoNavFocus`, `NoInputs` + +#### [Internal] + +- `NavFlattened` + [BETA] On child window: allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows. + +- `ChildWindow` + Don't use! For internal use by BeginChild() + +- `Tooltip` + Don't use! For internal use by [`begin_tooltip`][ImGui.begin_tooltip] + +- `Popup` + Don't use! For internal use by [`begin_popup`][ImGui.begin_popup] + +- `Modal` + Don't use! For internal use by [`begin_popup_modal`][ImGui.begin_popup_modal] + +- `ChildMenu` + Don't use! For internal use by [`begin_menu`][ImGui.begin_menu] + [Obsolete] --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by backend (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) + +## Flags for [`input_text`][ImGui.input_text] + +### ::: ImGui::ImGuiInputTextFlags + +- `None` + +- `CharsDecimal` + Allow 0123456789.+-*/ + +- `CharsHexadecimal` + Allow 0123456789ABCDEFabcdef + +- `CharsUppercase` + Turn a..z into A..Z + +- `CharsNoBlank` + Filter out spaces, tabs + +- `AutoSelectAll` + Select entire text when first taking mouse focus + +- `EnterReturnsTrue` + Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the [`is_item_deactivated_after_edit`][ImGui.is_item_deactivated_after_edit] function. + +- `CallbackCompletion` + Callback on pressing TAB (for completion handling) + +- `CallbackHistory` + Callback on pressing Up/Down arrows (for history handling) + +- `CallbackAlways` + Callback on each iteration. User code may query cursor position, modify text buffer. + +- `CallbackCharFilter` + Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. + +- `AllowTabInput` + Pressing TAB input a '\t' character into the text field + +- `CtrlEnterForNewLine` + In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). + +- `NoHorizontalScroll` + Disable following the cursor horizontally + +- `AlwaysOverwrite` + Overwrite mode + +- `ReadOnly` + Read-only mode + +- `Password` + Password mode, display all characters as '*' + +- `NoUndoRedo` + Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). + +- `CharsScientific` + Allow 0123456789.+-*/eE (Scientific notation input) + +- `CallbackResize` + Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) + +- `CallbackEdit` + Callback on any edit (note that [`input_text`][ImGui.input_text] already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) + +#### Obsolete names (will be removed soon) + +- `AlwaysOverwrite` + [renamed in 1.82] name was not matching behavior + +## Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() + +### ::: ImGui::ImGuiTreeNodeFlags + +- `None` + +- `Selected` + Draw as selected + +- `Framed` + Draw frame with background (e.g. for CollapsingHeader) + +- `AllowItemOverlap` + Hit testing to allow subsequent widgets to overlap this one + +- `NoTreePushOnOpen` + Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + +- `NoAutoOpenOnLog` + Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) + +- `DefaultOpen` + Default node to be open + +- `OpenOnDoubleClick` + Need double-click to open node + +- `OpenOnArrow` + Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. + +- `Leaf` + No collapsing, no arrow (use as a convenience for leaf nodes). + +- `Bullet` + Display a bullet instead of arrow + +- `FramePadding` + Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling [`align_text_to_frame_padding`][ImGui.align_text_to_frame_padding]. + +- `SpanAvailWidth` + Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. + +- `SpanFullWidth` + Extend hit box to the left-most and right-most edges (bypass the indented area). + +- `NavLeftJumpsBackHere` + (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and [`tree_pop`][ImGui.tree_pop]) + FIXME: TODO: Disable automatic scroll on [`tree_pop`][ImGui.tree_pop] if node got just open and contents is not visible + +- `Framed`, `NoTreePushOnOpen`, `NoAutoOpenOnLog`, `CollapsingHeader` + +Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions. + +- To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat + small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags. + It is therefore guaranteed to be legal to pass a mouse button index in [`ImGuiPopupFlags`][ImGui::ImGuiPopupFlags]. +- For the same reason, we exceptionally default the [`ImGuiPopupFlags`][ImGui::ImGuiPopupFlags] argument of BeginPopupContextXXX functions to 1 instead of 0. + IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter + and want to another another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag. +- Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later). + +### ::: ImGui::ImGuiPopupFlags + +- `None` + +- `MouseButtonLeft` + For BeginPopupContext*(): open on Left Mouse release. Guaranteed to always be == 0 (same as ImGuiMouseButton_Left) + +- `MouseButtonRight` + For BeginPopupContext*(): open on Right Mouse release. Guaranteed to always be == 1 (same as ImGuiMouseButton_Right) + +- `MouseButtonMiddle` + For BeginPopupContext*(): open on Middle Mouse release. Guaranteed to always be == 2 (same as ImGuiMouseButton_Middle) + +- `MouseButtonMask_` + +- `MouseButtonDefault_` + +- `NoOpenOverExistingPopup` + For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack + +- `NoOpenOverItems` + For [`begin_popup_context_window`][ImGui.begin_popup_context_window]: don't return true when hovering items, only when hovering empty space + +- `AnyPopupId` + For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup. + +- `AnyPopupLevel` + For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level) + +- `AnyPopupId`, `AnyPopupLevel`, `AnyPopup` + +## Flags for ImGui::Selectable() + +### ::: ImGui::ImGuiSelectableFlags + +- `None` + +- `DontClosePopups` + Clicking this don't close parent popup window + +- `SpanAllColumns` + Selectable frame can span all columns (text will still fit in current column) + +- `AllowDoubleClick` + Generate press events on double clicks too + +- `Disabled` + Cannot be selected, display grayed out text + +- `AllowItemOverlap` + (WIP) Hit testing to allow subsequent widgets to overlap this one + +## Flags for [`begin_combo`][ImGui.begin_combo] + +### ::: ImGui::ImGuiComboFlags + +- `None` + +- `PopupAlignLeft` + Align the popup toward the left by default + +- `HeightSmall` + Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use [`set_next_window_size_constraints`][ImGui.set_next_window_size_constraints] prior to calling [`begin_combo`][ImGui.begin_combo] + +- `HeightRegular` + Max ~8 items visible (default) + +- `HeightLarge` + Max ~20 items visible + +- `HeightLargest` + As many fitting items as possible + +- `NoArrowButton` + Display on the preview box without the square arrow button + +- `NoPreview` + Display only a square arrow button + +- `HeightSmall`, `HeightRegular`, `HeightLarge`, `HeightLargest`, `HeightMask_` + +## Flags for [`begin_tab_bar`][ImGui.begin_tab_bar] + +### ::: ImGui::ImGuiTabBarFlags + +- `None` + +- `Reorderable` + Allow manually dragging tabs to re-order them + New tabs are appended at the end of list + +- `AutoSelectNewTabs` + Automatically select new tabs when they appear + +- `TabListPopupButton` + Disable buttons to open the tab list popup + +- `NoCloseWithMiddleMouseButton` + Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if ([`is_item_hovered`][ImGui.is_item_hovered] && [`is_mouse_clicked`][ImGui.is_mouse_clicked](2)) *p_open = false. + +- `NoTabListScrollingButtons` + Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) + +- `NoTooltip` + Disable tooltips when hovering a tab + +- `FittingPolicyResizeDown` + Resize tabs when they don't fit + +- `FittingPolicyScroll` + Add scroll buttons when tabs don't fit + +- `FittingPolicyResizeDown`, `FittingPolicyScroll`, `FittingPolicyMask_` + +- `FittingPolicyResizeDown`, `FittingPolicyDefault_` + +## Flags for [`begin_tab_item`][ImGui.begin_tab_item] + +### ::: ImGui::ImGuiTabItemFlags + +- `None` + +- `UnsavedDocument` + Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. + +- `SetSelected` + Trigger flag to programmatically make the tab selected when calling [`begin_tab_item`][ImGui.begin_tab_item] + +- `NoCloseWithMiddleMouseButton` + Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if ([`is_item_hovered`][ImGui.is_item_hovered] && [`is_mouse_clicked`][ImGui.is_mouse_clicked](2)) *p_open = false. + +- `NoPushId` + Don't call PushID(tab->ID)/[`pop_id`][ImGui.pop_id] on [`begin_tab_item`][ImGui.begin_tab_item]/[`end_tab_item`][ImGui.end_tab_item] + +- `NoTooltip` + Disable tooltip for the given tab + +- `NoReorder` + Disable reordering this tab or having another tab cross over this tab + +- `Leading` + Enforce the tab position to the left of the tab bar (after the tab list popup button) + +- `Trailing` + Enforce the tab position to the right of the tab bar (before the scrolling buttons) + +## Flags for [`begin_table`][ImGui.begin_table] + +- Important! Sizing policies have complex and subtle side effects, much more so than you would expect. + Read comments/demos carefully + experiment with live demos to get acquainted with them. +- The DEFAULT sizing policies are: + - Default to ImGuiTableFlags_SizingFixedFit if ScrollX is on, or if host window has ImGuiWindowFlags_AlwaysAutoResize. + - Default to ImGuiTableFlags_SizingStretchSame if ScrollX is off. +- When ScrollX is off: + - Table defaults to ImGuiTableFlags_SizingStretchSame -> all [`columns`][ImGui.columns] defaults to ImGuiTableColumnFlags_WidthStretch with same weight. + - [`columns`][ImGui.columns] sizing policy allowed: Stretch (default), Fixed/Auto. + - Fixed [`columns`][ImGui.columns] (if any) will generally obtain their requested width (unless the table cannot fit them all). + - Stretch [`columns`][ImGui.columns] will share the remaining width according to their respective weight. + - Mixed Fixed/Stretch columns is possible but has various side-effects on resizing behaviors. + The typical use of mixing sizing policies is: any number of LEADING Fixed columns, followed by one or two TRAILING Stretch columns. + (this is because the visible order of columns have subtle but necessary effects on how they react to manual resizing). +- When ScrollX is on: + - Table defaults to ImGuiTableFlags_SizingFixedFit -> all [`columns`][ImGui.columns] defaults to ImGuiTableColumnFlags_WidthFixed + - [`columns`][ImGui.columns] sizing policy allowed: Fixed/Auto mostly. + - Fixed [`columns`][ImGui.columns] can be enlarged as needed. Table will show an horizontal scrollbar if needed. + - When using auto-resizing (non-resizable) fixed columns, querying the content width to use item right-alignment e.g. [`set_next_item_width`][ImGui.set_next_item_width](-FLT_MIN) doesn't make sense, would create a feedback loop. + - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in [`begin_table`][ImGui.begin_table]. + If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful again. +- Read on documentation at the top of imgui_tables.cpp for details. + +### ::: ImGui::ImGuiTableFlags + +#### Features + +- `None` + +- `Resizable` + Enable resizing columns. + +- `Reorderable` + Enable reordering columns in header row (need calling [`table_setup_column`][ImGui.table_setup_column] + [`table_headers_row`][ImGui.table_headers_row] to display headers) + +- `Hideable` + Enable hiding/disabling columns in context menu. + +- `Sortable` + Enable sorting. Call [`table_get_sort_specs`][ImGui.table_get_sort_specs] to obtain sort specs. Also see ImGuiTableFlags_SortMulti and ImGuiTableFlags_SortTristate. + +- `NoSavedSettings` + Disable persisting columns order, width and sort settings in the .ini file. + +- `ContextMenuInBody` + Right-click on columns body/contents will display table context menu. By default it is available in [`table_headers_row`][ImGui.table_headers_row]. +Decorations + +- `RowBg` + Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling [`table_set_bg_color`][ImGui.table_set_bg_color] with ImGuiTableBgFlags_RowBg0 on each row manually) + +- `BordersInnerH` + Draw horizontal borders between rows. + +- `BordersOuterH` + Draw horizontal borders at the top and bottom. + +- `BordersInnerV` + Draw vertical borders between columns. + +- `BordersOuterV` + Draw vertical borders on the left and right sides. + +- `BordersInnerH`, `BordersOuterH`, `BordersH` + Draw horizontal borders. + +- `BordersInnerV`, `BordersOuterV`, `BordersV` + Draw vertical borders. + +- `BordersInnerH`, `BordersInnerV`, `BordersInner` + Draw inner borders. + +- `BordersOuterH`, `BordersOuterV`, `BordersOuter` + Draw outer borders. + +- `BordersInner`, `BordersOuter`, `Borders` + Draw all borders. + +- `NoBordersInBody` + [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style + +- `NoBordersInBodyUntilResize` + [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style +Sizing Policy (read above for defaults) + +- `SizingFixedFit` + [`columns`][ImGui.columns] default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width. + +- `SizingFixedSame` + [`columns`][ImGui.columns] default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible. + +- `SizingStretchProp` + [`columns`][ImGui.columns] default to _WidthStretch with default weights proportional to each columns contents widths. + +- `SizingStretchSame` + [`columns`][ImGui.columns] default to _WidthStretch with default weights all equal, unless overridden by [`table_setup_column`][ImGui.table_setup_column]. +Sizing Extra Options + +- `NoHostExtendX` + Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used. + +- `NoHostExtendY` + Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible. + +- `NoKeepColumnsVisible` + Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable. + +- `PreciseWidths` + Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth. +Clipping + +- `NoClip` + Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with [`table_setup_scroll_freeze`][ImGui.table_setup_scroll_freeze]. +Padding + +- `PadOuterX` + Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers. + +- `NoPadOuterX` + Default if BordersOuterV is off. Disable outer-most padding. + +- `NoPadInnerX` + Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off). +Scrolling + +- `ScrollX` + Enable horizontal scrolling. Require 'outer_size' parameter of [`begin_table`][ImGui.begin_table] to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. + +- `ScrollY` + Enable vertical scrolling. Require 'outer_size' parameter of [`begin_table`][ImGui.begin_table] to specify the container size. +Sorting + +- `SortMulti` + Hold shift when clicking headers to sort on multiple column. [`table_get_sort_specs`][ImGui.table_get_sort_specs] may return specs where (SpecsCount > 1). + +- `SortTristate` + Allow no sorting, disable default sorting. [`table_get_sort_specs`][ImGui.table_get_sort_specs] may return specs where (SpecsCount == 0). + +#### [Internal] Combinations and masks + +- `SizingFixedFit`, `SizingFixedSame`, `SizingStretchProp`, `SizingStretchSame`, `SizingMask_` + +#### Obsolete names (will be removed soon) + +- `SizingFixedFit`, `SizingStretchSame` + WIP Tables 2020/12 + +- `SizingFixedFit`, `SizingStretchSame` + WIP Tables 2021/01 + +## Flags for [`table_setup_column`][ImGui.table_setup_column] + +### ::: ImGui::ImGuiTableColumnFlags + +#### Input configuration flags + +- `None` + +- `Disabled` + Overriding/master disable flag: hide column, won't show in context menu (unlike calling [`table_set_column_enabled`][ImGui.table_set_column_enabled] which manipulates the user accessible state) + +- `DefaultHide` + Default as a hidden/disabled column. + +- `DefaultSort` + Default as a sorting column. + +- `WidthStretch` + Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp). + +- `WidthFixed` + Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable). + +- `NoResize` + Disable manual resizing. + +- `NoReorder` + Disable manual reordering this column, this will also prevent other columns from crossing over this column. + +- `NoHide` + Disable ability to hide/disable this column. + +- `NoClip` + Disable clipping for this column (all NoClip columns will render in a same draw command). + +- `NoSort` + Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table). + +- `NoSortAscending` + Disable ability to sort in the ascending direction. + +- `NoSortDescending` + Disable ability to sort in the descending direction. + +- `NoHeaderLabel` + [`table_headers_row`][ImGui.table_headers_row] will not submit label for this column. Convenient for some small columns. Name will still appear in context menu. + +- `NoHeaderWidth` + Disable header text width contribution to automatic column width. + +- `PreferSortAscending` + Make the initial sort direction Ascending when first sorting on this column (default). + +- `PreferSortDescending` + Make the initial sort direction Descending when first sorting on this column. + +- `IndentEnable` + Use current [`indent`][ImGui.indent] value when entering cell (default for column 0). + +- `IndentDisable` + Ignore current [`indent`][ImGui.indent] value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored. + +#### Output status flags, read-only via [`table_get_column_flags`][ImGui.table_get_column_flags] + +- `IsEnabled` + Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags. + +- `IsVisible` + Status: is visible == is enabled AND not clipped by scrolling. + +- `IsSorted` + Status: is currently part of the sort specs + +- `IsHovered` + Status: is hovered by mouse + +#### [Internal] Combinations and masks + +- `WidthStretch`, `WidthFixed`, `WidthMask_` + +- `IndentEnable`, `IndentDisable`, `IndentMask_` + +- `IsEnabled`, `IsVisible`, `IsSorted`, `IsHovered`, `StatusMask_` + +- `NoDirectResize_` + [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge) + +#### Obsolete names (will be removed soon) + +- `WidthFixed`, `NoResize` + Column will not stretch and keep resizing based on submitted contents. + +## Flags for [`table_next_row`][ImGui.table_next_row] + +### ::: ImGui::ImGuiTableRowFlags + +- `None` + +- `Headers` + Identify header row (set default background color + width of its contents accounted differently for auto column width) + +## Enum for [`table_set_bg_color`][ImGui.table_set_bg_color] +Background colors are rendering in 3 layers: + + - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set. + - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set. + - Layer 2: draw with CellBg color if set. + +The purpose of the two row/columns layers is to let you decide if a background color changes should override or blend with the existing color. +When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows. +If you set the color of RowBg0 target, your color will override the existing RowBg0 color. +If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color. + +### ::: ImGui::ImGuiTableBgTarget + +- `None` + +- `RowBg0` + Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used) + +- `RowBg1` + Set row background color 1 (generally used for selection marking) + +- `CellBg` + Set cell background color (top-most color) + +## Flags for [`is_window_focused`][ImGui.is_window_focused] + +### ::: ImGui::ImGuiFocusedFlags + +- `None` + +- `ChildWindows` + Return true if any children of the window is focused + +- `RootWindow` + Test from root window (top most parent of the current hierarchy) + +- `AnyWindow` + Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! + +- `NoPopupHierarchy` + Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) + Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) + +- `ChildWindows`, `RootWindow`, `RootAndChildWindows` + +## Flags for [`is_item_hovered`][ImGui.is_item_hovered], [`is_window_hovered`][ImGui.is_window_hovered] +Note: if you are trying to check whether your mouse should be dispatched to Dear ImGui or to your app, you should use 'io.WantCaptureMouse' instead! Please read the FAQ! +Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by [`is_window_hovered`][ImGui.is_window_hovered] calls. + +### ::: ImGui::ImGuiHoveredFlags + +- `None` + Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. + +- `ChildWindows` + [`is_window_hovered`][ImGui.is_window_hovered] only: Return true if any children of the window is hovered + +- `RootWindow` + [`is_window_hovered`][ImGui.is_window_hovered] only: Test from root window (top most parent of the current hierarchy) + +- `AnyWindow` + [`is_window_hovered`][ImGui.is_window_hovered] only: Return true if any window is hovered + +- `NoPopupHierarchy` + [`is_window_hovered`][ImGui.is_window_hovered] only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) + [`is_window_hovered`][ImGui.is_window_hovered] only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) + +- `AllowWhenBlockedByPopup` + Return true even if a popup window is normally blocking access to this item/window + Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. + +- `AllowWhenBlockedByActiveItem` + Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. + +- `AllowWhenOverlapped` + [`is_item_hovered`][ImGui.is_item_hovered] only: Return true even if the position is obstructed or overlapped by another window + +- `AllowWhenDisabled` + [`is_item_hovered`][ImGui.is_item_hovered] only: Return true even if the item is disabled + +- `NoNavOverride` + Disable using gamepad/keyboard navigation state when active, always query mouse. + +- `AllowWhenBlockedByPopup`, `AllowWhenBlockedByActiveItem`, `AllowWhenOverlapped`, `RectOnly` + +- `ChildWindows`, `RootWindow`, `RootAndChildWindows` + +## Flags for [`begin_drag_drop_source`][ImGui.begin_drag_drop_source], [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] + +### ::: ImGui::ImGuiDragDropFlags + +- `None` + +[`begin_drag_drop_source`][ImGui.begin_drag_drop_source] flags + +- `SourceNoPreviewTooltip` + By default, a successful call to [`begin_drag_drop_source`][ImGui.begin_drag_drop_source] opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. + +- `SourceNoDisableHover` + By default, when dragging we clear data so that [`is_item_hovered`][ImGui.is_item_hovered] will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call [`is_item_hovered`][ImGui.is_item_hovered] on the source item. + +- `SourceNoHoldToOpenOthers` + Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. + +- `SourceAllowNullID` + Allow items such as [`text`][ImGui.text], [`image`][ImGui.image] that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. + +- `SourceExtern` + External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. + +- `SourceAutoExpirePayload` + Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged) +[`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] flags + +- `AcceptBeforeDelivery` + [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. + +- `AcceptNoDrawDefaultRect` + Do not draw the default highlight rectangle when hovering over target. + +- `AcceptNoPreviewTooltip` + Request hiding the [`begin_drag_drop_source`][ImGui.begin_drag_drop_source] tooltip from the [`begin_drag_drop_target`][ImGui.begin_drag_drop_target] site. + +- `AcceptBeforeDelivery`, `AcceptNoDrawDefaultRect`, `AcceptPeekOnly` + For peeking ahead and inspecting the payload before delivery. + +Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui. + float[3]: Standard type for colors, without alpha. User code may use this type. + + float[4]: Standard type for colors. User code may use this type. + +## A primary data type + +### ::: ImGui::ImGuiDataType + +- `S8` + signed char / char (with sensible compilers) + +- `U8` + unsigned char + +- `S16` + short + +- `U16` + unsigned short + +- `S32` + int + +- `U32` + unsigned int + +- `S64` + long long / __int64 + +- `U64` + unsigned long long / unsigned __int64 + +- `Float` + float + +- `Double` + double + +- `COUNT` + +## A cardinal direction + +### ::: ImGui::ImGuiDir + +- `None` + +- `Left` + +- `Right` + +- `Up` + +- `Down` + +- `COUNT` + +## A sorting direction + +### ::: ImGui::ImGuiSortDirection + +- `None` + +- `Ascending` + Ascending = 0->9, A->Z etc. + +- `Descending` + Descending = 9->0, Z->A etc. + +Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87) +Keys value >= 512 are named keys (>= 1.87) + +### ::: ImGui::ImGuiKey + +#### Keyboard + +- `None` + +- `Tab` + == ImGuiKey_NamedKey_BEGIN + +- `LeftArrow` + +- `RightArrow` + +- `UpArrow` + +- `DownArrow` + +- `PageUp` + +- `PageDown` + +- `Home` + +- `End` + +- `Insert` + +- `Delete` + +- `Backspace` + +- `Space` + +- `Enter` + +- `Escape` + +- `LeftCtrl`, `LeftShift`, `LeftAlt`, `LeftSuper` + +- `RightCtrl`, `RightShift`, `RightAlt`, `RightSuper` + +- `Menu` + +- `Num0`, `Num1`, `Num2`, `Num3`, `Num4`, `Num5`, `Num6`, `Num7`, `Num8`, `Num9` + +- `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`, `I`, `J` + +- `K`, `L`, `M`, `N`, `O`, `P`, `Q`, `R`, `S`, `T` + +- `U`, `V`, `W`, `X`, `Y`, `Z` + +- `F1`, `F2`, `F3`, `F4`, `F5`, `F6` + +- `F7`, `F8`, `F9`, `F10`, `F11`, `F12` + +- `Apostrophe` + ' + +- `Comma` + , + +- `Minus` + - + +- `Period` + . + +- `Slash` + / + +- `Semicolon` + ; + +- `Equal` + = + +- `LeftBracket` + [ + +- `Backslash` + \ (this text inhibit multiline comment caused by backslash) + +- `RightBracket` + ] + +- `GraveAccent` + ` + +- `CapsLock` + +- `ScrollLock` + +- `NumLock` + +- `PrintScreen` + +- `Pause` + +- `Keypad0`, `Keypad1`, `Keypad2`, `Keypad3`, `Keypad4` + +- `Keypad5`, `Keypad6`, `Keypad7`, `Keypad8`, `Keypad9` + +- `KeypadDecimal` + +- `KeypadDivide` + +- `KeypadMultiply` + +- `KeypadSubtract` + +- `KeypadAdd` + +- `KeypadEnter` + +- `KeypadEqual` + +Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION action + +- `GamepadStart` + Menu (Xbox) + (Switch) Start/Options (PS) // -- + +- `GamepadBack` + View (Xbox) - (Switch) Share (PS) // -- + +- `GamepadFaceUp` + Y (Xbox) X (Switch) Triangle (PS) // -> ImGuiNavInput_Input + +- `GamepadFaceDown` + A (Xbox) B (Switch) Cross (PS) // -> ImGuiNavInput_Activate + +- `GamepadFaceLeft` + X (Xbox) Y (Switch) Square (PS) // -> ImGuiNavInput_Menu + +- `GamepadFaceRight` + B (Xbox) A (Switch) Circle (PS) // -> ImGuiNavInput_Cancel + +- `GamepadDpadUp` + D-pad Up // -> ImGuiNavInput_DpadUp + +- `GamepadDpadDown` + D-pad Down // -> ImGuiNavInput_DpadDown + +- `GamepadDpadLeft` + D-pad Left // -> ImGuiNavInput_DpadLeft + +- `GamepadDpadRight` + D-pad Right // -> ImGuiNavInput_DpadRight + +- `GamepadL1` + L Bumper (Xbox) L (Switch) L1 (PS) // -> ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow + +- `GamepadR1` + R Bumper (Xbox) R (Switch) R1 (PS) // -> ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast + +- `GamepadL2` + L Trigger (Xbox) ZL (Switch) L2 (PS) [Analog] + +- `GamepadR2` + R Trigger (Xbox) ZR (Switch) R2 (PS) [Analog] + +- `GamepadL3` + L Thumbstick (Xbox) L3 (Switch) L3 (PS) + +- `GamepadR3` + R Thumbstick (Xbox) R3 (Switch) R3 (PS) + +- `GamepadLStickUp` + [Analog] // -> ImGuiNavInput_LStickUp + +- `GamepadLStickDown` + [Analog] // -> ImGuiNavInput_LStickDown + +- `GamepadLStickLeft` + [Analog] // -> ImGuiNavInput_LStickLeft + +- `GamepadLStickRight` + [Analog] // -> ImGuiNavInput_LStickRight + +- `GamepadRStickUp` + [Analog] + +- `GamepadRStickDown` + [Analog] + +- `GamepadRStickLeft` + [Analog] + +- `GamepadRStickRight` + [Analog] + +#### Keyboard Modifiers (explicitly submitted by backend via AddKeyEvent() calls) + +- 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 [`is_key_pressed`][ImGui.is_key_pressed], [`is_key_released`][ImGui.is_key_released], 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... + +- `ModCtrl`, `ModShift`, `ModAlt`, `ModSuper` + +#### End of list + +- `COUNT` + No valid [`ImGuiKey`][ImGui::ImGuiKey] is ever greater than this value + +[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. [`is_key_pressed`][ImGui.is_key_pressed](MY_NATIVE_KEY_CODE) + +- `NamedKey_BEGIN` + +- `COUNT`, `NamedKey_END` + +- `NamedKey_BEGIN`, `NamedKey_END`, `NamedKey_COUNT` + +- `NamedKey_COUNT`, `KeysData_SIZE` + Size of KeysData[]: only hold named keys + +- `NamedKey_BEGIN`, `KeysData_OFFSET` + First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET). + +- `COUNT`, `KeysData_SIZE` + Size of KeysData[]: hold legacy 0..512 keycodes + named keys + +- `KeysData_OFFSET` + First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET). + +- `KeypadEnter` + Renamed in 1.87 + +Helper "flags" version of key-mods to store and compare multiple key-mods easily. Sometimes used for storage (e.g. io.KeyMods) but otherwise not much used in public API. + +### ::: ImGui::ImGuiModFlags + +- `None` + +- `Ctrl` + +- `Shift` + +- `Alt` + Menu + +- `Super` + Cmd/Super/Windows key + +## Gamepad/Keyboard navigation +Since >= 1.87 backends you generally don't need to care about this enum since io.NavInputs[] is setup automatically. This might become private/internal some day. +Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. [`new_frame`][ImGui.new_frame] will automatically fill io.NavInputs[] based on your io.AddKeyEvent() calls. +Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling [`new_frame`][ImGui.new_frame]. Note that io.NavInputs[] is cleared by [`end_frame`][ImGui.end_frame]. +Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets. + +### ::: ImGui::ImGuiNavInput + +#### Gamepad Mapping + +- `Activate` + Activate / Open / Toggle / Tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) + +- `Cancel` + Cancel / Close / Exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) + +- `Input` + [`text`][ImGui.text] input / On-Screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) + +- `Menu` + Tap: Toggle menu / Hold: Focus, Move, Resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) + +- `DpadLeft` + Move / Tweak / Resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) + +- `DpadRight` + +- `DpadUp` + +- `DpadDown` + +- `LStickLeft` + Scroll / Move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down + +- `LStickRight` + +- `LStickUp` + +- `LStickDown` + +- `FocusPrev` + Focus Next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + +- `FocusNext` + Focus Prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) + +- `TweakSlow` + Slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + +- `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) will be directly reading from keyboard keys instead of io.NavInputs[]. + +- `KeyLeft_` + Move left // = Arrow keys + +- `KeyRight_` + Move right + +- `KeyUp_` + Move up + +- `KeyDown_` + Move down + +- `COUNT` + +Configuration flags stored in io.ConfigFlags. Set by user/application. + +### ::: ImGui::ImGuiConfigFlags + +- `None` + +- `NavEnableKeyboard` + Master keyboard navigation enable flag. [`new_frame`][ImGui.new_frame] will automatically fill io.NavInputs[] based on io.AddKeyEvent() calls + +- `NavEnableGamepad` + Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad. + +- `NavEnableSetMousePos` + 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 backend, otherwise ImGui will react as if the mouse is jumping around back and forth. + +- `NavNoCaptureKeyboard` + Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. + +- `NoMouse` + Instruct imgui to clear mouse position/buttons in [`new_frame`][ImGui.new_frame]. This allows ignoring the mouse information set by the backend. + +- `NoMouseCursorChange` + Instruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use [`set_mouse_cursor`][ImGui.set_mouse_cursor] to change mouse cursor. You may want to honor requests from imgui by reading [`get_mouse_cursor`][ImGui.get_mouse_cursor] yourself instead. + +User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are NOT used by core Dear ImGui) + +- `IsSRGB` + Application is SRGB-aware. + +- `IsTouchScreen` + Application is using a touch screen instead of a mouse. + +Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend. + +### ::: ImGui::ImGuiBackendFlags + +- `None` + +- `HasGamepad` + Backend Platform supports gamepad and currently has one connected. + +- `HasMouseCursors` + Backend Platform supports honoring [`get_mouse_cursor`][ImGui.get_mouse_cursor] value to change the OS cursor shape. + +- `HasSetMousePos` + Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). + +- `RendererHasVtxOffset` + Backend Renderer supports [`ImDrawCmd`][ImGui::ImDrawCmd]::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. + +## Enumeration for PushStyleColor() / [`pop_style_color`][ImGui.pop_style_color] + +### ::: ImGui::ImGuiCol + +- `Text` + +- `TextDisabled` + +- `WindowBg` + Background of normal windows + +- `ChildBg` + Background of child windows + +- `PopupBg` + Background of popups, menus, tooltips windows + +- `Border` + +- `BorderShadow` + +- `FrameBg` + Background of checkbox, radio button, plot, slider, text input + +- `FrameBgHovered` + +- `FrameBgActive` + +- `TitleBg` + +- `TitleBgActive` + +- `TitleBgCollapsed` + +- `MenuBarBg` + +- `ScrollbarBg` + +- `ScrollbarGrab` + +- `ScrollbarGrabHovered` + +- `ScrollbarGrabActive` + +- `CheckMark` + +- `SliderGrab` + +- `SliderGrabActive` + +- `Button` + +- `ButtonHovered` + +- `ButtonActive` + +- `Header` + Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem + +- `HeaderHovered` + +- `HeaderActive` + +- `Separator` + +- `SeparatorHovered` + +- `SeparatorActive` + +- `ResizeGrip` + Resize grip in lower-right and lower-left corners of windows. + +- `ResizeGripHovered` + +- `ResizeGripActive` + +- `Tab` + TabItem in a TabBar + +- `TabHovered` + +- `TabActive` + +- `TabUnfocused` + +- `TabUnfocusedActive` + +- `PlotLines` + +- `PlotLinesHovered` + +- `PlotHistogram` + +- `PlotHistogramHovered` + +- `TableHeaderBg` + Table header background + +- `TableBorderStrong` + Table outer and header borders (prefer using Alpha=1.0 here) + +- `TableBorderLight` + Table inner borders (prefer using Alpha=1.0 here) + +- `TableRowBg` + Table row background (even rows) + +- `TableRowBgAlt` + Table row background (odd rows) + +- `TextSelectedBg` + +- `DragDropTarget` + Rectangle highlighting a drop target + +- `NavHighlight` + Gamepad/keyboard: current highlighted item + +- `NavWindowingHighlight` + Highlight window when using CTRL+TAB + +- `NavWindowingDimBg` + Darken/colorize entire screen behind the CTRL+TAB window list, when active + +- `ModalWindowDimBg` + Darken/colorize entire screen behind a modal window, when one is active + +- `COUNT` + +Enumeration for PushStyleVar() / [`pop_style_var`][ImGui.pop_style_var] to temporarily modify the [`ImGuiStyle`][ImGui::ImGuiStyle] structure. + +- The enum only refers to fields of [`ImGuiStyle`][ImGui::ImGuiStyle] which makes sense to be pushed/popped inside UI code. + During initialization or between frames, feel free to just poke into [`ImGuiStyle`][ImGui::ImGuiStyle] directly. +- Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description. + In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. + With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. +- When changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. + +### ::: ImGui::ImGuiStyleVar + +- `Alpha` + float Alpha + +- `DisabledAlpha` + float DisabledAlpha + +- `WindowPadding` + [`ImVec2`][ImGui::ImVec2] WindowPadding + +- `WindowRounding` + float WindowRounding + +- `WindowBorderSize` + float WindowBorderSize + +- `WindowMinSize` + [`ImVec2`][ImGui::ImVec2] WindowMinSize + +- `WindowTitleAlign` + [`ImVec2`][ImGui::ImVec2] WindowTitleAlign + +- `ChildRounding` + float ChildRounding + +- `ChildBorderSize` + float ChildBorderSize + +- `PopupRounding` + float PopupRounding + +- `PopupBorderSize` + float PopupBorderSize + +- `FramePadding` + [`ImVec2`][ImGui::ImVec2] FramePadding + +- `FrameRounding` + float FrameRounding + +- `FrameBorderSize` + float FrameBorderSize + +- `ItemSpacing` + [`ImVec2`][ImGui::ImVec2] ItemSpacing + +- `ItemInnerSpacing` + [`ImVec2`][ImGui::ImVec2] ItemInnerSpacing + +- `IndentSpacing` + float IndentSpacing + +- `CellPadding` + [`ImVec2`][ImGui::ImVec2] CellPadding + +- `ScrollbarSize` + float ScrollbarSize + +- `ScrollbarRounding` + float ScrollbarRounding + +- `GrabMinSize` + float GrabMinSize + +- `GrabRounding` + float GrabRounding + +- `TabRounding` + float TabRounding + +- `ButtonTextAlign` + [`ImVec2`][ImGui::ImVec2] ButtonTextAlign + +- `SelectableTextAlign` + [`ImVec2`][ImGui::ImVec2] SelectableTextAlign + +- `COUNT` + +Flags for [`invisible_button`][ImGui.invisible_button] [extended in imgui_internal.h] + +### ::: ImGui::ImGuiButtonFlags + +- `None` + +- `MouseButtonLeft` + React on left mouse button (default) + +- `MouseButtonRight` + React on right mouse button + +- `MouseButtonMiddle` + React on center mouse button + +#### [Internal] + +- `MouseButtonLeft`, `MouseButtonRight`, `MouseButtonMiddle`, `MouseButtonMask_` + +- `MouseButtonLeft`, `MouseButtonDefault_` + +## Flags for [`color_edit3`][ImGui.color_edit3] / [`color_edit4`][ImGui.color_edit4] / [`color_picker3`][ImGui.color_picker3] / [`color_picker4`][ImGui.color_picker4] / [`color_button`][ImGui.color_button] + +### ::: ImGui::ImGuiColorEditFlags + +- `None` + +- `NoAlpha` + // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: ignore Alpha component (will only read 3 components from the input pointer). + +- `NoPicker` + // ColorEdit: disable picker when clicking on color square. + +- `NoOptions` + // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. + +- `NoSmallPreview` + // ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs) + +- `NoInputs` + // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square). + +- `NoTooltip` + // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: disable tooltip when hovering the preview. + +- `NoLabel` + // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). + +- `NoSidePreview` + // ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead. + +- `NoDragDrop` + // ColorEdit: disable drag and drop target. [`color_button`][ImGui.color_button]: disable drag and drop source. + +- `NoBorder` + // [`color_button`][ImGui.color_button]: disable border (which is enforced by default) + +User Options (right-click on widget to change some of them). + +- `AlphaBar` + // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. + +- `AlphaPreview` + // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: display preview as a transparent color over a checkerboard, instead of opaque. + +- `AlphaPreviewHalf` + // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: display half opaque / half checkerboard, instead of opaque. + +- `HDR` + // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). + +- `DisplayRGB` + [Display] // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. + +- `DisplayHSV` + [Display] // " + +- `DisplayHex` + [Display] // " + +- `Uint8` + [DataType] // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: _display_ values formatted as 0..255. + +- `Float` + [DataType] // ColorEdit, ColorPicker, [`color_button`][ImGui.color_button]: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. + +- `PickerHueBar` + [Picker] // ColorPicker: bar for Hue, rectangle for Sat/Value. + +- `PickerHueWheel` + [Picker] // ColorPicker: wheel for Hue, triangle for Sat/Value. + +- `InputRGB` + [Input] // ColorEdit, ColorPicker: input and output data in RGB format. + +- `InputHSV` + [Input] // ColorEdit, ColorPicker: input and output data in HSV format. + +Defaults Options. You can set application defaults using [`set_color_edit_options`][ImGui.set_color_edit_options]. The intent is that you probably don't want to +override them in most of your calls. Let the user choose via the option menu and/or call [`set_color_edit_options`][ImGui.set_color_edit_options] once during startup. + +- `DisplayRGB`, `Uint8`, `PickerHueBar`, `InputRGB`, `DefaultOptions_` + +#### [Internal] Masks + +- `DisplayRGB`, `DisplayHSV`, `DisplayHex`, `DisplayMask_` + +- `Uint8`, `Float`, `DataTypeMask_` + +- `PickerHueBar`, `PickerHueWheel`, `PickerMask_` + +- `InputRGB`, `InputHSV`, `InputMask_` + +#### Obsolete names (will be removed) +ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] + +Flags for [`drag_float`][ImGui.drag_float], [`drag_int`][ImGui.drag_int], [`slider_float`][ImGui.slider_float], [`slider_int`][ImGui.slider_int] etc. +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. + +### ::: ImGui::ImGuiSliderFlags + +- `None` + +- `AlwaysClamp` + Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds. + +- `Logarithmic` + Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits. + +- `NoRoundToFormat` + Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits) + +- `NoInput` + Disable CTRL+Click or Enter key allowing to input text directly into the widget + +- `InvalidMask_` + [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. + +#### Obsolete names (will be removed) + +- `AlwaysClamp` + [renamed in 1.79] + +Identify a mouse button. +Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience. + +### ::: ImGui::ImGuiMouseButton + +- `Left` + +- `Right` + +- `Middle` + +- `COUNT` + +## Enumeration for [`get_mouse_cursor`][ImGui.get_mouse_cursor] +User code may request backend to display given cursor by calling [`set_mouse_cursor`][ImGui.set_mouse_cursor], which is why we have some cursors that are marked unused here + +### ::: ImGui::ImGuiMouseCursor + +- `None` + +- `Arrow` + +- `TextInput` + When hovering over [`input_text`][ImGui.input_text], etc. + +- `ResizeAll` + (Unused by Dear ImGui functions) + +- `ResizeNS` + When hovering over an horizontal border + +- `ResizeEW` + When hovering over a vertical border or a column + +- `ResizeNESW` + When hovering over the bottom-left corner of a window + +- `ResizeNWSE` + When hovering over the bottom-right corner of a window + +- `Hand` + (Unused by Dear ImGui functions. Use for e.g. hyperlinks) + +- `NotAllowed` + When hovering something with disallowed interaction. Usually a crossed circle. + +- `COUNT` + +## Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions +Represent a condition. +Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. + +### ::: ImGui::ImGuiCond + +- `None` + No condition (always set the variable), same as _Always + +- `Always` + No condition (always set the variable) + +- `Once` + Set the variable once per runtime session (only the first call will succeed) + +- `FirstUseEver` + Set the variable if the object/window has no persistently saved data (no entry in .ini file) + +- `Appearing` + Set the variable if the object/window is appearing after being hidden/inactive (or the first time) + diff --git a/docs/font.md b/docs/font.md new file mode 100644 index 0000000..af88715 --- /dev/null +++ b/docs/font.md @@ -0,0 +1,442 @@ +# Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont) + +### ::: ImGui::ImFontConfig + +##### ::: ImGui::ImFontConfig.font_data + + // TTF/OTF data + +##### ::: ImGui::ImFontConfig.font_data_size + + // TTF/OTF data size + +##### ::: ImGui::ImFontConfig.font_data_owned_by_atlas + + true // TTF/OTF data ownership taken by the container [`ImFontAtlas`][ImGui::ImFontAtlas] (will delete memory itself). + +##### ::: ImGui::ImFontConfig.font_no + + 0 // Index of font within TTF/OTF file + +##### ::: ImGui::ImFontConfig.size_pixels + + // Size in pixels for rasterizer (more or less maps to the resulting font height). + +##### ::: ImGui::ImFontConfig.oversample_h + + 3 // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details. + +##### ::: ImGui::ImFontConfig.oversample_v + + 1 // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis. + +##### ::: ImGui::ImFontConfig.pixel_snap_h + + false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. + +##### ::: ImGui::ImFontConfig.glyph_extra_spacing + + 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. + +##### ::: ImGui::ImFontConfig.glyph_offset + + 0, 0 // Offset all glyphs from this font input. + +##### ::: ImGui::ImFontConfig.glyph_ranges + + NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + +##### ::: ImGui::ImFontConfig.glyph_min_advance_x + + 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font + +##### ::: ImGui::ImFontConfig.glyph_max_advance_x + + FLT_MAX // Maximum AdvanceX for glyphs + +##### ::: ImGui::ImFontConfig.merge_mode + + false // Merge into previous [`ImFont`][ImGui::ImFont], so you can combine multiple inputs font into one [`ImFont`][ImGui::ImFont] (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. + +##### ::: ImGui::ImFontConfig.font_builder_flags + + 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure. + +##### ::: ImGui::ImFontConfig.rasterizer_multiply + + 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. + +##### ::: ImGui::ImFontConfig.ellipsis_char + + -1 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used. + +#### [Internal] + +##### ::: ImGui::ImFontConfig.name + + Name (strictly to ease debugging) + +##### ::: ImGui::ImFontConfig.dst_font + +Hold rendering data for one glyph. +(Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this) + +### ::: ImGui::ImFontGlyph + +##### ::: ImGui::ImFontGlyph.colored + + Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops) + +##### ::: ImGui::ImFontGlyph.visible + + Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering. + +##### ::: ImGui::ImFontGlyph.codepoint + + 0x0000..0x10FFFF + +##### ::: ImGui::ImFontGlyph.advance_x + + Distance to next character (= data from font + [`ImFontConfig`][ImGui::ImFontConfig]::GlyphExtraSpacing.x baked in) + +##### ::: ImGui::ImFontGlyph.x0 + +##### ::: ImGui::ImFontGlyph.y0 + +##### ::: ImGui::ImFontGlyph.x1 + +##### ::: ImGui::ImFontGlyph.y1 + + Glyph corners + +##### ::: ImGui::ImFontGlyph.u0 + +##### ::: ImGui::ImFontGlyph.v0 + +##### ::: ImGui::ImFontGlyph.u1 + +##### ::: ImGui::ImFontGlyph.v1 + + Texture coordinates + +Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges(). +This is essentially a tightly packed of vector of 64k booleans = 8KB storage. + +### ::: ImGui::ImFontGlyphRangesBuilder + +##### ::: ImGui::ImFontGlyphRangesBuilder.used_chars + + Store 1-bit per Unicode code point (0=unused, 1=used) + + Get bit n in the array + Set bit n in the array + Add character + Add string (each character of the UTF-8 string are added) + Add ranges, e.g. builder.AddRanges([`ImFontAtlas`][ImGui::ImFontAtlas]::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext + Output new ranges + +See [`ImFontAtlas`][ImGui::ImFontAtlas]::AddCustomRectXXX functions. + +### ::: ImGui::ImFontAtlasCustomRect + +##### ::: ImGui::ImFontAtlasCustomRect.width + +##### ::: ImGui::ImFontAtlasCustomRect.height + + Input // Desired rectangle dimension + +##### ::: ImGui::ImFontAtlasCustomRect.x + +##### ::: ImGui::ImFontAtlasCustomRect.y + + Output // Packed position in Atlas + +##### ::: ImGui::ImFontAtlasCustomRect.glyph_id + + Input // For custom font glyphs only (ID < 0x110000) + +##### ::: ImGui::ImFontAtlasCustomRect.glyph_advance_x + + Input // For custom font glyphs only: glyph xadvance + +##### ::: ImGui::ImFontAtlasCustomRect.glyph_offset + + Input // For custom font glyphs only: glyph display offset + +##### ::: ImGui::ImFontAtlasCustomRect.font + + Input // For custom font glyphs only: target font + +## Flags for [`ImFontAtlas`][ImGui::ImFontAtlas] build + +### ::: ImGui::ImFontAtlasFlags + +- `None` + +- `NoPowerOfTwoHeight` + Don't round the height to next power of two + +- `NoMouseCursors` + Don't build software mouse cursors into the atlas (save a little texture memory) + +- `NoBakedLines` + Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). + +Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: + + - One or more fonts. + - Custom graphics data needed to render the shapes needed by Dear ImGui. + - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas). + +It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api. + + - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you. + - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. + - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples) + - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API. + This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details. + +Common pitfalls: + +- If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the + atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data. +- Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction. + You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed, +- Even though many functions are suffixed with "TTF", OTF data is supported just as well. +- This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future! + +### ::: ImGui::ImFontAtlas + + Note: Transfer ownership of 'ttf_data' to [`ImFontAtlas`][ImGui::ImFontAtlas]! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed. + 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp. + 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter. + Clear input data (all [`ImFontConfig`][ImGui::ImFontConfig] structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts. + Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory. + Clear output font data (glyphs storage, UV coordinates). + Clear all input and output. + +Build atlas, retrieve pixel data. +User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID(). +The pitch is always = Width * BytesPerPixels (1 or 4) +Building in RGBA32 format is provided for convenience and compatibility, but note that unless you manually manipulate or copy color data into +the texture (e.g. when using the AddCustomRect*** api), then the RGB pixels emitted will always be white (~75% of memory/bandwidth waste. + Build pixels data. This is called automatically for you by the GetTexData*** functions. + 1 byte per-pixel + 4 bytes-per-pixel + Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent... + +#### Glyph Ranges + +#### Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) +NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. +NB: Consider using [`ImFontGlyphRangesBuilder`][ImGui::ImFontGlyphRangesBuilder] to build glyph ranges from textual data. + Basic Latin, Extended Latin + Default + Korean characters + Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs + Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs + + Default + about 400 Cyrillic characters + Default + Thai characters + Default + Vietnamese characters + +#### [BETA] Custom Rectangles/Glyphs API + +You can request arbitrary rectangles to be packed into the atlas, for your own purposes. + +- After calling Build(), you can query the rectangle position and render your pixels. +- If you render colored output, set 'atlas->TexPixelsUseColors = true' as this may help some backends decide of prefered texture format. +- You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), + so you can render e.g. custom colorful icons and use them as regular glyphs. +- Read docs/FONTS.md for more details about using colorful icons. +- Note: this API may be redesigned later in order to support multi-monitor varying DPI settings. + +#### [Internal] + +#### Members + +##### ::: ImGui::ImFontAtlas.flags + + Build flags (see [`ImFontAtlasFlags`][ImGui::ImFontAtlasFlags]) + +##### ::: ImGui::ImFontAtlas.tex_id + + User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the [`ImDrawCmd`][ImGui::ImDrawCmd] structure. + +##### ::: ImGui::ImFontAtlas.tex_desired_width + + Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. + +##### ::: ImGui::ImFontAtlas.tex_glyph_padding + + Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false). + +##### ::: ImGui::ImFontAtlas.locked + + Marked as Locked by [`new_frame`][ImGui.new_frame] so attempt to modify the atlas will assert. + +#### [Internal] +NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. + +##### ::: ImGui::ImFontAtlas.tex_ready + + Set when texture was built matching current font input + +##### ::: ImGui::ImFontAtlas.tex_pixels_use_colors + + Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format. + +##### ::: ImGui::ImFontAtlas.tex_pixels_alpha8 + + 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight + +##### ::: ImGui::ImFontAtlas.tex_pixels_rgba32 + + 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 + +##### ::: ImGui::ImFontAtlas.tex_width + + Texture width calculated during Build(). + +##### ::: ImGui::ImFontAtlas.tex_height + + Texture height calculated during Build(). + +##### ::: ImGui::ImFontAtlas.tex_uv_scale + + = (1.0f/TexWidth, 1.0f/TexHeight) + +##### ::: ImGui::ImFontAtlas.tex_uv_white_pixel + + Texture coordinates to a white pixel + +##### ::: ImGui::ImFontAtlas.fonts + + Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling [`new_frame`][ImGui.new_frame], use [`push_font`][ImGui.push_font]/[`pop_font`][ImGui.pop_font] to change the current font. + +##### ::: ImGui::ImFontAtlas.custom_rects + + Rectangles for packing custom texture data into the atlas. + +##### ::: ImGui::ImFontAtlas.config_data + + Configuration data + +##### ::: ImGui::ImFontAtlas.tex_uv_lines + + UVs for baked anti-aliased lines + +#### [Internal] Font builder + +##### ::: ImGui::ImFontAtlas.font_builder_io + + Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE). + +##### ::: ImGui::ImFontAtlas.font_builder_flags + + Shared flags (for all fonts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font override is also available in [`ImFontConfig`][ImGui::ImFontConfig]. + +#### [Internal] Packing data + +##### ::: ImGui::ImFontAtlas.pack_id_mouse_cursors + + Custom texture rectangle ID for white pixel and mouse cursors + +##### ::: ImGui::ImFontAtlas.pack_id_lines + + Custom texture rectangle ID for baked anti-aliased lines + +#### [Obsolete] + OBSOLETED in 1.72+ + OBSOLETED in 1.67+ + +## Font runtime data and rendering +[`ImFontAtlas`][ImGui::ImFontAtlas] automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). + +### ::: ImGui::ImFont + +#### Members: Hot ~20/24 bytes (for [`calc_text_size`][ImGui.calc_text_size]) + +##### ::: ImGui::ImFont.index_advance_x + + 12-16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for [`calc_text_size`][ImGui.calc_text_size] functions which only this this info, and are often bottleneck in large UI). + +##### ::: ImGui::ImFont.fallback_advance_x + + 4 // out // = FallbackGlyph->AdvanceX + +##### ::: ImGui::ImFont.font_size + + 4 // in // // Height of characters/line, set during loading (don't change after loading) + +#### Members: Hot ~28/40 bytes (for [`calc_text_size`][ImGui.calc_text_size] + render loop) + +##### ::: ImGui::ImFont.index_lookup + + 12-16 // out // // Sparse. Index glyphs by Unicode code-point. + +##### ::: ImGui::ImFont.glyphs + + 12-16 // out // // All glyphs. + +##### ::: ImGui::ImFont.fallback_glyph + + 4-8 // out // = FindGlyph(FontFallbackChar) + +#### Members: Cold ~32/40 bytes + +##### ::: ImGui::ImFont.container_atlas + + 4-8 // out // // What we has been loaded into + +##### ::: ImGui::ImFont.config_data + + 4-8 // in // // Pointer within ContainerAtlas->ConfigData + +##### ::: ImGui::ImFont.config_data_count + + 2 // in // ~ 1 // Number of [`ImFontConfig`][ImGui::ImFontConfig] involved in creating this font. Bigger than 1 when merging multiple font sources into one [`ImFont`][ImGui::ImFont]. + +##### ::: ImGui::ImFont.fallback_char + + 2 // out // = FFFD/'?' // Character used if a glyph isn't found. + +##### ::: ImGui::ImFont.ellipsis_char + + 2 // out // = '...' // Character used for ellipsis rendering. + +##### ::: ImGui::ImFont.dot_char + + 2 // out // = '.' // Character used for ellipsis rendering (if a single '...' character isn't found) + +##### ::: ImGui::ImFont.dirty_lookup_tables + + 1 // out // + +##### ::: ImGui::ImFont.scale + + 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with [`set_window_font_scale`][ImGui.set_window_font_scale] + +##### ::: ImGui::ImFont.ascent + +##### ::: ImGui::ImFont.descent + + 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] + +##### ::: ImGui::ImFont.metrics_total_surface + + out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs) + +##### ::: ImGui::ImFont.used4k_pages_map + + 2 bytes if ImWchar=ImWchar16, 34 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints. + +#### Methods + +'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. +'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. + utf8 + +#### [Internal] Don't use! + + Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. + diff --git a/docs/helpers.md b/docs/helpers.md new file mode 100644 index 0000000..d0f7ea6 --- /dev/null +++ b/docs/helpers.md @@ -0,0 +1,148 @@ +# Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) + +## Helper: Unicode defines + Invalid Unicode code point (standard value). + + Maximum Unicode code point supported by this build. + + Maximum Unicode code point supported by this build. + +Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. +Usage: static [`ImGuiOnceUponAFrame`][ImGui::ImGuiOnceUponAFrame] oaf; if (oaf) [`text`][ImGui.text]("This will be called only once per frame"); + +### ::: ImGui::ImGuiOnceUponAFrame + +##### ::: ImGui::ImGuiOnceUponAFrame.ref_frame + +Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" + +### ::: ImGui::ImGuiTextFilter + + Helper calling [`input_text`][ImGui.input_text]+Build + +#### [Internal] + +##### ::: ImGui::ImGuiTextFilter.input_buf + +##### ::: ImGui::ImGuiTextFilter.filters + +##### ::: ImGui::ImGuiTextFilter.count_grep + +## Helper: Growable text buffer for logging/accumulating text +(this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder') + + Buf is zero-terminated, so end() will point on the zero-terminator + +## Helper: Key->Value storage +Typically you don't have to worry about this since a storage is held within each Window. +We use it to e.g. store collapse state for a tree (Int 0/1) +This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame) +You can use it as custom user storage for temporary values. Declare your own storage if, for example: + +- You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). +- You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) + +Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. + +### ::: ImGui::ImGuiStorage + +#### [Internal] + +##### ::: ImGui::ImGuiStorage.data + +- Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) +- Set***() functions find pair, insertion on demand if missing. +- Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. + + default_val is NULL + +- Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. +- References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. +- A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct) + float* pvar = ImGui::GetFloatRef(key); [`slider_float`][ImGui.slider_float]("var", pvar, 0, 100.0f); some_var += *pvar; + +#### Use on your own storage if you know only integer are being stored (open/close all tree nodes) + +For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. + +Helper: Manually clip large list of items. +If you have lots evenly spaced items and you have a random access to the list, you can perform coarse +clipping based on visibility to only submit items that are in view. +The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. +(Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally + fetching/submitting your own data incurs additional cost. Coarse clipping using [`ImGuiListClipper`][ImGui::ImGuiListClipper] allows you to easily + scale using lists with tens of thousands of items without a problem) + +Usage: + [`ImGuiListClipper`][ImGui::ImGuiListClipper] clipper; + clipper.Begin(1000); // We have 1000 elements, evenly spaced. + while (clipper.Step()) + for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + [`text`][ImGui.text]("line number %d", i); + +Generally what happens is: + +- Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not. +- User code submit that one element. +- Clipper can measure the height of the first element +- Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element. +- User code submit visible elements. +- The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc. + +### ::: ImGui::ImGuiListClipper + +##### ::: ImGui::ImGuiListClipper.display_start + + First item to display, updated by each call to Step() + +##### ::: ImGui::ImGuiListClipper.display_end + + End of items to display (exclusive) + +##### ::: ImGui::ImGuiListClipper.items_count + + [Internal] Number of items + +##### ::: ImGui::ImGuiListClipper.items_height + + [Internal] Height of item after a first step and item submission can calculate it + +##### ::: ImGui::ImGuiListClipper.start_pos_y + + [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed + +##### ::: ImGui::ImGuiListClipper.temp_data + + [Internal] Internal data + +items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step) +items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically [`get_text_line_height_with_spacing`][ImGui.get_text_line_height_with_spacing] or [`get_frame_height_with_spacing`][ImGui.get_frame_height_with_spacing]. + + Automatically called on the last call of Step() that returns false. + Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. + +Call ForceDisplayRangeByIndices() before first call to Step() if you need a range of items to be displayed regardless of visibility. + item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range. + + [removed in 1.79] + +## Helpers macros to generate 32-bit encoded colors +User can declare their own format by #defining the 5 _SHIFT/_MASK macros in their imconfig file. + + Opaque white = 0xFFFFFFFF + + Opaque black + + Transparent black = 0x00000000 + +## Helper: [`ImColor`][ImGui::ImColor] implicitly converts colors to either ImU32 (packed 4x1 byte) or [`ImVec4`][ImGui::ImVec4] (4x1 float) +Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with [`ImDrawList`][ImGui::ImDrawList] API. +**Avoid storing [`ImColor`][ImGui::ImColor]! Store either u32 of [`ImVec4`][ImGui::ImVec4]. This is not a full-featured color class. MAY OBSOLETE. +**None of the ImGui API are using [`ImColor`][ImGui::ImColor] directly but you can use it as a convenience to pass colors in either ImU32 or [`ImVec4`][ImGui::ImVec4] formats. Explicitly cast to ImU32 or [`ImVec4`][ImGui::ImVec4] if needed. + +### ::: ImGui::ImColor + +##### ::: ImGui::ImColor.value + +FIXME-OBSOLETE: May need to obsolete/cleanup those helpers. + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..768ac52 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,1561 @@ +# Dear ImGui end-user API functions +(Note that ImGui:: being a namespace, you can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!) + +## Context creation and access + +- Each context create its own [`ImFontAtlas`][ImGui::ImFontAtlas] by default. You may instance one yourself and pass it to [`create_context`][ImGui.create_context] to share a font atlas between contexts. +- DLL users: heaps and globals are not shared across DLL boundaries! You will need to call [`set_current_context`][ImGui.set_current_context] + [`set_allocator_functions`][ImGui.set_allocator_functions] + for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for details. + +### ::: ImGui.create_context + +### ::: ImGui.destroy_context + + NULL = destroy current context + +### ::: ImGui.get_current_context + +### ::: ImGui.set_current_context + +## Main + +### ::: ImGui.get_io + + access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) + +### ::: ImGui.get_style + + access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame! + +### ::: ImGui.new_frame + + start a new Dear ImGui frame, you can submit any command from this point until [`render`][ImGui.render]/[`end_frame`][ImGui.end_frame]. + +### ::: ImGui.end_frame + + ends the Dear ImGui frame. automatically called by [`render`][ImGui.render]. If you don't need to render data (skipping rendering) you may call [`end_frame`][ImGui.end_frame] without [`render`][ImGui.render]... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call [`new_frame`][ImGui.new_frame] at all! + +### ::: ImGui.render + + ends the Dear ImGui frame, finalize the draw data. You can then get call [`get_draw_data`][ImGui.get_draw_data]. + +### ::: ImGui.get_draw_data + + valid after [`render`][ImGui.render] and until the next call to [`new_frame`][ImGui.new_frame]. this is what you have to render. + +## Demo, Debug, Information + +### ::: ImGui.show_demo_window + + create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! + +### ::: ImGui.show_metrics_window + + create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc. + +### ::: ImGui.show_debug_log_window + + create Debug Log window. display a simplified log of important dear imgui events. + +### ::: ImGui.show_stack_tool_window + + create Stack Tool window. hover items with mouse to query information about the source of their unique ID. + +### ::: ImGui.show_about_window + + create About window. display Dear ImGui version, credits and build/system information. + +### ::: ImGui.show_style_editor + + add style editor block (not a window). you can pass in a reference [`ImGuiStyle`][ImGui::ImGuiStyle] structure to compare to, revert to and save to (else it uses the default style) + +### ::: ImGui.show_style_selector + + add style selector block (not a window), essentially a combo listing the default styles. + +### ::: ImGui.show_font_selector + + add font selector block (not a window), essentially a combo listing the loaded fonts. + +### ::: ImGui.show_user_guide + + add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). + +### ::: ImGui.get_version + + get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp) + +## Styles + +### ::: ImGui.style_colors_dark + + new, recommended style (default) + +### ::: ImGui.style_colors_light + + best used with borders and a custom, thicker font + +### ::: ImGui.style_colors_classic + + classic imgui style + +## Windows + +- Begin() = push window to the stack and start appending to it. End() = pop window from the stack. +- Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, + which clicking will set the boolean to false when clicked. +- You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times. + Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin(). +- Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting + anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! + [Important: due to legacy reason, this is inconsistent with most other functions such as [`begin_menu`][ImGui.begin_menu]/[`end_menu`][ImGui.end_menu], + [`begin_popup`][ImGui.begin_popup]/[`end_popup`][ImGui.end_popup], etc. where the EndXXX call should only be called if the corresponding BeginXXX function + returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.] +- Note that the bottom of window stack always contains a window called "Debug". + +### ::: ImGui.begin + +### ::: ImGui.end + +## Child Windows + +- Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. +- For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. [`ImVec2`][ImGui::ImVec2](0,400). +- BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. + Always call a matching [`end_child`][ImGui.end_child] for each BeginChild() call, regardless of its return value. + [Important: due to legacy reason, this is inconsistent with most other functions such as [`begin_menu`][ImGui.begin_menu]/[`end_menu`][ImGui.end_menu], + [`begin_popup`][ImGui.begin_popup]/[`end_popup`][ImGui.end_popup], etc. where the EndXXX call should only be called if the corresponding BeginXXX function + returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.] + +### ::: ImGui.begin_child + +### ::: ImGui.begin_child + +### ::: ImGui.end_child + +## Windows Utilities + +- 'current window' = the window we are appending into while inside a Begin()/End() block. 'next window' = next window we will Begin() into. + +### ::: ImGui.is_window_appearing + +### ::: ImGui.is_window_collapsed + +### ::: ImGui.is_window_focused + + is current window focused? or its root/child, depending on flags. see flags for options. + +### ::: ImGui.is_window_hovered + + is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! + +### ::: ImGui.get_window_draw_list + + get draw list associated to the current window, to append your own drawing primitives + +### ::: ImGui.get_window_pos + + get current window position in screen space (useful if you want to do your own drawing via the DrawList API) + +### ::: ImGui.get_window_size + + get current window size + +### ::: ImGui.get_window_width + + get current window width (shortcut for [`get_window_size`][ImGui.get_window_size].x) + +### ::: ImGui.get_window_height + + get current window height (shortcut for [`get_window_size`][ImGui.get_window_size].y) + +## Window manipulation + +- Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin). + +### ::: ImGui.set_next_window_pos + + set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. + +### ::: ImGui.set_next_window_size + + set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() + +### ::: ImGui.set_next_window_size_constraints + + set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints. + +### ::: ImGui.set_next_window_content_size + + set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin() + +### ::: ImGui.set_next_window_collapsed + + set next window collapsed state. call before Begin() + +### ::: ImGui.set_next_window_focus + + set next window to be focused / top-most. call before Begin() + +### ::: ImGui.set_next_window_bg_alpha + + set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. + +### ::: ImGui.set_window_pos + + (not recommended) set current window position - call within Begin()/End(). prefer using [`set_next_window_pos`][ImGui.set_next_window_pos], as this may incur tearing and side-effects. + +### ::: ImGui.set_window_size + + (not recommended) set current window size - call within Begin()/End(). set to [`ImVec2`][ImGui::ImVec2](0, 0) to force an auto-fit. prefer using [`set_next_window_size`][ImGui.set_next_window_size], as this may incur tearing and minor side-effects. + +### ::: ImGui.set_window_collapsed + + (not recommended) set current window collapsed state. prefer using [`set_next_window_collapsed`][ImGui.set_next_window_collapsed]. + +### ::: ImGui.set_window_focus + + (not recommended) set current window to be focused / top-most. prefer using [`set_next_window_focus`][ImGui.set_next_window_focus]. + +### ::: ImGui.set_window_font_scale + + [OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild [`ImFontAtlas`][ImGui::ImFontAtlas] + call style.ScaleAllSizes(). + +### ::: ImGui.set_window_pos + + set named window position. + +### ::: ImGui.set_window_size + + set named window size. set axis to 0.0f to force an auto-fit on this axis. + +### ::: ImGui.set_window_collapsed + + set named window collapsed state + +### ::: ImGui.set_window_focus + + set named window to be focused / top-most. use NULL to remove focus. + +## Content region + +- Retrieve available space from a given point. [`get_content_region_avail`][ImGui.get_content_region_avail] is frequently useful. +- Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion) + +### ::: ImGui.get_content_region_avail + + == [`get_content_region_max`][ImGui.get_content_region_max] - [`get_cursor_pos`][ImGui.get_cursor_pos] + +### ::: ImGui.get_content_region_max + + current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates + +### ::: ImGui.get_window_content_region_min + + content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates + +### ::: ImGui.get_window_content_region_max + + content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with [`set_next_window_content_size`][ImGui.set_next_window_content_size], in window coordinates + +## Windows Scrolling + +### ::: ImGui.get_scroll_x + + get scrolling amount [0 .. [`get_scroll_max_x`][ImGui.get_scroll_max_x]] + +### ::: ImGui.get_scroll_y + + get scrolling amount [0 .. [`get_scroll_max_y`][ImGui.get_scroll_max_y]] + +### ::: ImGui.set_scroll_x + + set scrolling amount [0 .. [`get_scroll_max_x`][ImGui.get_scroll_max_x]] + +### ::: ImGui.set_scroll_y + + set scrolling amount [0 .. [`get_scroll_max_y`][ImGui.get_scroll_max_y]] + +### ::: ImGui.get_scroll_max_x + + get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x + +### ::: ImGui.get_scroll_max_y + + get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y + +### ::: ImGui.set_scroll_here_x + + adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using [`set_item_default_focus`][ImGui.set_item_default_focus] instead. + +### ::: ImGui.set_scroll_here_y + + adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using [`set_item_default_focus`][ImGui.set_item_default_focus] instead. + +### ::: ImGui.set_scroll_from_pos_x + + adjust scrolling amount to make given position visible. Generally [`get_cursor_start_pos`][ImGui.get_cursor_start_pos] + offset to compute a valid position. + +### ::: ImGui.set_scroll_from_pos_y + + adjust scrolling amount to make given position visible. Generally [`get_cursor_start_pos`][ImGui.get_cursor_start_pos] + offset to compute a valid position. + +## Parameters stacks (shared) + +### ::: ImGui.push_font + + use NULL as a shortcut to push default font + +### ::: ImGui.pop_font + +### ::: ImGui.push_style_color + + modify a style color. always use this if you modify the style after [`new_frame`][ImGui.new_frame]. + +### ::: ImGui.push_style_color + +### ::: ImGui.pop_style_color + +### ::: ImGui.push_style_var + + modify a style float variable. always use this if you modify the style after [`new_frame`][ImGui.new_frame]. + +### ::: ImGui.push_style_var + + modify a style [`ImVec2`][ImGui::ImVec2] variable. always use this if you modify the style after [`new_frame`][ImGui.new_frame]. + +### ::: ImGui.pop_style_var + +### ::: ImGui.push_allow_keyboard_focus + + == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets + +### ::: ImGui.pop_allow_keyboard_focus + +### ::: ImGui.push_button_repeat + + in 'repeat' mode, [`button`][ImGui.button]*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call [`is_item_active`][ImGui.is_item_active] after any [`button`][ImGui.button] to tell if the button is held in the current frame. + +### ::: ImGui.pop_button_repeat + +## Parameters stacks (current window) + +### ::: ImGui.push_item_width + + push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side). + +### ::: ImGui.pop_item_width + +### ::: ImGui.set_next_item_width + + set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side) + +### ::: ImGui.calc_item_width + + width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions. + +### ::: ImGui.push_text_wrap_pos + + push word-wrapping position for [`text`][ImGui.text]*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space + +### ::: ImGui.pop_text_wrap_pos + +## Style read access + +- Use the style editor ([`show_style_editor`][ImGui.show_style_editor] function) to interactively see what the colors are) + +### ::: ImGui.get_font + + get current font + +### ::: ImGui.get_font_size + + get current font size (= height in pixels) of current font with current scale applied + +### ::: ImGui.get_font_tex_uv_white_pixel + + get UV coordinate for a while pixel, useful to draw custom shapes via the [`ImDrawList`][ImGui::ImDrawList] API + +### ::: ImGui.get_color_u32 + + retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for [`ImDrawList`][ImGui::ImDrawList] + +### ::: ImGui.get_color_u32 + + retrieve given color with style alpha applied, packed as a 32-bit value suitable for [`ImDrawList`][ImGui::ImDrawList] + +### ::: ImGui.get_color_u32 + + retrieve given color with style alpha applied, packed as a 32-bit value suitable for [`ImDrawList`][ImGui::ImDrawList] + +### ::: ImGui.get_style_color_vec4 + + retrieve style color as stored in [`ImGuiStyle`][ImGui::ImGuiStyle] structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in. + +## Cursor / Layout + +- By "cursor" we mean the current output position. +- The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down. +- You can call [`same_line`][ImGui.same_line] between widgets to undo the last carriage return and output at the right of the preceding widget. +- Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API: + Window-local coordinates: [`same_line`][ImGui.same_line], [`get_cursor_pos`][ImGui.get_cursor_pos], [`set_cursor_pos`][ImGui.set_cursor_pos], [`get_cursor_start_pos`][ImGui.get_cursor_start_pos], [`get_content_region_max`][ImGui.get_content_region_max], GetWindowContentRegion*(), [`push_text_wrap_pos`][ImGui.push_text_wrap_pos] + Absolute coordinate: [`get_cursor_screen_pos`][ImGui.get_cursor_screen_pos], [`set_cursor_screen_pos`][ImGui.set_cursor_screen_pos], all [`ImDrawList`][ImGui::ImDrawList]:: functions. + +### ::: ImGui.separator + + separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. + +### ::: ImGui.same_line + + call between widgets or groups to layout them horizontally. X position given in window coordinates. + +### ::: ImGui.new_line + + undo a [`same_line`][ImGui.same_line] or force a new line when in an horizontal-layout context. + +### ::: ImGui.spacing + + add vertical spacing. + +### ::: ImGui.dummy + + add a dummy item of given size. unlike [`invisible_button`][ImGui.invisible_button], [`dummy`][ImGui.dummy] won't take the mouse click or be navigable into. + +### ::: ImGui.indent + + move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0 + +### ::: ImGui.unindent + + move content position back to the left, by indent_w, or style.IndentSpacing if indent_w <= 0 + +### ::: ImGui.begin_group + + lock horizontal starting position + +### ::: ImGui.end_group + + unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use [`is_item_hovered`][ImGui.is_item_hovered] or layout primitives such as [`same_line`][ImGui.same_line] on whole group, etc.) + +### ::: ImGui.get_cursor_pos + + cursor position in window coordinates (relative to window position) + +### ::: ImGui.get_cursor_pos_x + + (some functions are using window-relative coordinates, such as: [`get_cursor_pos`][ImGui.get_cursor_pos], [`get_cursor_start_pos`][ImGui.get_cursor_start_pos], [`get_content_region_max`][ImGui.get_content_region_max], GetWindowContentRegion* etc. + +### ::: ImGui.get_cursor_pos_y + + other functions such as [`get_cursor_screen_pos`][ImGui.get_cursor_screen_pos] or everything in [`ImDrawList`][ImGui::ImDrawList]:: + +### ::: ImGui.set_cursor_pos + + are using the main, absolute coordinate system. + +### ::: ImGui.set_cursor_pos_x + + [`get_window_pos`][ImGui.get_window_pos] + [`get_cursor_pos`][ImGui.get_cursor_pos] == [`get_cursor_screen_pos`][ImGui.get_cursor_screen_pos] etc.) + +### ::: ImGui.set_cursor_pos_y + +### ::: ImGui.get_cursor_start_pos + + initial cursor position in window coordinates + +### ::: ImGui.get_cursor_screen_pos + + cursor position in absolute coordinates (useful to work with [`ImDrawList`][ImGui::ImDrawList] API). generally top-left == [`get_main_viewport`][ImGui.get_main_viewport]->Pos == (0,0) in single viewport mode, and bottom-right == [`get_main_viewport`][ImGui.get_main_viewport]->Pos+Size == io.DisplaySize in single-viewport mode. + +### ::: ImGui.set_cursor_screen_pos + + cursor position in absolute coordinates + +### ::: ImGui.align_text_to_frame_padding + + vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item) + +### ::: ImGui.get_text_line_height + + ~ FontSize + +### ::: ImGui.get_text_line_height_with_spacing + + ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text) + +### ::: ImGui.get_frame_height + + ~ FontSize + style.FramePadding.y * 2 + +### ::: ImGui.get_frame_height_with_spacing + + ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) + +## ID stack/scopes +Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui. + +- Those questions are answered and impacted by understanding of the ID stack system: + - "Q: Why is my widget not reacting when I click on it?" + - "Q: How can I have widgets with an empty label?" + - "Q: How can I have multiple widgets with the same label?" +- Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely + want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. +- You can also use the "Label##foobar" syntax within widget label to distinguish them from each others. +- In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID, + whereas "str_id" denote a string that is only used as an ID and not normally displayed. + +### ::: ImGui.push_id + + push string into the ID stack (will hash string). + +### ::: ImGui.push_id + + push string into the ID stack (will hash string). + +### ::: ImGui.push_id + + push pointer into the ID stack (will hash pointer). + +### ::: ImGui.push_id + + push integer into the ID stack (will hash integer). + +### ::: ImGui.pop_id + + pop from the ID stack. + +### ::: ImGui.get_id + + calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into [`ImGuiStorage`][ImGui::ImGuiStorage] yourself + +### ::: ImGui.get_id + +### ::: ImGui.get_id + +## Widgets: [`text`][ImGui.text] + +### ::: ImGui.text_unformatted + + raw text without formatting. Roughly equivalent to [`text`][ImGui.text]("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. + +### ::: ImGui.text + + formatted text + +### ::: ImGui.text_colored + + shortcut for PushStyleColor(ImGuiCol_Text, col); [`text`][ImGui.text](fmt, ...); [`pop_style_color`][ImGui.pop_style_color]; + +### ::: ImGui.text_disabled + + shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); [`text`][ImGui.text](fmt, ...); [`pop_style_color`][ImGui.pop_style_color]; + +### ::: ImGui.text_wrapped + + shortcut for [`push_text_wrap_pos`][ImGui.push_text_wrap_pos](0.0f); [`text`][ImGui.text](fmt, ...); [`pop_text_wrap_pos`][ImGui.pop_text_wrap_pos];. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using [`set_next_window_size`][ImGui.set_next_window_size]. + +### ::: ImGui.label_text + + display text+label aligned the same way as value+label widgets + +### ::: ImGui.bullet_text + + shortcut for [`bullet`][ImGui.bullet]+[`text`][ImGui.text] + +## Widgets: Main + +- Most widgets return true when the value has been changed or when pressed/selected +- You may also use one of the many IsItemXXX functions (e.g. [`is_item_active`][ImGui.is_item_active], [`is_item_hovered`][ImGui.is_item_hovered], etc.) to query widget state. + +### ::: ImGui.button + + button + +### ::: ImGui.small_button + + button with FramePadding=(0,0) to easily embed within text + +### ::: ImGui.invisible_button + + flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with [`is_item_active`][ImGui.is_item_active], [`is_item_hovered`][ImGui.is_item_hovered], etc.) + +### ::: ImGui.arrow_button + + square button with an arrow shape + +### ::: ImGui.image + +### ::: ImGui.image_button + + <0 frame_padding uses default frame padding settings. 0 for no padding + +### ::: ImGui.checkbox + +### ::: ImGui.checkbox_flags + +### ::: ImGui.checkbox_flags + +### ::: ImGui.radio_button + + use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; } + +### ::: ImGui.radio_button + + shortcut to handle the above pattern when value is an integer + +### ::: ImGui.progress_bar + +### ::: ImGui.bullet + + draw a small circle + keep the cursor on the same line. advance cursor x position by [`get_tree_node_to_label_spacing`][ImGui.get_tree_node_to_label_spacing], same distance that TreeNode() uses + +## Widgets: Combo Box + +- The [`begin_combo`][ImGui.begin_combo]/[`end_combo`][ImGui.end_combo] api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. +- The old Combo() api are helpers over [`begin_combo`][ImGui.begin_combo]/[`end_combo`][ImGui.end_combo] which are kept available for convenience purpose. This is analogous to how ListBox are created. + +### ::: ImGui.begin_combo + +### ::: ImGui.end_combo + + only call [`end_combo`][ImGui.end_combo] if [`begin_combo`][ImGui.begin_combo] returns true! + +### ::: ImGui.combo + +### ::: ImGui.combo + + Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" + +### ::: ImGui.combo + +## Widgets: Drag Sliders + +- CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. +- 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 if ImGuiSliderFlags_AlwaysClamp is not used. +- 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. +- Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `[`ImGuiSliderFlags`][ImGui::ImGuiSliderFlags] flags=0' argument. + If you get a warning converting a float to [`ImGuiSliderFlags`][ImGui::ImGuiSliderFlags], read https://github.com/ocornut/imgui/issues/3361 + +### ::: ImGui.drag_float + + If v_min >= v_max we have no bound + +### ::: ImGui.drag_float2 + +### ::: ImGui.drag_float3 + +### ::: ImGui.drag_float4 + +### ::: ImGui.drag_float_range2 + +### ::: ImGui.drag_int + + If v_min >= v_max we have no bound + +### ::: ImGui.drag_int2 + +### ::: ImGui.drag_int3 + +### ::: ImGui.drag_int4 + +### ::: ImGui.drag_int_range2 + +### ::: ImGui.drag_scalar + +### ::: ImGui.drag_scalar_n + +## Widgets: Regular Sliders + +- CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. +- 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"). +- Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `[`ImGuiSliderFlags`][ImGui::ImGuiSliderFlags] flags=0' argument. + If you get a warning converting a float to [`ImGuiSliderFlags`][ImGui::ImGuiSliderFlags], read https://github.com/ocornut/imgui/issues/3361 + +### ::: ImGui.slider_float + + adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. + +### ::: ImGui.slider_float2 + +### ::: ImGui.slider_float3 + +### ::: ImGui.slider_float4 + +### ::: ImGui.slider_angle + +### ::: ImGui.slider_int + +### ::: ImGui.slider_int2 + +### ::: ImGui.slider_int3 + +### ::: ImGui.slider_int4 + +### ::: ImGui.slider_scalar + +### ::: ImGui.slider_scalar_n + +### ::: ImGui.v_slider_float + +### ::: ImGui.v_slider_int + +### ::: ImGui.v_slider_scalar + +## Widgets: Input with Keyboard + +- If you want to use [`input_text`][ImGui.input_text] 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`][ImGui::ImGuiInputTextFlags] flags are only useful for [`input_text`][ImGui.input_text] and not for InputFloatX, InputIntX, [`input_double`][ImGui.input_double] etc. + +### ::: ImGui.input_text + +### ::: ImGui.input_text_multiline + +### ::: ImGui.input_text_with_hint + +### ::: ImGui.input_float + +### ::: ImGui.input_float2 + +### ::: ImGui.input_float3 + +### ::: ImGui.input_float4 + +### ::: ImGui.input_int + +### ::: ImGui.input_int2 + +### ::: ImGui.input_int3 + +### ::: ImGui.input_int4 + +### ::: ImGui.input_double + +### ::: ImGui.input_scalar + +### ::: ImGui.input_scalar_n + +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.) + +- Note that in C++ 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 the address of a first float element out of a contiguous structure, e.g. &myvector.x + +### ::: ImGui.color_edit3 + +### ::: ImGui.color_edit4 + +### ::: ImGui.color_picker3 + +### ::: ImGui.color_picker4 + +### ::: ImGui.color_button + + display a color square/button, hover for details, return true when pressed. + +### ::: ImGui.set_color_edit_options + + 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 + +- TreeNode functions return true when the node is open, in which case you need to also call [`tree_pop`][ImGui.tree_pop] when you are finished displaying the tree node contents. + +### ::: ImGui.tree_node + +### ::: ImGui.tree_node + + helper variation to easily 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.bullet]. + +### ::: ImGui.tree_node + + " + +### ::: ImGui.tree_node_ex + +### ::: ImGui.tree_node_ex + +### ::: ImGui.tree_node_ex + +### ::: ImGui.tree_push + + ~ [`indent`][ImGui.indent]+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/[`tree_pop`][ImGui.tree_pop] yourself if desired. + +### ::: ImGui.tree_push + + " + +### ::: ImGui.tree_pop + + ~ [`unindent`][ImGui.unindent]+PopId() + +### ::: ImGui.get_tree_node_to_label_spacing + + horizontal distance preceding label when using TreeNode*() or [`bullet`][ImGui.bullet] == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode + +### ::: ImGui.collapsing_header + + if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call [`tree_pop`][ImGui.tree_pop]. + +### ::: ImGui.collapsing_header + + when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header. + +### ::: ImGui.set_next_item_open + + set next TreeNode/CollapsingHeader open state. + +## Widgets: Selectables + +- A selectable highlights when hovered, and can display another color when selected. +- Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous. + +### ::: ImGui.selectable + + "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height + +### ::: ImGui.selectable + + "bool* p_selected" point to the selection state (read-write), as a convenient helper. + +## Widgets: List Boxes + +- This is essentially a thin wrapper to using BeginChild/[`end_child`][ImGui.end_child] with some stylistic changes. +- The [`begin_list_box`][ImGui.begin_list_box]/[`end_list_box`][ImGui.end_list_box] api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() or any items. +- The simplified/old ListBox() api are helpers over [`begin_list_box`][ImGui.begin_list_box]/[`end_list_box`][ImGui.end_list_box] which are kept available for convenience purpose. This is analoguous to how Combos are created. +- Choose frame width: size.x > 0.0f: custom / size.x < 0.0f or -FLT_MIN: right-align / size.x = 0.0f (default): use current ItemWidth +- Choose frame height: size.y > 0.0f: custom / size.y < 0.0f or -FLT_MIN: bottom-align / size.y = 0.0f (default): arbitrary default height which can fit ~7 items + +### ::: ImGui.begin_list_box + + open a framed scrolling region + +### ::: ImGui.end_list_box + + only call [`end_list_box`][ImGui.end_list_box] if [`begin_list_box`][ImGui.begin_list_box] returned true! + +### ::: ImGui.list_box + +### ::: ImGui.list_box + +## Widgets: Data Plotting + +- Consider using ImPlot (https://github.com/epezent/implot) which is much better! + +### ::: ImGui.plot_lines + +### ::: ImGui.plot_lines + +### ::: ImGui.plot_histogram + +### ::: ImGui.plot_histogram + +Widgets: Value() Helpers. + +- Those are merely shortcut to calling [`text`][ImGui.text] with a format string. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace) + +### ::: ImGui.value + +### ::: ImGui.value + +### ::: ImGui.value + +### ::: ImGui.value + +## Widgets: Menus + +- Use [`begin_menu_bar`][ImGui.begin_menu_bar] on a window ImGuiWindowFlags_MenuBar to append to its menu bar. +- Use [`begin_main_menu_bar`][ImGui.begin_main_menu_bar] to create a menu bar at the top of the screen and append to it. +- Use [`begin_menu`][ImGui.begin_menu] to create a menu. You can call [`begin_menu`][ImGui.begin_menu] multiple time with the same identifier to append more items to it. +- Not that MenuItem() keyboardshortcuts are displayed as a convenience but _not processed_ by Dear ImGui at the moment. + +### ::: ImGui.begin_menu_bar + + append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). + +### ::: ImGui.end_menu_bar + + only call [`end_menu_bar`][ImGui.end_menu_bar] if [`begin_menu_bar`][ImGui.begin_menu_bar] returns true! + +### ::: ImGui.begin_main_menu_bar + + create and append to a full screen menu-bar. + +### ::: ImGui.end_main_menu_bar + + only call [`end_main_menu_bar`][ImGui.end_main_menu_bar] if [`begin_main_menu_bar`][ImGui.begin_main_menu_bar] returns true! + +### ::: ImGui.begin_menu + + create a sub-menu entry. only call [`end_menu`][ImGui.end_menu] if this returns true! + +### ::: ImGui.end_menu + + only call [`end_menu`][ImGui.end_menu] if [`begin_menu`][ImGui.begin_menu] returns true! + +### ::: ImGui.menu_item + + return true when activated. + +### ::: ImGui.menu_item + + return true when activated + toggle (*p_selected) if p_selected != NULL + +## Tooltips + +- Tooltip are windows following the mouse. They do not take focus away. + +### ::: ImGui.begin_tooltip + + begin/append a tooltip window. to create full-featured tooltip (with any kind of items). + +### ::: ImGui.end_tooltip + +### ::: ImGui.set_tooltip + + set a text-only tooltip, typically use with [`is_item_hovered`][ImGui.is_item_hovered]. override any previous call to [`set_tooltip`][ImGui.set_tooltip]. + +## Popups, Modals + + - They block normal mouse hovering detection (and therefore most mouse interactions) behind them. + - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. + - Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular Begin*() calls. + - The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time. + - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling [`is_item_hovered`][ImGui.is_item_hovered] or [`is_window_hovered`][ImGui.is_window_hovered]. + - IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and [`begin_popup`][ImGui.begin_popup] generally needs to be at the same level of the stack. + This is sometimes leading to confusing mistakes. May rework this in the future. + +## Popups: begin/end functions + + - [`begin_popup`][ImGui.begin_popup]: query popup state, if open start appending into the window. Call [`end_popup`][ImGui.end_popup] afterwards. [`ImGuiWindowFlags`][ImGui::ImGuiWindowFlags] are forwarded to the window. + - [`begin_popup_modal`][ImGui.begin_popup_modal]: block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar. + +### ::: ImGui.begin_popup + + return true if the popup is open, and you can start outputting to it. + +### ::: ImGui.begin_popup_modal + + return true if the modal is open, and you can start outputting to it. + +### ::: ImGui.end_popup + + only call [`end_popup`][ImGui.end_popup] if BeginPopupXXX() returns true! + +## Popups: open/close functions + + - OpenPopup(): set popup state to open. [`ImGuiPopupFlags`][ImGui::ImGuiPopupFlags] are available for opening options. + - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. + - [`close_current_popup`][ImGui.close_current_popup]: use inside the [`begin_popup`][ImGui.begin_popup]/[`end_popup`][ImGui.end_popup] scope to close manually. + - [`close_current_popup`][ImGui.close_current_popup] is called by default by Selectable()/MenuItem() when activated (FIXME: need some options). + - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). + - Use [`is_window_appearing`][ImGui.is_window_appearing] after [`begin_popup`][ImGui.begin_popup] to tell if a window just opened. + - IMPORTANT: Notice that for [`open_popup_on_item_click`][ImGui.open_popup_on_item_click] we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter + +### ::: ImGui.open_popup + + call to mark popup as open (don't call every frame!). + +### ::: ImGui.open_popup + + id overload to facilitate calling from nested stacks + +### ::: ImGui.open_popup_on_item_click + + helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) + +### ::: ImGui.close_current_popup + + manually close the popup we have begin-ed into. + +## Popups: open+begin combined functions helpers + + - Helpers to do OpenPopup+[`begin_popup`][ImGui.begin_popup] where the Open action is triggered by e.g. hovering an item and right-clicking. + - They are convenient to easily create context menus, hence the name. + - IMPORTANT: Notice that BeginPopupContextXXX takes [`ImGuiPopupFlags`][ImGui::ImGuiPopupFlags] just like OpenPopup() and unlike [`begin_popup`][ImGui.begin_popup]. For full consistency, we may add [`ImGuiWindowFlags`][ImGui::ImGuiWindowFlags] to the BeginPopupContextXXX functions in the future. + - IMPORTANT: Notice that we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. + +### ::: ImGui.begin_popup_context_item + + open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as [`text`][ImGui.text] you need to pass in an explicit ID here. read comments in .cpp! + +### ::: ImGui.begin_popup_context_window + +### ::: ImGui.begin_popup_context_void + + open+begin popup when clicked in void (where there are no windows). + +## Popups: query functions + + - IsPopupOpen(): return true if the popup is open at the current [`begin_popup`][ImGui.begin_popup] level of the popup stack. + - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current [`begin_popup`][ImGui.begin_popup] level of the popup stack. + - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open. + +### ::: ImGui.is_popup_open + + return true if the popup is open. + +## Tables + +- Full-featured replacement for old [`columns`][ImGui.columns] API. +- See Demo->Tables for demo code. See top of imgui_tables.cpp for general commentary. +- See [`ImGuiTableFlags`][ImGui::ImGuiTableFlags] and [`ImGuiTableColumnFlags`][ImGui::ImGuiTableColumnFlags] enums for a description of available flags. + +The typical call flow is: + +- 1. Call [`begin_table`][ImGui.begin_table], early out if returning false. +- 2. Optionally call [`table_setup_column`][ImGui.table_setup_column] to submit column name/flags/defaults. +- 3. Optionally call [`table_setup_scroll_freeze`][ImGui.table_setup_scroll_freeze] to request scroll freezing of columns/rows. +- 4. Optionally call [`table_headers_row`][ImGui.table_headers_row] to submit a header row. Names are pulled from [`table_setup_column`][ImGui.table_setup_column] data. +- 5. Populate contents: + - In most situations you can use [`table_next_row`][ImGui.table_next_row] + [`table_set_column_index`][ImGui.table_set_column_index](N) to start appending into a column. + - If you are using tables as a sort of grid, where every columns is holding the same type of contents, + you may prefer using [`table_next_column`][ImGui.table_next_column] instead of [`table_next_row`][ImGui.table_next_row] + [`table_set_column_index`][ImGui.table_set_column_index]. + [`table_next_column`][ImGui.table_next_column] will automatically wrap-around into the next row if needed. + - IMPORTANT: Comparatively to the old [`columns`][ImGui.columns] API, we need to call [`table_next_column`][ImGui.table_next_column] for the first column! + - Summary of possible call flow: + + [`table_next_row`][ImGui.table_next_row] -> [`table_set_column_index`][ImGui.table_set_column_index](0) -> [`text`][ImGui.text]("Hello 0") -> [`table_set_column_index`][ImGui.table_set_column_index](1) -> [`text`][ImGui.text]("Hello 1") // OK + [`table_next_row`][ImGui.table_next_row] -> [`table_next_column`][ImGui.table_next_column] -> [`text`][ImGui.text]("Hello 0") -> [`table_next_column`][ImGui.table_next_column] -> [`text`][ImGui.text]("Hello 1") // OK + [`table_next_column`][ImGui.table_next_column] -> [`text`][ImGui.text]("Hello 0") -> [`table_next_column`][ImGui.table_next_column] -> [`text`][ImGui.text]("Hello 1") // OK: [`table_next_column`][ImGui.table_next_column] automatically gets to next row! + [`table_next_row`][ImGui.table_next_row] -> [`text`][ImGui.text]("Hello 0") // Not OK! Missing [`table_set_column_index`][ImGui.table_set_column_index] or [`table_next_column`][ImGui.table_next_column]! [`text`][ImGui.text] will not appear! + +- 5. Call [`end_table`][ImGui.end_table] + +### ::: ImGui.begin_table + +### ::: ImGui.end_table + + only call [`end_table`][ImGui.end_table] if [`begin_table`][ImGui.begin_table] returns true! + +### ::: ImGui.table_next_row + + append into the first cell of a new row. + +### ::: ImGui.table_next_column + + append into the next column (or first column of next row if currently in last column). Return true when column is visible. + +### ::: ImGui.table_set_column_index + + append into the specified column. Return true when column is visible. + +## Tables: Headers & [`columns`][ImGui.columns] declaration + +- Use [`table_setup_column`][ImGui.table_setup_column] to specify label, resizing policy, default width/weight, id, various other flags etc. +- Use [`table_headers_row`][ImGui.table_headers_row] to create a header row and automatically submit a [`table_header`][ImGui.table_header] for each column. + Headers are required to perform: reordering, sorting, and opening the context menu. + The context menu can also be made available in columns body using ImGuiTableFlags_ContextMenuInBody. +- You may manually submit headers using [`table_next_row`][ImGui.table_next_row] + [`table_header`][ImGui.table_header] calls, but this is only useful in + some advanced use cases (e.g. adding custom widgets in header row). +- Use [`table_setup_scroll_freeze`][ImGui.table_setup_scroll_freeze] to lock columns/rows so they stay visible when scrolled. + +### ::: ImGui.table_setup_column + +### ::: ImGui.table_setup_scroll_freeze + + lock columns/rows so they stay visible when scrolled. + +### ::: ImGui.table_headers_row + + submit all headers cells based on data provided to [`table_setup_column`][ImGui.table_setup_column] + submit context menu + +### ::: ImGui.table_header + + submit one header cell manually (rarely used) + +## Tables: Sorting & Miscellaneous functions + +- Sorting: call [`table_get_sort_specs`][ImGui.table_get_sort_specs] to retrieve latest sort specs for the table. NULL when not sorting. + When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have + changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, + else you may wastefully sort your data every frame! +- Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index. + +### ::: ImGui.table_get_sort_specs + + get latest sort specs for the table (NULL if not sorting). Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to [`begin_table`][ImGui.begin_table]. + +### ::: ImGui.table_get_column_count + + return number of columns (value passed to [`begin_table`][ImGui.begin_table]) + +### ::: ImGui.table_get_column_index + + return current column index. + +### ::: ImGui.table_get_row_index + + return current row index. + +### ::: ImGui.table_get_column_name + + return "" if column didn't have a name declared by [`table_setup_column`][ImGui.table_setup_column]. Pass -1 to use current column. + +### ::: ImGui.table_get_column_flags + + return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column. + +### ::: ImGui.table_set_column_enabled + +### ::: ImGui.table_set_bg_color + + change the color of a cell, row, or column. See [`ImGuiTableBgTarget`][ImGui::ImGuiTableBgTarget] flags for details. + +## Legacy [`columns`][ImGui.columns] API (prefer using Tables!) + +- You can also use [`same_line`][ImGui.same_line](pos_x) to mimic simplified columns. + +### ::: ImGui.columns + +### ::: ImGui.next_column + + next column, defaults to current row or next row if the current row is finished + +### ::: ImGui.get_column_index + + get current column index + +### ::: ImGui.get_column_width + + get column width (in pixels). pass -1 to use current column + +### ::: ImGui.set_column_width + + set column width (in pixels). pass -1 to use current column + +### ::: ImGui.get_column_offset + + get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..[`get_columns_count`][ImGui.get_columns_count] inclusive. column 0 is typically 0.0f + +### ::: ImGui.set_column_offset + + set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column + +### ::: ImGui.get_columns_count + +## Tab Bars, Tabs + +### ::: ImGui.begin_tab_bar + + create and append into a TabBar + +### ::: ImGui.end_tab_bar + + only call [`end_tab_bar`][ImGui.end_tab_bar] if [`begin_tab_bar`][ImGui.begin_tab_bar] returns true! + +### ::: ImGui.begin_tab_item + + create a Tab. Returns true if the Tab is selected. + +### ::: ImGui.end_tab_item + + only call [`end_tab_item`][ImGui.end_tab_item] if [`begin_tab_item`][ImGui.begin_tab_item] returns true! + +### ::: ImGui.tab_item_button + + create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar. + +### ::: ImGui.set_tab_item_closed + + notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after [`begin_tab_bar`][ImGui.begin_tab_bar] and before Tab submissions. Otherwise call with a window name. + +## Logging/Capture + +- All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging. + +### ::: ImGui.log_to_tty + + start logging to tty (stdout) + +### ::: ImGui.log_to_file + + start logging to file + +### ::: ImGui.log_to_clipboard + + start logging to OS clipboard + +### ::: ImGui.log_finish + + stop logging (close file, etc.) + +### ::: ImGui.log_buttons + + helper to display buttons for logging to tty/file/clipboard + +### ::: ImGui.log_text + + pass text data straight to log (without being displayed) + +## Drag and Drop + +- On source items, call [`begin_drag_drop_source`][ImGui.begin_drag_drop_source], if it returns true also call [`set_drag_drop_payload`][ImGui.set_drag_drop_payload] + [`end_drag_drop_source`][ImGui.end_drag_drop_source]. +- On target candidates, call [`begin_drag_drop_target`][ImGui.begin_drag_drop_target], if it returns true also call [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] + [`end_drag_drop_target`][ImGui.end_drag_drop_target]. +- If you stop calling [`begin_drag_drop_source`][ImGui.begin_drag_drop_source] the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip, see #1725) +- An item can be both drag source and drop target. + +### ::: ImGui.begin_drag_drop_source + + call after submitting an item which may be dragged. when this return true, you can call [`set_drag_drop_payload`][ImGui.set_drag_drop_payload] + [`end_drag_drop_source`][ImGui.end_drag_drop_source] + +### ::: ImGui.set_drag_drop_payload + + type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. Return true when payload has been accepted. + +### ::: ImGui.end_drag_drop_source + + only call [`end_drag_drop_source`][ImGui.end_drag_drop_source] if [`begin_drag_drop_source`][ImGui.begin_drag_drop_source] returns true! + +### ::: ImGui.begin_drag_drop_target + + call after submitting an item that may receive a payload. If this returns true, you can call [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] + [`end_drag_drop_target`][ImGui.end_drag_drop_target] + +### ::: ImGui.accept_drag_drop_payload + + accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. + +### ::: ImGui.end_drag_drop_target + + only call [`end_drag_drop_target`][ImGui.end_drag_drop_target] if [`begin_drag_drop_target`][ImGui.begin_drag_drop_target] returns true! + +### ::: ImGui.get_drag_drop_payload + + peek directly into the current payload from anywhere. may return NULL. use [`ImGuiPayload`][ImGui::ImGuiPayload]::IsDataType() to test for the payload type. + +## Disabling [BETA API] + +- Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors) +- Those can be nested but it cannot be used to enable an already disabled section (a single [`begin_disabled`][ImGui.begin_disabled](true) in the stack is enough to keep everything disabled) +- [`begin_disabled`][ImGui.begin_disabled](false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling [`begin_disabled`][ImGui.begin_disabled](False)/[`end_disabled`][ImGui.end_disabled] best to avoid it. + +### ::: ImGui.begin_disabled + +### ::: ImGui.end_disabled + +## Clipping + +- Mouse hovering is affected by [`push_clip_rect`][ImGui.push_clip_rect] calls, unlike direct calls to [`ImDrawList`][ImGui::ImDrawList]::[`push_clip_rect`][ImGui.push_clip_rect] which are render only. + +### ::: ImGui.push_clip_rect + +### ::: ImGui.pop_clip_rect + +## Focus, Activation + +- Prefer using "[`set_item_default_focus`][ImGui.set_item_default_focus]" over "if ([`is_window_appearing`][ImGui.is_window_appearing]) [`set_scroll_here_y`][ImGui.set_scroll_here_y]" when applicable to signify "this is the default item" + +### ::: ImGui.set_item_default_focus + + make last item the default focused item of a window. + +### ::: ImGui.set_keyboard_focus_here + + focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. + +## Item/Widgets Utilities and Query Functions + +- Most of the functions are referring to the previous Item that has been submitted. +- See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions. + +### ::: ImGui.is_item_hovered + + is the last item hovered? (and usable, aka not blocked by a popup, etc.). See [`ImGuiHoveredFlags`][ImGui::ImGuiHoveredFlags] for more options. + +### ::: ImGui.is_item_active + + 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.is_item_focused + + is the last item focused for keyboard/gamepad navigation? + +### ::: ImGui.is_item_clicked + + is the last item hovered and mouse clicked on? (**) == [`is_mouse_clicked`][ImGui.is_mouse_clicked](mouse_button) && [`is_item_hovered`][ImGui.is_item_hovered]Important. (**) this it NOT equivalent to the behavior of e.g. [`button`][ImGui.button]. Read comments in function definition. + +### ::: ImGui.is_item_visible + + is the last item visible? (items may be out of sight because of clipping/scrolling) + +### ::: ImGui.is_item_edited + + did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. + +### ::: ImGui.is_item_activated + + was the last item just made active (item was previously inactive). + +### ::: ImGui.is_item_deactivated + + was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. + +### ::: ImGui.is_item_deactivated_after_edit + + 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.is_item_toggled_open + + was the last item open state toggled? set by TreeNode(). + +### ::: ImGui.is_any_item_hovered + + is any item hovered? + +### ::: ImGui.is_any_item_active + + is any item active? + +### ::: ImGui.is_any_item_focused + + is any item focused? + +### ::: ImGui.get_item_rect_min + + get upper-left bounding rectangle of the last item (screen space) + +### ::: ImGui.get_item_rect_max + + get lower-right bounding rectangle of the last item (screen space) + +### ::: ImGui.get_item_rect_size + + get size of last item + +### ::: ImGui.set_item_allow_overlap + + allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. + +## Viewports + +- Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. +- In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports. +- In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode. + +### ::: ImGui.get_main_viewport + + return primary/default viewport. This can never be NULL. + +## Background/Foreground Draw Lists + +### ::: ImGui.get_background_draw_list + + this draw list will be the first rendered one. Useful to quickly draw shapes/text behind dear imgui contents. + +### ::: ImGui.get_foreground_draw_list + + this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. + +## Miscellaneous Utilities + +### ::: ImGui.is_rect_visible + + test if rectangle (of given size, starting from cursor position) is visible / not clipped. + +### ::: ImGui.is_rect_visible + + test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. + +### ::: ImGui.get_time + + get global imgui time. incremented by io.DeltaTime every frame. + +### ::: ImGui.get_frame_count + + get global imgui frame count. incremented by 1 every frame. + +### ::: ImGui.get_draw_list_shared_data + + you may use this when creating your own [`ImDrawList`][ImGui::ImDrawList] instances. + +### ::: ImGui.get_style_color_name + + get a string corresponding to the enum value (for display, saving, etc.). + +### ::: ImGui.set_state_storage + + replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) + +### ::: ImGui.get_state_storage + +### ::: ImGui.begin_child_frame + + helper to create a child window / scrolling region that looks like a normal widget frame + +### ::: ImGui.end_child_frame + + always call [`end_child_frame`][ImGui.end_child_frame] regardless of [`begin_child_frame`][ImGui.begin_child_frame] return values (which indicates a collapsed/clipped window) + +## [`text`][ImGui.text] Utilities + +### ::: ImGui.calc_text_size + +## Color Utilities + +### ::: ImGui.color_convert_u32_to_float4 + +### ::: ImGui.color_convert_float4_to_u32 + +### ::: ImGui.color_convert_rgb_to_hsv + +### ::: ImGui.color_convert_hsv_to_rgb + +## Inputs Utilities: Keyboard +Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support) + + - For '[`ImGuiKey`][ImGui::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`][ImGui::ImGuiKey]' will assert when key < 512 will be passed, previously reserved as native/user keys indices + - [`get_key_index`][ImGui.get_key_index] is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined) + +### ::: ImGui.is_key_down + + is key being held. + +### ::: ImGui.is_key_pressed + + was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate + +### ::: ImGui.is_key_released + + was key released (went from Down to !Down)? + +### ::: ImGui.get_key_pressed_amount + + uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate + +### ::: ImGui.get_key_name + + [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared. + +### ::: ImGui.set_next_frame_want_capture_keyboard + + Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next [`new_frame`][ImGui.new_frame] call. + +## Inputs Utilities: Mouse + +- To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right. +- You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. +- Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold') + +### ::: ImGui.is_mouse_down + + is mouse button held? + +### ::: ImGui.is_mouse_clicked + + did mouse button clicked? (went from !Down to Down). Same as [`get_mouse_clicked_count`][ImGui.get_mouse_clicked_count] == 1. + +### ::: ImGui.is_mouse_released + + did mouse button released? (went from Down to !Down) + +### ::: ImGui.is_mouse_double_clicked + + did mouse button double-clicked? Same as [`get_mouse_clicked_count`][ImGui.get_mouse_clicked_count] == 2. (note that a double-click will also report [`is_mouse_clicked`][ImGui.is_mouse_clicked] == true) + +### ::: ImGui.get_mouse_clicked_count + + return the number of successive mouse-clicks at the time where a click happen (otherwise 0). + +### ::: ImGui.is_mouse_hovering_rect + +### ::: ImGui.is_mouse_pos_valid + + by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available + +### ::: ImGui.is_any_mouse_down + + [WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. + +### ::: ImGui.get_mouse_pos + + shortcut to [`get_io`][ImGui.get_io].MousePos provided by user, to be consistent with other calls + +### ::: ImGui.get_mouse_pos_on_opening_current_popup + + retrieve mouse position at the time of opening popup we have [`begin_popup`][ImGui.begin_popup] into (helper to avoid user backing that value themselves) + +### ::: ImGui.is_mouse_dragging + + is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) + +### ::: ImGui.get_mouse_drag_delta + + return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) + +### ::: ImGui.reset_mouse_drag_delta + +### ::: ImGui.get_mouse_cursor + + get desired cursor type, reset in [`new_frame`][ImGui.new_frame], this is updated during the frame. valid before [`render`][ImGui.render]. If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you + +### ::: ImGui.set_mouse_cursor + + set desired cursor type + +### ::: ImGui.set_next_frame_want_capture_mouse + + Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next [`new_frame`][ImGui.new_frame] call. + +## Clipboard Utilities + +- Also see the [`log_to_clipboard`][ImGui.log_to_clipboard] function to capture GUI into clipboard, or easily output text data to the clipboard. + +### ::: ImGui.get_clipboard_text + +### ::: ImGui.set_clipboard_text + +Settings/.Ini Utilities + +- The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini"). +- Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually. +- Important: default value "imgui.ini" is relative to current working dir! Most apps will want to lock this to an absolute path (e.g. same path as executables). + +### ::: ImGui.load_ini_settings_from_disk + + call after [`create_context`][ImGui.create_context] and before the first call to [`new_frame`][ImGui.new_frame]. [`new_frame`][ImGui.new_frame] automatically calls [`load_ini_settings_from_disk`][ImGui.load_ini_settings_from_disk](io.IniFilename). + +### ::: ImGui.load_ini_settings_from_memory + + call after [`create_context`][ImGui.create_context] and before the first call to [`new_frame`][ImGui.new_frame] to provide .ini data from your own data source. + +### ::: ImGui.save_ini_settings_to_disk + + this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by [`destroy_context`][ImGui.destroy_context]). + +### ::: ImGui.save_ini_settings_to_memory + + return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. + +## Debug Utilities + +### ::: ImGui.debug_text_encoding + +### ::: ImGui.debug_check_version_and_data_layout + + This is called by IMGUI_CHECKVERSION() macro. + +## Memory Allocators + +- Those functions are not reliant on the current context. +- DLL users: heaps and globals are not shared across DLL boundaries! You will need to call [`set_current_context`][ImGui.set_current_context] + [`set_allocator_functions`][ImGui.set_allocator_functions] + for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. + +### ::: ImGui.set_allocator_functions + +### ::: ImGui.get_allocator_functions + +### ::: ImGui.mem_alloc + +### ::: ImGui.mem_free + + namespace ImGui + diff --git a/docs/io.md b/docs/io.md new file mode 100644 index 0000000..97530be --- /dev/null +++ b/docs/io.md @@ -0,0 +1,402 @@ +# ImGuiIO + +Communicate most settings and inputs/outputs to Dear ImGui using this structure. +Access via [`get_io`][ImGui.get_io]. Read 'Programmer guide' section in .cpp file for general usage. + +[Internal] Storage used by [`is_key_down`][ImGui.is_key_down], [`is_key_pressed`][ImGui.is_key_pressed] 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. + +### ::: ImGui::ImGuiKeyData + +##### ::: ImGui::ImGuiKeyData.down + + True for if key is down + +##### ::: ImGui::ImGuiKeyData.down_duration + + Duration the key has been down (<0.0f: not pressed, 0.0f: just pressed, >0.0f: time held) + +##### ::: ImGui::ImGuiKeyData.down_duration_prev + + Last frame duration the key has been down + +##### ::: ImGui::ImGuiKeyData.analog_value + + 0.0f..1.0f for gamepad values + +### ::: ImGui::ImGuiIO + +#### Configuration // Default value + +##### ::: ImGui::ImGuiIO.config_flags + + = 0 // See [`ImGuiConfigFlags`][ImGui::ImGuiConfigFlags] enum. Set by user/application. Gamepad/keyboard navigation options, etc. + +##### ::: ImGui::ImGuiIO.backend_flags + + = 0 // See [`ImGuiBackendFlags`][ImGui::ImGuiBackendFlags] enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. + +##### ::: ImGui::ImGuiIO.display_size + + // Main display size, in pixels (generally == [`get_main_viewport`][ImGui.get_main_viewport]->Size). May change every frame. + +##### ::: ImGui::ImGuiIO.delta_time + + = 1.0f/60.0f // Time elapsed since last frame, in seconds. May change every frame. + +##### ::: ImGui::ImGuiIO.ini_saving_rate + + = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds. + +##### ::: ImGui::ImGuiIO.ini_filename + + = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. + +##### ::: ImGui::ImGuiIO.log_filename + + = "imgui_log.txt"// Path to .log file (default parameter to [`log_to_file`][ImGui.log_to_file] when no file is specified). + +##### ::: ImGui::ImGuiIO.mouse_double_click_time + + = 0.30f // Time for a double-click, in seconds. + +##### ::: ImGui::ImGuiIO.mouse_double_click_max_dist + + = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. + +##### ::: ImGui::ImGuiIO.mouse_drag_threshold + + = 6.0f // Distance threshold before considering we are dragging. + +##### ::: ImGui::ImGuiIO.key_repeat_delay + + = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). + +##### ::: ImGui::ImGuiIO.key_repeat_rate + + = 0.050f // When holding a key/button, rate at which it repeats, in seconds. + +##### ::: ImGui::ImGuiIO.user_data + + = NULL // Store your own data for retrieval by callbacks. + +##### ::: ImGui::ImGuiIO.fonts + + // Font atlas: load, rasterize and pack one or more fonts into a single texture. + +##### ::: ImGui::ImGuiIO.font_global_scale + + = 1.0f // Global scale all fonts + +##### ::: ImGui::ImGuiIO.font_allow_user_scaling + + = false // Allow user scaling text of individual window with CTRL+Wheel. + +##### ::: ImGui::ImGuiIO.font_default + + = NULL // Font to use on [`new_frame`][ImGui.new_frame]. Use NULL to uses Fonts->Fonts[0]. + +##### ::: ImGui::ImGuiIO.display_framebuffer_scale + + = (1, 1) // For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in [`ImDrawData`][ImGui::ImDrawData]::FramebufferScale. + +#### Miscellaneous options + +##### ::: ImGui::ImGuiIO.mouse_draw_cursor + + = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations. + +##### ::: ImGui::ImGuiIO.config_mac_osx_behaviors + + = defined(__APPLE__) // OS X style: [`text`][ImGui.text] editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/[`text`][ImGui.text] Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. + +##### ::: ImGui::ImGuiIO.config_input_trickle_event_queue + + = true // 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. + +##### ::: ImGui::ImGuiIO.config_input_text_cursor_blink + + = true // Enable blinking cursor (optional as some users consider it to be distracting). + +##### ::: ImGui::ImGuiIO.config_drag_click_to_input_text + + = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard. + +##### ::: ImGui::ImGuiIO.config_windows_resize_from_edges + + = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) + +##### ::: ImGui::ImGuiIO.config_windows_move_from_title_bar_only + + = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. + +##### ::: ImGui::ImGuiIO.config_memory_compact_timer + + = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. + +#### Platform Functions +(the imgui_impl_xxxx backend files are setting those up for you) + +Optional: Platform/Renderer backend name (informational only! will be displayed in About Window) + User data for backend/wrappers to store their own stuff. + +##### ::: ImGui::ImGuiIO.backend_platform_name + + = NULL + +##### ::: ImGui::ImGuiIO.backend_renderer_name + + = NULL + +##### ::: ImGui::ImGuiIO.backend_platform_user_data + + = NULL // User data for platform backend + +##### ::: ImGui::ImGuiIO.backend_renderer_user_data + + = NULL // User data for renderer backend + +##### ::: ImGui::ImGuiIO.backend_language_user_data + + = NULL // User data for non C++ programming language backend + +#### Optional: Access OS clipboard +(default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) + +##### ::: ImGui::ImGuiIO.clipboard_user_data + +Optional: Notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME on Windows) +(default to use native imm32 api on Windows) + + = NULL // [Obsolete] Set [`ImGuiViewport`][ImGui::ImGuiViewport]::PlatformHandleRaw instead. Set this to your HWND to get automatic IME cursor positioning. + + Unused field to keep data structure the same size. + +#### Input - Call before calling [`new_frame`][ImGui.new_frame] + +#### Input Functions + 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) + Queue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). Dead-zones should be handled by the backend. + Queue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. app not focused and not hovered) + Queue a mouse button change + Queue a mouse wheel update + Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window) + Queue a new character input + Queue a new character input from an UTF-16 character, it can be a surrogate + Queue a new characters input from an UTF-8 string + + [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode. + Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen. + [Internal] Clear the text input buffer manually + [Internal] Release all keys + +#### Output - Updated by [`new_frame`][ImGui.new_frame] or [`end_frame`][ImGui.end_frame]/[`render`][ImGui.render] +(when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is + generally easier and more correct to use their state BEFORE calling [`new_frame`][ImGui.new_frame]. See FAQ for details!) + +##### ::: ImGui::ImGuiIO.want_capture_mouse + + Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). + +##### ::: ImGui::ImGuiIO.want_capture_keyboard + + Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. [`input_text`][ImGui.input_text] active, or an imgui window is focused and navigation is enabled, etc.). + +##### ::: ImGui::ImGuiIO.want_text_input + + Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a [`input_text`][ImGui.input_text] widget is active). + +##### ::: ImGui::ImGuiIO.want_set_mouse_pos + + MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. + +##### ::: ImGui::ImGuiIO.want_save_ini_settings + + When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call [`save_ini_settings_to_memory`][ImGui.save_ini_settings_to_memory] and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! + +##### ::: ImGui::ImGuiIO.nav_active + + Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. + +##### ::: ImGui::ImGuiIO.nav_visible + + Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). + +##### ::: ImGui::ImGuiIO.framerate + + Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. + +##### ::: ImGui::ImGuiIO.metrics_render_vertices + + Vertices output during last call to [`render`][ImGui.render] + +##### ::: ImGui::ImGuiIO.metrics_render_indices + + Indices output during last call to [`render`][ImGui.render] = number of triangles * 3 + +##### ::: ImGui::ImGuiIO.metrics_render_windows + + Number of visible windows + +##### ::: ImGui::ImGuiIO.metrics_active_windows + + Number of active windows + +##### ::: ImGui::ImGuiIO.metrics_active_allocations + + Number of active allocations, updated by [`mem_alloc`][ImGui.mem_alloc]/[`mem_free`][ImGui.mem_free] based on current context. May be off if you have multiple imgui contexts. + +##### ::: ImGui::ImGuiIO.mouse_delta + + Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + +Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->native map) during initialization and io.KeysDown[] (native indices) every frame. +This is still temporarily supported as a legacy feature. However the new preferred scheme is for backend to call io.AddKeyEvent(). + +##### ::: ImGui::ImGuiIO.key_map + + [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using [`ImGuiKey`][ImGui::ImGuiKey] indices which are always >512. + +##### ::: ImGui::ImGuiIO.keys_down + + [LEGACY] Input: 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). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[[`get_key_index`][ImGui.get_key_index](...)] to work without an overflow. + +[Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed! + +#### Main Input State +(this block used to be written by backend, since 1.87 it is best to NOT write to those directly, call the AddXXX functions above instead) +(reading from those variables is fair game, as they are extremely unlikely to be moving anywhere) + +##### ::: ImGui::ImGuiIO.mouse_pos + + Mouse position, in pixels. Set to [`ImVec2`][ImGui::ImVec2](-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) + +##### ::: ImGui::ImGuiIO.mouse_down + + 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. + +##### ::: ImGui::ImGuiIO.mouse_wheel + + Mouse wheel Vertical: 1 unit scrolls about 5 lines text. + +##### ::: ImGui::ImGuiIO.mouse_wheel_h + + Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends. + +##### ::: ImGui::ImGuiIO.key_ctrl + + Keyboard modifier down: Control + +##### ::: ImGui::ImGuiIO.key_shift + + Keyboard modifier down: Shift + +##### ::: ImGui::ImGuiIO.key_alt + + Keyboard modifier down: Alt + +##### ::: ImGui::ImGuiIO.key_super + + Keyboard modifier down: Cmd/Super/Windows + +##### ::: ImGui::ImGuiIO.nav_inputs + + Gamepad inputs. Cleared back to zero by [`end_frame`][ImGui.end_frame]. Keyboard keys will be auto-mapped and be written here by [`new_frame`][ImGui.new_frame]. + +#### Other state maintained from data above + IO function calls + +##### ::: ImGui::ImGuiIO.key_mods + + Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by [`new_frame`][ImGui.new_frame] + +##### ::: ImGui::ImGuiIO.keys_data + + Key state for all known keys. Use IsKeyXXX() functions to access this. + +##### ::: ImGui::ImGuiIO.want_capture_mouse_unless_popup_close + + Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup. + +##### ::: ImGui::ImGuiIO.mouse_pos_prev + + Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) + +##### ::: ImGui::ImGuiIO.mouse_clicked_pos + + Position at time of clicking + +##### ::: ImGui::ImGuiIO.mouse_clicked_time + + Time of last click (used to figure out double-click) + +##### ::: ImGui::ImGuiIO.mouse_clicked + + Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0) + +##### ::: ImGui::ImGuiIO.mouse_double_clicked + + Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2) + +##### ::: ImGui::ImGuiIO.mouse_clicked_count + + == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down + +##### ::: ImGui::ImGuiIO.mouse_clicked_last_count + + Count successive number of clicks. Stays valid after mouse release. Reset after another click is done. + +##### ::: ImGui::ImGuiIO.mouse_released + + Mouse button went from Down to !Down + +##### ::: ImGui::ImGuiIO.mouse_down_owned + + Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds. + +##### ::: ImGui::ImGuiIO.mouse_down_owned_unless_popup_close + + Track if button was clicked inside a dear imgui window. + +##### ::: ImGui::ImGuiIO.mouse_down_duration + + Duration the mouse button has been down (0.0f == just clicked) + +##### ::: ImGui::ImGuiIO.mouse_down_duration_prev + + Previous time the mouse button has been down + +##### ::: ImGui::ImGuiIO.mouse_drag_max_distance_sqr + + Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds) + +##### ::: ImGui::ImGuiIO.nav_inputs_down_duration + +##### ::: ImGui::ImGuiIO.nav_inputs_down_duration_prev + +##### ::: ImGui::ImGuiIO.pen_pressure + + Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui. + +##### ::: ImGui::ImGuiIO.app_focus_lost + + Only modify via AddFocusEvent() + +##### ::: ImGui::ImGuiIO.app_accepting_events + + Only modify via SetAppAcceptingEvents() + +##### ::: ImGui::ImGuiIO.backend_using_legacy_key_arrays + + -1: unknown, 0: using AddKeyEvent(), 1: using legacy io.KeysDown[] + +##### ::: ImGui::ImGuiIO.backend_using_legacy_nav_input_array + + 0: using AddKeyAnalogEvent(), 1: writing to legacy io.NavInputs[] directly + +##### ::: ImGui::ImGuiIO.input_queue_surrogate + + For AddInputCharacterUTF16() + +##### ::: ImGui::ImGuiIO.input_queue_characters + + Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper. + diff --git a/docs/obsolete.md b/docs/obsolete.md new file mode 100644 index 0000000..345285a --- /dev/null +++ b/docs/obsolete.md @@ -0,0 +1,7 @@ +# Obsolete functions and types +(Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) +Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. + +### ::: ImGui.get_key_index + + map [`ImGuiKey`][ImGui::ImGuiKey]* values into legacy native key index. == io.KeyMap[key] diff --git a/docs/platform.md b/docs/platform.md new file mode 100644 index 0000000..ec9dc44 --- /dev/null +++ b/docs/platform.md @@ -0,0 +1,18 @@ +# Platform Dependent Interfaces + +(Optional) Support for IME (Input Method Editor) via the io.SetPlatformImeDataFn() function. + +### ::: ImGui::ImGuiPlatformImeData + +##### ::: ImGui::ImGuiPlatformImeData.want_visible + + A widget wants the IME to be visible + +##### ::: ImGui::ImGuiPlatformImeData.input_pos + + Position of the input cursor + +##### ::: ImGui::ImGuiPlatformImeData.input_line_height + + Line height + diff --git a/docs/requirements.in b/docs/requirements.in new file mode 100644 index 0000000..1feeb99 --- /dev/null +++ b/docs/requirements.in @@ -0,0 +1,5 @@ +mkdocs>=1.1.2 +mkdocs-literate-nav>=0.3.1 +mkdocs-material>=7.1.4 +mkdocstrings-crystal>=0.3.1 +pymdown-extensions>=8.2 diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..6afb893 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,83 @@ +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile docs/requirements.in +# +cached-property==1.5.2 + # via mkdocstrings-crystal +click==8.1.3 + # via mkdocs +ghp-import==2.1.0 + # via mkdocs +importlib-metadata==4.12.0 + # via mkdocs +jinja2==3.1.2 + # via + # mkdocs + # mkdocs-material + # mkdocstrings + # mkdocstrings-crystal +markdown==3.3.7 + # via + # markdown-callouts + # mkdocs + # mkdocs-autorefs + # mkdocs-material + # mkdocstrings + # pymdown-extensions +markdown-callouts==0.2.0 + # via mkdocstrings-crystal +markupsafe==2.1.1 + # via + # jinja2 + # mkdocstrings + # mkdocstrings-crystal +mergedeep==1.3.4 + # via mkdocs +mkdocs==1.3.1 + # via + # -r docs/requirements.in + # mkdocs-autorefs + # mkdocs-literate-nav + # mkdocs-material + # mkdocstrings +mkdocs-autorefs==0.4.1 + # via + # mkdocstrings + # mkdocstrings-crystal +mkdocs-literate-nav==0.4.1 + # via -r docs/requirements.in +mkdocs-material==8.3.9 + # via -r docs/requirements.in +mkdocs-material-extensions==1.0.3 + # via mkdocs-material +mkdocstrings==0.19.0 + # via mkdocstrings-crystal +mkdocstrings-crystal==0.3.5 + # via -r docs/requirements.in +packaging==21.3 + # via mkdocs +pygments==2.12.0 + # via mkdocs-material +pymdown-extensions==9.5 + # via + # -r docs/requirements.in + # mkdocs-material + # mkdocstrings +pyparsing==3.0.9 + # via packaging +python-dateutil==2.8.2 + # via ghp-import +pyyaml==6.0 + # via + # mkdocs + # pyyaml-env-tag +pyyaml-env-tag==0.1 + # via mkdocs +six==1.16.0 + # via python-dateutil +watchdog==2.1.9 + # via mkdocs +zipp==3.8.1 + # via importlib-metadata diff --git a/docs/structs.md b/docs/structs.md new file mode 100644 index 0000000..42ab132 --- /dev/null +++ b/docs/structs.md @@ -0,0 +1,171 @@ +# Misc data structures + +Shared state of [`input_text`][ImGui.input_text], passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used. +The callback function should return 0 by default. +Callbacks (follow a flag name and see comments in [`ImGuiInputTextFlags`][ImGui::ImGuiInputTextFlags] declarations for more details) + +- ImGuiInputTextFlags_CallbackEdit: Callback on buffer edit (note that [`input_text`][ImGui.input_text] already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) +- ImGuiInputTextFlags_CallbackAlways: Callback on each iteration +- ImGuiInputTextFlags_CallbackCompletion: Callback on pressing TAB +- ImGuiInputTextFlags_CallbackHistory: Callback on pressing Up/Down arrows +- ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. +- ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. + +### ::: ImGui::ImGuiInputTextCallbackData + +##### ::: ImGui::ImGuiInputTextCallbackData.event_flag + + One ImGuiInputTextFlags_Callback* // Read-only + +##### ::: ImGui::ImGuiInputTextCallbackData.flags + + What user passed to [`input_text`][ImGui.input_text] // Read-only + +##### ::: ImGui::ImGuiInputTextCallbackData.user_data + + What user passed to [`input_text`][ImGui.input_text] // Read-only + +#### Arguments for the different callback events + +- To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary. +- If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so [`input_text`][ImGui.input_text] can update its internal state. + +##### ::: ImGui::ImGuiInputTextCallbackData.event_char + + Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0; + +##### ::: ImGui::ImGuiInputTextCallbackData.event_key + + Key pressed (Up/Down/TAB) // Read-only // [Completion,History] + +##### ::: ImGui::ImGuiInputTextCallbackData.buf + + [`text`][ImGui.text] buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! + +##### ::: ImGui::ImGuiInputTextCallbackData.buf_text_len + + [`text`][ImGui.text] length (in bytes) // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length() + +##### ::: ImGui::ImGuiInputTextCallbackData.buf_size + + Buffer size (in bytes) = capacity+1 // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1 + +##### ::: ImGui::ImGuiInputTextCallbackData.buf_dirty + + Set if you modify Buf/BufTextLen! // Write // [Completion,History,Always] + +##### ::: ImGui::ImGuiInputTextCallbackData.cursor_pos + + // Read-write // [Completion,History,Always] + +##### ::: ImGui::ImGuiInputTextCallbackData.selection_start + + // Read-write // [Completion,History,Always] == to SelectionEnd when no selection) + +##### ::: ImGui::ImGuiInputTextCallbackData.selection_end + + // Read-write // [Completion,History,Always] + +Helper functions for text manipulation. +Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection. + +Resizing callback data to apply custom constraint. As enabled by [`set_next_window_size_constraints`][ImGui.set_next_window_size_constraints]. Callback is called during the next Begin(). +NB: For basic min/max size constraint on each axis you don't need to use the callback! The [`set_next_window_size_constraints`][ImGui.set_next_window_size_constraints] parameters are enough. + +### ::: ImGui::ImGuiSizeCallbackData + +##### ::: ImGui::ImGuiSizeCallbackData.user_data + + Read-only. What user passed to [`set_next_window_size_constraints`][ImGui.set_next_window_size_constraints] + +##### ::: ImGui::ImGuiSizeCallbackData.pos + + Read-only. Window position, for reference. + +##### ::: ImGui::ImGuiSizeCallbackData.current_size + + Read-only. Current window size. + +##### ::: ImGui::ImGuiSizeCallbackData.desired_size + + Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. + +## Data payload for Drag and Drop operations: [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload], [`get_drag_drop_payload`][ImGui.get_drag_drop_payload] + +### ::: ImGui::ImGuiPayload + +#### Members + +##### ::: ImGui::ImGuiPayload.data + + Data (copied and owned by dear imgui) + +##### ::: ImGui::ImGuiPayload.data_size + + Data size + +#### [Internal] + +##### ::: ImGui::ImGuiPayload.source_id + + Source item id + +##### ::: ImGui::ImGuiPayload.source_parent_id + + Source parent id (if available) + +##### ::: ImGui::ImGuiPayload.data_frame_count + + Data timestamp + +##### ::: ImGui::ImGuiPayload.data_type + + Data type tag (short user-supplied string, 32 characters max) + +##### ::: ImGui::ImGuiPayload.preview + + Set when [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] was called and mouse has been hovering the target item (nb: handle overlapping drag targets) + +##### ::: ImGui::ImGuiPayload.delivery + + Set when [`accept_drag_drop_payload`][ImGui.accept_drag_drop_payload] was called and mouse button is released over the target item. + +## Sorting specification for one column of a table (sizeof == 12 bytes) + +### ::: ImGui::ImGuiTableColumnSortSpecs + +##### ::: ImGui::ImGuiTableColumnSortSpecs.column_user_id + + User id of the column (if specified by a [`table_setup_column`][ImGui.table_setup_column] call) + +##### ::: ImGui::ImGuiTableColumnSortSpecs.column_index + + Index of the column + +##### ::: ImGui::ImGuiTableColumnSortSpecs.sort_order + + Index within parent [`ImGuiTableSortSpecs`][ImGui::ImGuiTableSortSpecs] (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here) + +##### ::: ImGui::ImGuiTableColumnSortSpecs.sort_direction + + ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending (you can use this or SortSign, whichever is more convenient for your sort function) + +## Sorting specifications for a table (often handling sort specs for a single column, occasionally more) +Obtained by calling [`table_get_sort_specs`][ImGui.table_get_sort_specs]. +When 'SpecsDirty == true' you can sort your data. It will be true with sorting specs have changed since last call, or the first time. +Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame! + +### ::: ImGui::ImGuiTableSortSpecs + +##### ::: ImGui::ImGuiTableSortSpecs.specs + + Pointer to sort spec array. + +##### ::: ImGui::ImGuiTableSortSpecs.specs_count + + Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. + +##### ::: ImGui::ImGuiTableSortSpecs.specs_dirty + + Set to true when specs have changed since last time! Use this to sort again, then clear the flag. + diff --git a/docs/style.md b/docs/style.md new file mode 100644 index 0000000..91e2a49 --- /dev/null +++ b/docs/style.md @@ -0,0 +1,170 @@ +# ImGuiStyle + +You may modify the [`get_style`][ImGui.get_style] main instance during initialization and before [`new_frame`][ImGui.new_frame]. +During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/[`pop_style_var`][ImGui.pop_style_var] to alter the main style values, +and ImGui::PushStyleColor(ImGuiCol_XXX)/[`pop_style_color`][ImGui.pop_style_color] for colors. + +### ::: ImGui::ImGuiStyle + +##### ::: ImGui::ImGuiStyle.alpha + + Global alpha applies to everything in Dear ImGui. + +##### ::: ImGui::ImGuiStyle.disabled_alpha + + Additional alpha multiplier applied by [`begin_disabled`][ImGui.begin_disabled]. Multiply over current value of Alpha. + +##### ::: ImGui::ImGuiStyle.window_padding + + Padding within a window. + +##### ::: ImGui::ImGuiStyle.window_rounding + + Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended. + +##### ::: ImGui::ImGuiStyle.window_border_size + + Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + +##### ::: ImGui::ImGuiStyle.window_min_size + + Minimum window size. This is a global setting. If you want to constraint individual windows, use [`set_next_window_size_constraints`][ImGui.set_next_window_size_constraints]. + +##### ::: ImGui::ImGuiStyle.window_title_align + + Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. + +##### ::: ImGui::ImGuiStyle.window_menu_button_position + + Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. + +##### ::: ImGui::ImGuiStyle.child_rounding + + Radius of child window corners rounding. Set to 0.0f to have rectangular windows. + +##### ::: ImGui::ImGuiStyle.child_border_size + + Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + +##### ::: ImGui::ImGuiStyle.popup_rounding + + Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) + +##### ::: ImGui::ImGuiStyle.popup_border_size + + Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + +##### ::: ImGui::ImGuiStyle.frame_padding + + Padding within a framed rectangle (used by most widgets). + +##### ::: ImGui::ImGuiStyle.frame_rounding + + Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). + +##### ::: ImGui::ImGuiStyle.frame_border_size + + Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + +##### ::: ImGui::ImGuiStyle.item_spacing + + Horizontal and vertical spacing between widgets/lines. + +##### ::: ImGui::ImGuiStyle.item_inner_spacing + + Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). + +##### ::: ImGui::ImGuiStyle.cell_padding + + Padding within a table cell + +##### ::: ImGui::ImGuiStyle.touch_extra_padding + + Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! + +##### ::: ImGui::ImGuiStyle.indent_spacing + + Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + +##### ::: ImGui::ImGuiStyle.columns_min_spacing + + Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). + +##### ::: ImGui::ImGuiStyle.scrollbar_size + + Width of the vertical scrollbar, Height of the horizontal scrollbar. + +##### ::: ImGui::ImGuiStyle.scrollbar_rounding + + Radius of grab corners for scrollbar. + +##### ::: ImGui::ImGuiStyle.grab_min_size + + Minimum width/height of a grab box for slider/scrollbar. + +##### ::: ImGui::ImGuiStyle.grab_rounding + + Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + +##### ::: ImGui::ImGuiStyle.log_slider_deadzone + + The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. + +##### ::: ImGui::ImGuiStyle.tab_rounding + + Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. + +##### ::: ImGui::ImGuiStyle.tab_border_size + + Thickness of border around tabs. + +##### ::: ImGui::ImGuiStyle.tab_min_width_for_close_button + + Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. + +##### ::: ImGui::ImGuiStyle.color_button_position + + Side of the color button in the [`color_edit4`][ImGui.color_edit4] widget (left/right). Defaults to ImGuiDir_Right. + +##### ::: ImGui::ImGuiStyle.button_text_align + + Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). + +##### ::: ImGui::ImGuiStyle.selectable_text_align + + Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. + +##### ::: ImGui::ImGuiStyle.display_window_padding + + Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. + +##### ::: ImGui::ImGuiStyle.display_safe_area_padding + + If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! + +##### ::: ImGui::ImGuiStyle.mouse_cursor_scale + + Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + +##### ::: ImGui::ImGuiStyle.anti_aliased_lines + + Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to [`ImDrawList`][ImGui::ImDrawList]). + +##### ::: ImGui::ImGuiStyle.anti_aliased_lines_use_tex + + Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to [`ImDrawList`][ImGui::ImDrawList]). + +##### ::: ImGui::ImGuiStyle.anti_aliased_fill + + Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to [`ImDrawList`][ImGui::ImDrawList]). + +##### ::: ImGui::ImGuiStyle.curve_tessellation_tol + + Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + +##### ::: ImGui::ImGuiStyle.circle_tessellation_max_error + + Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. + +##### ::: ImGui::ImGuiStyle.colors + diff --git a/docs/types.md b/docs/types.md new file mode 100644 index 0000000..8def06a --- /dev/null +++ b/docs/types.md @@ -0,0 +1,30 @@ +# Basic types + +[`ImVec2`][ImGui::ImVec2]: 2D vector used to store positions, sizes etc. [Compile-time configurable type] +This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type. + +### ::: ImGui::ImVec2 + +##### ::: ImGui::ImVec2.x + +##### ::: ImGui::ImVec2.y + + We very rarely use this [] operator, the assert overhead is fine. + We very rarely use this [] operator, the assert overhead is fine. + + Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and [`ImVec2`][ImGui::ImVec2]. + +[`ImVec4`][ImGui::ImVec4]: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type] + +### ::: ImGui::ImVec4 + +##### ::: ImGui::ImVec4.x + +##### ::: ImGui::ImVec4.y + +##### ::: ImGui::ImVec4.z + +##### ::: ImGui::ImVec4.w + + Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and [`ImVec4`][ImGui::ImVec4]. + diff --git a/docs/viewports.md b/docs/viewports.md new file mode 100644 index 0000000..6a3600e --- /dev/null +++ b/docs/viewports.md @@ -0,0 +1,55 @@ +# Viewports + +Flags stored in [`ImGuiViewport`][ImGui::ImGuiViewport]::Flags, giving indications to the platform backends. + +### ::: ImGui::ImGuiViewportFlags + +- `None` + +- `IsPlatformWindow` + Represent a Platform Window + +- `IsPlatformMonitor` + Represent a Platform Monitor (unused yet) + +- `OwnedByApp` + Platform Window: is created/managed by the application (rather than a dear imgui backend) + +- Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. +- In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports. +- In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode. +- About Main Area vs Work Area: + - Main Area = entire viewport. + - Work Area = entire viewport minus sections used by main menu bars (for platform windows), or by task bar (for platform monitor). + - Windows are generally trying to stay within the Work Area of their host viewport. + +### ::: ImGui::ImGuiViewport + +##### ::: ImGui::ImGuiViewport.flags + + See [`ImGuiViewportFlags`][ImGui::ImGuiViewportFlags] + +##### ::: ImGui::ImGuiViewport.pos + + Main Area: Position of the viewport (Dear ImGui coordinates are the same as OS desktop/native coordinates) + +##### ::: ImGui::ImGuiViewport.size + + Main Area: Size of the viewport. + +##### ::: ImGui::ImGuiViewport.work_pos + + Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos) + +##### ::: ImGui::ImGuiViewport.work_size + + Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) + +#### Platform/Backend Dependent Data + +##### ::: ImGui::ImGuiViewport.platform_handle_raw + + void* to hold lower-level, platform-native window handle (under Win32 this is expected to be a HWND, unused for other platforms) + +#### Helpers + diff --git a/generate.cr b/generate.cr index 7329ffe..f1233d0 100644 --- a/generate.cr +++ b/generate.cr @@ -22,6 +22,10 @@ macro def_map_from_json(field, parent_field = nil) def self.new(pull : JSON::PullParser) self.new(pull.string_value, {{field.type}}.new(pull)) end + + def name(ctx : Context = Context::Lib) + @name + end end macro with_location(url = true, &block) @@ -40,22 +44,6 @@ macro with_location(url = true, &block) def location : Location assert self.location? end - - def comment - return nil if self.location?.try(&.file) != "imgui.h" - first_comment = IMGUI_H[self.location.line - 1].partition("// ").last - unless first_comment.strip.empty? - first_comment.split(" // ").each do |s| - yield " # " + s.strip unless s.strip.empty? - end - {% if url %} - yield " #" - {% end %} - end - {% if url %} - yield " # [#{self.cpp_name}](#{location.url})" - {% end %} - end end class CType @@ -270,7 +258,7 @@ class COverload end end - def name(ctx : Context) : String + def name(ctx : Context = Context::Lib) : String if ctx.obj? if self.destructor? "finalize" @@ -351,9 +339,7 @@ class COverload end def render(ctx, inside_class = false, &block : String ->) - return if self.templated? - return if self.destructor? - return if self.args.any? { |arg| arg.type.c_name == "va_list" } + return if !usable_overload?(self) if ctx.lib? args = self.args.map do |arg| @@ -466,7 +452,6 @@ class COverload outp2, rets = convert_returns!(outp2, rets) ret_s = to_tuple(rets) || "Void" any_outputter = self.parent.overloads.any?(&.input_output_arg?) - self.comment(&block) def_name = self.name(ctx) yield %( #{"pointer_wrapper " if any_outputter}def #{"self." if !inside_class}#{def_name}(#{args.join(", ")}) : #{ret_s}) call = %( LibImGui.#{self.name(Context::Lib)}(#{call_args.join(", ")})) @@ -569,6 +554,10 @@ class CFunction end end +def usable_overload?(f : COverload) : Bool + !(f.templated? || f.destructor? || f.args.any? { |arg| arg.type.c_name == "va_list" }) +end + AllFunctions = Hash(String, CFunction).from_json( File.read("cimgui/generator/output/definitions.json") ) @@ -583,7 +572,7 @@ class CStructMember @c_name.partition("[")[0] end - def name(ctx : Context) : String + def name(ctx : Context = Context::Obj) : String self.c_name.underscore.presence || "val" end @@ -660,7 +649,6 @@ class CStructMember end if ctx.obj? if (self.type.is_a?(CTemplateType)) && ctx.obj? - self.comment(&block) yield %(def #{varname} : #{typename}) yield %(t = #{this}#{varname}) yield %(pointerof(t).as(#{typename}*).value) @@ -669,7 +657,6 @@ class CStructMember yield set_call += %(.as(#{typeinternal}*).value) yield %(end) elsif self.parent.class? - self.comment(&block) yield %(def #{varname} : #{typename}) yield call yield %(end) @@ -684,6 +671,10 @@ end class CStruct def_map_from_json(members : Array(CStructMember), parent) + def c_name + name + end + def render(ctx : Context, &block : String ->) if self.internal? if ctx.lib? @@ -692,7 +683,6 @@ class CStruct yield %(alias #{self.name} = LibImGui::#{self.name}) end elsif ctx.obj? - self.comment(&block) if self.class? yield %(struct #{self.name}) yield %(include ClassType(LibImGui::#{self.name})) @@ -763,7 +753,7 @@ class CEnumMember @[JSON::Field(key: "name")] getter c_name : String - def name : String + def name(context = Context::Obj) : String name = (assert self.c_name.lchop?(self.parent.name)).lchop("_") if name.to_i? name = "Num#{name}" @@ -801,7 +791,11 @@ end class CEnum def_map_from_json(members : Array(CEnumMember), parent) - def name : String + def c_name + @name + end + + def name(ctx : Context = Context::Lib) : String @name.rchop("_") end @@ -816,14 +810,12 @@ class CEnum yield %() yield "# :nodoc:" if self.internal? - self.comment(&block) yield %(@[Flags]) if self.name.ends_with?("Flags") yield %(enum #{name}) self.members.each do |member| next if member.name.in?("All", "COUNT") next if member.name =~ /_[A-Z]{2,}$/ - member.comment(&block) yield %(#{member.name} = #{member.value}) end yield %(end) @@ -912,7 +904,10 @@ end IMGUI_H = File.read_lines("cimgui/imgui/imgui.h") -def render(ctx : Context, &block : String ->) +items = AllEnums.values + AllTypedefs.values + AllStructs.values + AllFunctions.values +items.sort_by! { |x| {x.location? || Location.new(":0"), x.name} } + +def render(items, ctx : Context, &block : String ->) if ctx.lib? yield %(require "./custom") yield %(require "./types") @@ -933,8 +928,6 @@ def render(ctx : Context, &block : String ->) yield "" end - items = AllEnums.values + AllTypedefs.values + AllStructs.values + AllFunctions.values - items.sort_by! { |x| {x.location? || Location.new(":0"), x.name} } items.each do |it| case it in CEnum ; it.render(ctx, &block) @@ -948,11 +941,156 @@ def render(ctx : Context, &block : String ->) end File.open("src/lib.cr", "w") do |f| - render(Context::Lib, &->f.puts(String)) + render(items, Context::Lib, &->f.puts(String)) end File.open("src/types.cr", "w") do |f| - render(Context::Ext, &->f.puts(String)) + render(items, Context::Ext, &->f.puts(String)) end File.open("src/obj.cr", "w") do |f| - render(Context::Obj, &->f.puts(String)) + render(items, Context::Obj, &->f.puts(String)) +end + +items = ( + AllEnums.values.reject!(&.internal?) + + AllStructs.values.reject!(&.internal?) + + AllFunctions.values.reject!(&.struct?).flat_map(&.overloads).reject!(&.internal?).select { |f| usable_overload?(f) } +) +items.sort_by! { |x| {x.location?.not_nil!, x.name} } + +REFERRABLE_ITEMS = {} of String => String + +def refer(header_level : Int, item) + sep = (item.is_a?(COverload) || item.is_a?(CStructMember) ? "." : "::") + name = sep + item.name(Context::Obj) + if item.is_a?(CStructMember) || item.is_a?(CEnumMember) + name = "::" + item.parent.name(Context::Obj) + name + else + REFERRABLE_ITEMS[item.c_name] = REFERRABLE_ITEMS[item.c_name.rchop('_')] = "ImGui" + name + end + "#" * header_level + " ::: ImGui" + name +end + +out_api = ["# Basic types"] +i = 0 +until IMGUI_H[i] =~ %r(^// ImVec2:) + i += 1 +end +inside = nil +item_i = 0 +item = items[0] +prev_cmt = "" +prev_line = "" +while i < IMGUI_H.size + line = IMGUI_H[i - 1] + if line.includes?("-----") + line = "" + end + + if i == item.location.line + if item.is_a?(CEnum) || item.is_a?(CStruct) + inside = item + end + sep = (item.is_a?(COverload) ? "." : "::") + out_api << "" << refer(3, item) << "" + end + + code, _, cmt = line.partition(%r((^| )// )) + if cmt =~ /^\[SECTION\] (.+)/ + cmt = "# #{$1}" + elsif line =~ %r(^ {0,4}// ) && cmt =~ /^\[?[A-Z][^\.]*$/ && prev_line.strip.strip("{").empty? + cmt = "###{"##" if inside} #{cmt}" + end + + if code == "};" + inside = nil + end + if inside + found = [] of String + if inside.is_a?(CEnum) + inside.members.each do |member| + if code =~ /\b#{member.c_name}\b/ + found << "`#{member.name}`" + end + end + else + inside.members.each do |member| + if code =~ /^[^({]+\b#{member.c_name}\b/ && !member.internal? + out_api << "" << refer(5, member) << "" + end + end + end + if !found.empty? + out_api << "" << "- " + found.join(", ") + " " + end + # if inside.is_a?(CStruct) + # inside.functions.each do |member| + # if code =~ /\b#{member.c_name}\b/ + # out_api << "### ::: ImGui::#{inside.name(Context::Obj)}.#{member.name(Context::Obj)}" + # end + # end + # end + end + + if !inside && prev_cmt =~ /^(-| |$)/ && cmt !~ /^(-| |$)/ + out_api << "" + end + if cmt =~ /^ *(-|[0-9]+\.) / && prev_cmt !~ /^(-| |$)/ + out_api << "" + end + + cmt = cmt.gsub(/^( +)(-|[0-9]+\.)/, "\\1\\1\\2") + + if !cmt.blank? && !cmt[0].in?(' ', '-') + cmt += " " + end + if !code.blank? && !cmt.blank? + cmt = " #{cmt}" + end + out_api << cmt + + if i >= item.location.line + item = items[item_i += 1]? || break + end + + i += 1 + prev_line = line + prev_cmt = code.blank? ? cmt : "" +end + +keys = REFERRABLE_ITEMS.keys.sort_by! { |s| -s.size }.map { |s| Regex.escape(s) }.join('|') +referrable_items_re = /(?!Begin\b)(?!End\b)(ImGui::)?\b(#{keys})\b(?!`)(\(\))?/ + +file = nil +file_mappings = { + /Basic types/ => "types", + /API functions/ => "index", + /\bFlags\b/ => "flags", + /Helpers/ => "helpers", + /Style\b/ => "style", + /IO\b/ => "io", + /data struct/ => "structs", + /Viewports/ => "viewports", + /Platform/ => "platform", + /Obsolete/ => "obsolete", + /Drawing/ => "drawing", + /\bFont\b/ => "font", +} +out_api.each_with_index do |line, i| + if line =~ /^# (.+?) *$/ + title = $1 + file.try(&.close) + fn = file_mappings.find { |k, v| title =~ k } || raise title + fn = fn.last + file = fn ? File.open("docs/#{fn}.md", "w") : nil + elsif !line.includes?(" ::: ") + line = line.gsub(referrable_items_re) do + s = REFERRABLE_ITEMS[$2] + "[`#{s.lchop("ImGui::").lchop("ImGui.")}`][#{s}]" + end + end + + next if line.empty? && out_api[i - 1].strip.empty? + + file.try(&.puts line) end +file.try(&.close) diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..e472fe4 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,40 @@ +site_name: crystal-imgui +use_directory_urls: false +repo_url: https://github.com/oprypin/crsfml/ +edit_uri: blob/master/ + +theme: + name: material + features: + #- navigation.tabs + +extra_css: + - css/mkdocstrings.css + +markdown_extensions: + - admonition + - pymdownx.magiclink + - pymdownx.superfences + - toc: + permalink: "#" + +plugins: + - search + - mkdocstrings: + default_handler: crystal + handlers: + crystal: + selection: + file_filters: ['!'] + +markdown_extensions: + - pymdownx.highlight + - pymdownx.magiclink + - pymdownx.saneheaders + - pymdownx.superfences + - deduplicate-toc + - callouts + - toc: + permalink: "#" + +watch: [src] diff --git a/src/imgui.cr b/src/imgui.cr index 5193f87..2ace6de 100644 --- a/src/imgui.cr +++ b/src/imgui.cr @@ -3,6 +3,7 @@ module ImGui GC.malloc(size) }, ->(ptr, data) {}, nil) + # :nodoc: private module ClassType(T) macro included @this : T* @@ -18,6 +19,7 @@ module ImGui end end + # :nodoc: private module StructType def to_unsafe {{"pointerof(@#{@type.instance_vars.first}).as(#{@type}*)".id}} diff --git a/src/obj.cr b/src/obj.cr index a68d35c..cf5b631 100644 --- a/src/obj.cr +++ b/src/obj.cr @@ -1,198 +1,128 @@ require "./lib" module ImGui - # [struct ImVec2](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L249) struct ImVec2 include StructType - # [ImVec2::ImVec2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L252) def self.new : ImVec2 result = LibImGui.ImVec2_ImVec2_Nil result.value end - # [ImVec2::ImVec2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L253) def self.new(_x : Float32, _y : Float32) : ImVec2 result = LibImGui.ImVec2_ImVec2_Float(_x, _y) result.value end end - # [struct ImVec4](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L262) struct ImVec4 include StructType - # [ImVec4::ImVec4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L265) def self.new : ImVec4 result = LibImGui.ImVec4_ImVec4_Nil result.value end - # [ImVec4::ImVec4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L266) def self.new(_x : Float32, _y : Float32, _z : Float32, _w : Float32) : ImVec4 result = LibImGui.ImVec4_ImVec4_Float(_x, _y, _z, _w) result.value end end - # [ImGui::CreateContext()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L284) def self.create_context(shared_font_atlas : ImFontAtlas? = nil) : ImGuiContext result = LibImGui.CreateContext(shared_font_atlas) result.value end - # NULL = destroy current context - # - # [ImGui::DestroyContext()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L285) def self.destroy_context(ctx : ImGuiContext? = nil) : Void LibImGui.DestroyContext(ctx) end - # [ImGui::GetCurrentContext()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L286) def self.get_current_context : ImGuiContext result = LibImGui.GetCurrentContext result.value end - # [ImGui::SetCurrentContext()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L287) def self.set_current_context(ctx : ImGuiContext) : Void LibImGui.SetCurrentContext(ctx) end - # access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) - # - # [ImGui::GetIO()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L290) def self.get_io : ImGuiIO result = LibImGui.GetIO ImGuiIO.new(result) end - # access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame! - # - # [ImGui::GetStyle()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L291) def self.get_style : ImGuiStyle result = LibImGui.GetStyle ImGuiStyle.new(result) end - # start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame(). - # - # [ImGui::NewFrame()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L292) def self.new_frame : Void LibImGui.NewFrame end - # ends the Dear ImGui frame. automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all! - # - # [ImGui::EndFrame()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L293) def self.end_frame : Void LibImGui.EndFrame end - # ends the Dear ImGui frame, finalize the draw data. You can then get call GetDrawData(). - # - # [ImGui::Render()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L294) def self.render : Void LibImGui.Render end - # valid after Render() and until the next call to NewFrame(). this is what you have to render. - # - # [ImGui::GetDrawData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L295) def self.get_draw_data : ImDrawData result = LibImGui.GetDrawData ImDrawData.new(result) end - # create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! - # - # [ImGui::ShowDemoWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L298) pointer_wrapper def self.show_demo_window(p_open : Bool* = Pointer(Bool).null) : Void LibImGui.ShowDemoWindow(p_open) end - # create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc. - # - # [ImGui::ShowMetricsWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L299) pointer_wrapper def self.show_metrics_window(p_open : Bool* = Pointer(Bool).null) : Void LibImGui.ShowMetricsWindow(p_open) end - # create Debug Log window. display a simplified log of important dear imgui events. - # - # [ImGui::ShowDebugLogWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L300) pointer_wrapper def self.show_debug_log_window(p_open : Bool* = Pointer(Bool).null) : Void LibImGui.ShowDebugLogWindow(p_open) end - # create Stack Tool window. hover items with mouse to query information about the source of their unique ID. - # - # [ImGui::ShowStackToolWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L301) pointer_wrapper def self.show_stack_tool_window(p_open : Bool* = Pointer(Bool).null) : Void LibImGui.ShowStackToolWindow(p_open) end - # create About window. display Dear ImGui version, credits and build/system information. - # - # [ImGui::ShowAboutWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L302) pointer_wrapper def self.show_about_window(p_open : Bool* = Pointer(Bool).null) : Void LibImGui.ShowAboutWindow(p_open) end - # add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) - # - # [ImGui::ShowStyleEditor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L303) def self.show_style_editor(ref : ImGuiStyle? = nil) : Void LibImGui.ShowStyleEditor(ref) end - # add style selector block (not a window), essentially a combo listing the default styles. - # - # [ImGui::ShowStyleSelector()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L304) def self.show_style_selector(label : String) : Bool LibImGui.ShowStyleSelector(label) end - # add font selector block (not a window), essentially a combo listing the loaded fonts. - # - # [ImGui::ShowFontSelector()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L305) def self.show_font_selector(label : String) : Void LibImGui.ShowFontSelector(label) end - # add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). - # - # [ImGui::ShowUserGuide()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L306) def self.show_user_guide : Void LibImGui.ShowUserGuide end - # get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp) - # - # [ImGui::GetVersion()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L307) def self.get_version : String result = LibImGui.GetVersion String.new(result) end - # new, recommended style (default) - # - # [ImGui::StyleColorsDark()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L310) def self.style_colors_dark(dst : ImGuiStyle? = nil) : Void LibImGui.StyleColorsDark(dst) end - # best used with borders and a custom, thicker font - # - # [ImGui::StyleColorsLight()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L311) def self.style_colors_light(dst : ImGuiStyle? = nil) : Void LibImGui.StyleColorsLight(dst) end - # classic imgui style - # - # [ImGui::StyleColorsClassic()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L312) def self.style_colors_classic(dst : ImGuiStyle? = nil) : Void LibImGui.StyleColorsClassic(dst) end - # [ImGui::Begin()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L326) pointer_wrapper def self.begin(name : String, p_open : Bool* = Pointer(Bool).null, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.Begin(name, p_open, flags) end @@ -202,12 +132,10 @@ module ImGui self.end end - # [ImGui::End()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L327) def self.end : Void LibImGui.End end - # [ImGui::BeginChild()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L337) def self.begin_child(str_id : String, size : ImVec2 = ImVec2.new(0, 0), border : Bool = false, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.BeginChild_Str(str_id, size, border, flags) end @@ -218,7 +146,6 @@ module ImGui self.end_child end - # [ImGui::BeginChild()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L338) def self.begin_child(id : ImGuiID, size : ImVec2 = ImVec2.new(0, 0), border : Bool = false, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.BeginChild_ID(id, size, border, flags) end @@ -229,290 +156,173 @@ module ImGui self.end_child end - # [ImGui::EndChild()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L339) def self.end_child : Void LibImGui.EndChild end - # [ImGui::IsWindowAppearing()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L343) def self.is_window_appearing : Bool LibImGui.IsWindowAppearing end - # [ImGui::IsWindowCollapsed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L344) def self.is_window_collapsed : Bool LibImGui.IsWindowCollapsed end - # is current window focused? or its root/child, depending on flags. see flags for options. - # - # [ImGui::IsWindowFocused()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L345) def self.is_window_focused(flags : ImGuiFocusedFlags = ImGuiFocusedFlags.new(0)) : Bool LibImGui.IsWindowFocused(flags) end - # is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! - # - # [ImGui::IsWindowHovered()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L346) def self.is_window_hovered(flags : ImGuiHoveredFlags = ImGuiHoveredFlags.new(0)) : Bool LibImGui.IsWindowHovered(flags) end - # get draw list associated to the current window, to append your own drawing primitives - # - # [ImGui::GetWindowDrawList()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L347) def self.get_window_draw_list : ImDrawList result = LibImGui.GetWindowDrawList ImDrawList.new(result) end - # get current window position in screen space (useful if you want to do your own drawing via the DrawList API) - # - # [ImGui::GetWindowPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L348) def self.get_window_pos : ImGui::ImVec2 LibImGui.GetWindowPos(out p_out) p_out end - # get current window size - # - # [ImGui::GetWindowSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L349) def self.get_window_size : ImGui::ImVec2 LibImGui.GetWindowSize(out p_out) p_out end - # get current window width (shortcut for GetWindowSize().x) - # - # [ImGui::GetWindowWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L350) def self.get_window_width : Float32 LibImGui.GetWindowWidth end - # get current window height (shortcut for GetWindowSize().y) - # - # [ImGui::GetWindowHeight()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L351) def self.get_window_height : Float32 LibImGui.GetWindowHeight end - # set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. - # - # [ImGui::SetNextWindowPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L355) def self.set_next_window_pos(pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0), pivot : ImVec2 = ImVec2.new(0, 0)) : Void LibImGui.SetNextWindowPos(pos, cond, pivot) end - # set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() - # - # [ImGui::SetNextWindowSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L356) def self.set_next_window_size(size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetNextWindowSize(size, cond) end - # set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints. - # - # [ImGui::SetNextWindowSizeConstraints()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L357) def self.set_next_window_size_constraints(size_min : ImVec2, size_max : ImVec2, custom_callback : ImGuiSizeCallback? = nil, custom_callback_data : Void* = Pointer(Void).null) : Void LibImGui.SetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_data) end - # set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin() - # - # [ImGui::SetNextWindowContentSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L358) def self.set_next_window_content_size(size : ImVec2) : Void LibImGui.SetNextWindowContentSize(size) end - # set next window collapsed state. call before Begin() - # - # [ImGui::SetNextWindowCollapsed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L359) def self.set_next_window_collapsed(collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetNextWindowCollapsed(collapsed, cond) end - # set next window to be focused / top-most. call before Begin() - # - # [ImGui::SetNextWindowFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L360) def self.set_next_window_focus : Void LibImGui.SetNextWindowFocus end - # set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. - # - # [ImGui::SetNextWindowBgAlpha()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L361) def self.set_next_window_bg_alpha(alpha : Float32) : Void LibImGui.SetNextWindowBgAlpha(alpha) end - # (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. - # - # [ImGui::SetWindowPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L362) def self.set_window_pos(pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowPos_Vec2(pos, cond) end - # set named window position. - # - # [ImGui::SetWindowPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L367) def self.set_window_pos(name : String, pos : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowPos_Str(name, pos, cond) end - # (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. - # - # [ImGui::SetWindowSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L363) def self.set_window_size(size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowSize_Vec2(size, cond) end - # set named window size. set axis to 0.0f to force an auto-fit on this axis. - # - # [ImGui::SetWindowSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L368) def self.set_window_size(name : String, size : ImVec2, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowSize_Str(name, size, cond) end - # (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed(). - # - # [ImGui::SetWindowCollapsed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L364) def self.set_window_collapsed(collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowCollapsed_Bool(collapsed, cond) end - # set named window collapsed state - # - # [ImGui::SetWindowCollapsed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L369) def self.set_window_collapsed(name : String, collapsed : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetWindowCollapsed_Str(name, collapsed, cond) end - # (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus(). - # - # [ImGui::SetWindowFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L365) def self.set_window_focus : Void LibImGui.SetWindowFocus_Nil end - # set named window to be focused / top-most. use NULL to remove focus. - # - # [ImGui::SetWindowFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L370) def self.set_window_focus(name : String) : Void LibImGui.SetWindowFocus_Str(name) end - # [OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes(). - # - # [ImGui::SetWindowFontScale()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L366) def self.set_window_font_scale(scale : Float32) : Void LibImGui.SetWindowFontScale(scale) end - # == GetContentRegionMax() - GetCursorPos() - # - # [ImGui::GetContentRegionAvail()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L375) def self.get_content_region_avail : ImGui::ImVec2 LibImGui.GetContentRegionAvail(out p_out) p_out end - # current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates - # - # [ImGui::GetContentRegionMax()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L376) def self.get_content_region_max : ImGui::ImVec2 LibImGui.GetContentRegionMax(out p_out) p_out end - # content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates - # - # [ImGui::GetWindowContentRegionMin()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L377) def self.get_window_content_region_min : ImGui::ImVec2 LibImGui.GetWindowContentRegionMin(out p_out) p_out end - # content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates - # - # [ImGui::GetWindowContentRegionMax()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L378) def self.get_window_content_region_max : ImGui::ImVec2 LibImGui.GetWindowContentRegionMax(out p_out) p_out end - # get scrolling amount [0 .. GetScrollMaxX()] - # - # [ImGui::GetScrollX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L381) def self.get_scroll_x : Float32 LibImGui.GetScrollX end - # get scrolling amount [0 .. GetScrollMaxY()] - # - # [ImGui::GetScrollY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L382) def self.get_scroll_y : Float32 LibImGui.GetScrollY end - # set scrolling amount [0 .. GetScrollMaxX()] - # - # [ImGui::SetScrollX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L383) def self.set_scroll_x(scroll_x : Float32) : Void LibImGui.SetScrollX_Float(scroll_x) end - # set scrolling amount [0 .. GetScrollMaxY()] - # - # [ImGui::SetScrollY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L384) def self.set_scroll_y(scroll_y : Float32) : Void LibImGui.SetScrollY_Float(scroll_y) end - # get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x - # - # [ImGui::GetScrollMaxX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L385) def self.get_scroll_max_x : Float32 LibImGui.GetScrollMaxX end - # get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y - # - # [ImGui::GetScrollMaxY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L386) def self.get_scroll_max_y : Float32 LibImGui.GetScrollMaxY end - # adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. - # - # [ImGui::SetScrollHereX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L387) def self.set_scroll_here_x(center_x_ratio : Float32 = 0.5) : Void LibImGui.SetScrollHereX(center_x_ratio) end - # adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. - # - # [ImGui::SetScrollHereY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L388) def self.set_scroll_here_y(center_y_ratio : Float32 = 0.5) : Void LibImGui.SetScrollHereY(center_y_ratio) end - # adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position. - # - # [ImGui::SetScrollFromPosX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L389) def self.set_scroll_from_pos_x(local_x : Float32, center_x_ratio : Float32 = 0.5) : Void LibImGui.SetScrollFromPosX_Float(local_x, center_x_ratio) end - # adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position. - # - # [ImGui::SetScrollFromPosY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L390) def self.set_scroll_from_pos_y(local_y : Float32, center_y_ratio : Float32 = 0.5) : Void LibImGui.SetScrollFromPosY_Float(local_y, center_y_ratio) end - # use NULL as a shortcut to push default font - # - # [ImGui::PushFont()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L393) def self.push_font(font : ImFont) : Void LibImGui.PushFont(font) end @@ -524,14 +334,10 @@ module ImGui self.pop_font end - # [ImGui::PopFont()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L394) def self.pop_font : Void LibImGui.PopFont end - # modify a style color. always use this if you modify the style after NewFrame(). - # - # [ImGui::PushStyleColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L395) def self.push_style_color(idx : ImGuiCol, col : UInt32) : Void LibImGui.PushStyleColor_U32(idx, col) end @@ -543,7 +349,6 @@ module ImGui self.pop_style_color end - # [ImGui::PushStyleColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L396) def self.push_style_color(idx : ImGuiCol, col : ImVec4) : Void LibImGui.PushStyleColor_Vec4(idx, col) end @@ -555,14 +360,10 @@ module ImGui self.pop_style_color end - # [ImGui::PopStyleColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L397) def self.pop_style_color(count : Int32 = 1) : Void LibImGui.PopStyleColor(count) end - # modify a style float variable. always use this if you modify the style after NewFrame(). - # - # [ImGui::PushStyleVar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L398) def self.push_style_var(idx : ImGuiStyleVar, val : Float32) : Void LibImGui.PushStyleVar_Float(idx, val) end @@ -574,9 +375,6 @@ module ImGui self.pop_style_var end - # modify a style ImVec2 variable. always use this if you modify the style after NewFrame(). - # - # [ImGui::PushStyleVar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L399) def self.push_style_var(idx : ImGuiStyleVar, val : ImVec2) : Void LibImGui.PushStyleVar_Vec2(idx, val) end @@ -588,14 +386,10 @@ module ImGui self.pop_style_var end - # [ImGui::PopStyleVar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L400) def self.pop_style_var(count : Int32 = 1) : Void LibImGui.PopStyleVar(count) end - # == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets - # - # [ImGui::PushAllowKeyboardFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L401) def self.push_allow_keyboard_focus(allow_keyboard_focus : Bool) : Void LibImGui.PushAllowKeyboardFocus(allow_keyboard_focus) end @@ -607,14 +401,10 @@ module ImGui self.pop_allow_keyboard_focus end - # [ImGui::PopAllowKeyboardFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L402) def self.pop_allow_keyboard_focus : Void LibImGui.PopAllowKeyboardFocus end - # in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. - # - # [ImGui::PushButtonRepeat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L403) def self.push_button_repeat(repeat : Bool) : Void LibImGui.PushButtonRepeat(repeat) end @@ -626,14 +416,10 @@ module ImGui self.pop_button_repeat end - # [ImGui::PopButtonRepeat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L404) def self.pop_button_repeat : Void LibImGui.PopButtonRepeat end - # push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side). - # - # [ImGui::PushItemWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L407) def self.push_item_width(item_width : Float32) : Void LibImGui.PushItemWidth(item_width) end @@ -645,28 +431,18 @@ module ImGui self.pop_item_width end - # [ImGui::PopItemWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L408) def self.pop_item_width : Void LibImGui.PopItemWidth end - # set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side) - # - # [ImGui::SetNextItemWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L409) def self.set_next_item_width(item_width : Float32) : Void LibImGui.SetNextItemWidth(item_width) end - # width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions. - # - # [ImGui::CalcItemWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L410) def self.calc_item_width : Float32 LibImGui.CalcItemWidth end - # push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space - # - # [ImGui::PushTextWrapPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L411) def self.push_text_wrap_pos(wrap_local_pos_x : Float32 = 0.0) : Void LibImGui.PushTextWrapPos(wrap_local_pos_x) end @@ -678,115 +454,69 @@ module ImGui self.pop_text_wrap_pos end - # [ImGui::PopTextWrapPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L412) def self.pop_text_wrap_pos : Void LibImGui.PopTextWrapPos end - # get current font - # - # [ImGui::GetFont()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L416) def self.get_font : ImFont result = LibImGui.GetFont ImFont.new(result) end - # get current font size (= height in pixels) of current font with current scale applied - # - # [ImGui::GetFontSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L417) def self.get_font_size : Float32 LibImGui.GetFontSize end - # get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API - # - # [ImGui::GetFontTexUvWhitePixel()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L418) def self.get_font_tex_uv_white_pixel : ImGui::ImVec2 LibImGui.GetFontTexUvWhitePixel(out p_out) p_out end - # retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList - # - # [ImGui::GetColorU32()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L419) def self.get_color_u32(idx : ImGuiCol, alpha_mul : Float32 = 1.0) : UInt32 LibImGui.GetColorU32_Col(idx, alpha_mul) end - # retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList - # - # [ImGui::GetColorU32()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L420) def self.get_color_u32(col : ImVec4) : UInt32 LibImGui.GetColorU32_Vec4(col) end - # retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList - # - # [ImGui::GetColorU32()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L421) def self.get_color_u32(col : UInt32) : UInt32 LibImGui.GetColorU32_U32(col) end - # retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in. - # - # [ImGui::GetStyleColorVec4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L422) def self.get_style_color_vec4(idx : ImGuiCol) : ImVec4 result = LibImGui.GetStyleColorVec4(idx) result.value end - # separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. - # - # [ImGui::Separator()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L431) def self.separator : Void LibImGui.Separator end - # call between widgets or groups to layout them horizontally. X position given in window coordinates. - # - # [ImGui::SameLine()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L432) def self.same_line(offset_from_start_x : Float32 = 0.0, spacing : Float32 = -1.0) : Void LibImGui.SameLine(offset_from_start_x, spacing) end - # undo a SameLine() or force a new line when in an horizontal-layout context. - # - # [ImGui::NewLine()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L433) def self.new_line : Void LibImGui.NewLine end - # add vertical spacing. - # - # [ImGui::Spacing()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L434) def self.spacing : Void LibImGui.Spacing end - # add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into. - # - # [ImGui::Dummy()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L435) def self.dummy(size : ImVec2) : Void LibImGui.Dummy(size) end - # move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0 - # - # [ImGui::Indent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L436) def self.indent(indent_w : Float32 = 0.0) : Void LibImGui.Indent(indent_w) end - # move content position back to the left, by indent_w, or style.IndentSpacing if indent_w <= 0 - # - # [ImGui::Unindent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L437) def self.unindent(indent_w : Float32 = 0.0) : Void LibImGui.Unindent(indent_w) end - # lock horizontal starting position - # - # [ImGui::BeginGroup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L438) def self.begin_group : Void LibImGui.BeginGroup end @@ -798,115 +528,69 @@ module ImGui self.end_group end - # unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) - # - # [ImGui::EndGroup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L439) def self.end_group : Void LibImGui.EndGroup end - # cursor position in window coordinates (relative to window position) - # - # [ImGui::GetCursorPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L440) def self.get_cursor_pos : ImGui::ImVec2 LibImGui.GetCursorPos(out p_out) p_out end - # (some functions are using window-relative coordinates, such as: GetCursorPos, GetCursorStartPos, GetContentRegionMax, GetWindowContentRegion* etc. - # - # [ImGui::GetCursorPosX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L441) def self.get_cursor_pos_x : Float32 LibImGui.GetCursorPosX end - # other functions such as GetCursorScreenPos or everything in ImDrawList:: - # - # [ImGui::GetCursorPosY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L442) def self.get_cursor_pos_y : Float32 LibImGui.GetCursorPosY end - # are using the main, absolute coordinate system. - # - # [ImGui::SetCursorPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L443) def self.set_cursor_pos(local_pos : ImVec2) : Void LibImGui.SetCursorPos(local_pos) end - # GetWindowPos() + GetCursorPos() == GetCursorScreenPos() etc.) - # - # [ImGui::SetCursorPosX()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L444) def self.set_cursor_pos_x(local_x : Float32) : Void LibImGui.SetCursorPosX(local_x) end - # [ImGui::SetCursorPosY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L445) def self.set_cursor_pos_y(local_y : Float32) : Void LibImGui.SetCursorPosY(local_y) end - # initial cursor position in window coordinates - # - # [ImGui::GetCursorStartPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L446) def self.get_cursor_start_pos : ImGui::ImVec2 LibImGui.GetCursorStartPos(out p_out) p_out end - # cursor position in absolute coordinates (useful to work with ImDrawList API). generally top-left == GetMainViewport()->Pos == (0,0) in single viewport mode, and bottom-right == GetMainViewport()->Pos+Size == io.DisplaySize in single-viewport mode. - # - # [ImGui::GetCursorScreenPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L447) def self.get_cursor_screen_pos : ImGui::ImVec2 LibImGui.GetCursorScreenPos(out p_out) p_out end - # cursor position in absolute coordinates - # - # [ImGui::SetCursorScreenPos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L448) def self.set_cursor_screen_pos(pos : ImVec2) : Void LibImGui.SetCursorScreenPos(pos) end - # vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item) - # - # [ImGui::AlignTextToFramePadding()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L449) def self.align_text_to_frame_padding : Void LibImGui.AlignTextToFramePadding end - # ~ FontSize - # - # [ImGui::GetTextLineHeight()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L450) def self.get_text_line_height : Float32 LibImGui.GetTextLineHeight end - # ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text) - # - # [ImGui::GetTextLineHeightWithSpacing()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L451) def self.get_text_line_height_with_spacing : Float32 LibImGui.GetTextLineHeightWithSpacing end - # ~ FontSize + style.FramePadding.y * 2 - # - # [ImGui::GetFrameHeight()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L452) def self.get_frame_height : Float32 LibImGui.GetFrameHeight end - # ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) - # - # [ImGui::GetFrameHeightWithSpacing()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L453) def self.get_frame_height_with_spacing : Float32 LibImGui.GetFrameHeightWithSpacing end - # push string into the ID stack (will hash string). - # - # [ImGui::PushID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L466) def self.push_id(str_id : String) : Void LibImGui.PushID_Str(str_id) end @@ -918,9 +602,6 @@ module ImGui self.pop_id end - # push string into the ID stack (will hash string). - # - # [ImGui::PushID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L467) def self.push_id(str_id : Bytes | String) : Void LibImGui.PushID_StrStr(str_id, (str_id.to_unsafe + str_id.bytesize)) end @@ -932,9 +613,6 @@ module ImGui self.pop_id end - # push pointer into the ID stack (will hash pointer). - # - # [ImGui::PushID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L468) def self.push_id(ptr_id : Reference | ClassType | Int | Void*) : Void LibImGui.PushID_Ptr(to_void_id(ptr_id)) end @@ -946,9 +624,6 @@ module ImGui self.pop_id end - # push integer into the ID stack (will hash integer). - # - # [ImGui::PushID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L469) def self.push_id(int_id : Int32) : Void LibImGui.PushID_Int(int_id) end @@ -960,157 +635,98 @@ module ImGui self.pop_id end - # pop from the ID stack. - # - # [ImGui::PopID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L470) def self.pop_id : Void LibImGui.PopID end - # calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself - # - # [ImGui::GetID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L471) def self.get_id(str_id : String) : ImGuiID LibImGui.GetID_Str(str_id) end - # [ImGui::GetID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L472) def self.get_id(str_id : Bytes | String) : ImGuiID LibImGui.GetID_StrStr(str_id, (str_id.to_unsafe + str_id.bytesize)) end - # [ImGui::GetID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L473) def self.get_id(ptr_id : Reference | ClassType | Int | Void*) : ImGuiID LibImGui.GetID_Ptr(to_void_id(ptr_id)) end - # raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. - # - # [ImGui::TextUnformatted()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L476) def self.text_unformatted(text : Bytes | String) : Void LibImGui.TextUnformatted(text, (text.to_unsafe + text.bytesize)) end - # formatted text - # - # [ImGui::Text()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L477) def self.text(fmt : String, *args) : Void LibImGui.Text(fmt, *args._promote_va_args) end - # shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor(); - # - # [ImGui::TextColored()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L479) def self.text_colored(col : ImVec4, fmt : String, *args) : Void LibImGui.TextColored(col, fmt, *args._promote_va_args) end - # shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); - # - # [ImGui::TextDisabled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L481) def self.text_disabled(fmt : String, *args) : Void LibImGui.TextDisabled(fmt, *args._promote_va_args) end - # shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize(). - # - # [ImGui::TextWrapped()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L483) def self.text_wrapped(fmt : String, *args) : Void LibImGui.TextWrapped(fmt, *args._promote_va_args) end - # display text+label aligned the same way as value+label widgets - # - # [ImGui::LabelText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L485) def self.label_text(label : String, fmt : String, *args) : Void LibImGui.LabelText(label, fmt, *args._promote_va_args) end - # shortcut for Bullet()+Text() - # - # [ImGui::BulletText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L487) def self.bullet_text(fmt : String, *args) : Void LibImGui.BulletText(fmt, *args._promote_va_args) end - # button - # - # [ImGui::Button()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L493) def self.button(label : String, size : ImVec2 = ImVec2.new(0, 0)) : Bool LibImGui.Button(label, size) end - # button with FramePadding=(0,0) to easily embed within text - # - # [ImGui::SmallButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L494) def self.small_button(label : String) : Bool LibImGui.SmallButton(label) end - # flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) - # - # [ImGui::InvisibleButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L495) def self.invisible_button(str_id : String, size : ImVec2, flags : ImGuiButtonFlags = ImGuiButtonFlags.new(0)) : Bool LibImGui.InvisibleButton(str_id, size, flags) end - # square button with an arrow shape - # - # [ImGui::ArrowButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L496) def self.arrow_button(str_id : String, dir : ImGuiDir) : Bool LibImGui.ArrowButton(str_id, dir) end - # [ImGui::Image()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L497) def self.image(user_texture_id : ImTextureID, size : ImVec2, uv0 : ImVec2 = ImVec2.new(0, 0), uv1 : ImVec2 = ImVec2.new(1, 1), tint_col : ImVec4 = ImVec4.new(1, 1, 1, 1), border_col : ImVec4 = ImVec4.new(0, 0, 0, 0)) : Void LibImGui.Image(user_texture_id, size, uv0, uv1, tint_col, border_col) end - # <0 frame_padding uses default frame padding settings. 0 for no padding - # - # [ImGui::ImageButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L498) def self.image_button(user_texture_id : ImTextureID, size : ImVec2, uv0 : ImVec2 = ImVec2.new(0, 0), uv1 : ImVec2 = ImVec2.new(1, 1), frame_padding : Int32 = -1, bg_col : ImVec4 = ImVec4.new(0, 0, 0, 0), tint_col : ImVec4 = ImVec4.new(1, 1, 1, 1)) : Bool LibImGui.ImageButton(user_texture_id, size, uv0, uv1, frame_padding, bg_col, tint_col) end - # [ImGui::Checkbox()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L499) pointer_wrapper def self.checkbox(label : String, v : Bool*) : Bool LibImGui.Checkbox(label, v) end - # [ImGui::CheckboxFlags()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L500) pointer_wrapper def self.checkbox_flags(label : String, flags : Int32*, flags_value : Int32) : Bool LibImGui.CheckboxFlags_IntPtr(label, flags, flags_value) end - # [ImGui::CheckboxFlags()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L501) pointer_wrapper def self.checkbox_flags(label : String, flags : UInt32*, flags_value : UInt32) : Bool LibImGui.CheckboxFlags_UintPtr(label, flags, flags_value) end - # use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; } - # - # [ImGui::RadioButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L502) pointer_wrapper def self.radio_button(label : String, active : Bool) : Bool LibImGui.RadioButton_Bool(label, active) end - # shortcut to handle the above pattern when value is an integer - # - # [ImGui::RadioButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L503) pointer_wrapper def self.radio_button(label : String, v : Int32*, v_button : Int32) : Bool LibImGui.RadioButton_IntPtr(label, v, v_button) end - # [ImGui::ProgressBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L504) def self.progress_bar(fraction : Float32, size_arg : ImVec2 = ImVec2.new(-Float32::MIN_POSITIVE, 0), overlay : String? = nil) : Void LibImGui.ProgressBar(fraction, size_arg, overlay) end - # draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses - # - # [ImGui::Bullet()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L505) def self.bullet : Void LibImGui.Bullet end - # [ImGui::BeginCombo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L510) def self.begin_combo(label : String, preview_value : String, flags : ImGuiComboFlags = ImGuiComboFlags.new(0)) : Bool LibImGui.BeginCombo(label, preview_value, flags) end @@ -1122,287 +738,222 @@ module ImGui self.end_combo end - # only call EndCombo() if BeginCombo() returns true! - # - # [ImGui::EndCombo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L511) def self.end_combo : Void LibImGui.EndCombo end - # [ImGui::Combo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L512) pointer_wrapper def self.combo(label : String, current_item : Int32* | Pointer, items : Indexable(LibC::Char*), popup_max_height_in_items : Int32 = -1) : Bool LibImGui.Combo_Str_arr(label, (typeof(current_item.value.to_i32); current_item.as(Int32*)), items, items.size, popup_max_height_in_items) end - # Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" - # - # [ImGui::Combo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L513) pointer_wrapper def self.combo(label : String, current_item : Int32* | Pointer, items_separated_by_zeros : String, popup_max_height_in_items : Int32 = -1) : Bool LibImGui.Combo_Str(label, (typeof(current_item.value.to_i32); current_item.as(Int32*)), items_separated_by_zeros, popup_max_height_in_items) end - # [ImGui::Combo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L514) pointer_wrapper def self.combo(label : String, current_item : Int32* | Pointer, items_getter : (Void*, Int32, LibC::Char**) -> Bool, data : Void*, items_count : Int32, popup_max_height_in_items : Int32 = -1) : Bool LibImGui.Combo_FnBoolPtr(label, (typeof(current_item.value.to_i32); current_item.as(Int32*)), items_getter, data, items_count, popup_max_height_in_items) end - # If v_min >= v_max we have no bound - # - # [ImGui::DragFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L528) pointer_wrapper def self.drag_float(label : String, v : Float32*, v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragFloat(label, v, v_speed, v_min, v_max, format, flags) end - # [ImGui::DragFloat2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L529) pointer_wrapper def self.drag_float2(label : String, v : ImVec2* | Indexable(Float32) | Float32*, v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragFloat2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Float32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragFloat3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L530) pointer_wrapper def self.drag_float3(label : String, v : Indexable(Float32) | Float32*, v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragFloat3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Float32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragFloat4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L531) pointer_wrapper def self.drag_float4(label : String, v : ImVec4* | Indexable(Float32) | Float32*, v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragFloat4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Float32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragFloatRange2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L532) pointer_wrapper def self.drag_float_range2(label : String, v_current_min : Float32*, v_current_max : Float32*, v_speed : Float32 = 1.0, v_min : Float32 = 0.0, v_max : Float32 = 0.0, format : String = "%.3f", format_max : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragFloatRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) end - # If v_min >= v_max we have no bound - # - # [ImGui::DragInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L533) pointer_wrapper def self.drag_int(label : String, v : Int32*, v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragInt(label, v, v_speed, v_min, v_max, format, flags) end - # [ImGui::DragInt2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L534) pointer_wrapper def self.drag_int2(label : String, v : Indexable(Int32) | Int32*, v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragInt2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Int32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragInt3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L535) pointer_wrapper def self.drag_int3(label : String, v : Indexable(Int32) | Int32*, v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragInt3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Int32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragInt4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L536) pointer_wrapper def self.drag_int4(label : String, v : Indexable(Int32) | Int32*, v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragInt4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Int32*), v_speed, v_min, v_max, format, flags) end - # [ImGui::DragIntRange2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L537) pointer_wrapper def self.drag_int_range2(label : String, v_current_min : Int32*, v_current_max : Int32*, v_speed : Float32 = 1.0, v_min : Int32 = 0, v_max : Int32 = 0, format : String = "%d", format_max : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragIntRange2(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags) end {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::DragScalar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L538) pointer_wrapper def self.drag_scalar(label : String, p_data : {{t}}*, v_speed : Float32 = 1.0, p_min : {{t}}? = nil, p_max : {{t}}? = nil, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragScalar(label, ImGuiDataType::{{k.id}}, p_data, v_speed, p_min ? (p_min_ = p_min; pointerof(p_min_)) : Pointer({{t}}).null, p_max ? (p_max_ = p_max; pointerof(p_max_)) : Pointer({{t}}).null, format, flags) end {% end %} {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::DragScalarN()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L539) pointer_wrapper def self.drag_scalar_n(label : String, p_data : {{t}}*, components : Int32, v_speed : Float32 = 1.0, p_min : {{t}}* = Pointer({{t}}).null, p_max : {{t}}* = Pointer({{t}}).null, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.DragScalarN(label, ImGuiDataType::{{k.id}}, p_data, components, v_speed, p_min, p_max, format, flags) end {% end %} - # adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. - # - # [ImGui::SliderFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L547) pointer_wrapper def self.slider_float(label : String, v : Float32*, v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderFloat(label, v, v_min, v_max, format, flags) end - # [ImGui::SliderFloat2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L548) pointer_wrapper def self.slider_float2(label : String, v : ImVec2* | Indexable(Float32) | Float32*, v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderFloat2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Float32*), v_min, v_max, format, flags) end - # [ImGui::SliderFloat3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L549) pointer_wrapper def self.slider_float3(label : String, v : Indexable(Float32) | Float32*, v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderFloat3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Float32*), v_min, v_max, format, flags) end - # [ImGui::SliderFloat4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L550) pointer_wrapper def self.slider_float4(label : String, v : ImVec4* | Indexable(Float32) | Float32*, v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderFloat4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Float32*), v_min, v_max, format, flags) end - # [ImGui::SliderAngle()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L551) pointer_wrapper def self.slider_angle(label : String, v_rad : Float32*, v_degrees_min : Float32 = -360.0, v_degrees_max : Float32 = +360.0, format : String = "%.0 deg", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderAngle(label, v_rad, v_degrees_min, v_degrees_max, format, flags) end - # [ImGui::SliderInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L552) pointer_wrapper def self.slider_int(label : String, v : Int32*, v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderInt(label, v, v_min, v_max, format, flags) end - # [ImGui::SliderInt2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L553) pointer_wrapper def self.slider_int2(label : String, v : Indexable(Int32) | Int32*, v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderInt2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Int32*), v_min, v_max, format, flags) end - # [ImGui::SliderInt3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L554) pointer_wrapper def self.slider_int3(label : String, v : Indexable(Int32) | Int32*, v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderInt3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Int32*), v_min, v_max, format, flags) end - # [ImGui::SliderInt4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L555) pointer_wrapper def self.slider_int4(label : String, v : Indexable(Int32) | Int32*, v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderInt4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Int32*), v_min, v_max, format, flags) end {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::SliderScalar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L556) pointer_wrapper def self.slider_scalar(label : String, p_data : {{t}}*, p_min : {{t}}, p_max : {{t}}, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderScalar(label, ImGuiDataType::{{k.id}}, p_data, p_min ? (p_min_ = p_min; pointerof(p_min_)) : Pointer({{t}}).null, p_max ? (p_max_ = p_max; pointerof(p_max_)) : Pointer({{t}}).null, format, flags) end {% end %} {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::SliderScalarN()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L557) pointer_wrapper def self.slider_scalar_n(label : String, p_data : {{t}}*, components : Int32, p_min : {{t}}*, p_max : {{t}}*, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.SliderScalarN(label, ImGuiDataType::{{k.id}}, p_data, components, p_min, p_max, format, flags) end {% end %} - # [ImGui::VSliderFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L558) pointer_wrapper def self.v_slider_float(label : String, size : ImVec2, v : Float32*, v_min : Float32, v_max : Float32, format : String = "%.3f", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.VSliderFloat(label, size, v, v_min, v_max, format, flags) end - # [ImGui::VSliderInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L559) pointer_wrapper def self.v_slider_int(label : String, size : ImVec2, v : Int32*, v_min : Int32, v_max : Int32, format : String = "%d", flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.VSliderInt(label, size, v, v_min, v_max, format, flags) end {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::VSliderScalar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L560) pointer_wrapper def self.v_slider_scalar(label : String, size : ImVec2, p_data : {{t}}*, p_min : {{t}}, p_max : {{t}}, format : String? = nil, flags : ImGuiSliderFlags = ImGuiSliderFlags.new(0)) : Bool LibImGui.VSliderScalar(label, size, ImGuiDataType::{{k.id}}, p_data, p_min ? (p_min_ = p_min; pointerof(p_min_)) : Pointer({{t}}).null, p_max ? (p_max_ = p_max; pointerof(p_max_)) : Pointer({{t}}).null, format, flags) end {% end %} - # [ImGui::InputText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L565) def self.input_text(label : String, buf : Bytes, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Void* = Pointer(Void).null) : Bool LibImGui.InputText(label, buf, buf.size, flags, callback, user_data) end - # [ImGui::InputTextMultiline()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L566) def self.input_text_multiline(label : String, buf : Bytes, size : ImVec2 = ImVec2.new(0, 0), flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Void* = Pointer(Void).null) : Bool LibImGui.InputTextMultiline(label, buf, buf.size, size, flags, callback, user_data) end - # [ImGui::InputTextWithHint()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L567) def self.input_text_with_hint(label : String, hint : String, buf : Bytes, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0), callback : ImGuiInputTextCallback? = nil, user_data : Void* = Pointer(Void).null) : Bool LibImGui.InputTextWithHint(label, hint, buf, buf.size, flags, callback, user_data) end - # [ImGui::InputFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L568) pointer_wrapper def self.input_float(label : String, v : Float32*, step : Float32 = 0.0, step_fast : Float32 = 0.0, format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputFloat(label, v, step, step_fast, format, flags) end - # [ImGui::InputFloat2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L569) pointer_wrapper def self.input_float2(label : String, v : ImVec2* | Indexable(Float32) | Float32*, format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputFloat2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Float32*), format, flags) end - # [ImGui::InputFloat3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L570) pointer_wrapper def self.input_float3(label : String, v : Indexable(Float32) | Float32*, format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputFloat3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Float32*), format, flags) end - # [ImGui::InputFloat4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L571) pointer_wrapper def self.input_float4(label : String, v : ImVec4* | Indexable(Float32) | Float32*, format : String = "%.3f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputFloat4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Float32*), format, flags) end - # [ImGui::InputInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L572) pointer_wrapper def self.input_int(label : String, v : Int32*, step : Int32 = 1, step_fast : Int32 = 100, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputInt(label, v, step, step_fast, flags) end - # [ImGui::InputInt2()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L573) pointer_wrapper def self.input_int2(label : String, v : Indexable(Int32) | Int32*, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputInt2(label, v.is_a?(Indexable) ? ( v.size == 2 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 2)") ) : v.as(Int32*), flags) end - # [ImGui::InputInt3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L574) pointer_wrapper def self.input_int3(label : String, v : Indexable(Int32) | Int32*, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputInt3(label, v.is_a?(Indexable) ? ( v.size == 3 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 3)") ) : v.as(Int32*), flags) end - # [ImGui::InputInt4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L575) pointer_wrapper def self.input_int4(label : String, v : Indexable(Int32) | Int32*, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputInt4(label, v.is_a?(Indexable) ? ( v.size == 4 ? v.to_unsafe : raise ArgumentError.new("Slice has wrong size #{v.size} (want 4)") ) : v.as(Int32*), flags) end - # [ImGui::InputDouble()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L576) pointer_wrapper def self.input_double(label : String, v : Float64*, step : Float64 = 0.0, step_fast : Float64 = 0.0, format : String = "%.6f", flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputDouble(label, v, step, step_fast, format, flags) end {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::InputScalar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L577) pointer_wrapper def self.input_scalar(label : String, p_data : {{t}}*, p_step : {{t}}? = nil, p_step_fast : {{t}}? = nil, format : String? = nil, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputScalar(label, ImGuiDataType::{{k.id}}, p_data, p_step ? (p_step_ = p_step; pointerof(p_step_)) : Pointer({{t}}).null, p_step_fast ? (p_step_fast_ = p_step_fast; pointerof(p_step_fast_)) : Pointer({{t}}).null, format, flags) end {% end %} {% for k, t in {S8: Int8, U8: UInt8, S16: Int16, U16: UInt16, S32: Int32, U32: UInt32, S64: Int64, U64: UInt64, Float: Float32, Double: Float64} %} - # [ImGui::InputScalarN()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L578) pointer_wrapper def self.input_scalar_n(label : String, p_data : {{t}}*, components : Int32, p_step : {{t}}* = Pointer({{t}}).null, p_step_fast : {{t}}* = Pointer({{t}}).null, format : String? = nil, flags : ImGuiInputTextFlags = ImGuiInputTextFlags.new(0)) : Bool LibImGui.InputScalarN(label, ImGuiDataType::{{k.id}}, p_data, components, p_step, p_step_fast, format, flags) end {% end %} - # [ImGui::ColorEdit3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L583) pointer_wrapper def self.color_edit3(label : String, col : ImVec4* | Indexable(Float32) | Float32*, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool LibImGui.ColorEdit3(label, col.is_a?(Indexable) ? ( col.size == 3 ? col.to_unsafe : raise ArgumentError.new("Slice has wrong size #{col.size} (want 3)") ) : col.as(Float32*), flags) end - # [ImGui::ColorEdit4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L584) pointer_wrapper def self.color_edit4(label : String, col : ImVec4* | Indexable(Float32) | Float32*, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool LibImGui.ColorEdit4(label, col.is_a?(Indexable) ? ( col.size == 4 ? col.to_unsafe : raise ArgumentError.new("Slice has wrong size #{col.size} (want 4)") ) : col.as(Float32*), flags) end - # [ImGui::ColorPicker3()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L585) pointer_wrapper def self.color_picker3(label : String, col : ImVec4* | Indexable(Float32) | Float32*, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0)) : Bool LibImGui.ColorPicker3(label, col.is_a?(Indexable) ? ( col.size == 3 ? col.to_unsafe : raise ArgumentError.new("Slice has wrong size #{col.size} (want 3)") ) : col.as(Float32*), flags) end - # [ImGui::ColorPicker4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L586) pointer_wrapper def self.color_picker4(label : String, col : ImVec4* | Indexable(Float32) | Float32*, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0), ref_col : Float32* = Pointer(Float32).null) : Bool LibImGui.ColorPicker4(label, col.is_a?(Indexable) ? ( col.size == 4 ? col.to_unsafe : raise ArgumentError.new("Slice has wrong size #{col.size} (want 4)") ) : col.as(Float32*), flags, ref_col) end - # display a color square/button, hover for details, return true when pressed. - # - # [ImGui::ColorButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L587) def self.color_button(desc_id : String, col : ImVec4, flags : ImGuiColorEditFlags = ImGuiColorEditFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool LibImGui.ColorButton(desc_id, col, flags, size) end - # 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::SetColorEditOptions()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L588) def self.set_color_edit_options(flags : ImGuiColorEditFlags) : Void LibImGui.SetColorEditOptions(flags) end - # [ImGui::TreeNode()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L592) def self.tree_node(label : String) : Bool LibImGui.TreeNode_Str(label) end @@ -1414,9 +965,6 @@ module ImGui self.tree_pop end - # helper variation to easily 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::TreeNode()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L593) def self.tree_node(str_id : String, fmt : String, *args) : Bool LibImGui.TreeNode_StrStr(str_id, fmt, *args._promote_va_args) end @@ -1428,9 +976,6 @@ module ImGui self.tree_pop end - # " - # - # [ImGui::TreeNode()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L594) def self.tree_node(ptr_id : Reference | ClassType | Int | Void*, fmt : String, *args) : Bool LibImGui.TreeNode_Ptr(to_void_id(ptr_id), fmt, *args._promote_va_args) end @@ -1442,7 +987,6 @@ module ImGui self.tree_pop end - # [ImGui::TreeNodeEx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L597) def self.tree_node_ex(label : String, flags : ImGuiTreeNodeFlags = ImGuiTreeNodeFlags.new(0)) : Bool LibImGui.TreeNodeEx_Str(label, flags) end @@ -1454,7 +998,6 @@ module ImGui self.tree_pop end - # [ImGui::TreeNodeEx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L598) def self.tree_node_ex(str_id : String, flags : ImGuiTreeNodeFlags, fmt : String, *args) : Bool LibImGui.TreeNodeEx_StrStr(str_id, flags, fmt, *args._promote_va_args) end @@ -1466,7 +1009,6 @@ module ImGui self.tree_pop end - # [ImGui::TreeNodeEx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L599) def self.tree_node_ex(ptr_id : Reference | ClassType | Int | Void*, flags : ImGuiTreeNodeFlags, fmt : String, *args) : Bool LibImGui.TreeNodeEx_Ptr(to_void_id(ptr_id), flags, fmt, *args._promote_va_args) end @@ -1478,9 +1020,6 @@ module ImGui self.tree_pop end - # ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. - # - # [ImGui::TreePush()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L602) def self.tree_push(str_id : String) : Void LibImGui.TreePush_Str(str_id) end @@ -1492,9 +1031,6 @@ module ImGui self.tree_pop end - # " - # - # [ImGui::TreePush()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L603) def self.tree_push(ptr_id : Reference | ClassType | Int | Void* = Pointer(Reference | ClassType | Int | Void).null) : Void LibImGui.TreePush_Ptr(to_void_id(ptr_id)) end @@ -1506,56 +1042,32 @@ module ImGui self.tree_pop end - # ~ Unindent()+PopId() - # - # [ImGui::TreePop()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L604) def self.tree_pop : Void LibImGui.TreePop end - # horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode - # - # [ImGui::GetTreeNodeToLabelSpacing()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L605) def self.get_tree_node_to_label_spacing : Float32 LibImGui.GetTreeNodeToLabelSpacing end - # if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). - # - # [ImGui::CollapsingHeader()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L606) pointer_wrapper def self.collapsing_header(label : String, flags : ImGuiTreeNodeFlags = ImGuiTreeNodeFlags.new(0)) : Bool LibImGui.CollapsingHeader_TreeNodeFlags(label, flags) end - # when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header. - # - # [ImGui::CollapsingHeader()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L607) pointer_wrapper def self.collapsing_header(label : String, p_visible : Bool*, flags : ImGuiTreeNodeFlags = ImGuiTreeNodeFlags.new(0)) : Bool LibImGui.CollapsingHeader_BoolPtr(label, p_visible, flags) end - # set next TreeNode/CollapsingHeader open state. - # - # [ImGui::SetNextItemOpen()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L608) def self.set_next_item_open(is_open : Bool, cond : ImGuiCond = ImGuiCond.new(0)) : Void LibImGui.SetNextItemOpen(is_open, cond) end - # "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height - # - # [ImGui::Selectable()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L613) pointer_wrapper def self.selectable(label : String, selected : Bool = false, flags : ImGuiSelectableFlags = ImGuiSelectableFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool LibImGui.Selectable_Bool(label, selected, flags, size) end - # "bool* p_selected" point to the selection state (read-write), as a convenient helper. - # - # [ImGui::Selectable()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L614) pointer_wrapper def self.selectable(label : String, p_selected : Bool*, flags : ImGuiSelectableFlags = ImGuiSelectableFlags.new(0), size : ImVec2 = ImVec2.new(0, 0)) : Bool LibImGui.Selectable_BoolPtr(label, p_selected, flags, size) end - # open a framed scrolling region - # - # [ImGui::BeginListBox()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L622) def self.begin_list_box(label : String, size : ImVec2 = ImVec2.new(0, 0)) : Bool LibImGui.BeginListBox(label, size) end @@ -1567,65 +1079,49 @@ module ImGui self.end_list_box end - # only call EndListBox() if BeginListBox() returned true! - # - # [ImGui::EndListBox()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L623) def self.end_list_box : Void LibImGui.EndListBox end - # [ImGui::ListBox()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L624) pointer_wrapper def self.list_box(label : String, current_item : Int32* | Pointer, items : Indexable(LibC::Char*), height_in_items : Int32 = -1) : Bool LibImGui.ListBox_Str_arr(label, (typeof(current_item.value.to_i32); current_item.as(Int32*)), items, items.size, height_in_items) end - # [ImGui::ListBox()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L625) pointer_wrapper def self.list_box(label : String, current_item : Int32* | Pointer, items_getter : (Void*, Int32, LibC::Char**) -> Bool, data : Void*, items_count : Int32, height_in_items : Int32 = -1) : Bool LibImGui.ListBox_FnBoolPtr(label, (typeof(current_item.value.to_i32); current_item.as(Int32*)), items_getter, data, items_count, height_in_items) end - # [ImGui::PlotLines()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L629) def self.plot_lines(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void LibImGui.PlotLines_FloatPtr(label, values, values.size, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) end - # [ImGui::PlotLines()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L630) def self.plot_lines(label : String, values_getter : (Void*, Int32) -> Float32, data : Void*, values_count : Int32, values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0)) : Void LibImGui.PlotLines_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end - # [ImGui::PlotHistogram()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L631) def self.plot_histogram(label : String, values : Indexable(Float32), values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0), stride : Int32 = sizeof(Float32)) : Void LibImGui.PlotHistogram_FloatPtr(label, values, values.size, values_offset, overlay_text, scale_min, scale_max, graph_size, stride) end - # [ImGui::PlotHistogram()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L632) def self.plot_histogram(label : String, values_getter : (Void*, Int32) -> Float32, data : Void*, values_count : Int32, values_offset : Int32 = 0, overlay_text : String? = nil, scale_min : Float32 = Float32::MAX, scale_max : Float32 = Float32::MAX, graph_size : ImVec2 = ImVec2.new(0, 0)) : Void LibImGui.PlotHistogram_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size) end - # [ImGui::Value()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L636) def self.value(prefix : String, b : Bool) : Void LibImGui.Value_Bool(prefix, b) end - # [ImGui::Value()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L637) def self.value(prefix : String, v : Int32) : Void LibImGui.Value_Int(prefix, v) end - # [ImGui::Value()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L638) def self.value(prefix : String, v : UInt32) : Void LibImGui.Value_Uint(prefix, v) end - # [ImGui::Value()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L639) def self.value(prefix : String, v : Float32, float_format : String? = nil) : Void LibImGui.Value_Float(prefix, v, float_format) end - # append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). - # - # [ImGui::BeginMenuBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L646) def self.begin_menu_bar : Bool LibImGui.BeginMenuBar end @@ -1637,16 +1133,10 @@ module ImGui self.end_menu_bar end - # only call EndMenuBar() if BeginMenuBar() returns true! - # - # [ImGui::EndMenuBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L647) def self.end_menu_bar : Void LibImGui.EndMenuBar end - # create and append to a full screen menu-bar. - # - # [ImGui::BeginMainMenuBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L648) def self.begin_main_menu_bar : Bool LibImGui.BeginMainMenuBar end @@ -1658,16 +1148,10 @@ module ImGui self.end_main_menu_bar end - # only call EndMainMenuBar() if BeginMainMenuBar() returns true! - # - # [ImGui::EndMainMenuBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L649) def self.end_main_menu_bar : Void LibImGui.EndMainMenuBar end - # create a sub-menu entry. only call EndMenu() if this returns true! - # - # [ImGui::BeginMenu()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L650) def self.begin_menu(label : String, enabled : Bool = true) : Bool LibImGui.BeginMenu(label, enabled) end @@ -1679,29 +1163,17 @@ module ImGui self.end_menu end - # only call EndMenu() if BeginMenu() returns true! - # - # [ImGui::EndMenu()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L651) def self.end_menu : Void LibImGui.EndMenu end - # return true when activated. - # - # [ImGui::MenuItem()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L652) pointer_wrapper def self.menu_item(label : String, shortcut : String? = nil, selected : Bool = false, enabled : Bool = true) : Bool LibImGui.MenuItem_Bool(label, shortcut, selected, enabled) end - # return true when activated + toggle (*p_selected) if p_selected != NULL - # - # [ImGui::MenuItem()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L653) pointer_wrapper def self.menu_item(label : String, shortcut : String, p_selected : Bool*, enabled : Bool = true) : Bool LibImGui.MenuItem_BoolPtr(label, shortcut, p_selected, enabled) end - # begin/append a tooltip window. to create full-featured tooltip (with any kind of items). - # - # [ImGui::BeginTooltip()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L657) def self.begin_tooltip : Void LibImGui.BeginTooltip end @@ -1713,21 +1185,14 @@ module ImGui self.end_tooltip end - # [ImGui::EndTooltip()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L658) def self.end_tooltip : Void LibImGui.EndTooltip end - # set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip(). - # - # [ImGui::SetTooltip()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L659) def self.set_tooltip(fmt : String, *args) : Void LibImGui.SetTooltip(fmt, *args._promote_va_args) end - # return true if the popup is open, and you can start outputting to it. - # - # [ImGui::BeginPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L674) def self.begin_popup(str_id : String, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.BeginPopup(str_id, flags) end @@ -1739,9 +1204,6 @@ module ImGui self.end_popup end - # return true if the modal is open, and you can start outputting to it. - # - # [ImGui::BeginPopupModal()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L675) pointer_wrapper def self.begin_popup_modal(name : String, p_open : Bool* = Pointer(Bool).null, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.BeginPopupModal(name, p_open, flags) end @@ -1752,44 +1214,26 @@ module ImGui self.end_popup end - # only call EndPopup() if BeginPopupXXX() returns true! - # - # [ImGui::EndPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L676) def self.end_popup : Void LibImGui.EndPopup end - # call to mark popup as open (don't call every frame!). - # - # [ImGui::OpenPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L686) def self.open_popup(str_id : String, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Void LibImGui.OpenPopup_Str(str_id, popup_flags) end - # id overload to facilitate calling from nested stacks - # - # [ImGui::OpenPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L687) def self.open_popup(id : ImGuiID, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Void LibImGui.OpenPopup_ID(id, popup_flags) end - # helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) - # - # [ImGui::OpenPopupOnItemClick()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L688) def self.open_popup_on_item_click(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Void LibImGui.OpenPopupOnItemClick(str_id, popup_flags) end - # manually close the popup we have begin-ed into. - # - # [ImGui::CloseCurrentPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L689) def self.close_current_popup : Void LibImGui.CloseCurrentPopup end - # open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! - # - # [ImGui::BeginPopupContextItem()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L696) def self.begin_popup_context_item(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool LibImGui.BeginPopupContextItem(str_id, popup_flags) end @@ -1801,9 +1245,6 @@ module ImGui self.end_popup end - # open+begin popup when clicked on current window. - # - # [ImGui::BeginPopupContextWindow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L697) def self.begin_popup_context_window(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool LibImGui.BeginPopupContextWindow(str_id, popup_flags) end @@ -1815,9 +1256,6 @@ module ImGui self.end_popup end - # open+begin popup when clicked in void (where there are no windows). - # - # [ImGui::BeginPopupContextVoid()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L698) def self.begin_popup_context_void(str_id : String? = nil, popup_flags : ImGuiPopupFlags = ImGuiPopupFlags.new(1)) : Bool LibImGui.BeginPopupContextVoid(str_id, popup_flags) end @@ -1829,14 +1267,10 @@ module ImGui self.end_popup end - # return true if the popup is open. - # - # [ImGui::IsPopupOpen()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L704) def self.is_popup_open(str_id : String, flags : ImGuiPopupFlags = ImGuiPopupFlags.new(0)) : Bool LibImGui.IsPopupOpen_Str(str_id, flags) end - # [ImGui::BeginTable()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L729) def self.begin_table(str_id : String, column : Int32, flags : ImGuiTableFlags = ImGuiTableFlags.new(0), outer_size : ImVec2 = ImVec2.new(0.0, 0.0), inner_width : Float32 = 0.0) : Bool LibImGui.BeginTable(str_id, column, flags, outer_size, inner_width) end @@ -1848,173 +1282,104 @@ module ImGui self.end_table end - # only call EndTable() if BeginTable() returns true! - # - # [ImGui::EndTable()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L730) def self.end_table : Void LibImGui.EndTable end - # append into the first cell of a new row. - # - # [ImGui::TableNextRow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L731) def self.table_next_row(row_flags : ImGuiTableRowFlags = ImGuiTableRowFlags.new(0), min_row_height : Float32 = 0.0) : Void LibImGui.TableNextRow(row_flags, min_row_height) end - # append into the next column (or first column of next row if currently in last column). Return true when column is visible. - # - # [ImGui::TableNextColumn()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L732) def self.table_next_column : Bool LibImGui.TableNextColumn end - # append into the specified column. Return true when column is visible. - # - # [ImGui::TableSetColumnIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L733) def self.table_set_column_index(column_n : Int32) : Bool LibImGui.TableSetColumnIndex(column_n) end - # [ImGui::TableSetupColumn()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L743) def self.table_setup_column(label : String, flags : ImGuiTableColumnFlags = ImGuiTableColumnFlags.new(0), init_width_or_weight : Float32 = 0.0, user_id : ImGuiID = 0) : Void LibImGui.TableSetupColumn(label, flags, init_width_or_weight, user_id) end - # lock columns/rows so they stay visible when scrolled. - # - # [ImGui::TableSetupScrollFreeze()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L744) def self.table_setup_scroll_freeze(cols : Int32, rows : Int32) : Void LibImGui.TableSetupScrollFreeze(cols, rows) end - # submit all headers cells based on data provided to TableSetupColumn() + submit context menu - # - # [ImGui::TableHeadersRow()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L745) def self.table_headers_row : Void LibImGui.TableHeadersRow end - # submit one header cell manually (rarely used) - # - # [ImGui::TableHeader()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L746) def self.table_header(label : String) : Void LibImGui.TableHeader(label) end - # get latest sort specs for the table (NULL if not sorting). Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable(). - # - # [ImGui::TableGetSortSpecs()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L754) def self.table_get_sort_specs : ImGuiTableSortSpecs? result = LibImGui.TableGetSortSpecs result ? ImGuiTableSortSpecs.new(result) : nil end - # return number of columns (value passed to BeginTable) - # - # [ImGui::TableGetColumnCount()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L755) def self.table_get_column_count : Int32 LibImGui.TableGetColumnCount end - # return current column index. - # - # [ImGui::TableGetColumnIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L756) def self.table_get_column_index : Int32 LibImGui.TableGetColumnIndex end - # return current row index. - # - # [ImGui::TableGetRowIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L757) def self.table_get_row_index : Int32 LibImGui.TableGetRowIndex end - # return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column. - # - # [ImGui::TableGetColumnName()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L758) def self.table_get_column_name(column_n : Int32 = -1) : String result = LibImGui.TableGetColumnName_Int(column_n) String.new(result) end - # return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column. - # - # [ImGui::TableGetColumnFlags()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L759) def self.table_get_column_flags(column_n : Int32 = -1) : ImGuiTableColumnFlags LibImGui.TableGetColumnFlags(column_n) end - # change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody) - # - # [ImGui::TableSetColumnEnabled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L760) def self.table_set_column_enabled(column_n : Int32, v : Bool) : Void LibImGui.TableSetColumnEnabled(column_n, v) end - # change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details. - # - # [ImGui::TableSetBgColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L761) def self.table_set_bg_color(target : ImGuiTableBgTarget, color : UInt32, column_n : Int32 = -1) : Void LibImGui.TableSetBgColor(target, color, column_n) end - # [ImGui::Columns()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L765) def self.columns(count : Int32 = 1, id : String? = nil, border : Bool = true) : Void LibImGui.Columns(count, id, border) end - # next column, defaults to current row or next row if the current row is finished - # - # [ImGui::NextColumn()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L766) def self.next_column : Void LibImGui.NextColumn end - # get current column index - # - # [ImGui::GetColumnIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L767) def self.get_column_index : Int32 LibImGui.GetColumnIndex end - # get column width (in pixels). pass -1 to use current column - # - # [ImGui::GetColumnWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L768) def self.get_column_width(column_index : Int32 = -1) : Float32 LibImGui.GetColumnWidth(column_index) end - # set column width (in pixels). pass -1 to use current column - # - # [ImGui::SetColumnWidth()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L769) def self.set_column_width(column_index : Int32, width : Float32) : Void LibImGui.SetColumnWidth(column_index, width) end - # get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f - # - # [ImGui::GetColumnOffset()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L770) def self.get_column_offset(column_index : Int32 = -1) : Float32 LibImGui.GetColumnOffset(column_index) end - # set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column - # - # [ImGui::SetColumnOffset()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L771) def self.set_column_offset(column_index : Int32, offset_x : Float32) : Void LibImGui.SetColumnOffset(column_index, offset_x) end - # [ImGui::GetColumnsCount()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L772) def self.get_columns_count : Int32 LibImGui.GetColumnsCount end - # create and append into a TabBar - # - # [ImGui::BeginTabBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L775) def self.begin_tab_bar(str_id : String, flags : ImGuiTabBarFlags = ImGuiTabBarFlags.new(0)) : Bool LibImGui.BeginTabBar(str_id, flags) end @@ -2026,16 +1391,10 @@ module ImGui self.end_tab_bar end - # only call EndTabBar() if BeginTabBar() returns true! - # - # [ImGui::EndTabBar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L776) def self.end_tab_bar : Void LibImGui.EndTabBar end - # create a Tab. Returns true if the Tab is selected. - # - # [ImGui::BeginTabItem()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L777) pointer_wrapper def self.begin_tab_item(label : String, p_open : Bool* = Pointer(Bool).null, flags : ImGuiTabItemFlags = ImGuiTabItemFlags.new(0)) : Bool LibImGui.BeginTabItem(label, p_open, flags) end @@ -2046,72 +1405,42 @@ module ImGui self.end_tab_item end - # only call EndTabItem() if BeginTabItem() returns true! - # - # [ImGui::EndTabItem()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L778) def self.end_tab_item : Void LibImGui.EndTabItem end - # create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar. - # - # [ImGui::TabItemButton()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L779) def self.tab_item_button(label : String, flags : ImGuiTabItemFlags = ImGuiTabItemFlags.new(0)) : Bool LibImGui.TabItemButton(label, flags) end - # notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name. - # - # [ImGui::SetTabItemClosed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L780) def self.set_tab_item_closed(tab_or_docked_window_label : String) : Void LibImGui.SetTabItemClosed(tab_or_docked_window_label) end - # start logging to tty (stdout) - # - # [ImGui::LogToTTY()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L784) def self.log_to_tty(auto_open_depth : Int32 = -1) : Void LibImGui.LogToTTY(auto_open_depth) end - # start logging to file - # - # [ImGui::LogToFile()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L785) def self.log_to_file(auto_open_depth : Int32 = -1, filename : String? = nil) : Void LibImGui.LogToFile(auto_open_depth, filename) end - # start logging to OS clipboard - # - # [ImGui::LogToClipboard()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L786) def self.log_to_clipboard(auto_open_depth : Int32 = -1) : Void LibImGui.LogToClipboard(auto_open_depth) end - # stop logging (close file, etc.) - # - # [ImGui::LogFinish()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L787) def self.log_finish : Void LibImGui.LogFinish end - # helper to display buttons for logging to tty/file/clipboard - # - # [ImGui::LogButtons()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L788) def self.log_buttons : Void LibImGui.LogButtons end - # pass text data straight to log (without being displayed) - # - # [ImGui::LogText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L789) def self.log_text(fmt : String, *args) : Void LibImGui.LogText(fmt, *args._promote_va_args) end - # call after submitting an item which may be dragged. when this return true, you can call SetDragDropPayload() + EndDragDropSource() - # - # [ImGui::BeginDragDropSource()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L797) def self.begin_drag_drop_source(flags : ImGuiDragDropFlags = ImGuiDragDropFlags.new(0)) : Bool LibImGui.BeginDragDropSource(flags) end @@ -2123,23 +1452,14 @@ module ImGui self.end_drag_drop_source end - # type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. Return true when payload has been accepted. - # - # [ImGui::SetDragDropPayload()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L798) def self.set_drag_drop_payload(type : String, data : Void*, sz : LibC::SizeT, cond : ImGuiCond = ImGuiCond.new(0)) : Bool LibImGui.SetDragDropPayload(type, data, sz, cond) end - # only call EndDragDropSource() if BeginDragDropSource() returns true! - # - # [ImGui::EndDragDropSource()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L799) def self.end_drag_drop_source : Void LibImGui.EndDragDropSource end - # call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() - # - # [ImGui::BeginDragDropTarget()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L800) def self.begin_drag_drop_target : Bool LibImGui.BeginDragDropTarget end @@ -2151,30 +1471,20 @@ module ImGui self.end_drag_drop_target end - # accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. - # - # [ImGui::AcceptDragDropPayload()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L801) def self.accept_drag_drop_payload(type : String, flags : ImGuiDragDropFlags = ImGuiDragDropFlags.new(0)) : ImGuiPayload? result = LibImGui.AcceptDragDropPayload(type, flags) result ? ImGuiPayload.new(result) : nil end - # only call EndDragDropTarget() if BeginDragDropTarget() returns true! - # - # [ImGui::EndDragDropTarget()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L802) def self.end_drag_drop_target : Void LibImGui.EndDragDropTarget end - # peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type. - # - # [ImGui::GetDragDropPayload()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L803) def self.get_drag_drop_payload : ImGuiPayload? result = LibImGui.GetDragDropPayload result ? ImGuiPayload.new(result) : nil end - # [ImGui::BeginDisabled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L809) def self.begin_disabled(disabled : Bool = true) : Void LibImGui.BeginDisabled(disabled) end @@ -2186,12 +1496,10 @@ module ImGui self.end_disabled end - # [ImGui::EndDisabled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L810) def self.end_disabled : Void LibImGui.EndDisabled end - # [ImGui::PushClipRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L814) def self.push_clip_rect(clip_rect_min : ImVec2, clip_rect_max : ImVec2, intersect_with_current_clip_rect : Bool) : Void LibImGui.PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) end @@ -2203,231 +1511,139 @@ module ImGui self.pop_clip_rect end - # [ImGui::PopClipRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L815) def self.pop_clip_rect : Void LibImGui.PopClipRect end - # make last item the default focused item of a window. - # - # [ImGui::SetItemDefaultFocus()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L819) def self.set_item_default_focus : Void LibImGui.SetItemDefaultFocus end - # 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::SetKeyboardFocusHere()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L820) def self.set_keyboard_focus_here(offset : Int32 = 0) : Void LibImGui.SetKeyboardFocusHere(offset) end - # is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options. - # - # [ImGui::IsItemHovered()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L825) def self.is_item_hovered(flags : ImGuiHoveredFlags = ImGuiHoveredFlags.new(0)) : Bool LibImGui.IsItemHovered(flags) end - # 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::IsItemActive()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L826) def self.is_item_active : Bool LibImGui.IsItemActive end - # is the last item focused for keyboard/gamepad navigation? - # - # [ImGui::IsItemFocused()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L827) def self.is_item_focused : Bool LibImGui.IsItemFocused end - # is the last item hovered and mouse clicked on? (**) == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this it NOT equivalent to the behavior of e.g. Button(). Read comments in function definition. - # - # [ImGui::IsItemClicked()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L828) def self.is_item_clicked(mouse_button : ImGuiMouseButton = ImGuiMouseButton.new(0)) : Bool LibImGui.IsItemClicked(mouse_button) end - # is the last item visible? (items may be out of sight because of clipping/scrolling) - # - # [ImGui::IsItemVisible()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L829) def self.is_item_visible : Bool LibImGui.IsItemVisible end - # did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. - # - # [ImGui::IsItemEdited()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L830) def self.is_item_edited : Bool LibImGui.IsItemEdited end - # was the last item just made active (item was previously inactive). - # - # [ImGui::IsItemActivated()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L831) def self.is_item_activated : Bool LibImGui.IsItemActivated end - # was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. - # - # [ImGui::IsItemDeactivated()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L832) def self.is_item_deactivated : Bool LibImGui.IsItemDeactivated end - # 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::IsItemDeactivatedAfterEdit()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L833) def self.is_item_deactivated_after_edit : Bool LibImGui.IsItemDeactivatedAfterEdit end - # was the last item open state toggled? set by TreeNode(). - # - # [ImGui::IsItemToggledOpen()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L834) def self.is_item_toggled_open : Bool LibImGui.IsItemToggledOpen end - # is any item hovered? - # - # [ImGui::IsAnyItemHovered()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L835) def self.is_any_item_hovered : Bool LibImGui.IsAnyItemHovered end - # is any item active? - # - # [ImGui::IsAnyItemActive()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L836) def self.is_any_item_active : Bool LibImGui.IsAnyItemActive end - # is any item focused? - # - # [ImGui::IsAnyItemFocused()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L837) def self.is_any_item_focused : Bool LibImGui.IsAnyItemFocused end - # get upper-left bounding rectangle of the last item (screen space) - # - # [ImGui::GetItemRectMin()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L838) def self.get_item_rect_min : ImGui::ImVec2 LibImGui.GetItemRectMin(out p_out) p_out end - # get lower-right bounding rectangle of the last item (screen space) - # - # [ImGui::GetItemRectMax()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L839) def self.get_item_rect_max : ImGui::ImVec2 LibImGui.GetItemRectMax(out p_out) p_out end - # get size of last item - # - # [ImGui::GetItemRectSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L840) def self.get_item_rect_size : ImGui::ImVec2 LibImGui.GetItemRectSize(out p_out) p_out end - # allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. - # - # [ImGui::SetItemAllowOverlap()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L841) def self.set_item_allow_overlap : Void LibImGui.SetItemAllowOverlap end - # return primary/default viewport. This can never be NULL. - # - # [ImGui::GetMainViewport()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L847) def self.get_main_viewport : ImGuiViewport result = LibImGui.GetMainViewport ImGuiViewport.new(result) end - # this draw list will be the first rendered one. Useful to quickly draw shapes/text behind dear imgui contents. - # - # [ImGui::GetBackgroundDrawList()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L850) def self.get_background_draw_list : ImDrawList result = LibImGui.GetBackgroundDrawList_Nil ImDrawList.new(result) end - # this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. - # - # [ImGui::GetForegroundDrawList()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L851) def self.get_foreground_draw_list : ImDrawList result = LibImGui.GetForegroundDrawList_Nil ImDrawList.new(result) end - # test if rectangle (of given size, starting from cursor position) is visible / not clipped. - # - # [ImGui::IsRectVisible()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L854) def self.is_rect_visible(size : ImVec2) : Bool LibImGui.IsRectVisible_Nil(size) end - # test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. - # - # [ImGui::IsRectVisible()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L855) def self.is_rect_visible(rect_min : ImVec2, rect_max : ImVec2) : Bool LibImGui.IsRectVisible_Vec2(rect_min, rect_max) end - # get global imgui time. incremented by io.DeltaTime every frame. - # - # [ImGui::GetTime()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L856) def self.get_time : Float64 LibImGui.GetTime end - # get global imgui frame count. incremented by 1 every frame. - # - # [ImGui::GetFrameCount()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L857) def self.get_frame_count : Int32 LibImGui.GetFrameCount end - # you may use this when creating your own ImDrawList instances. - # - # [ImGui::GetDrawListSharedData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L858) def self.get_draw_list_shared_data : ImDrawListSharedData result = LibImGui.GetDrawListSharedData result.value end - # get a string corresponding to the enum value (for display, saving, etc.). - # - # [ImGui::GetStyleColorName()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L859) def self.get_style_color_name(idx : ImGuiCol) : String result = LibImGui.GetStyleColorName(idx) String.new(result) end - # replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) - # - # [ImGui::SetStateStorage()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L860) def self.set_state_storage(storage : ImGuiStorage*) : Void LibImGui.SetStateStorage(storage) end - # [ImGui::GetStateStorage()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L861) def self.get_state_storage : ImGuiStorage result = LibImGui.GetStateStorage result.value end - # helper to create a child window / scrolling region that looks like a normal widget frame - # - # [ImGui::BeginChildFrame()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L862) def self.begin_child_frame(id : ImGuiID, size : ImVec2, flags : ImGuiWindowFlags = ImGuiWindowFlags.new(0)) : Bool LibImGui.BeginChildFrame(id, size, flags) end @@ -2438,280 +1654,183 @@ module ImGui self.end_child_frame end - # always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window) - # - # [ImGui::EndChildFrame()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L863) def self.end_child_frame : Void LibImGui.EndChildFrame end - # [ImGui::CalcTextSize()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L866) def self.calc_text_size(text : Bytes | String, hide_text_after_double_hash : Bool = false, wrap_width : Float32 = -1.0) : ImGui::ImVec2 LibImGui.CalcTextSize(out p_out, text, (text.to_unsafe + text.bytesize), hide_text_after_double_hash, wrap_width) p_out end - # [ImGui::ColorConvertU32ToFloat4()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L869) def self.color_convert_u32_to_float4(in_ : UInt32) : ImGui::ImVec4 LibImGui.ColorConvertU32ToFloat4(out p_out, in_) p_out end - # [ImGui::ColorConvertFloat4ToU32()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L870) def self.color_convert_float4_to_u32(in_ : ImVec4) : UInt32 LibImGui.ColorConvertFloat4ToU32(in_) end - # [ImGui::ColorConvertRGBtoHSV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L871) def self.color_convert_rgb_to_hsv(r : Float32, g : Float32, b : Float32) : {LibC::Float, LibC::Float, LibC::Float} LibImGui.ColorConvertRGBtoHSV(r, g, b, out out_h, out out_s, out out_v) {out_h, out_s, out_v} end - # [ImGui::ColorConvertHSVtoRGB()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L872) def self.color_convert_hsv_to_rgb(h : Float32, s : Float32, v : Float32) : {LibC::Float, LibC::Float, LibC::Float} LibImGui.ColorConvertHSVtoRGB(h, s, v, out out_r, out out_g, out out_b) {out_r, out_g, out_b} end - # is key being held. - # - # [ImGui::IsKeyDown()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L880) def self.is_key_down(key : ImGuiKey) : Bool LibImGui.IsKeyDown(key) end - # was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate - # - # [ImGui::IsKeyPressed()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L881) def self.is_key_pressed(key : ImGuiKey, repeat : Bool = true) : Bool LibImGui.IsKeyPressed(key, repeat) end - # was key released (went from Down to !Down)? - # - # [ImGui::IsKeyReleased()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L882) def self.is_key_released(key : ImGuiKey) : Bool LibImGui.IsKeyReleased(key) end - # uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate - # - # [ImGui::GetKeyPressedAmount()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L883) def self.get_key_pressed_amount(key : ImGuiKey, repeat_delay : Float32, rate : Float32) : Int32 LibImGui.GetKeyPressedAmount(key, repeat_delay, rate) end - # [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared. - # - # [ImGui::GetKeyName()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L884) def self.get_key_name(key : ImGuiKey) : String result = LibImGui.GetKeyName(key) String.new(result) end - # Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call. - # - # [ImGui::SetNextFrameWantCaptureKeyboard()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L885) def self.set_next_frame_want_capture_keyboard(want_capture_keyboard : Bool) : Void LibImGui.SetNextFrameWantCaptureKeyboard(want_capture_keyboard) end - # is mouse button held? - # - # [ImGui::IsMouseDown()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L891) def self.is_mouse_down(button : ImGuiMouseButton) : Bool LibImGui.IsMouseDown(button) end - # did mouse button clicked? (went from !Down to Down). Same as GetMouseClickedCount() == 1. - # - # [ImGui::IsMouseClicked()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L892) def self.is_mouse_clicked(button : ImGuiMouseButton, repeat : Bool = false) : Bool LibImGui.IsMouseClicked(button, repeat) end - # did mouse button released? (went from Down to !Down) - # - # [ImGui::IsMouseReleased()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L893) def self.is_mouse_released(button : ImGuiMouseButton) : Bool LibImGui.IsMouseReleased(button) end - # did mouse button double-clicked? Same as GetMouseClickedCount() == 2. (note that a double-click will also report IsMouseClicked() == true) - # - # [ImGui::IsMouseDoubleClicked()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L894) def self.is_mouse_double_clicked(button : ImGuiMouseButton) : Bool LibImGui.IsMouseDoubleClicked(button) end - # return the number of successive mouse-clicks at the time where a click happen (otherwise 0). - # - # [ImGui::GetMouseClickedCount()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L895) def self.get_mouse_clicked_count(button : ImGuiMouseButton) : Int32 LibImGui.GetMouseClickedCount(button) end - # is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block. - # - # [ImGui::IsMouseHoveringRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L896) def self.is_mouse_hovering_rect(r_min : ImVec2, r_max : ImVec2, clip : Bool = true) : Bool LibImGui.IsMouseHoveringRect(r_min, r_max, clip) end - # by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available - # - # [ImGui::IsMousePosValid()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L897) def self.is_mouse_pos_valid(mouse_pos : ImVec2* = Pointer(ImVec2).null) : Bool LibImGui.IsMousePosValid(mouse_pos) end - # [WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. - # - # [ImGui::IsAnyMouseDown()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L898) def self.is_any_mouse_down : Bool LibImGui.IsAnyMouseDown end - # shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls - # - # [ImGui::GetMousePos()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L899) def self.get_mouse_pos : ImGui::ImVec2 LibImGui.GetMousePos(out p_out) p_out end - # retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves) - # - # [ImGui::GetMousePosOnOpeningCurrentPopup()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L900) def self.get_mouse_pos_on_opening_current_popup : ImGui::ImVec2 LibImGui.GetMousePosOnOpeningCurrentPopup(out p_out) p_out end - # is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) - # - # [ImGui::IsMouseDragging()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L901) def self.is_mouse_dragging(button : ImGuiMouseButton, lock_threshold : Float32 = -1.0) : Bool LibImGui.IsMouseDragging(button, lock_threshold) end - # return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) - # - # [ImGui::GetMouseDragDelta()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L902) def self.get_mouse_drag_delta(button : ImGuiMouseButton = ImGuiMouseButton.new(0), lock_threshold : Float32 = -1.0) : ImGui::ImVec2 LibImGui.GetMouseDragDelta(out p_out, button, lock_threshold) p_out end - # [ImGui::ResetMouseDragDelta()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L903) def self.reset_mouse_drag_delta(button : ImGuiMouseButton = ImGuiMouseButton.new(0)) : Void LibImGui.ResetMouseDragDelta(button) end - # get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you - # - # [ImGui::GetMouseCursor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L904) def self.get_mouse_cursor : ImGuiMouseCursor LibImGui.GetMouseCursor end - # set desired cursor type - # - # [ImGui::SetMouseCursor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L905) def self.set_mouse_cursor(cursor_type : ImGuiMouseCursor) : Void LibImGui.SetMouseCursor(cursor_type) end - # Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next NewFrame() call. - # - # [ImGui::SetNextFrameWantCaptureMouse()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L906) def self.set_next_frame_want_capture_mouse(want_capture_mouse : Bool) : Void LibImGui.SetNextFrameWantCaptureMouse(want_capture_mouse) end - # [ImGui::GetClipboardText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L910) def self.get_clipboard_text : String result = LibImGui.GetClipboardText String.new(result) end - # [ImGui::SetClipboardText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L911) def self.set_clipboard_text(text : String) : Void LibImGui.SetClipboardText(text) end - # call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename). - # - # [ImGui::LoadIniSettingsFromDisk()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L917) def self.load_ini_settings_from_disk(ini_filename : String) : Void LibImGui.LoadIniSettingsFromDisk(ini_filename) end - # call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source. - # - # [ImGui::LoadIniSettingsFromMemory()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L918) def self.load_ini_settings_from_memory(ini_data : String, ini_size : LibC::SizeT = 0) : Void LibImGui.LoadIniSettingsFromMemory(ini_data, ini_size) end - # this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext). - # - # [ImGui::SaveIniSettingsToDisk()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L919) def self.save_ini_settings_to_disk(ini_filename : String) : Void LibImGui.SaveIniSettingsToDisk(ini_filename) end - # return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. - # - # [ImGui::SaveIniSettingsToMemory()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L920) def self.save_ini_settings_to_memory : {String, LibC::SizeT} result = LibImGui.SaveIniSettingsToMemory(out out_ini_size) {String.new(result), out_ini_size} end - # [ImGui::DebugTextEncoding()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L923) def self.debug_text_encoding(text : String) : Void LibImGui.DebugTextEncoding(text) end - # This is called by IMGUI_CHECKVERSION() macro. - # - # [ImGui::DebugCheckVersionAndDataLayout()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L924) def self.debug_check_version_and_data_layout(version_str : String, sz_io : LibC::SizeT, sz_style : LibC::SizeT, sz_vec2 : LibC::SizeT, sz_vec4 : LibC::SizeT, sz_drawvert : LibC::SizeT, sz_drawidx : LibC::SizeT) : Bool LibImGui.DebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx) end - # [ImGui::SetAllocatorFunctions()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L930) def self.set_allocator_functions(alloc_func : ImGuiMemAllocFunc, free_func : ImGuiMemFreeFunc, user_data : Void* = Pointer(Void).null) : Void LibImGui.SetAllocatorFunctions(alloc_func, free_func, user_data) end - # [ImGui::GetAllocatorFunctions()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L931) pointer_wrapper def self.get_allocator_functions(p_alloc_func : ImGuiMemAllocFunc*, p_free_func : ImGuiMemFreeFunc*, p_user_data : Void**) : Void LibImGui.GetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data) end - # [ImGui::MemAlloc()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L932) def self.mem_alloc(size : LibC::SizeT) : Void* LibImGui.MemAlloc(size) end - # [ImGui::MemFree()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L933) def self.mem_free(ptr : Void*) : Void LibImGui.MemFree(ptr) end - # [struct ImVector](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1769) struct ImVector include StructType end - # [struct ImGuiStyle](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1840) struct ImGuiStyle include ClassType(LibImGui::ImGuiStyle) - # Global alpha applies to everything in Dear ImGui. def alpha : Float32 @this.value.alpha end @@ -2720,7 +1839,6 @@ module ImGui @this.value.alpha = alpha end - # Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha. def disabled_alpha : Float32 @this.value.disabled_alpha end @@ -2729,7 +1847,6 @@ module ImGui @this.value.disabled_alpha = disabled_alpha end - # Padding within a window. def window_padding : ImVec2 @this.value.window_padding end @@ -2738,7 +1855,6 @@ module ImGui @this.value.window_padding = window_padding end - # Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended. def window_rounding : Float32 @this.value.window_rounding end @@ -2747,7 +1863,6 @@ module ImGui @this.value.window_rounding = window_rounding end - # Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). def window_border_size : Float32 @this.value.window_border_size end @@ -2756,7 +1871,6 @@ module ImGui @this.value.window_border_size = window_border_size end - # Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). def window_min_size : ImVec2 @this.value.window_min_size end @@ -2765,7 +1879,6 @@ module ImGui @this.value.window_min_size = window_min_size end - # Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. def window_title_align : ImVec2 @this.value.window_title_align end @@ -2774,7 +1887,6 @@ module ImGui @this.value.window_title_align = window_title_align end - # Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. def window_menu_button_position : ImGuiDir @this.value.window_menu_button_position end @@ -2783,7 +1895,6 @@ module ImGui @this.value.window_menu_button_position = window_menu_button_position end - # Radius of child window corners rounding. Set to 0.0f to have rectangular windows. def child_rounding : Float32 @this.value.child_rounding end @@ -2792,7 +1903,6 @@ module ImGui @this.value.child_rounding = child_rounding end - # Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). def child_border_size : Float32 @this.value.child_border_size end @@ -2801,7 +1911,6 @@ module ImGui @this.value.child_border_size = child_border_size end - # Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) def popup_rounding : Float32 @this.value.popup_rounding end @@ -2810,7 +1919,6 @@ module ImGui @this.value.popup_rounding = popup_rounding end - # Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). def popup_border_size : Float32 @this.value.popup_border_size end @@ -2819,7 +1927,6 @@ module ImGui @this.value.popup_border_size = popup_border_size end - # Padding within a framed rectangle (used by most widgets). def frame_padding : ImVec2 @this.value.frame_padding end @@ -2828,7 +1935,6 @@ module ImGui @this.value.frame_padding = frame_padding end - # Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). def frame_rounding : Float32 @this.value.frame_rounding end @@ -2837,7 +1943,6 @@ module ImGui @this.value.frame_rounding = frame_rounding end - # Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). def frame_border_size : Float32 @this.value.frame_border_size end @@ -2846,7 +1951,6 @@ module ImGui @this.value.frame_border_size = frame_border_size end - # Horizontal and vertical spacing between widgets/lines. def item_spacing : ImVec2 @this.value.item_spacing end @@ -2855,7 +1959,6 @@ module ImGui @this.value.item_spacing = item_spacing end - # Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). def item_inner_spacing : ImVec2 @this.value.item_inner_spacing end @@ -2864,7 +1967,6 @@ module ImGui @this.value.item_inner_spacing = item_inner_spacing end - # Padding within a table cell def cell_padding : ImVec2 @this.value.cell_padding end @@ -2873,7 +1975,6 @@ module ImGui @this.value.cell_padding = cell_padding end - # Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! def touch_extra_padding : ImVec2 @this.value.touch_extra_padding end @@ -2882,7 +1983,6 @@ module ImGui @this.value.touch_extra_padding = touch_extra_padding end - # Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). def indent_spacing : Float32 @this.value.indent_spacing end @@ -2891,7 +1991,6 @@ module ImGui @this.value.indent_spacing = indent_spacing end - # Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). def columns_min_spacing : Float32 @this.value.columns_min_spacing end @@ -2900,7 +1999,6 @@ module ImGui @this.value.columns_min_spacing = columns_min_spacing end - # Width of the vertical scrollbar, Height of the horizontal scrollbar. def scrollbar_size : Float32 @this.value.scrollbar_size end @@ -2909,7 +2007,6 @@ module ImGui @this.value.scrollbar_size = scrollbar_size end - # Radius of grab corners for scrollbar. def scrollbar_rounding : Float32 @this.value.scrollbar_rounding end @@ -2918,7 +2015,6 @@ module ImGui @this.value.scrollbar_rounding = scrollbar_rounding end - # Minimum width/height of a grab box for slider/scrollbar. def grab_min_size : Float32 @this.value.grab_min_size end @@ -2927,7 +2023,6 @@ module ImGui @this.value.grab_min_size = grab_min_size end - # Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. def grab_rounding : Float32 @this.value.grab_rounding end @@ -2936,7 +2031,6 @@ module ImGui @this.value.grab_rounding = grab_rounding end - # The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. def log_slider_deadzone : Float32 @this.value.log_slider_deadzone end @@ -2945,7 +2039,6 @@ module ImGui @this.value.log_slider_deadzone = log_slider_deadzone end - # Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. def tab_rounding : Float32 @this.value.tab_rounding end @@ -2954,7 +2047,6 @@ module ImGui @this.value.tab_rounding = tab_rounding end - # Thickness of border around tabs. def tab_border_size : Float32 @this.value.tab_border_size end @@ -2963,7 +2055,6 @@ module ImGui @this.value.tab_border_size = tab_border_size end - # Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. def tab_min_width_for_close_button : Float32 @this.value.tab_min_width_for_close_button end @@ -2972,7 +2063,6 @@ module ImGui @this.value.tab_min_width_for_close_button = tab_min_width_for_close_button end - # Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. def color_button_position : ImGuiDir @this.value.color_button_position end @@ -2981,7 +2071,6 @@ module ImGui @this.value.color_button_position = color_button_position end - # Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). def button_text_align : ImVec2 @this.value.button_text_align end @@ -2990,7 +2079,6 @@ module ImGui @this.value.button_text_align = button_text_align end - # Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. def selectable_text_align : ImVec2 @this.value.selectable_text_align end @@ -2999,7 +2087,6 @@ module ImGui @this.value.selectable_text_align = selectable_text_align end - # Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. def display_window_padding : ImVec2 @this.value.display_window_padding end @@ -3008,7 +2095,6 @@ module ImGui @this.value.display_window_padding = display_window_padding end - # If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! def display_safe_area_padding : ImVec2 @this.value.display_safe_area_padding end @@ -3017,7 +2103,6 @@ module ImGui @this.value.display_safe_area_padding = display_safe_area_padding end - # Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. def mouse_cursor_scale : Float32 @this.value.mouse_cursor_scale end @@ -3026,7 +2111,6 @@ module ImGui @this.value.mouse_cursor_scale = mouse_cursor_scale end - # Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). def anti_aliased_lines : Bool @this.value.anti_aliased_lines end @@ -3035,7 +2119,6 @@ module ImGui @this.value.anti_aliased_lines = anti_aliased_lines end - # Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList). def anti_aliased_lines_use_tex : Bool @this.value.anti_aliased_lines_use_tex end @@ -3044,7 +2127,6 @@ module ImGui @this.value.anti_aliased_lines_use_tex = anti_aliased_lines_use_tex end - # Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). def anti_aliased_fill : Bool @this.value.anti_aliased_fill end @@ -3053,7 +2135,6 @@ module ImGui @this.value.anti_aliased_fill = anti_aliased_fill end - # Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. def curve_tessellation_tol : Float32 @this.value.curve_tessellation_tol end @@ -3062,7 +2143,6 @@ module ImGui @this.value.curve_tessellation_tol = curve_tessellation_tol end - # Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. def circle_tessellation_max_error : Float32 @this.value.circle_tessellation_max_error end @@ -3079,13 +2159,11 @@ module ImGui @this.value.colors = colors end - # [ImGuiStyle::ImGuiStyle()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1884) def self.new : ImGuiStyle result = LibImGui.ImGuiStyle_ImGuiStyle ImGuiStyle.new(result) end - # [ImGuiStyle::ScaleAllSizes()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1885) def scale_all_sizes(scale_factor : Float32) : Void LibImGui.ImGuiStyle_ScaleAllSizes(self, scale_factor) end @@ -3093,11 +2171,9 @@ module ImGui alias TopLevel::ImGuiStyle = ImGui::ImGuiStyle - # [struct ImGuiKeyData](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1897) struct ImGuiKeyData include ClassType(LibImGui::ImGuiKeyData) - # True for if key is down def down : Bool @this.value.down end @@ -3106,7 +2182,6 @@ module ImGui @this.value.down = down end - # Duration the key has been down (<0.0f: not pressed, 0.0f: just pressed, >0.0f: time held) def down_duration : Float32 @this.value.down_duration end @@ -3115,7 +2190,6 @@ module ImGui @this.value.down_duration = down_duration end - # Last frame duration the key has been down def down_duration_prev : Float32 @this.value.down_duration_prev end @@ -3124,7 +2198,6 @@ module ImGui @this.value.down_duration_prev = down_duration_prev end - # 0.0f..1.0f for gamepad values def analog_value : Float32 @this.value.analog_value end @@ -3136,12 +2209,9 @@ module ImGui alias TopLevel::ImGuiKeyData = ImGui::ImGuiKeyData - # [struct ImGuiIO](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1905) struct ImGuiIO include ClassType(LibImGui::ImGuiIO) - # = 0 - # See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. def config_flags : ImGuiConfigFlags @this.value.config_flags end @@ -3150,8 +2220,6 @@ module ImGui @this.value.config_flags = config_flags end - # = 0 - # See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. def backend_flags : ImGuiBackendFlags @this.value.backend_flags end @@ -3160,8 +2228,6 @@ module ImGui @this.value.backend_flags = backend_flags end - # - # Main display size, in pixels (generally == GetMainViewport()->Size). May change every frame. def display_size : ImVec2 @this.value.display_size end @@ -3170,8 +2236,6 @@ module ImGui @this.value.display_size = display_size end - # = 1.0f/60.0f - # Time elapsed since last frame, in seconds. May change every frame. def delta_time : Float32 @this.value.delta_time end @@ -3180,8 +2244,6 @@ module ImGui @this.value.delta_time = delta_time end - # = 5.0f - # Minimum time between saving positions/sizes to .ini file, in seconds. def ini_saving_rate : Float32 @this.value.ini_saving_rate end @@ -3190,8 +2252,6 @@ module ImGui @this.value.ini_saving_rate = ini_saving_rate end - # = "imgui.ini" - # Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. def ini_filename : String? (v = @this.value.ini_filename) ? String.new(v) : nil end @@ -3200,7 +2260,6 @@ module ImGui @this.value.ini_filename = ini_filename end - # = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). def log_filename : String? (v = @this.value.log_filename) ? String.new(v) : nil end @@ -3209,8 +2268,6 @@ module ImGui @this.value.log_filename = log_filename end - # = 0.30f - # Time for a double-click, in seconds. def mouse_double_click_time : Float32 @this.value.mouse_double_click_time end @@ -3219,8 +2276,6 @@ module ImGui @this.value.mouse_double_click_time = mouse_double_click_time end - # = 6.0f - # Distance threshold to stay in to validate a double-click, in pixels. def mouse_double_click_max_dist : Float32 @this.value.mouse_double_click_max_dist end @@ -3229,8 +2284,6 @@ module ImGui @this.value.mouse_double_click_max_dist = mouse_double_click_max_dist end - # = 6.0f - # Distance threshold before considering we are dragging. def mouse_drag_threshold : Float32 @this.value.mouse_drag_threshold end @@ -3239,8 +2292,6 @@ module ImGui @this.value.mouse_drag_threshold = mouse_drag_threshold end - # = 0.250f - # When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). def key_repeat_delay : Float32 @this.value.key_repeat_delay end @@ -3249,8 +2300,6 @@ module ImGui @this.value.key_repeat_delay = key_repeat_delay end - # = 0.050f - # When holding a key/button, rate at which it repeats, in seconds. def key_repeat_rate : Float32 @this.value.key_repeat_rate end @@ -3259,8 +2308,6 @@ module ImGui @this.value.key_repeat_rate = key_repeat_rate end - # = NULL - # Store your own data for retrieval by callbacks. def user_data : Void* @this.value.user_data end @@ -3269,8 +2316,6 @@ module ImGui @this.value.user_data = user_data end - # - # Font atlas: load, rasterize and pack one or more fonts into a single texture. def fonts : ImFontAtlas ImFontAtlas.new(@this.value.fonts) end @@ -3279,8 +2324,6 @@ module ImGui @this.value.fonts = fonts end - # = 1.0f - # Global scale all fonts def font_global_scale : Float32 @this.value.font_global_scale end @@ -3289,8 +2332,6 @@ module ImGui @this.value.font_global_scale = font_global_scale end - # = false - # Allow user scaling text of individual window with CTRL+Wheel. def font_allow_user_scaling : Bool @this.value.font_allow_user_scaling end @@ -3299,8 +2340,6 @@ module ImGui @this.value.font_allow_user_scaling = font_allow_user_scaling end - # = NULL - # Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0]. def font_default : ImFont ImFont.new(@this.value.font_default) end @@ -3309,8 +2348,6 @@ module ImGui @this.value.font_default = font_default end - # = (1, 1) - # For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale. def display_framebuffer_scale : ImVec2 @this.value.display_framebuffer_scale end @@ -3319,8 +2356,6 @@ module ImGui @this.value.display_framebuffer_scale = display_framebuffer_scale end - # = false - # Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations. def mouse_draw_cursor : Bool @this.value.mouse_draw_cursor end @@ -3329,8 +2364,6 @@ module ImGui @this.value.mouse_draw_cursor = mouse_draw_cursor end - # = defined(__APPLE__) - # OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. def config_mac_osx_behaviors : Bool @this.value.config_mac_osx_behaviors end @@ -3339,8 +2372,6 @@ module ImGui @this.value.config_mac_osx_behaviors = config_mac_osx_behaviors end - # = true - # 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. def config_input_trickle_event_queue : Bool @this.value.config_input_trickle_event_queue end @@ -3349,8 +2380,6 @@ module ImGui @this.value.config_input_trickle_event_queue = config_input_trickle_event_queue end - # = true - # Enable blinking cursor (optional as some users consider it to be distracting). def config_input_text_cursor_blink : Bool @this.value.config_input_text_cursor_blink end @@ -3359,8 +2388,6 @@ module ImGui @this.value.config_input_text_cursor_blink = config_input_text_cursor_blink end - # = false - # [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard. def config_drag_click_to_input_text : Bool @this.value.config_drag_click_to_input_text end @@ -3369,8 +2396,6 @@ module ImGui @this.value.config_drag_click_to_input_text = config_drag_click_to_input_text end - # = true - # Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) def config_windows_resize_from_edges : Bool @this.value.config_windows_resize_from_edges end @@ -3379,8 +2404,6 @@ module ImGui @this.value.config_windows_resize_from_edges = config_windows_resize_from_edges end - # = false - # Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. def config_windows_move_from_title_bar_only : Bool @this.value.config_windows_move_from_title_bar_only end @@ -3389,8 +2412,6 @@ module ImGui @this.value.config_windows_move_from_title_bar_only = config_windows_move_from_title_bar_only end - # = 60.0f - # Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. def config_memory_compact_timer : Float32 @this.value.config_memory_compact_timer end @@ -3399,7 +2420,6 @@ module ImGui @this.value.config_memory_compact_timer = config_memory_compact_timer end - # = NULL def backend_platform_name : String? (v = @this.value.backend_platform_name) ? String.new(v) : nil end @@ -3408,7 +2428,6 @@ module ImGui @this.value.backend_platform_name = backend_platform_name end - # = NULL def backend_renderer_name : String? (v = @this.value.backend_renderer_name) ? String.new(v) : nil end @@ -3417,8 +2436,6 @@ module ImGui @this.value.backend_renderer_name = backend_renderer_name end - # = NULL - # User data for platform backend def backend_platform_user_data : Void* @this.value.backend_platform_user_data end @@ -3427,8 +2444,6 @@ module ImGui @this.value.backend_platform_user_data = backend_platform_user_data end - # = NULL - # User data for renderer backend def backend_renderer_user_data : Void* @this.value.backend_renderer_user_data end @@ -3437,8 +2452,6 @@ module ImGui @this.value.backend_renderer_user_data = backend_renderer_user_data end - # = NULL - # User data for non C++ programming language backend def backend_language_user_data : Void* @this.value.backend_language_user_data end @@ -3479,7 +2492,6 @@ module ImGui @this.value.set_platform_ime_data_fn = set_platform_ime_data_fn end - # Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). def want_capture_mouse : Bool @this.value.want_capture_mouse end @@ -3488,7 +2500,6 @@ module ImGui @this.value.want_capture_mouse = want_capture_mouse end - # Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.). def want_capture_keyboard : Bool @this.value.want_capture_keyboard end @@ -3497,7 +2508,6 @@ module ImGui @this.value.want_capture_keyboard = want_capture_keyboard end - # Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). def want_text_input : Bool @this.value.want_text_input end @@ -3506,7 +2516,6 @@ module ImGui @this.value.want_text_input = want_text_input end - # MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. def want_set_mouse_pos : Bool @this.value.want_set_mouse_pos end @@ -3515,7 +2524,6 @@ module ImGui @this.value.want_set_mouse_pos = want_set_mouse_pos end - # When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! def want_save_ini_settings : Bool @this.value.want_save_ini_settings end @@ -3524,7 +2532,6 @@ module ImGui @this.value.want_save_ini_settings = want_save_ini_settings end - # Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. def nav_active : Bool @this.value.nav_active end @@ -3533,7 +2540,6 @@ module ImGui @this.value.nav_active = nav_active end - # Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). def nav_visible : Bool @this.value.nav_visible end @@ -3542,7 +2548,6 @@ module ImGui @this.value.nav_visible = nav_visible end - # Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. def framerate : Float32 @this.value.framerate end @@ -3551,7 +2556,6 @@ module ImGui @this.value.framerate = framerate end - # Vertices output during last call to Render() def metrics_render_vertices : Int32 @this.value.metrics_render_vertices end @@ -3560,7 +2564,6 @@ module ImGui @this.value.metrics_render_vertices = metrics_render_vertices end - # Indices output during last call to Render() = number of triangles * 3 def metrics_render_indices : Int32 @this.value.metrics_render_indices end @@ -3569,7 +2572,6 @@ module ImGui @this.value.metrics_render_indices = metrics_render_indices end - # Number of visible windows def metrics_render_windows : Int32 @this.value.metrics_render_windows end @@ -3578,7 +2580,6 @@ module ImGui @this.value.metrics_render_windows = metrics_render_windows end - # Number of active windows def metrics_active_windows : Int32 @this.value.metrics_active_windows end @@ -3587,7 +2588,6 @@ module ImGui @this.value.metrics_active_windows = metrics_active_windows end - # Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. def metrics_active_allocations : Int32 @this.value.metrics_active_allocations end @@ -3596,7 +2596,6 @@ module ImGui @this.value.metrics_active_allocations = metrics_active_allocations end - # Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. def mouse_delta : ImVec2 @this.value.mouse_delta end @@ -3605,7 +2604,6 @@ module ImGui @this.value.mouse_delta = mouse_delta end - # [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512. def key_map : Slice(Int32) @this.value.key_map.to_slice end @@ -3614,7 +2612,6 @@ module ImGui @this.value.key_map = key_map end - # [LEGACY] Input: 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). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow. def keys_down : Slice(Bool) @this.value.keys_down.to_slice end @@ -3623,7 +2620,6 @@ module ImGui @this.value.keys_down = keys_down end - # Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) def mouse_pos : ImVec2 @this.value.mouse_pos end @@ -3632,7 +2628,6 @@ module ImGui @this.value.mouse_pos = mouse_pos end - # 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. def mouse_down : Slice(Bool) @this.value.mouse_down.to_slice end @@ -3641,7 +2636,6 @@ module ImGui @this.value.mouse_down = mouse_down end - # Mouse wheel Vertical: 1 unit scrolls about 5 lines text. def mouse_wheel : Float32 @this.value.mouse_wheel end @@ -3650,7 +2644,6 @@ module ImGui @this.value.mouse_wheel = mouse_wheel end - # Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends. def mouse_wheel_h : Float32 @this.value.mouse_wheel_h end @@ -3659,7 +2652,6 @@ module ImGui @this.value.mouse_wheel_h = mouse_wheel_h end - # Keyboard modifier down: Control def key_ctrl : Bool @this.value.key_ctrl end @@ -3668,7 +2660,6 @@ module ImGui @this.value.key_ctrl = key_ctrl end - # Keyboard modifier down: Shift def key_shift : Bool @this.value.key_shift end @@ -3677,7 +2668,6 @@ module ImGui @this.value.key_shift = key_shift end - # Keyboard modifier down: Alt def key_alt : Bool @this.value.key_alt end @@ -3686,7 +2676,6 @@ module ImGui @this.value.key_alt = key_alt end - # Keyboard modifier down: Cmd/Super/Windows def key_super : Bool @this.value.key_super end @@ -3695,7 +2684,6 @@ module ImGui @this.value.key_super = key_super end - # Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). def nav_inputs : Slice(Float32) @this.value.nav_inputs.to_slice end @@ -3704,7 +2692,6 @@ module ImGui @this.value.nav_inputs = nav_inputs end - # Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame() def key_mods : ImGuiModFlags @this.value.key_mods end @@ -3713,7 +2700,6 @@ module ImGui @this.value.key_mods = key_mods end - # Key state for all known keys. Use IsKeyXXX() functions to access this. def keys_data : Slice(ImGuiKeyData) @this.value.keys_data.to_slice end @@ -3722,7 +2708,6 @@ module ImGui @this.value.keys_data = keys_data end - # Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup. def want_capture_mouse_unless_popup_close : Bool @this.value.want_capture_mouse_unless_popup_close end @@ -3731,7 +2716,6 @@ module ImGui @this.value.want_capture_mouse_unless_popup_close = want_capture_mouse_unless_popup_close end - # Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) def mouse_pos_prev : ImVec2 @this.value.mouse_pos_prev end @@ -3740,7 +2724,6 @@ module ImGui @this.value.mouse_pos_prev = mouse_pos_prev end - # Position at time of clicking def mouse_clicked_pos : Slice(ImVec2) @this.value.mouse_clicked_pos.to_slice end @@ -3749,7 +2732,6 @@ module ImGui @this.value.mouse_clicked_pos = mouse_clicked_pos end - # Time of last click (used to figure out double-click) def mouse_clicked_time : Slice(Float64) @this.value.mouse_clicked_time.to_slice end @@ -3758,7 +2740,6 @@ module ImGui @this.value.mouse_clicked_time = mouse_clicked_time end - # Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0) def mouse_clicked : Slice(Bool) @this.value.mouse_clicked.to_slice end @@ -3767,7 +2748,6 @@ module ImGui @this.value.mouse_clicked = mouse_clicked end - # Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2) def mouse_double_clicked : Slice(Bool) @this.value.mouse_double_clicked.to_slice end @@ -3776,7 +2756,6 @@ module ImGui @this.value.mouse_double_clicked = mouse_double_clicked end - # == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down def mouse_clicked_count : Slice(UInt16) @this.value.mouse_clicked_count.to_slice end @@ -3785,7 +2764,6 @@ module ImGui @this.value.mouse_clicked_count = mouse_clicked_count end - # Count successive number of clicks. Stays valid after mouse release. Reset after another click is done. def mouse_clicked_last_count : Slice(UInt16) @this.value.mouse_clicked_last_count.to_slice end @@ -3794,7 +2772,6 @@ module ImGui @this.value.mouse_clicked_last_count = mouse_clicked_last_count end - # Mouse button went from Down to !Down def mouse_released : Slice(Bool) @this.value.mouse_released.to_slice end @@ -3803,7 +2780,6 @@ module ImGui @this.value.mouse_released = mouse_released end - # Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds. def mouse_down_owned : Slice(Bool) @this.value.mouse_down_owned.to_slice end @@ -3812,7 +2788,6 @@ module ImGui @this.value.mouse_down_owned = mouse_down_owned end - # Track if button was clicked inside a dear imgui window. def mouse_down_owned_unless_popup_close : Slice(Bool) @this.value.mouse_down_owned_unless_popup_close.to_slice end @@ -3821,7 +2796,6 @@ module ImGui @this.value.mouse_down_owned_unless_popup_close = mouse_down_owned_unless_popup_close end - # Duration the mouse button has been down (0.0f == just clicked) def mouse_down_duration : Slice(Float32) @this.value.mouse_down_duration.to_slice end @@ -3830,7 +2804,6 @@ module ImGui @this.value.mouse_down_duration = mouse_down_duration end - # Previous time the mouse button has been down def mouse_down_duration_prev : Slice(Float32) @this.value.mouse_down_duration_prev.to_slice end @@ -3839,7 +2812,6 @@ module ImGui @this.value.mouse_down_duration_prev = mouse_down_duration_prev end - # Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds) def mouse_drag_max_distance_sqr : Slice(Float32) @this.value.mouse_drag_max_distance_sqr.to_slice end @@ -3864,7 +2836,6 @@ module ImGui @this.value.nav_inputs_down_duration_prev = nav_inputs_down_duration_prev end - # Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui. def pen_pressure : Float32 @this.value.pen_pressure end @@ -3873,7 +2844,6 @@ module ImGui @this.value.pen_pressure = pen_pressure end - # Only modify via AddFocusEvent() def app_focus_lost : Bool @this.value.app_focus_lost end @@ -3882,7 +2852,6 @@ module ImGui @this.value.app_focus_lost = app_focus_lost end - # Only modify via SetAppAcceptingEvents() def app_accepting_events : Bool @this.value.app_accepting_events end @@ -3891,7 +2860,6 @@ module ImGui @this.value.app_accepting_events = app_accepting_events end - # -1: unknown, 0: using AddKeyEvent(), 1: using legacy io.KeysDown[] def backend_using_legacy_key_arrays : Int8 @this.value.backend_using_legacy_key_arrays end @@ -3900,7 +2868,6 @@ module ImGui @this.value.backend_using_legacy_key_arrays = backend_using_legacy_key_arrays end - # 0: using AddKeyAnalogEvent(), 1: writing to legacy io.NavInputs[] directly def backend_using_legacy_nav_input_array : Bool @this.value.backend_using_legacy_nav_input_array end @@ -3909,7 +2876,6 @@ module ImGui @this.value.backend_using_legacy_nav_input_array = backend_using_legacy_nav_input_array end - # For AddInputCharacterUTF16() def input_queue_surrogate : ImWchar16 @this.value.input_queue_surrogate end @@ -3918,7 +2884,6 @@ module ImGui @this.value.input_queue_surrogate = input_queue_surrogate end - # Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper. def input_queue_characters : ImVector(ImWchar) t = @this.value.input_queue_characters pointerof(t).as(ImVector(ImWchar)*).value @@ -3928,98 +2893,58 @@ module ImGui @this.value.input_queue_characters = input_queue_characters.as(LibImGui::ImVectorInternal*).value end - # 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) - # - # [ImGuiIO::AddKeyEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1973) def add_key_event(key : ImGuiKey, down : Bool) : Void LibImGui.ImGuiIO_AddKeyEvent(self, key, down) end - # Queue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). Dead-zones should be handled by the backend. - # - # [ImGuiIO::AddKeyAnalogEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1974) def add_key_analog_event(key : ImGuiKey, down : Bool, v : Float32) : Void LibImGui.ImGuiIO_AddKeyAnalogEvent(self, key, down, v) end - # Queue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. app not focused and not hovered) - # - # [ImGuiIO::AddMousePosEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1975) def add_mouse_pos_event(x : Float32, y : Float32) : Void LibImGui.ImGuiIO_AddMousePosEvent(self, x, y) end - # Queue a mouse button change - # - # [ImGuiIO::AddMouseButtonEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1976) def add_mouse_button_event(button : Int32, down : Bool) : Void LibImGui.ImGuiIO_AddMouseButtonEvent(self, button, down) end - # Queue a mouse wheel update - # - # [ImGuiIO::AddMouseWheelEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1977) def add_mouse_wheel_event(wh_x : Float32, wh_y : Float32) : Void LibImGui.ImGuiIO_AddMouseWheelEvent(self, wh_x, wh_y) end - # Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window) - # - # [ImGuiIO::AddFocusEvent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1978) def add_focus_event(focused : Bool) : Void LibImGui.ImGuiIO_AddFocusEvent(self, focused) end - # Queue a new character input - # - # [ImGuiIO::AddInputCharacter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1979) def add_input_character(c : UInt32) : Void LibImGui.ImGuiIO_AddInputCharacter(self, c) end - # Queue a new character input from an UTF-16 character, it can be a surrogate - # - # [ImGuiIO::AddInputCharacterUTF16()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1980) def add_input_character_utf16(c : ImWchar16) : Void LibImGui.ImGuiIO_AddInputCharacterUTF16(self, c) end - # Queue a new characters input from an UTF-8 string - # - # [ImGuiIO::AddInputCharactersUTF8()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1981) def add_input_characters_utf8(str : String) : Void LibImGui.ImGuiIO_AddInputCharactersUTF8(self, str) end - # [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode. - # - # [ImGuiIO::SetKeyEventNativeData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1983) def set_key_event_native_data(key : ImGuiKey, native_keycode : Int32, native_scancode : Int32, native_legacy_index : Int32 = -1) : Void LibImGui.ImGuiIO_SetKeyEventNativeData(self, key, native_keycode, native_scancode, native_legacy_index) end - # Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen. - # - # [ImGuiIO::SetAppAcceptingEvents()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1984) def set_app_accepting_events(accepting_events : Bool) : Void LibImGui.ImGuiIO_SetAppAcceptingEvents(self, accepting_events) end - # [Internal] Clear the text input buffer manually - # - # [ImGuiIO::ClearInputCharacters()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1985) def clear_input_characters : Void LibImGui.ImGuiIO_ClearInputCharacters(self) end - # [Internal] Release all keys - # - # [ImGuiIO::ClearInputKeys()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1986) def clear_input_keys : Void LibImGui.ImGuiIO_ClearInputKeys(self) end - # [ImGuiIO::ImGuiIO()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2060) def self.new : ImGuiIO result = LibImGui.ImGuiIO_ImGuiIO ImGuiIO.new(result) @@ -4028,12 +2953,9 @@ module ImGui alias TopLevel::ImGuiIO = ImGui::ImGuiIO - # [struct ImGuiInputTextCallbackData](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2076) struct ImGuiInputTextCallbackData include ClassType(LibImGui::ImGuiInputTextCallbackData) - # One ImGuiInputTextFlags_Callback* - # Read-only def event_flag : ImGuiInputTextFlags @this.value.event_flag end @@ -4042,8 +2964,6 @@ module ImGui @this.value.event_flag = event_flag end - # What user passed to InputText() - # Read-only def flags : ImGuiInputTextFlags @this.value.flags end @@ -4052,8 +2972,6 @@ module ImGui @this.value.flags = flags end - # What user passed to InputText() - # Read-only def user_data : Void* @this.value.user_data end @@ -4062,9 +2980,6 @@ module ImGui @this.value.user_data = user_data end - # Character input - # Read-write - # [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0; def event_char : ImWchar @this.value.event_char end @@ -4073,9 +2988,6 @@ module ImGui @this.value.event_char = event_char end - # Key pressed (Up/Down/TAB) - # Read-only - # [Completion,History] def event_key : ImGuiKey @this.value.event_key end @@ -4084,9 +2996,6 @@ module ImGui @this.value.event_key = event_key end - # Text buffer - # Read-write - # [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! def buf : LibC::Char* @this.value.buf end @@ -4095,9 +3004,6 @@ module ImGui @this.value.buf = buf end - # Text length (in bytes) - # Read-write - # [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length() def buf_text_len : Int32 @this.value.buf_text_len end @@ -4106,9 +3012,6 @@ module ImGui @this.value.buf_text_len = buf_text_len end - # Buffer size (in bytes) = capacity+1 - # Read-only - # [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1 def buf_size : Int32 @this.value.buf_size end @@ -4117,9 +3020,6 @@ module ImGui @this.value.buf_size = buf_size end - # Set if you modify Buf/BufTextLen! - # Write - # [Completion,History,Always] def buf_dirty : Bool @this.value.buf_dirty end @@ -4128,8 +3028,6 @@ module ImGui @this.value.buf_dirty = buf_dirty end - # Read-write - # [Completion,History,Always] def cursor_pos : Int32 @this.value.cursor_pos end @@ -4138,8 +3036,6 @@ module ImGui @this.value.cursor_pos = cursor_pos end - # Read-write - # [Completion,History,Always] == to SelectionEnd when no selection) def selection_start : Int32 @this.value.selection_start end @@ -4148,8 +3044,6 @@ module ImGui @this.value.selection_start = selection_start end - # Read-write - # [Completion,History,Always] def selection_end : Int32 @this.value.selection_end end @@ -4158,33 +3052,27 @@ module ImGui @this.value.selection_end = selection_end end - # [ImGuiInputTextCallbackData::ImGuiInputTextCallbackData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2097) def self.new : ImGuiInputTextCallbackData result = LibImGui.ImGuiInputTextCallbackData_ImGuiInputTextCallbackData ImGuiInputTextCallbackData.new(result) end - # [ImGuiInputTextCallbackData::DeleteChars()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2098) def delete_chars(pos : Int32, bytes_count : Int32) : Void LibImGui.ImGuiInputTextCallbackData_DeleteChars(self, pos, bytes_count) end - # [ImGuiInputTextCallbackData::InsertChars()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2099) def insert_chars(pos : Int32, text : Bytes | String) : Void LibImGui.ImGuiInputTextCallbackData_InsertChars(self, pos, text, (text.to_unsafe + text.bytesize)) end - # [ImGuiInputTextCallbackData::SelectAll()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2100) def select_all : Void LibImGui.ImGuiInputTextCallbackData_SelectAll(self) end - # [ImGuiInputTextCallbackData::ClearSelection()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2101) def clear_selection : Void LibImGui.ImGuiInputTextCallbackData_ClearSelection(self) end - # [ImGuiInputTextCallbackData::HasSelection()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2102) def has_selection : Bool LibImGui.ImGuiInputTextCallbackData_HasSelection(self) end @@ -4192,11 +3080,9 @@ module ImGui alias TopLevel::ImGuiInputTextCallbackData = ImGui::ImGuiInputTextCallbackData - # [struct ImGuiSizeCallbackData](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2107) struct ImGuiSizeCallbackData include ClassType(LibImGui::ImGuiSizeCallbackData) - # Read-only. What user passed to SetNextWindowSizeConstraints() def user_data : Void* @this.value.user_data end @@ -4205,7 +3091,6 @@ module ImGui @this.value.user_data = user_data end - # Read-only. Window position, for reference. def pos : ImVec2 @this.value.pos end @@ -4214,7 +3099,6 @@ module ImGui @this.value.pos = pos end - # Read-only. Current window size. def current_size : ImVec2 @this.value.current_size end @@ -4223,7 +3107,6 @@ module ImGui @this.value.current_size = current_size end - # Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. def desired_size : ImVec2 @this.value.desired_size end @@ -4235,11 +3118,9 @@ module ImGui alias TopLevel::ImGuiSizeCallbackData = ImGui::ImGuiSizeCallbackData - # [struct ImGuiPayload](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2116) struct ImGuiPayload include ClassType(LibImGui::ImGuiPayload) - # Data (copied and owned by dear imgui) def data : Void* @this.value.data end @@ -4248,7 +3129,6 @@ module ImGui @this.value.data = data end - # Data size def data_size : Int32 @this.value.data_size end @@ -4257,7 +3137,6 @@ module ImGui @this.value.data_size = data_size end - # Source item id def source_id : ImGuiID @this.value.source_id end @@ -4266,7 +3145,6 @@ module ImGui @this.value.source_id = source_id end - # Source parent id (if available) def source_parent_id : ImGuiID @this.value.source_parent_id end @@ -4275,7 +3153,6 @@ module ImGui @this.value.source_parent_id = source_parent_id end - # Data timestamp def data_frame_count : Int32 @this.value.data_frame_count end @@ -4284,7 +3161,6 @@ module ImGui @this.value.data_frame_count = data_frame_count end - # Data type tag (short user-supplied string, 32 characters max) def data_type : Slice(LibC::Char) @this.value.data_type.to_slice end @@ -4293,7 +3169,6 @@ module ImGui @this.value.data_type = data_type end - # Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets) def preview : Bool @this.value.preview end @@ -4302,7 +3177,6 @@ module ImGui @this.value.preview = preview end - # Set when AcceptDragDropPayload() was called and mouse button is released over the target item. def delivery : Bool @this.value.delivery end @@ -4311,28 +3185,23 @@ module ImGui @this.value.delivery = delivery end - # [ImGuiPayload::ImGuiPayload()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2130) def self.new : ImGuiPayload result = LibImGui.ImGuiPayload_ImGuiPayload ImGuiPayload.new(result) end - # [ImGuiPayload::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2131) def clear : Void LibImGui.ImGuiPayload_Clear(self) end - # [ImGuiPayload::IsDataType()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2132) def is_data_type(type : String) : Bool LibImGui.ImGuiPayload_IsDataType(self, type) end - # [ImGuiPayload::IsPreview()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2133) def is_preview : Bool LibImGui.ImGuiPayload_IsPreview(self) end - # [ImGuiPayload::IsDelivery()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2134) def is_delivery : Bool LibImGui.ImGuiPayload_IsDelivery(self) end @@ -4340,11 +3209,9 @@ module ImGui alias TopLevel::ImGuiPayload = ImGui::ImGuiPayload - # [struct ImGuiTableColumnSortSpecs](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2138) struct ImGuiTableColumnSortSpecs include ClassType(LibImGui::ImGuiTableColumnSortSpecs) - # User id of the column (if specified by a TableSetupColumn() call) def column_user_id : ImGuiID @this.value.column_user_id end @@ -4353,7 +3220,6 @@ module ImGui @this.value.column_user_id = column_user_id end - # Index of the column def column_index : Int16 @this.value.column_index end @@ -4362,7 +3228,6 @@ module ImGui @this.value.column_index = column_index end - # Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here) def sort_order : Int16 @this.value.sort_order end @@ -4371,7 +3236,6 @@ module ImGui @this.value.sort_order = sort_order end - # ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending (you can use this or SortSign, whichever is more convenient for your sort function) def sort_direction : ImGuiSortDirection @this.value.sort_direction end @@ -4380,7 +3244,6 @@ module ImGui @this.value.sort_direction = sort_direction end - # [ImGuiTableColumnSortSpecs::ImGuiTableColumnSortSpecs()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2145) def self.new : ImGuiTableColumnSortSpecs result = LibImGui.ImGuiTableColumnSortSpecs_ImGuiTableColumnSortSpecs ImGuiTableColumnSortSpecs.new(result) @@ -4389,11 +3252,9 @@ module ImGui alias TopLevel::ImGuiTableColumnSortSpecs = ImGui::ImGuiTableColumnSortSpecs - # [struct ImGuiTableSortSpecs](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2152) struct ImGuiTableSortSpecs include ClassType(LibImGui::ImGuiTableSortSpecs) - # Pointer to sort spec array. def specs : Slice(ImGuiTableColumnSortSpecs) Slice.new(@this.value.specs_count.to_i) { |i| ImGuiTableColumnSortSpecs.new(@this.value.specs + i) } end @@ -4402,7 +3263,6 @@ module ImGui @this.value.specs, @this.value.specs_count = specs.to_unsafe, specs.bytesize end - # Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. def specs_count : Int32 @this.value.specs_count end @@ -4411,7 +3271,6 @@ module ImGui @this.value.specs_count = specs_count end - # Set to true when specs have changed since last time! Use this to sort again, then clear the flag. def specs_dirty : Bool @this.value.specs_dirty end @@ -4420,7 +3279,6 @@ module ImGui @this.value.specs_dirty = specs_dirty end - # [ImGuiTableSortSpecs::ImGuiTableSortSpecs()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2158) def self.new : ImGuiTableSortSpecs? result = LibImGui.ImGuiTableSortSpecs_ImGuiTableSortSpecs result ? ImGuiTableSortSpecs.new(result) : nil @@ -4429,18 +3287,15 @@ module ImGui alias TopLevel::ImGuiTableSortSpecs = ImGui::ImGuiTableSortSpecs - # [struct ImGuiOnceUponAFrame](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2175) struct ImGuiOnceUponAFrame include StructType - # [ImGuiOnceUponAFrame::ImGuiOnceUponAFrame()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2177) def self.new : ImGuiOnceUponAFrame result = LibImGui.ImGuiOnceUponAFrame_ImGuiOnceUponAFrame result.value end end - # [struct ImGuiTextFilter](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2183) struct ImGuiTextFilter include ClassType(LibImGui::ImGuiTextFilter) @@ -4469,35 +3324,27 @@ module ImGui @this.value.count_grep = count_grep end - # [ImGuiTextFilter::ImGuiTextFilter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2185) def self.new(default_filter : String = "") : ImGuiTextFilter result = LibImGui.ImGuiTextFilter_ImGuiTextFilter(default_filter) ImGuiTextFilter.new(result) end - # Helper calling InputText+Build - # - # [ImGuiTextFilter::Draw()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2186) def draw(label : String = "Filter(inc,-exc)", width : Float32 = 0.0) : Bool LibImGui.ImGuiTextFilter_Draw(self, label, width) end - # [ImGuiTextFilter::PassFilter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2187) def pass_filter(text : Bytes | String) : Bool LibImGui.ImGuiTextFilter_PassFilter(self, text, (text.to_unsafe + text.bytesize)) end - # [ImGuiTextFilter::Build()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2188) def build : Void LibImGui.ImGuiTextFilter_Build(self) end - # [ImGuiTextFilter::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2189) def clear : Void LibImGui.ImGuiTextFilter_Clear(self) end - # [ImGuiTextFilter::IsActive()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2190) def is_active : Bool LibImGui.ImGuiTextFilter_IsActive(self) end @@ -4505,7 +3352,6 @@ module ImGui alias TopLevel::ImGuiTextFilter = ImGui::ImGuiTextFilter - # [struct ImGuiStorage](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2237) struct ImGuiStorage include StructType @@ -4518,173 +3364,133 @@ module ImGui @data = data.as(LibImGui::ImVectorInternal*).value end - # [ImGuiStorage::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2254) def clear : Void LibImGui.ImGuiStorage_Clear(self) end - # [ImGuiStorage::GetInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2255) def get_int(key : ImGuiID, default_val : Int32 = 0) : Int32 LibImGui.ImGuiStorage_GetInt(self, key, default_val) end - # [ImGuiStorage::SetInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2256) def set_int(key : ImGuiID, val : Int32) : Void LibImGui.ImGuiStorage_SetInt(self, key, val) end - # [ImGuiStorage::GetBool()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2257) def get_bool(key : ImGuiID, default_val : Bool = false) : Bool LibImGui.ImGuiStorage_GetBool(self, key, default_val) end - # [ImGuiStorage::SetBool()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2258) def set_bool(key : ImGuiID, val : Bool) : Void LibImGui.ImGuiStorage_SetBool(self, key, val) end - # [ImGuiStorage::GetFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2259) def get_float(key : ImGuiID, default_val : Float32 = 0.0) : Float32 LibImGui.ImGuiStorage_GetFloat(self, key, default_val) end - # [ImGuiStorage::SetFloat()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2260) def set_float(key : ImGuiID, val : Float32) : Void LibImGui.ImGuiStorage_SetFloat(self, key, val) end - # default_val is NULL - # - # [ImGuiStorage::GetVoidPtr()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2261) def get_void_ptr(key : ImGuiID) : Void* LibImGui.ImGuiStorage_GetVoidPtr(self, key) end - # [ImGuiStorage::SetVoidPtr()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2262) def set_void_ptr(key : ImGuiID, val : Void*) : Void LibImGui.ImGuiStorage_SetVoidPtr(self, key, val) end - # [ImGuiStorage::GetIntRef()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2268) def get_int_ref(key : ImGuiID, default_val : Int32 = 0) : Int32* LibImGui.ImGuiStorage_GetIntRef(self, key, default_val) end - # [ImGuiStorage::GetBoolRef()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2269) def get_bool_ref(key : ImGuiID, default_val : Bool = false) : Bool* LibImGui.ImGuiStorage_GetBoolRef(self, key, default_val) end - # [ImGuiStorage::GetFloatRef()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2270) def get_float_ref(key : ImGuiID, default_val : Float32 = 0.0) : Float32* LibImGui.ImGuiStorage_GetFloatRef(self, key, default_val) end - # [ImGuiStorage::GetVoidPtrRef()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2271) def get_void_ptr_ref(key : ImGuiID, default_val : Void* = Pointer(Void).null) : Void** LibImGui.ImGuiStorage_GetVoidPtrRef(self, key, default_val) end - # [ImGuiStorage::SetAllInt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2274) def set_all_int(val : Int32) : Void LibImGui.ImGuiStorage_SetAllInt(self, val) end - # [ImGuiStorage::BuildSortByKey()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2277) def build_sort_by_key : Void LibImGui.ImGuiStorage_BuildSortByKey(self) end end - # [struct ImGuiListClipper](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2300) struct ImGuiListClipper include StructType - # [ImGuiListClipper::ImGuiListClipper()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2311) def self.new : ImGuiListClipper result = LibImGui.ImGuiListClipper_ImGuiListClipper result.value end - # [ImGuiListClipper::Begin()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2313) def begin(items_count : Int32, items_height : Float32 = -1.0) : Void LibImGui.ImGuiListClipper_Begin(self, items_count, items_height) end - # Automatically called on the last call of Step() that returns false. - # - # [ImGuiListClipper::End()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2314) def end : Void LibImGui.ImGuiListClipper_End(self) end - # Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. - # - # [ImGuiListClipper::Step()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2315) def step : Bool LibImGui.ImGuiListClipper_Step(self) end - # item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range. - # - # [ImGuiListClipper::ForceDisplayRangeByIndices()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2318) def force_display_range_by_indices(item_min : Int32, item_max : Int32) : Void LibImGui.ImGuiListClipper_ForceDisplayRangeByIndices(self, item_min, item_max) end end - # [struct ImColor](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2351) struct ImColor include StructType - # [ImColor::ImColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2355) def self.new : ImColor result = LibImGui.ImColor_ImColor_Nil result.value end - # [ImColor::ImColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2356) def self.new(r : Float32, g : Float32, b : Float32, a : Float32 = 1.0) : ImColor result = LibImGui.ImColor_ImColor_Float(r, g, b, a) result.value end - # [ImColor::ImColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2357) def self.new(col : ImVec4) : ImColor result = LibImGui.ImColor_ImColor_Vec4(col) result.value end - # [ImColor::ImColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2358) def self.new(r : Int32, g : Int32, b : Int32, a : Int32 = 255) : ImColor result = LibImGui.ImColor_ImColor_Int(r, g, b, a) result.value end - # [ImColor::ImColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2359) def self.new(rgba : UInt32) : ImColor result = LibImGui.ImColor_ImColor_U32(rgba) result.value end - # [ImColor::SetHSV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2364) def set_hsv(h : Float32, s : Float32, v : Float32, a : Float32 = 1.0) : Void LibImGui.ImColor_SetHSV(self, h, s, v, a) end - # [ImColor::HSV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2365) def hsv(h : Float32, s : Float32, v : Float32, a : Float32 = 1.0) : ImGui::ImColor LibImGui.ImColor_HSV(out p_out, h, s, v, a) p_out end end - # [struct ImDrawCmd](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2400) struct ImDrawCmd include ClassType(LibImGui::ImDrawCmd) - # 4*4 - # Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates def clip_rect : ImVec4 @this.value.clip_rect end @@ -4693,8 +3499,6 @@ module ImGui @this.value.clip_rect = clip_rect end - # 4-8 - # User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. def texture_id : ImTextureID @this.value.texture_id end @@ -4703,8 +3507,6 @@ module ImGui @this.value.texture_id = texture_id end - # 4 - # Start offset in vertex buffer. ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to support meshes larger than 64K vertices with 16-bit indices. def vtx_offset : UInt32 @this.value.vtx_offset end @@ -4713,8 +3515,6 @@ module ImGui @this.value.vtx_offset = vtx_offset end - # 4 - # Start offset in index buffer. def idx_offset : UInt32 @this.value.idx_offset end @@ -4723,8 +3523,6 @@ module ImGui @this.value.idx_offset = idx_offset end - # 4 - # Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. def elem_count : UInt32 @this.value.elem_count end @@ -4733,8 +3531,6 @@ module ImGui @this.value.elem_count = elem_count end - # 4-8 - # If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. def user_callback : ImDrawCallback @this.value.user_callback end @@ -4743,8 +3539,6 @@ module ImGui @this.value.user_callback = user_callback end - # 4-8 - # The draw callback code can access this. def user_callback_data : Void* @this.value.user_callback_data end @@ -4753,15 +3547,11 @@ module ImGui @this.value.user_callback_data = user_callback_data end - # Also ensure our padding fields are zeroed - # - # [ImDrawCmd::ImDrawCmd()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2410) def self.new : ImDrawCmd result = LibImGui.ImDrawCmd_ImDrawCmd ImDrawCmd.new(result) end - # [ImDrawCmd::GetTexID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2413) def get_tex_id : ImTextureID LibImGui.ImDrawCmd_GetTexID(self) end @@ -4769,12 +3559,10 @@ module ImGui alias TopLevel::ImDrawCmd = ImGui::ImDrawCmd - # [struct ImDrawVert](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2418) struct ImDrawVert include StructType end - # [struct ImDrawCmdHeader](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2433) struct ImDrawCmdHeader include ClassType(LibImGui::ImDrawCmdHeader) @@ -4805,44 +3593,34 @@ module ImGui alias TopLevel::ImDrawCmdHeader = ImGui::ImDrawCmdHeader - # [struct ImDrawChannel](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2441) struct ImDrawChannel include StructType end - # [struct ImDrawListSplitter](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2450) struct ImDrawListSplitter include ClassType(LibImGui::ImDrawListSplitter) - # [ImDrawListSplitter::ImDrawListSplitter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2456) def self.new : ImDrawListSplitter result = LibImGui.ImDrawListSplitter_ImDrawListSplitter ImDrawListSplitter.new(result) end - # Do not clear Channels[] so our allocations are reused next frame - # - # [ImDrawListSplitter::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2458) def clear : Void LibImGui.ImDrawListSplitter_Clear(self) end - # [ImDrawListSplitter::ClearFreeMemory()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2459) def clear_free_memory : Void LibImGui.ImDrawListSplitter_ClearFreeMemory(self) end - # [ImDrawListSplitter::Split()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2460) def split(draw_list : ImDrawList, count : Int32) : Void LibImGui.ImDrawListSplitter_Split(self, draw_list, count) end - # [ImDrawListSplitter::Merge()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2461) def merge(draw_list : ImDrawList) : Void LibImGui.ImDrawListSplitter_Merge(self, draw_list) end - # [ImDrawListSplitter::SetCurrentChannel()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2462) def set_current_channel(draw_list : ImDrawList, channel_idx : Int32) : Void LibImGui.ImDrawListSplitter_SetCurrentChannel(self, draw_list, channel_idx) end @@ -4850,11 +3628,9 @@ module ImGui alias TopLevel::ImDrawListSplitter = ImGui::ImDrawListSplitter - # [struct ImDrawList](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2505) struct ImDrawList include ClassType(LibImGui::ImDrawList) - # Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback. def cmd_buffer : ImVector(LibImGui::ImDrawCmd) t = @this.value.cmd_buffer pointerof(t).as(ImVector(LibImGui::ImDrawCmd)*).value @@ -4864,7 +3640,6 @@ module ImGui @this.value.cmd_buffer = cmd_buffer.as(LibImGui::ImVectorInternal*).value end - # Index buffer. Each command consume ImDrawCmd::ElemCount of those def idx_buffer : ImVector(ImDrawIdx) t = @this.value.idx_buffer pointerof(t).as(ImVector(ImDrawIdx)*).value @@ -4874,7 +3649,6 @@ module ImGui @this.value.idx_buffer = idx_buffer.as(LibImGui::ImVectorInternal*).value end - # Vertex buffer. def vtx_buffer : ImVector(ImDrawVert) t = @this.value.vtx_buffer pointerof(t).as(ImVector(ImDrawVert)*).value @@ -4884,7 +3658,6 @@ module ImGui @this.value.vtx_buffer = vtx_buffer.as(LibImGui::ImVectorInternal*).value end - # Flags, you may poke into these to adjust anti-aliasing settings per-primitive. def flags : ImDrawListFlags @this.value.flags end @@ -4893,297 +3666,218 @@ module ImGui @this.value.flags = flags end - # [ImDrawList::ImDrawList()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2527) def self.new(shared_data : ImDrawListSharedData) : ImDrawList result = LibImGui.ImDrawList_ImDrawList(shared_data) ImDrawList.new(result) end - # Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) - # - # [ImDrawList::PushClipRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2530) def push_clip_rect(clip_rect_min : ImVec2, clip_rect_max : ImVec2, intersect_with_current_clip_rect : Bool = false) : Void LibImGui.ImDrawList_PushClipRect(self, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) end - # [ImDrawList::PushClipRectFullScreen()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2531) def push_clip_rect_full_screen : Void LibImGui.ImDrawList_PushClipRectFullScreen(self) end - # [ImDrawList::PopClipRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2532) def pop_clip_rect : Void LibImGui.ImDrawList_PopClipRect(self) end - # [ImDrawList::PushTextureID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2533) def push_texture_id(texture_id : ImTextureID) : Void LibImGui.ImDrawList_PushTextureID(self, texture_id) end - # [ImDrawList::PopTextureID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2534) def pop_texture_id : Void LibImGui.ImDrawList_PopTextureID(self) end - # [ImDrawList::GetClipRectMin()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2535) def get_clip_rect_min : ImGui::ImVec2 LibImGui.ImDrawList_GetClipRectMin(out p_out, self) p_out end - # [ImDrawList::GetClipRectMax()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2536) def get_clip_rect_max : ImGui::ImVec2 LibImGui.ImDrawList_GetClipRectMax(out p_out, self) p_out end - # [ImDrawList::AddLine()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2545) def add_line(p1 : ImVec2, p2 : ImVec2, col : UInt32, thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddLine(self, p1, p2, col, thickness) end - # a: upper-left, b: lower-right (== upper-left + size) - # - # [ImDrawList::AddRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2546) def add_rect(p_min : ImVec2, p_max : ImVec2, col : UInt32, rounding : Float32 = 0.0, flags : ImDrawFlags = ImDrawFlags.new(0), thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddRect(self, p_min, p_max, col, rounding, flags, thickness) end - # a: upper-left, b: lower-right (== upper-left + size) - # - # [ImDrawList::AddRectFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2547) def add_rect_filled(p_min : ImVec2, p_max : ImVec2, col : UInt32, rounding : Float32 = 0.0, flags : ImDrawFlags = ImDrawFlags.new(0)) : Void LibImGui.ImDrawList_AddRectFilled(self, p_min, p_max, col, rounding, flags) end - # [ImDrawList::AddRectFilledMultiColor()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2548) def add_rect_filled_multi_color(p_min : ImVec2, p_max : ImVec2, col_upr_left : UInt32, col_upr_right : UInt32, col_bot_right : UInt32, col_bot_left : UInt32) : Void LibImGui.ImDrawList_AddRectFilledMultiColor(self, p_min, p_max, col_upr_left, col_upr_right, col_bot_right, col_bot_left) end - # [ImDrawList::AddQuad()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2549) def add_quad(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, p4 : ImVec2, col : UInt32, thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddQuad(self, p1, p2, p3, p4, col, thickness) end - # [ImDrawList::AddQuadFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2550) def add_quad_filled(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, p4 : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_AddQuadFilled(self, p1, p2, p3, p4, col) end - # [ImDrawList::AddTriangle()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2551) def add_triangle(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, col : UInt32, thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddTriangle(self, p1, p2, p3, col, thickness) end - # [ImDrawList::AddTriangleFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2552) def add_triangle_filled(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_AddTriangleFilled(self, p1, p2, p3, col) end - # [ImDrawList::AddCircle()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2553) def add_circle(center : ImVec2, radius : Float32, col : UInt32, num_segments : Int32 = 0, thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddCircle(self, center, radius, col, num_segments, thickness) end - # [ImDrawList::AddCircleFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2554) def add_circle_filled(center : ImVec2, radius : Float32, col : UInt32, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_AddCircleFilled(self, center, radius, col, num_segments) end - # [ImDrawList::AddNgon()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2555) def add_ngon(center : ImVec2, radius : Float32, col : UInt32, num_segments : Int32, thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_AddNgon(self, center, radius, col, num_segments, thickness) end - # [ImDrawList::AddNgonFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2556) def add_ngon_filled(center : ImVec2, radius : Float32, col : UInt32, num_segments : Int32) : Void LibImGui.ImDrawList_AddNgonFilled(self, center, radius, col, num_segments) end - # [ImDrawList::AddText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2557) def add_text(pos : ImVec2, col : UInt32, text : Bytes | String) : Void LibImGui.ImDrawList_AddText_Vec2(self, pos, col, text, (text.to_unsafe + text.bytesize)) end - # [ImDrawList::AddText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2558) def add_text(font : ImFont, font_size : Float32, pos : ImVec2, col : UInt32, text : Bytes | String, wrap_width : Float32 = 0.0, cpu_fine_clip_rect : ImVec4* = Pointer(ImVec4).null) : Void LibImGui.ImDrawList_AddText_FontPtr(self, font, font_size, pos, col, text, (text.to_unsafe + text.bytesize), wrap_width, cpu_fine_clip_rect) end - # [ImDrawList::AddPolyline()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2559) def add_polyline(points : ImVec2*, num_points : Int32, col : UInt32, flags : ImDrawFlags, thickness : Float32) : Void LibImGui.ImDrawList_AddPolyline(self, points, num_points, col, flags, thickness) end - # [ImDrawList::AddConvexPolyFilled()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2560) def add_convex_poly_filled(points : ImVec2*, num_points : Int32, col : UInt32) : Void LibImGui.ImDrawList_AddConvexPolyFilled(self, points, num_points, col) end - # Cubic Bezier (4 control points) - # - # [ImDrawList::AddBezierCubic()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2561) def add_bezier_cubic(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, p4 : ImVec2, col : UInt32, thickness : Float32, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_AddBezierCubic(self, p1, p2, p3, p4, col, thickness, num_segments) end - # Quadratic Bezier (3 control points) - # - # [ImDrawList::AddBezierQuadratic()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2562) def add_bezier_quadratic(p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, col : UInt32, thickness : Float32, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_AddBezierQuadratic(self, p1, p2, p3, col, thickness, num_segments) end - # [ImDrawList::AddImage()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2568) def add_image(user_texture_id : ImTextureID, p_min : ImVec2, p_max : ImVec2, uv_min : ImVec2 = ImVec2.new(0, 0), uv_max : ImVec2 = ImVec2.new(1, 1), col : UInt32 = 4294967295) : Void LibImGui.ImDrawList_AddImage(self, user_texture_id, p_min, p_max, uv_min, uv_max, col) end - # [ImDrawList::AddImageQuad()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2569) def add_image_quad(user_texture_id : ImTextureID, p1 : ImVec2, p2 : ImVec2, p3 : ImVec2, p4 : ImVec2, uv1 : ImVec2 = ImVec2.new(0, 0), uv2 : ImVec2 = ImVec2.new(1, 0), uv3 : ImVec2 = ImVec2.new(1, 1), uv4 : ImVec2 = ImVec2.new(0, 1), col : UInt32 = 4294967295) : Void LibImGui.ImDrawList_AddImageQuad(self, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col) end - # [ImDrawList::AddImageRounded()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2570) def add_image_rounded(user_texture_id : ImTextureID, p_min : ImVec2, p_max : ImVec2, uv_min : ImVec2, uv_max : ImVec2, col : UInt32, rounding : Float32, flags : ImDrawFlags = ImDrawFlags.new(0)) : Void LibImGui.ImDrawList_AddImageRounded(self, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags) end - # [ImDrawList::PathClear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2574) def path_clear : Void LibImGui.ImDrawList_PathClear(self) end - # [ImDrawList::PathLineTo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2575) def path_line_to(pos : ImVec2) : Void LibImGui.ImDrawList_PathLineTo(self, pos) end - # [ImDrawList::PathLineToMergeDuplicate()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2576) def path_line_to_merge_duplicate(pos : ImVec2) : Void LibImGui.ImDrawList_PathLineToMergeDuplicate(self, pos) end - # [ImDrawList::PathFillConvex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2577) def path_fill_convex(col : UInt32) : Void LibImGui.ImDrawList_PathFillConvex(self, col) end - # [ImDrawList::PathStroke()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2578) def path_stroke(col : UInt32, flags : ImDrawFlags = ImDrawFlags.new(0), thickness : Float32 = 1.0) : Void LibImGui.ImDrawList_PathStroke(self, col, flags, thickness) end - # [ImDrawList::PathArcTo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2579) def path_arc_to(center : ImVec2, radius : Float32, a_min : Float32, a_max : Float32, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_PathArcTo(self, center, radius, a_min, a_max, num_segments) end - # Use precomputed angles for a 12 steps circle - # - # [ImDrawList::PathArcToFast()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2580) def path_arc_to_fast(center : ImVec2, radius : Float32, a_min_of_12 : Int32, a_max_of_12 : Int32) : Void LibImGui.ImDrawList_PathArcToFast(self, center, radius, a_min_of_12, a_max_of_12) end - # Cubic Bezier (4 control points) - # - # [ImDrawList::PathBezierCubicCurveTo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2581) def path_bezier_cubic_curve_to(p2 : ImVec2, p3 : ImVec2, p4 : ImVec2, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_PathBezierCubicCurveTo(self, p2, p3, p4, num_segments) end - # Quadratic Bezier (3 control points) - # - # [ImDrawList::PathBezierQuadraticCurveTo()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2582) def path_bezier_quadratic_curve_to(p2 : ImVec2, p3 : ImVec2, num_segments : Int32 = 0) : Void LibImGui.ImDrawList_PathBezierQuadraticCurveTo(self, p2, p3, num_segments) end - # [ImDrawList::PathRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2583) def path_rect(rect_min : ImVec2, rect_max : ImVec2, rounding : Float32 = 0.0, flags : ImDrawFlags = ImDrawFlags.new(0)) : Void LibImGui.ImDrawList_PathRect(self, rect_min, rect_max, rounding, flags) end - # Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. - # - # [ImDrawList::AddCallback()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2586) def add_callback(callback : ImDrawCallback, callback_data : Void*) : Void LibImGui.ImDrawList_AddCallback(self, callback, callback_data) end - # This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible - # - # [ImDrawList::AddDrawCmd()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2587) def add_draw_cmd : Void LibImGui.ImDrawList_AddDrawCmd(self) end - # Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. - # - # [ImDrawList::CloneOutput()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2588) def clone_output : ImDrawList result = LibImGui.ImDrawList_CloneOutput(self) ImDrawList.new(result) end - # [ImDrawList::ChannelsSplit()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2596) def channels_split(count : Int32) : Void LibImGui.ImDrawList_ChannelsSplit(self, count) end - # [ImDrawList::ChannelsMerge()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2597) def channels_merge : Void LibImGui.ImDrawList_ChannelsMerge(self) end - # [ImDrawList::ChannelsSetCurrent()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2598) def channels_set_current(n : Int32) : Void LibImGui.ImDrawList_ChannelsSetCurrent(self, n) end - # [ImDrawList::PrimReserve()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2603) def prim_reserve(idx_count : Int32, vtx_count : Int32) : Void LibImGui.ImDrawList_PrimReserve(self, idx_count, vtx_count) end - # [ImDrawList::PrimUnreserve()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2604) def prim_unreserve(idx_count : Int32, vtx_count : Int32) : Void LibImGui.ImDrawList_PrimUnreserve(self, idx_count, vtx_count) end - # Axis aligned rectangle (composed of two triangles) - # - # [ImDrawList::PrimRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2605) def prim_rect(a : ImVec2, b : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_PrimRect(self, a, b, col) end - # [ImDrawList::PrimRectUV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2606) def prim_rect_uv(a : ImVec2, b : ImVec2, uv_a : ImVec2, uv_b : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_PrimRectUV(self, a, b, uv_a, uv_b, col) end - # [ImDrawList::PrimQuadUV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2607) def prim_quad_uv(a : ImVec2, b : ImVec2, c : ImVec2, d : ImVec2, uv_a : ImVec2, uv_b : ImVec2, uv_c : ImVec2, uv_d : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_PrimQuadUV(self, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col) end - # [ImDrawList::PrimWriteVtx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2608) def prim_write_vtx(pos : ImVec2, uv : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_PrimWriteVtx(self, pos, uv, col) end - # [ImDrawList::PrimWriteIdx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2609) def prim_write_idx(idx : ImDrawIdx) : Void LibImGui.ImDrawList_PrimWriteIdx(self, idx) end - # Write vertex with unique index - # - # [ImDrawList::PrimVtx()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2610) def prim_vtx(pos : ImVec2, uv : ImVec2, col : UInt32) : Void LibImGui.ImDrawList_PrimVtx(self, pos, uv, col) end @@ -5191,11 +3885,9 @@ module ImGui alias TopLevel::ImDrawList = ImGui::ImDrawList - # [struct ImDrawData](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2633) struct ImDrawData include ClassType(LibImGui::ImDrawData) - # Only valid after Render() is called and before the next NewFrame() is called. def valid : Bool @this.value.valid end @@ -5204,7 +3896,6 @@ module ImGui @this.value.valid = valid end - # Number of ImDrawList* to render def cmd_lists_count : Int32 @this.value.cmd_lists_count end @@ -5213,7 +3904,6 @@ module ImGui @this.value.cmd_lists_count = cmd_lists_count end - # For convenience, sum of all ImDrawList's IdxBuffer.Size def total_idx_count : Int32 @this.value.total_idx_count end @@ -5222,7 +3912,6 @@ module ImGui @this.value.total_idx_count = total_idx_count end - # For convenience, sum of all ImDrawList's VtxBuffer.Size def total_vtx_count : Int32 @this.value.total_vtx_count end @@ -5231,7 +3920,6 @@ module ImGui @this.value.total_vtx_count = total_vtx_count end - # Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here. def cmd_lists : Slice(ImDrawList) Slice.new(@this.value.cmd_lists_count.to_i) { |i| ImDrawList.new(@this.value.cmd_lists + i) } end @@ -5240,7 +3928,6 @@ module ImGui @this.value.cmd_lists, @this.value.cmd_lists_count = cmd_lists.to_unsafe, cmd_lists.bytesize end - # Top-left position of the viewport to render (== top-left of the orthogonal projection matrix to use) (== GetMainViewport()->Pos for the main viewport, == (0.0) in most single-viewport applications) def display_pos : ImVec2 @this.value.display_pos end @@ -5249,7 +3936,6 @@ module ImGui @this.value.display_pos = display_pos end - # Size of the viewport to render (== GetMainViewport()->Size for the main viewport, == io.DisplaySize in most single-viewport applications) def display_size : ImVec2 @this.value.display_size end @@ -5258,7 +3944,6 @@ module ImGui @this.value.display_size = display_size end - # Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. def framebuffer_scale : ImVec2 @this.value.framebuffer_scale end @@ -5267,29 +3952,19 @@ module ImGui @this.value.framebuffer_scale = framebuffer_scale end - # [ImDrawData::ImDrawData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2645) def self.new : ImDrawData result = LibImGui.ImDrawData_ImDrawData ImDrawData.new(result) end - # The ImDrawList are owned by ImGuiContext! - # - # [ImDrawData::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2646) def clear : Void LibImGui.ImDrawData_Clear(self) end - # Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! - # - # [ImDrawData::DeIndexAllBuffers()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2647) def de_index_all_buffers : Void LibImGui.ImDrawData_DeIndexAllBuffers(self) end - # Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. - # - # [ImDrawData::ScaleClipRects()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2648) def scale_clip_rects(fb_scale : ImVec2) : Void LibImGui.ImDrawData_ScaleClipRects(self, fb_scale) end @@ -5297,11 +3972,9 @@ module ImGui alias TopLevel::ImDrawData = ImGui::ImDrawData - # [struct ImFontConfig](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2655) struct ImFontConfig include ClassType(LibImGui::ImFontConfig) - # TTF/OTF data def font_data : Void* @this.value.font_data end @@ -5310,7 +3983,6 @@ module ImGui @this.value.font_data = font_data end - # TTF/OTF data size def font_data_size : Int32 @this.value.font_data_size end @@ -5319,8 +3991,6 @@ module ImGui @this.value.font_data_size = font_data_size end - # true - # TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). def font_data_owned_by_atlas : Bool @this.value.font_data_owned_by_atlas end @@ -5329,8 +3999,6 @@ module ImGui @this.value.font_data_owned_by_atlas = font_data_owned_by_atlas end - # 0 - # Index of font within TTF/OTF file def font_no : Int32 @this.value.font_no end @@ -5339,7 +4007,6 @@ module ImGui @this.value.font_no = font_no end - # Size in pixels for rasterizer (more or less maps to the resulting font height). def size_pixels : Float32 @this.value.size_pixels end @@ -5348,8 +4015,6 @@ module ImGui @this.value.size_pixels = size_pixels end - # 3 - # Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details. def oversample_h : Int32 @this.value.oversample_h end @@ -5358,8 +4023,6 @@ module ImGui @this.value.oversample_h = oversample_h end - # 1 - # Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis. def oversample_v : Int32 @this.value.oversample_v end @@ -5368,8 +4031,6 @@ module ImGui @this.value.oversample_v = oversample_v end - # false - # Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. def pixel_snap_h : Bool @this.value.pixel_snap_h end @@ -5378,8 +4039,6 @@ module ImGui @this.value.pixel_snap_h = pixel_snap_h end - # 0, 0 - # Extra spacing (in pixels) between glyphs. Only X axis is supported for now. def glyph_extra_spacing : ImVec2 @this.value.glyph_extra_spacing end @@ -5388,8 +4047,6 @@ module ImGui @this.value.glyph_extra_spacing = glyph_extra_spacing end - # 0, 0 - # Offset all glyphs from this font input. def glyph_offset : ImVec2 @this.value.glyph_offset end @@ -5398,8 +4055,6 @@ module ImGui @this.value.glyph_offset = glyph_offset end - # NULL - # Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. def glyph_ranges : ImWchar* @this.value.glyph_ranges end @@ -5408,8 +4063,6 @@ module ImGui @this.value.glyph_ranges = glyph_ranges end - # 0 - # Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font def glyph_min_advance_x : Float32 @this.value.glyph_min_advance_x end @@ -5418,8 +4071,6 @@ module ImGui @this.value.glyph_min_advance_x = glyph_min_advance_x end - # FLT_MAX - # Maximum AdvanceX for glyphs def glyph_max_advance_x : Float32 @this.value.glyph_max_advance_x end @@ -5428,8 +4079,6 @@ module ImGui @this.value.glyph_max_advance_x = glyph_max_advance_x end - # false - # Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. def merge_mode : Bool @this.value.merge_mode end @@ -5438,8 +4087,6 @@ module ImGui @this.value.merge_mode = merge_mode end - # 0 - # Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure. def font_builder_flags : UInt32 @this.value.font_builder_flags end @@ -5448,8 +4095,6 @@ module ImGui @this.value.font_builder_flags = font_builder_flags end - # 1.0f - # Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. def rasterizer_multiply : Float32 @this.value.rasterizer_multiply end @@ -5458,8 +4103,6 @@ module ImGui @this.value.rasterizer_multiply = rasterizer_multiply end - # -1 - # Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used. def ellipsis_char : ImWchar @this.value.ellipsis_char end @@ -5468,7 +4111,6 @@ module ImGui @this.value.ellipsis_char = ellipsis_char end - # Name (strictly to ease debugging) def name : Slice(LibC::Char) @this.value.name.to_slice end @@ -5485,7 +4127,6 @@ module ImGui @this.value.dst_font = dst_font end - # [ImFontConfig::ImFontConfig()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2679) def self.new : ImFontConfig result = LibImGui.ImFontConfig_ImFontConfig ImFontConfig.new(result) @@ -5494,16 +4135,13 @@ module ImGui alias TopLevel::ImFontConfig = ImGui::ImFontConfig - # [struct ImFontGlyph](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2684) struct ImFontGlyph include StructType end - # [struct ImFontGlyphRangesBuilder](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2696) struct ImFontGlyphRangesBuilder include StructType - # Store 1-bit per Unicode code point (0=unused, 1=used) def used_chars : ImVector(UInt32) t = @used_chars pointerof(t).as(ImVector(UInt32)*).value @@ -5513,67 +4151,44 @@ module ImGui @used_chars = used_chars.as(LibImGui::ImVectorInternal*).value end - # [ImFontGlyphRangesBuilder::ImFontGlyphRangesBuilder()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2700) def self.new : ImFontGlyphRangesBuilder result = LibImGui.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder result.value end - # [ImFontGlyphRangesBuilder::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2701) def clear : Void LibImGui.ImFontGlyphRangesBuilder_Clear(self) end - # Get bit n in the array - # - # [ImFontGlyphRangesBuilder::GetBit()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2702) def get_bit(n : LibC::SizeT) : Bool LibImGui.ImFontGlyphRangesBuilder_GetBit(self, n) end - # Set bit n in the array - # - # [ImFontGlyphRangesBuilder::SetBit()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2703) def set_bit(n : LibC::SizeT) : Void LibImGui.ImFontGlyphRangesBuilder_SetBit(self, n) end - # Add character - # - # [ImFontGlyphRangesBuilder::AddChar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2704) def add_char(c : ImWchar) : Void LibImGui.ImFontGlyphRangesBuilder_AddChar(self, c) end - # Add string (each character of the UTF-8 string are added) - # - # [ImFontGlyphRangesBuilder::AddText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2705) def add_text(text : Bytes | String) : Void LibImGui.ImFontGlyphRangesBuilder_AddText(self, text, (text.to_unsafe + text.bytesize)) end - # Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext - # - # [ImFontGlyphRangesBuilder::AddRanges()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2706) def add_ranges(ranges : ImWchar*) : Void LibImGui.ImFontGlyphRangesBuilder_AddRanges(self, ranges) end - # Output new ranges - # - # [ImFontGlyphRangesBuilder::BuildRanges()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2707) def build_ranges : ImVector LibImGui.ImFontGlyphRangesBuilder_BuildRanges(self, out out_ranges) out_ranges end end - # [struct ImFontAtlasCustomRect](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2711) struct ImFontAtlasCustomRect include ClassType(LibImGui::ImFontAtlasCustomRect) - # Input - # Desired rectangle dimension def width : UInt16 @this.value.width end @@ -5582,8 +4197,6 @@ module ImGui @this.value.width = width end - # Input - # Desired rectangle dimension def height : UInt16 @this.value.height end @@ -5592,8 +4205,6 @@ module ImGui @this.value.height = height end - # Output - # Packed position in Atlas def x : UInt16 @this.value.x end @@ -5602,8 +4213,6 @@ module ImGui @this.value.x = x end - # Output - # Packed position in Atlas def y : UInt16 @this.value.y end @@ -5612,8 +4221,6 @@ module ImGui @this.value.y = y end - # Input - # For custom font glyphs only (ID < 0x110000) def glyph_id : UInt32 @this.value.glyph_id end @@ -5622,8 +4229,6 @@ module ImGui @this.value.glyph_id = glyph_id end - # Input - # For custom font glyphs only: glyph xadvance def glyph_advance_x : Float32 @this.value.glyph_advance_x end @@ -5632,8 +4237,6 @@ module ImGui @this.value.glyph_advance_x = glyph_advance_x end - # Input - # For custom font glyphs only: glyph display offset def glyph_offset : ImVec2 @this.value.glyph_offset end @@ -5642,8 +4245,6 @@ module ImGui @this.value.glyph_offset = glyph_offset end - # Input - # For custom font glyphs only: target font def font : ImFont ImFont.new(@this.value.font) end @@ -5652,13 +4253,11 @@ module ImGui @this.value.font = font end - # [ImFontAtlasCustomRect::ImFontAtlasCustomRect()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2719) def self.new : ImFontAtlasCustomRect result = LibImGui.ImFontAtlasCustomRect_ImFontAtlasCustomRect ImFontAtlasCustomRect.new(result) end - # [ImFontAtlasCustomRect::IsPacked()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2720) def is_packed : Bool LibImGui.ImFontAtlasCustomRect_IsPacked(self) end @@ -5666,11 +4265,9 @@ module ImGui alias TopLevel::ImFontAtlasCustomRect = ImGui::ImFontAtlasCustomRect - # [struct ImFontAtlas](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2749) struct ImFontAtlas include ClassType(LibImGui::ImFontAtlas) - # Build flags (see ImFontAtlasFlags_) def flags : ImFontAtlasFlags @this.value.flags end @@ -5679,7 +4276,6 @@ module ImGui @this.value.flags = flags end - # User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. def tex_id : ImTextureID @this.value.tex_id end @@ -5688,7 +4284,6 @@ module ImGui @this.value.tex_id = tex_id end - # Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. def tex_desired_width : Int32 @this.value.tex_desired_width end @@ -5697,7 +4292,6 @@ module ImGui @this.value.tex_desired_width = tex_desired_width end - # Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false). def tex_glyph_padding : Int32 @this.value.tex_glyph_padding end @@ -5706,7 +4300,6 @@ module ImGui @this.value.tex_glyph_padding = tex_glyph_padding end - # Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert. def locked : Bool @this.value.locked end @@ -5715,7 +4308,6 @@ module ImGui @this.value.locked = locked end - # Set when texture was built matching current font input def tex_ready : Bool @this.value.tex_ready end @@ -5724,7 +4316,6 @@ module ImGui @this.value.tex_ready = tex_ready end - # Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format. def tex_pixels_use_colors : Bool @this.value.tex_pixels_use_colors end @@ -5733,7 +4324,6 @@ module ImGui @this.value.tex_pixels_use_colors = tex_pixels_use_colors end - # 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight def tex_pixels_alpha8 : LibC::UChar* @this.value.tex_pixels_alpha8 end @@ -5742,7 +4332,6 @@ module ImGui @this.value.tex_pixels_alpha8 = tex_pixels_alpha8 end - # 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 def tex_pixels_rgba32 : UInt32* @this.value.tex_pixels_rgba32 end @@ -5751,7 +4340,6 @@ module ImGui @this.value.tex_pixels_rgba32 = tex_pixels_rgba32 end - # Texture width calculated during Build(). def tex_width : Int32 @this.value.tex_width end @@ -5760,7 +4348,6 @@ module ImGui @this.value.tex_width = tex_width end - # Texture height calculated during Build(). def tex_height : Int32 @this.value.tex_height end @@ -5769,7 +4356,6 @@ module ImGui @this.value.tex_height = tex_height end - # = (1.0f/TexWidth, 1.0f/TexHeight) def tex_uv_scale : ImVec2 @this.value.tex_uv_scale end @@ -5778,7 +4364,6 @@ module ImGui @this.value.tex_uv_scale = tex_uv_scale end - # Texture coordinates to a white pixel def tex_uv_white_pixel : ImVec2 @this.value.tex_uv_white_pixel end @@ -5787,7 +4372,6 @@ module ImGui @this.value.tex_uv_white_pixel = tex_uv_white_pixel end - # Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font. def fonts : ImVector(ImFont) t = @this.value.fonts pointerof(t).as(ImVector(ImFont)*).value @@ -5797,7 +4381,6 @@ module ImGui @this.value.fonts = fonts.as(LibImGui::ImVectorInternal*).value end - # Rectangles for packing custom texture data into the atlas. def custom_rects : ImVector(LibImGui::ImFontAtlasCustomRect) t = @this.value.custom_rects pointerof(t).as(ImVector(LibImGui::ImFontAtlasCustomRect)*).value @@ -5807,7 +4390,6 @@ module ImGui @this.value.custom_rects = custom_rects.as(LibImGui::ImVectorInternal*).value end - # Configuration data def config_data : ImVector(LibImGui::ImFontConfig) t = @this.value.config_data pointerof(t).as(ImVector(LibImGui::ImFontConfig)*).value @@ -5817,7 +4399,6 @@ module ImGui @this.value.config_data = config_data.as(LibImGui::ImVectorInternal*).value end - # UVs for baked anti-aliased lines def tex_uv_lines : Slice(ImVec4) @this.value.tex_uv_lines.to_slice end @@ -5826,7 +4407,6 @@ module ImGui @this.value.tex_uv_lines = tex_uv_lines end - # Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE). def font_builder_io : ImFontBuilderIO? (v = @this.value.font_builder_io) ? v.value : nil end @@ -5835,7 +4415,6 @@ module ImGui @this.value.font_builder_io = font_builder_io end - # Shared flags (for all fonts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font override is also available in ImFontConfig. def font_builder_flags : UInt32 @this.value.font_builder_flags end @@ -5844,7 +4423,6 @@ module ImGui @this.value.font_builder_flags = font_builder_flags end - # Custom texture rectangle ID for white pixel and mouse cursors def pack_id_mouse_cursors : Int32 @this.value.pack_id_mouse_cursors end @@ -5853,7 +4431,6 @@ module ImGui @this.value.pack_id_mouse_cursors = pack_id_mouse_cursors end - # Custom texture rectangle ID for baked anti-aliased lines def pack_id_lines : Int32 @this.value.pack_id_lines end @@ -5862,196 +4439,129 @@ module ImGui @this.value.pack_id_lines = pack_id_lines end - # [ImFontAtlas::ImFontAtlas()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2751) def self.new : ImFontAtlas result = LibImGui.ImFontAtlas_ImFontAtlas ImFontAtlas.new(result) end - # [ImFontAtlas::AddFont()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2753) def add_font(font_cfg : ImFontConfig) : ImFont result = LibImGui.ImFontAtlas_AddFont(self, font_cfg) ImFont.new(result) end - # [ImFontAtlas::AddFontDefault()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2754) def add_font_default(font_cfg : ImFontConfig? = nil) : ImFont result = LibImGui.ImFontAtlas_AddFontDefault(self, font_cfg) ImFont.new(result) end - # [ImFontAtlas::AddFontFromFileTTF()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2755) def add_font_from_file_ttf(filename : String, size_pixels : Float32, font_cfg : ImFontConfig? = nil, glyph_ranges : ImWchar* = Pointer(ImWchar).null) : ImFont result = LibImGui.ImFontAtlas_AddFontFromFileTTF(self, filename, size_pixels, font_cfg, glyph_ranges) ImFont.new(result) end - # Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed. - # - # [ImFontAtlas::AddFontFromMemoryTTF()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2756) def add_font_from_memory_ttf(font_data : Void*, font_size : Int32, size_pixels : Float32, font_cfg : ImFontConfig? = nil, glyph_ranges : ImWchar* = Pointer(ImWchar).null) : ImFont result = LibImGui.ImFontAtlas_AddFontFromMemoryTTF(self, font_data, font_size, size_pixels, font_cfg, glyph_ranges) ImFont.new(result) end - # 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp. - # - # [ImFontAtlas::AddFontFromMemoryCompressedTTF()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2757) def add_font_from_memory_compressed_ttf(compressed_font_data : Void*, compressed_font_size : Int32, size_pixels : Float32, font_cfg : ImFontConfig? = nil, glyph_ranges : ImWchar* = Pointer(ImWchar).null) : ImFont result = LibImGui.ImFontAtlas_AddFontFromMemoryCompressedTTF(self, compressed_font_data, compressed_font_size, size_pixels, font_cfg, glyph_ranges) ImFont.new(result) end - # 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter. - # - # [ImFontAtlas::AddFontFromMemoryCompressedBase85TTF()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2758) def add_font_from_memory_compressed_base85_ttf(compressed_font_data_base85 : String, size_pixels : Float32, font_cfg : ImFontConfig? = nil, glyph_ranges : ImWchar* = Pointer(ImWchar).null) : ImFont result = LibImGui.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self, compressed_font_data_base85, size_pixels, font_cfg, glyph_ranges) ImFont.new(result) end - # Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts. - # - # [ImFontAtlas::ClearInputData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2759) def clear_input_data : Void LibImGui.ImFontAtlas_ClearInputData(self) end - # Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory. - # - # [ImFontAtlas::ClearTexData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2760) def clear_tex_data : Void LibImGui.ImFontAtlas_ClearTexData(self) end - # Clear output font data (glyphs storage, UV coordinates). - # - # [ImFontAtlas::ClearFonts()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2761) def clear_fonts : Void LibImGui.ImFontAtlas_ClearFonts(self) end - # Clear all input and output. - # - # [ImFontAtlas::Clear()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2762) def clear : Void LibImGui.ImFontAtlas_Clear(self) end - # Build pixels data. This is called automatically for you by the GetTexData*** functions. - # - # [ImFontAtlas::Build()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2769) def build : Bool LibImGui.ImFontAtlas_Build(self) end - # 1 byte per-pixel - # - # [ImFontAtlas::GetTexDataAsAlpha8()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2770) def get_tex_data_as_alpha8 : {LibC::UChar*, LibC::Int, LibC::Int, LibC::Int} LibImGui.ImFontAtlas_GetTexDataAsAlpha8(self, out out_pixels, out out_width, out out_height, out out_bytes_per_pixel) {out_pixels, out_width, out_height, out_bytes_per_pixel} end - # 4 bytes-per-pixel - # - # [ImFontAtlas::GetTexDataAsRGBA32()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2771) def get_tex_data_as_rgba32 : {LibC::UChar*, LibC::Int, LibC::Int, LibC::Int} LibImGui.ImFontAtlas_GetTexDataAsRGBA32(self, out out_pixels, out out_width, out out_height, out out_bytes_per_pixel) {out_pixels, out_width, out_height, out_bytes_per_pixel} end - # Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent... - # - # [ImFontAtlas::IsBuilt()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2772) def is_built : Bool LibImGui.ImFontAtlas_IsBuilt(self) end - # [ImFontAtlas::SetTexID()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2773) def set_tex_id(id : ImTextureID) : Void LibImGui.ImFontAtlas_SetTexID(self, id) end - # Basic Latin, Extended Latin - # - # [ImFontAtlas::GetGlyphRangesDefault()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2782) def get_glyph_ranges_default : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesDefault(self) end - # Default + Korean characters - # - # [ImFontAtlas::GetGlyphRangesKorean()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2783) def get_glyph_ranges_korean : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesKorean(self) end - # Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs - # - # [ImFontAtlas::GetGlyphRangesJapanese()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2784) def get_glyph_ranges_japanese : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesJapanese(self) end - # Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs - # - # [ImFontAtlas::GetGlyphRangesChineseFull()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2785) def get_glyph_ranges_chinese_full : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesChineseFull(self) end - # Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese - # - # [ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2786) def get_glyph_ranges_chinese_simplified_common : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(self) end - # Default + about 400 Cyrillic characters - # - # [ImFontAtlas::GetGlyphRangesCyrillic()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2787) def get_glyph_ranges_cyrillic : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesCyrillic(self) end - # Default + Thai characters - # - # [ImFontAtlas::GetGlyphRangesThai()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2788) def get_glyph_ranges_thai : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesThai(self) end - # Default + Vietnamese characters - # - # [ImFontAtlas::GetGlyphRangesVietnamese()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2789) def get_glyph_ranges_vietnamese : ImWchar* LibImGui.ImFontAtlas_GetGlyphRangesVietnamese(self) end - # [ImFontAtlas::AddCustomRectRegular()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2802) def add_custom_rect_regular(width : Int32, height : Int32) : Int32 LibImGui.ImFontAtlas_AddCustomRectRegular(self, width, height) end - # [ImFontAtlas::AddCustomRectFontGlyph()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2803) def add_custom_rect_font_glyph(font : ImFont, id : ImWchar, width : Int32, height : Int32, advance_x : Float32, offset : ImVec2 = ImVec2.new(0, 0)) : Int32 LibImGui.ImFontAtlas_AddCustomRectFontGlyph(self, font, id, width, height, advance_x, offset) end - # [ImFontAtlas::GetCustomRectByIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2804) def get_custom_rect_by_index(index : Int32) : ImFontAtlasCustomRect result = LibImGui.ImFontAtlas_GetCustomRectByIndex(self, index) ImFontAtlasCustomRect.new(result) end - # [ImFontAtlas::CalcCustomRectUV()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2807) def calc_custom_rect_uv(rect : ImFontAtlasCustomRect) : {ImGui::ImVec2, ImGui::ImVec2} LibImGui.ImFontAtlas_CalcCustomRectUV(self, rect, out out_uv_min, out out_uv_max) {out_uv_min, out_uv_max} end - # [ImFontAtlas::GetMouseCursorTexData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2808) def get_mouse_cursor_tex_data(cursor : ImGuiMouseCursor) : {Bool, ImGui::ImVec2, ImGui::ImVec2, Slice(ImGui::ImVec2), Slice(ImGui::ImVec2)} result = LibImGui.ImFontAtlas_GetMouseCursorTexData(self, cursor, out out_offset, out out_size, out out_uv_border, out out_uv_fill) {result, out_offset, out_size, out_uv_border.to_slice, out_uv_fill.to_slice} @@ -6060,13 +4570,9 @@ module ImGui alias TopLevel::ImFontAtlas = ImGui::ImFontAtlas - # [struct ImFont](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2850) struct ImFont include ClassType(LibImGui::ImFont) - # 12-16 - # out - # Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for CalcTextSize functions which only this this info, and are often bottleneck in large UI). def index_advance_x : ImVector(Float32) t = @this.value.index_advance_x pointerof(t).as(ImVector(Float32)*).value @@ -6076,9 +4582,6 @@ module ImGui @this.value.index_advance_x = index_advance_x.as(LibImGui::ImVectorInternal*).value end - # 4 - # out - # = FallbackGlyph->AdvanceX def fallback_advance_x : Float32 @this.value.fallback_advance_x end @@ -6087,9 +4590,6 @@ module ImGui @this.value.fallback_advance_x = fallback_advance_x end - # 4 - # in - # Height of characters/line, set during loading (don't change after loading) def font_size : Float32 @this.value.font_size end @@ -6098,9 +4598,6 @@ module ImGui @this.value.font_size = font_size end - # 12-16 - # out - # Sparse. Index glyphs by Unicode code-point. def index_lookup : ImVector(ImWchar) t = @this.value.index_lookup pointerof(t).as(ImVector(ImWchar)*).value @@ -6110,9 +4607,6 @@ module ImGui @this.value.index_lookup = index_lookup.as(LibImGui::ImVectorInternal*).value end - # 12-16 - # out - # All glyphs. def glyphs : ImVector(ImFontGlyph) t = @this.value.glyphs pointerof(t).as(ImVector(ImFontGlyph)*).value @@ -6122,9 +4616,6 @@ module ImGui @this.value.glyphs = glyphs.as(LibImGui::ImVectorInternal*).value end - # 4-8 - # out - # = FindGlyph(FontFallbackChar) def fallback_glyph : ImFontGlyph? (v = @this.value.fallback_glyph) ? v.value : nil end @@ -6133,9 +4624,6 @@ module ImGui @this.value.fallback_glyph = fallback_glyph end - # 4-8 - # out - # What we has been loaded into def container_atlas : ImFontAtlas ImFontAtlas.new(@this.value.container_atlas) end @@ -6144,9 +4632,6 @@ module ImGui @this.value.container_atlas = container_atlas end - # 4-8 - # in - # Pointer within ContainerAtlas->ConfigData def config_data : Slice(ImFontConfig) Slice.new(@this.value.config_data_count.to_i) { |i| ImFontConfig.new(@this.value.config_data + i) } end @@ -6155,10 +4640,6 @@ module ImGui @this.value.config_data, @this.value.config_data_count = config_data.to_unsafe, config_data.bytesize end - # 2 - # in - # ~ 1 - # Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. def config_data_count : Int16 @this.value.config_data_count end @@ -6167,10 +4648,6 @@ module ImGui @this.value.config_data_count = config_data_count end - # 2 - # out - # = FFFD/'?' - # Character used if a glyph isn't found. def fallback_char : ImWchar @this.value.fallback_char end @@ -6179,10 +4656,6 @@ module ImGui @this.value.fallback_char = fallback_char end - # 2 - # out - # = '...' - # Character used for ellipsis rendering. def ellipsis_char : ImWchar @this.value.ellipsis_char end @@ -6191,10 +4664,6 @@ module ImGui @this.value.ellipsis_char = ellipsis_char end - # 2 - # out - # = '.' - # Character used for ellipsis rendering (if a single '...' character isn't found) def dot_char : ImWchar @this.value.dot_char end @@ -6203,8 +4672,6 @@ module ImGui @this.value.dot_char = dot_char end - # 1 - # out // def dirty_lookup_tables : Bool @this.value.dirty_lookup_tables end @@ -6213,10 +4680,6 @@ module ImGui @this.value.dirty_lookup_tables = dirty_lookup_tables end - # 4 - # in - # = 1.f - # Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale() def scale : Float32 @this.value.scale end @@ -6225,9 +4688,6 @@ module ImGui @this.value.scale = scale end - # 4+4 - # out - # Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] def ascent : Float32 @this.value.ascent end @@ -6236,9 +4696,6 @@ module ImGui @this.value.ascent = ascent end - # 4+4 - # out - # Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] def descent : Float32 @this.value.descent end @@ -6247,9 +4704,6 @@ module ImGui @this.value.descent = descent end - # 4 - # out - # Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs) def metrics_total_surface : Int32 @this.value.metrics_total_surface end @@ -6258,7 +4712,6 @@ module ImGui @this.value.metrics_total_surface = metrics_total_surface end - # 2 bytes if ImWchar=ImWchar16, 34 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints. def used4k_pages_map : Slice(UInt8) @this.value.used4k_pages_map.to_slice end @@ -6267,97 +4720,76 @@ module ImGui @this.value.used4k_pages_map = used4k_pages_map end - # [ImFont::ImFont()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2876) def self.new : ImFont result = LibImGui.ImFont_ImFont ImFont.new(result) end - # [ImFont::FindGlyph()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2878) def find_glyph(c : ImWchar) : ImFontGlyph result = LibImGui.ImFont_FindGlyph(self, c) result.value end - # [ImFont::FindGlyphNoFallback()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2879) def find_glyph_no_fallback(c : ImWchar) : ImFontGlyph result = LibImGui.ImFont_FindGlyphNoFallback(self, c) result.value end - # [ImFont::GetCharAdvance()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2880) def get_char_advance(c : ImWchar) : Float32 LibImGui.ImFont_GetCharAdvance(self, c) end - # [ImFont::IsLoaded()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2881) def is_loaded : Bool LibImGui.ImFont_IsLoaded(self) end - # [ImFont::GetDebugName()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2882) def get_debug_name : String result = LibImGui.ImFont_GetDebugName(self) String.new(result) end - # utf8 - # - # [ImFont::CalcTextSizeA()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2886) def calc_text_size_a(size : Float32, max_width : Float32, wrap_width : Float32, text : Bytes | String, remaining : LibC::Char** = Pointer(LibC::Char*).null) : ImGui::ImVec2 LibImGui.ImFont_CalcTextSizeA(out p_out, self, size, max_width, wrap_width, text, (text.to_unsafe + text.bytesize), remaining) p_out end - # [ImFont::CalcWordWrapPositionA()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2887) def calc_word_wrap_position_a(scale : Float32, text : Bytes | String, wrap_width : Float32) : String result = LibImGui.ImFont_CalcWordWrapPositionA(self, scale, text, (text.to_unsafe + text.bytesize), wrap_width) String.new(result) end - # [ImFont::RenderChar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2888) def render_char(draw_list : ImDrawList, size : Float32, pos : ImVec2, col : UInt32, c : ImWchar) : Void LibImGui.ImFont_RenderChar(self, draw_list, size, pos, col, c) end - # [ImFont::RenderText()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2889) def render_text(draw_list : ImDrawList, size : Float32, pos : ImVec2, col : UInt32, clip_rect : ImVec4, text : Bytes | String, wrap_width : Float32 = 0.0, cpu_fine_clip : Bool = false) : Void LibImGui.ImFont_RenderText(self, draw_list, size, pos, col, clip_rect, text, (text.to_unsafe + text.bytesize), wrap_width, cpu_fine_clip) end - # [ImFont::BuildLookupTable()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2892) def build_lookup_table : Void LibImGui.ImFont_BuildLookupTable(self) end - # [ImFont::ClearOutputData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2893) def clear_output_data : Void LibImGui.ImFont_ClearOutputData(self) end - # [ImFont::GrowIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2894) def grow_index(new_size : Int32) : Void LibImGui.ImFont_GrowIndex(self, new_size) end - # [ImFont::AddGlyph()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2895) def add_glyph(src_cfg : ImFontConfig, c : ImWchar, x0 : Float32, y0 : Float32, x1 : Float32, y1 : Float32, u0 : Float32, v0 : Float32, u1 : Float32, v1 : Float32, advance_x : Float32) : Void LibImGui.ImFont_AddGlyph(self, src_cfg, c, x0, y0, x1, y1, u0, v0, u1, v1, advance_x) end - # Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. - # - # [ImFont::AddRemapChar()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2896) def add_remap_char(dst : ImWchar, src : ImWchar, overwrite_dst : Bool = true) : Void LibImGui.ImFont_AddRemapChar(self, dst, src, overwrite_dst) end - # [ImFont::SetGlyphVisible()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2897) def set_glyph_visible(c : ImWchar, visible : Bool) : Void LibImGui.ImFont_SetGlyphVisible(self, c, visible) end - # [ImFont::IsGlyphRangeUnused()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2898) def is_glyph_range_unused(c_begin : UInt32, c_last : UInt32) : Bool LibImGui.ImFont_IsGlyphRangeUnused(self, c_begin, c_last) end @@ -6365,11 +4797,9 @@ module ImGui alias TopLevel::ImFont = ImGui::ImFont - # [struct ImGuiViewport](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2921) struct ImGuiViewport include ClassType(LibImGui::ImGuiViewport) - # See ImGuiViewportFlags_ def flags : ImGuiViewportFlags @this.value.flags end @@ -6378,7 +4808,6 @@ module ImGui @this.value.flags = flags end - # Main Area: Position of the viewport (Dear ImGui coordinates are the same as OS desktop/native coordinates) def pos : ImVec2 @this.value.pos end @@ -6387,7 +4816,6 @@ module ImGui @this.value.pos = pos end - # Main Area: Size of the viewport. def size : ImVec2 @this.value.size end @@ -6396,7 +4824,6 @@ module ImGui @this.value.size = size end - # Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos) def work_pos : ImVec2 @this.value.work_pos end @@ -6405,7 +4832,6 @@ module ImGui @this.value.work_pos = work_pos end - # Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) def work_size : ImVec2 @this.value.work_size end @@ -6414,7 +4840,6 @@ module ImGui @this.value.work_size = work_size end - # void* to hold lower-level, platform-native window handle (under Win32 this is expected to be a HWND, unused for other platforms) def platform_handle_raw : Void* @this.value.platform_handle_raw end @@ -6423,19 +4848,16 @@ module ImGui @this.value.platform_handle_raw = platform_handle_raw end - # [ImGuiViewport::ImGuiViewport()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2932) def self.new : ImGuiViewport result = LibImGui.ImGuiViewport_ImGuiViewport ImGuiViewport.new(result) end - # [ImGuiViewport::GetCenter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2935) def get_center : ImGui::ImVec2 LibImGui.ImGuiViewport_GetCenter(out p_out, self) p_out end - # [ImGuiViewport::GetWorkCenter()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2936) def get_work_center : ImGui::ImVec2 LibImGui.ImGuiViewport_GetWorkCenter(out p_out, self) p_out @@ -6444,11 +4866,9 @@ module ImGui alias TopLevel::ImGuiViewport = ImGui::ImGuiViewport - # [struct ImGuiPlatformImeData](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2944) struct ImGuiPlatformImeData include ClassType(LibImGui::ImGuiPlatformImeData) - # A widget wants the IME to be visible def want_visible : Bool @this.value.want_visible end @@ -6457,7 +4877,6 @@ module ImGui @this.value.want_visible = want_visible end - # Position of the input cursor def input_pos : ImVec2 @this.value.input_pos end @@ -6466,7 +4885,6 @@ module ImGui @this.value.input_pos = input_pos end - # Line height def input_line_height : Float32 @this.value.input_line_height end @@ -6475,7 +4893,6 @@ module ImGui @this.value.input_line_height = input_line_height end - # [ImGuiPlatformImeData::ImGuiPlatformImeData()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2950) def self.new : ImGuiPlatformImeData result = LibImGui.ImGuiPlatformImeData_ImGuiPlatformImeData ImGuiPlatformImeData.new(result) @@ -6484,9 +4901,6 @@ module ImGui alias TopLevel::ImGuiPlatformImeData = ImGui::ImGuiPlatformImeData - # map ImGuiKey_* values into legacy native key index. == io.KeyMap[key] - # - # [ImGui::GetKeyIndex()](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2962) def self.get_key_index(key : ImGuiKey) : Int32 LibImGui.GetKeyIndex(key) end diff --git a/src/types.cr b/src/types.cr index 1b90988..568c6f9 100644 --- a/src/types.cr +++ b/src/types.cr @@ -46,512 +46,305 @@ module ImGui alias TopLevel::ImVec4 = ImGui::ImVec4 - # [enum ImGuiWindowFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L942) @[Flags] enum ImGuiWindowFlags - None = 0 - # Disable title-bar - NoTitleBar = 1 << 0 - # Disable user resizing with the lower-right grip - NoResize = 1 << 1 - # Disable user moving the window - NoMove = 1 << 2 - # Disable scrollbars (window can still scroll with mouse or programmatically) - NoScrollbar = 1 << 3 - # Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. - NoScrollWithMouse = 1 << 4 - # Disable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node). - NoCollapse = 1 << 5 - # Resize every window to its content every frame - AlwaysAutoResize = 1 << 6 - # Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). - NoBackground = 1 << 7 - # Never load/save settings in .ini file - NoSavedSettings = 1 << 8 - # Disable catching mouse, hovering test with pass through. - NoMouseInputs = 1 << 9 - # Has a menu-bar - MenuBar = 1 << 10 - # Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. - HorizontalScrollbar = 1 << 11 - # Disable taking focus when transitioning from hidden to visible state - NoFocusOnAppearing = 1 << 12 - # Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) - NoBringToFrontOnFocus = 1 << 13 - # Always show vertical scrollbar (even if ContentSize.y < Size.y) - AlwaysVerticalScrollbar = 1 << 14 - # Always show horizontal scrollbar (even if ContentSize.x < Size.x) + None = 0 + NoTitleBar = 1 << 0 + NoResize = 1 << 1 + NoMove = 1 << 2 + NoScrollbar = 1 << 3 + NoScrollWithMouse = 1 << 4 + NoCollapse = 1 << 5 + AlwaysAutoResize = 1 << 6 + NoBackground = 1 << 7 + NoSavedSettings = 1 << 8 + NoMouseInputs = 1 << 9 + MenuBar = 1 << 10 + HorizontalScrollbar = 1 << 11 + NoFocusOnAppearing = 1 << 12 + NoBringToFrontOnFocus = 1 << 13 + AlwaysVerticalScrollbar = 1 << 14 AlwaysHorizontalScrollbar = 1 << 15 - # Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) - AlwaysUseWindowPadding = 1 << 16 - # No gamepad/keyboard navigation within the window - NoNavInputs = 1 << 18 - # No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) - NoNavFocus = 1 << 19 - # Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. - UnsavedDocument = 1 << 20 - NoNav = NoNavInputs | NoNavFocus - NoDecoration = NoTitleBar | NoResize | NoScrollbar | NoCollapse - NoInputs = NoMouseInputs | NoNavInputs | NoNavFocus - # [BETA] On child window: allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows. - NavFlattened = 1 << 23 - # Don't use! For internal use by BeginChild() - ChildWindow = 1 << 24 - # Don't use! For internal use by BeginTooltip() - Tooltip = 1 << 25 - # Don't use! For internal use by BeginPopup() - Popup = 1 << 26 - # Don't use! For internal use by BeginPopupModal() - Modal = 1 << 27 - # Don't use! For internal use by BeginMenu() - ChildMenu = 1 << 28 + AlwaysUseWindowPadding = 1 << 16 + NoNavInputs = 1 << 18 + NoNavFocus = 1 << 19 + UnsavedDocument = 1 << 20 + NoNav = NoNavInputs | NoNavFocus + NoDecoration = NoTitleBar | NoResize | NoScrollbar | NoCollapse + NoInputs = NoMouseInputs | NoNavInputs | NoNavFocus + NavFlattened = 1 << 23 + ChildWindow = 1 << 24 + Tooltip = 1 << 25 + Popup = 1 << 26 + Modal = 1 << 27 + ChildMenu = 1 << 28 end alias TopLevel::ImGuiWindowFlags = ImGui::ImGuiWindowFlags - # [enum ImGuiInputTextFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L980) @[Flags] enum ImGuiInputTextFlags - None = 0 - # Allow 0123456789.+-*/ - CharsDecimal = 1 << 0 - # Allow 0123456789ABCDEFabcdef - CharsHexadecimal = 1 << 1 - # Turn a..z into A..Z - CharsUppercase = 1 << 2 - # Filter out spaces, tabs - CharsNoBlank = 1 << 3 - # Select entire text when first taking mouse focus - AutoSelectAll = 1 << 4 - # Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function. - EnterReturnsTrue = 1 << 5 - # Callback on pressing TAB (for completion handling) - CallbackCompletion = 1 << 6 - # Callback on pressing Up/Down arrows (for history handling) - CallbackHistory = 1 << 7 - # Callback on each iteration. User code may query cursor position, modify text buffer. - CallbackAlways = 1 << 8 - # Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. - CallbackCharFilter = 1 << 9 - # Pressing TAB input a '\t' character into the text field - AllowTabInput = 1 << 10 - # In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). + None = 0 + CharsDecimal = 1 << 0 + CharsHexadecimal = 1 << 1 + CharsUppercase = 1 << 2 + CharsNoBlank = 1 << 3 + AutoSelectAll = 1 << 4 + EnterReturnsTrue = 1 << 5 + CallbackCompletion = 1 << 6 + CallbackHistory = 1 << 7 + CallbackAlways = 1 << 8 + CallbackCharFilter = 1 << 9 + AllowTabInput = 1 << 10 CtrlEnterForNewLine = 1 << 11 - # Disable following the cursor horizontally - NoHorizontalScroll = 1 << 12 - # Overwrite mode - AlwaysOverwrite = 1 << 13 - # Read-only mode - ReadOnly = 1 << 14 - # Password mode, display all characters as '*' - Password = 1 << 15 - # Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). - NoUndoRedo = 1 << 16 - # Allow 0123456789.+-*/eE (Scientific notation input) - CharsScientific = 1 << 17 - # Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) - CallbackResize = 1 << 18 - # Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) - CallbackEdit = 1 << 19 + NoHorizontalScroll = 1 << 12 + AlwaysOverwrite = 1 << 13 + ReadOnly = 1 << 14 + Password = 1 << 15 + NoUndoRedo = 1 << 16 + CharsScientific = 1 << 17 + CallbackResize = 1 << 18 + CallbackEdit = 1 << 19 end alias TopLevel::ImGuiInputTextFlags = ImGui::ImGuiInputTextFlags - # [enum ImGuiTreeNodeFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1011) @[Flags] enum ImGuiTreeNodeFlags - None = 0 - # Draw as selected - Selected = 1 << 0 - # Draw frame with background (e.g. for CollapsingHeader) - Framed = 1 << 1 - # Hit testing to allow subsequent widgets to overlap this one - AllowItemOverlap = 1 << 2 - # Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack - NoTreePushOnOpen = 1 << 3 - # Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) - NoAutoOpenOnLog = 1 << 4 - # Default node to be open - DefaultOpen = 1 << 5 - # Need double-click to open node - OpenOnDoubleClick = 1 << 6 - # Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. - OpenOnArrow = 1 << 7 - # No collapsing, no arrow (use as a convenience for leaf nodes). - Leaf = 1 << 8 - # Display a bullet instead of arrow - Bullet = 1 << 9 - # Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). - FramePadding = 1 << 10 - # Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. - SpanAvailWidth = 1 << 11 - # Extend hit box to the left-most and right-most edges (bypass the indented area). - SpanFullWidth = 1 << 12 - # (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) + None = 0 + Selected = 1 << 0 + Framed = 1 << 1 + AllowItemOverlap = 1 << 2 + NoTreePushOnOpen = 1 << 3 + NoAutoOpenOnLog = 1 << 4 + DefaultOpen = 1 << 5 + OpenOnDoubleClick = 1 << 6 + OpenOnArrow = 1 << 7 + Leaf = 1 << 8 + Bullet = 1 << 9 + FramePadding = 1 << 10 + SpanAvailWidth = 1 << 11 + SpanFullWidth = 1 << 12 NavLeftJumpsBackHere = 1 << 13 CollapsingHeader = Framed | NoTreePushOnOpen | NoAutoOpenOnLog end alias TopLevel::ImGuiTreeNodeFlags = ImGui::ImGuiTreeNodeFlags - # [enum ImGuiPopupFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1040) @[Flags] enum ImGuiPopupFlags - None = 0 - # For BeginPopupContext*(): open on Left Mouse release. Guaranteed to always be == 0 (same as ImGuiMouseButton_Left) - MouseButtonLeft = 0 - # For BeginPopupContext*(): open on Right Mouse release. Guaranteed to always be == 1 (same as ImGuiMouseButton_Right) - MouseButtonRight = 1 - # For BeginPopupContext*(): open on Middle Mouse release. Guaranteed to always be == 2 (same as ImGuiMouseButton_Middle) - MouseButtonMiddle = 2 - MouseButtonMask_ = 0x1F - MouseButtonDefault_ = 1 - # For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack + None = 0 + MouseButtonLeft = 0 + MouseButtonRight = 1 + MouseButtonMiddle = 2 + MouseButtonMask_ = 0x1F + MouseButtonDefault_ = 1 NoOpenOverExistingPopup = 1 << 5 - # For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space - NoOpenOverItems = 1 << 6 - # For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup. - AnyPopupId = 1 << 7 - # For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level) - AnyPopupLevel = 1 << 8 - AnyPopup = AnyPopupId | AnyPopupLevel + NoOpenOverItems = 1 << 6 + AnyPopupId = 1 << 7 + AnyPopupLevel = 1 << 8 + AnyPopup = AnyPopupId | AnyPopupLevel end alias TopLevel::ImGuiPopupFlags = ImGui::ImGuiPopupFlags - # [enum ImGuiSelectableFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1056) @[Flags] enum ImGuiSelectableFlags - None = 0 - # Clicking this don't close parent popup window - DontClosePopups = 1 << 0 - # Selectable frame can span all columns (text will still fit in current column) - SpanAllColumns = 1 << 1 - # Generate press events on double clicks too + None = 0 + DontClosePopups = 1 << 0 + SpanAllColumns = 1 << 1 AllowDoubleClick = 1 << 2 - # Cannot be selected, display grayed out text - Disabled = 1 << 3 - # (WIP) Hit testing to allow subsequent widgets to overlap this one + Disabled = 1 << 3 AllowItemOverlap = 1 << 4 end alias TopLevel::ImGuiSelectableFlags = ImGui::ImGuiSelectableFlags - # [enum ImGuiComboFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1067) @[Flags] enum ImGuiComboFlags - None = 0 - # Align the popup toward the left by default + None = 0 PopupAlignLeft = 1 << 0 - # Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo() - HeightSmall = 1 << 1 - # Max ~8 items visible (default) - HeightRegular = 1 << 2 - # Max ~20 items visible - HeightLarge = 1 << 3 - # As many fitting items as possible - HeightLargest = 1 << 4 - # Display on the preview box without the square arrow button - NoArrowButton = 1 << 5 - # Display only a square arrow button - NoPreview = 1 << 6 - HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest + HeightSmall = 1 << 1 + HeightRegular = 1 << 2 + HeightLarge = 1 << 3 + HeightLargest = 1 << 4 + NoArrowButton = 1 << 5 + NoPreview = 1 << 6 + HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest end alias TopLevel::ImGuiComboFlags = ImGui::ImGuiComboFlags - # [enum ImGuiTabBarFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1081) @[Flags] enum ImGuiTabBarFlags - None = 0 - # Allow manually dragging tabs to re-order them + New tabs are appended at the end of list - Reorderable = 1 << 0 - # Automatically select new tabs when they appear - AutoSelectNewTabs = 1 << 1 - # Disable buttons to open the tab list popup - TabListPopupButton = 1 << 2 - # Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. + None = 0 + Reorderable = 1 << 0 + AutoSelectNewTabs = 1 << 1 + TabListPopupButton = 1 << 2 NoCloseWithMiddleMouseButton = 1 << 3 - # Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) - NoTabListScrollingButtons = 1 << 4 - # Disable tooltips when hovering a tab - NoTooltip = 1 << 5 - # Resize tabs when they don't fit - FittingPolicyResizeDown = 1 << 6 - # Add scroll buttons when tabs don't fit - FittingPolicyScroll = 1 << 7 - FittingPolicyMask_ = FittingPolicyResizeDown | FittingPolicyScroll - FittingPolicyDefault_ = FittingPolicyResizeDown + NoTabListScrollingButtons = 1 << 4 + NoTooltip = 1 << 5 + FittingPolicyResizeDown = 1 << 6 + FittingPolicyScroll = 1 << 7 + FittingPolicyMask_ = FittingPolicyResizeDown | FittingPolicyScroll + FittingPolicyDefault_ = FittingPolicyResizeDown end alias TopLevel::ImGuiTabBarFlags = ImGui::ImGuiTabBarFlags - # [enum ImGuiTabItemFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1097) @[Flags] enum ImGuiTabItemFlags - None = 0 - # Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. - UnsavedDocument = 1 << 0 - # Trigger flag to programmatically make the tab selected when calling BeginTabItem() - SetSelected = 1 << 1 - # Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. + None = 0 + UnsavedDocument = 1 << 0 + SetSelected = 1 << 1 NoCloseWithMiddleMouseButton = 1 << 2 - # Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() - NoPushId = 1 << 3 - # Disable tooltip for the given tab - NoTooltip = 1 << 4 - # Disable reordering this tab or having another tab cross over this tab - NoReorder = 1 << 5 - # Enforce the tab position to the left of the tab bar (after the tab list popup button) - Leading = 1 << 6 - # Enforce the tab position to the right of the tab bar (before the scrolling buttons) - Trailing = 1 << 7 + NoPushId = 1 << 3 + NoTooltip = 1 << 4 + NoReorder = 1 << 5 + Leading = 1 << 6 + Trailing = 1 << 7 end alias TopLevel::ImGuiTabItemFlags = ImGui::ImGuiTabItemFlags - # [enum ImGuiTableFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1132) @[Flags] enum ImGuiTableFlags - None = 0 - # Enable resizing columns. - Resizable = 1 << 0 - # Enable reordering columns in header row (need calling TableSetupColumn() + TableHeadersRow() to display headers) - Reorderable = 1 << 1 - # Enable hiding/disabling columns in context menu. - Hideable = 1 << 2 - # Enable sorting. Call TableGetSortSpecs() to obtain sort specs. Also see ImGuiTableFlags_SortMulti and ImGuiTableFlags_SortTristate. - Sortable = 1 << 3 - # Disable persisting columns order, width and sort settings in the .ini file. - NoSavedSettings = 1 << 4 - # Right-click on columns body/contents will display table context menu. By default it is available in TableHeadersRow(). - ContextMenuInBody = 1 << 5 - # Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually) - RowBg = 1 << 6 - # Draw horizontal borders between rows. - BordersInnerH = 1 << 7 - # Draw horizontal borders at the top and bottom. - BordersOuterH = 1 << 8 - # Draw vertical borders between columns. - BordersInnerV = 1 << 9 - # Draw vertical borders on the left and right sides. - BordersOuterV = 1 << 10 - # Draw horizontal borders. - BordersH = BordersInnerH | BordersOuterH - # Draw vertical borders. - BordersV = BordersInnerV | BordersOuterV - # Draw inner borders. - BordersInner = BordersInnerV | BordersInnerH - # Draw outer borders. - BordersOuter = BordersOuterV | BordersOuterH - # Draw all borders. - Borders = BordersInner | BordersOuter - # [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style - NoBordersInBody = 1 << 11 - # [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style + None = 0 + Resizable = 1 << 0 + Reorderable = 1 << 1 + Hideable = 1 << 2 + Sortable = 1 << 3 + NoSavedSettings = 1 << 4 + ContextMenuInBody = 1 << 5 + RowBg = 1 << 6 + BordersInnerH = 1 << 7 + BordersOuterH = 1 << 8 + BordersInnerV = 1 << 9 + BordersOuterV = 1 << 10 + BordersH = BordersInnerH | BordersOuterH + BordersV = BordersInnerV | BordersOuterV + BordersInner = BordersInnerV | BordersInnerH + BordersOuter = BordersOuterV | BordersOuterH + Borders = BordersInner | BordersOuter + NoBordersInBody = 1 << 11 NoBordersInBodyUntilResize = 1 << 12 - # Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width. - SizingFixedFit = 1 << 13 - # Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible. - SizingFixedSame = 2 << 13 - # Columns default to _WidthStretch with default weights proportional to each columns contents widths. - SizingStretchProp = 3 << 13 - # Columns default to _WidthStretch with default weights all equal, unless overridden by TableSetupColumn(). - SizingStretchSame = 4 << 13 - # Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used. - NoHostExtendX = 1 << 16 - # Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible. - NoHostExtendY = 1 << 17 - # Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable. - NoKeepColumnsVisible = 1 << 18 - # Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth. - PreciseWidths = 1 << 19 - # Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze(). - NoClip = 1 << 20 - # Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers. - PadOuterX = 1 << 21 - # Default if BordersOuterV is off. Disable outer-most padding. - NoPadOuterX = 1 << 22 - # Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off). - NoPadInnerX = 1 << 23 - # Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. - ScrollX = 1 << 24 - # Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. - ScrollY = 1 << 25 - # Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1). - SortMulti = 1 << 26 - # Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0). - SortTristate = 1 << 27 - SizingMask_ = SizingFixedFit | SizingFixedSame | SizingStretchProp | SizingStretchSame + SizingFixedFit = 1 << 13 + SizingFixedSame = 2 << 13 + SizingStretchProp = 3 << 13 + SizingStretchSame = 4 << 13 + NoHostExtendX = 1 << 16 + NoHostExtendY = 1 << 17 + NoKeepColumnsVisible = 1 << 18 + PreciseWidths = 1 << 19 + NoClip = 1 << 20 + PadOuterX = 1 << 21 + NoPadOuterX = 1 << 22 + NoPadInnerX = 1 << 23 + ScrollX = 1 << 24 + ScrollY = 1 << 25 + SortMulti = 1 << 26 + SortTristate = 1 << 27 + SizingMask_ = SizingFixedFit | SizingFixedSame | SizingStretchProp | SizingStretchSame end alias TopLevel::ImGuiTableFlags = ImGui::ImGuiTableFlags - # [enum ImGuiTableColumnFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1189) @[Flags] enum ImGuiTableColumnFlags - None = 0 - # Overriding/master disable flag: hide column, won't show in context menu (unlike calling TableSetColumnEnabled() which manipulates the user accessible state) - Disabled = 1 << 0 - # Default as a hidden/disabled column. - DefaultHide = 1 << 1 - # Default as a sorting column. - DefaultSort = 1 << 2 - # Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp). - WidthStretch = 1 << 3 - # Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable). - WidthFixed = 1 << 4 - # Disable manual resizing. - NoResize = 1 << 5 - # Disable manual reordering this column, this will also prevent other columns from crossing over this column. - NoReorder = 1 << 6 - # Disable ability to hide/disable this column. - NoHide = 1 << 7 - # Disable clipping for this column (all NoClip columns will render in a same draw command). - NoClip = 1 << 8 - # Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table). - NoSort = 1 << 9 - # Disable ability to sort in the ascending direction. - NoSortAscending = 1 << 10 - # Disable ability to sort in the descending direction. - NoSortDescending = 1 << 11 - # TableHeadersRow() will not submit label for this column. Convenient for some small columns. Name will still appear in context menu. - NoHeaderLabel = 1 << 12 - # Disable header text width contribution to automatic column width. - NoHeaderWidth = 1 << 13 - # Make the initial sort direction Ascending when first sorting on this column (default). - PreferSortAscending = 1 << 14 - # Make the initial sort direction Descending when first sorting on this column. + None = 0 + Disabled = 1 << 0 + DefaultHide = 1 << 1 + DefaultSort = 1 << 2 + WidthStretch = 1 << 3 + WidthFixed = 1 << 4 + NoResize = 1 << 5 + NoReorder = 1 << 6 + NoHide = 1 << 7 + NoClip = 1 << 8 + NoSort = 1 << 9 + NoSortAscending = 1 << 10 + NoSortDescending = 1 << 11 + NoHeaderLabel = 1 << 12 + NoHeaderWidth = 1 << 13 + PreferSortAscending = 1 << 14 PreferSortDescending = 1 << 15 - # Use current Indent value when entering cell (default for column 0). - IndentEnable = 1 << 16 - # Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored. - IndentDisable = 1 << 17 - # Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags. - IsEnabled = 1 << 24 - # Status: is visible == is enabled AND not clipped by scrolling. - IsVisible = 1 << 25 - # Status: is currently part of the sort specs - IsSorted = 1 << 26 - # Status: is hovered by mouse - IsHovered = 1 << 27 - WidthMask_ = WidthStretch | WidthFixed - IndentMask_ = IndentEnable | IndentDisable - StatusMask_ = IsEnabled | IsVisible | IsSorted | IsHovered - # [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge) - NoDirectResize_ = 1 << 30 + IndentEnable = 1 << 16 + IndentDisable = 1 << 17 + IsEnabled = 1 << 24 + IsVisible = 1 << 25 + IsSorted = 1 << 26 + IsHovered = 1 << 27 + WidthMask_ = WidthStretch | WidthFixed + IndentMask_ = IndentEnable | IndentDisable + StatusMask_ = IsEnabled | IsVisible | IsSorted | IsHovered + NoDirectResize_ = 1 << 30 end alias TopLevel::ImGuiTableColumnFlags = ImGui::ImGuiTableColumnFlags - # [enum ImGuiTableRowFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1231) @[Flags] enum ImGuiTableRowFlags - None = 0 - # Identify header row (set default background color + width of its contents accounted differently for auto column width) + None = 0 Headers = 1 << 0 end alias TopLevel::ImGuiTableRowFlags = ImGui::ImGuiTableRowFlags - # [enum ImGuiTableBgTarget_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1246) enum ImGuiTableBgTarget - None = 0 - # Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used) + None = 0 RowBg0 = 1 - # Set row background color 1 (generally used for selection marking) RowBg1 = 2 - # Set cell background color (top-most color) CellBg = 3 end alias TopLevel::ImGuiTableBgTarget = ImGui::ImGuiTableBgTarget - # [enum ImGuiFocusedFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1255) @[Flags] enum ImGuiFocusedFlags - None = 0 - # Return true if any children of the window is focused - ChildWindows = 1 << 0 - # Test from root window (top most parent of the current hierarchy) - RootWindow = 1 << 1 - # Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! - AnyWindow = 1 << 2 - # Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) + None = 0 + ChildWindows = 1 << 0 + RootWindow = 1 << 1 + AnyWindow = 1 << 2 NoPopupHierarchy = 1 << 3 RootAndChildWindows = RootWindow | ChildWindows end alias TopLevel::ImGuiFocusedFlags = ImGui::ImGuiFocusedFlags - # [enum ImGuiHoveredFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1269) @[Flags] enum ImGuiHoveredFlags - # Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. - None = 0 - # IsWindowHovered() only: Return true if any children of the window is hovered - ChildWindows = 1 << 0 - # IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) - RootWindow = 1 << 1 - # IsWindowHovered() only: Return true if any window is hovered - AnyWindow = 1 << 2 - # IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) - NoPopupHierarchy = 1 << 3 - # Return true even if a popup window is normally blocking access to this item/window - AllowWhenBlockedByPopup = 1 << 5 - # Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. + None = 0 + ChildWindows = 1 << 0 + RootWindow = 1 << 1 + AnyWindow = 1 << 2 + NoPopupHierarchy = 1 << 3 + AllowWhenBlockedByPopup = 1 << 5 AllowWhenBlockedByActiveItem = 1 << 7 - # IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window - AllowWhenOverlapped = 1 << 8 - # IsItemHovered() only: Return true even if the item is disabled - AllowWhenDisabled = 1 << 9 - # Disable using gamepad/keyboard navigation state when active, always query mouse. - NoNavOverride = 1 << 10 - RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped - RootAndChildWindows = RootWindow | ChildWindows + AllowWhenOverlapped = 1 << 8 + AllowWhenDisabled = 1 << 9 + NoNavOverride = 1 << 10 + RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped + RootAndChildWindows = RootWindow | ChildWindows end alias TopLevel::ImGuiHoveredFlags = ImGui::ImGuiHoveredFlags - # [enum ImGuiDragDropFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1288) @[Flags] enum ImGuiDragDropFlags - None = 0 - # By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. - SourceNoPreviewTooltip = 1 << 0 - # By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. - SourceNoDisableHover = 1 << 1 - # Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. + None = 0 + SourceNoPreviewTooltip = 1 << 0 + SourceNoDisableHover = 1 << 1 SourceNoHoldToOpenOthers = 1 << 2 - # Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. - SourceAllowNullID = 1 << 3 - # External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. - SourceExtern = 1 << 4 - # Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged) - SourceAutoExpirePayload = 1 << 5 - # AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. - AcceptBeforeDelivery = 1 << 10 - # Do not draw the default highlight rectangle when hovering over target. - AcceptNoDrawDefaultRect = 1 << 11 - # Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site. - AcceptNoPreviewTooltip = 1 << 12 - # For peeking ahead and inspecting the payload before delivery. - AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect + SourceAllowNullID = 1 << 3 + SourceExtern = 1 << 4 + SourceAutoExpirePayload = 1 << 5 + AcceptBeforeDelivery = 1 << 10 + AcceptNoDrawDefaultRect = 1 << 11 + AcceptNoPreviewTooltip = 1 << 12 + AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect end alias TopLevel::ImGuiDragDropFlags = ImGui::ImGuiDragDropFlags - # [enum ImGuiDataType_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1310) enum ImGuiDataType - # signed char / char (with sensible compilers) - S8 = 0 - # unsigned char - U8 = 1 - # short - S16 = 2 - # unsigned short - U16 = 3 - # int - S32 = 4 - # unsigned int - U32 = 5 - # long long / __int64 - S64 = 6 - # unsigned long long / unsigned __int64 - U64 = 7 - # float - Float = 8 - # double + S8 = 0 + U8 = 1 + S16 = 2 + U16 = 3 + S32 = 4 + U32 = 5 + S64 = 6 + U64 = 7 + Float = 8 Double = 9 end alias TopLevel::ImGuiDataType = ImGui::ImGuiDataType - # [enum ImGuiDir_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1326) enum ImGuiDir None = -1 Left = 0 @@ -561,199 +354,143 @@ module ImGui end alias TopLevel::ImGuiDir = ImGui::ImGuiDir - # [enum ImGuiSortDirection_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1337) enum ImGuiSortDirection - None = 0 - # Ascending = 0->9, A->Z etc. - Ascending = 1 - # Descending = 9->0, Z->A etc. + None = 0 + Ascending = 1 Descending = 2 end alias TopLevel::ImGuiSortDirection = ImGui::ImGuiSortDirection - # [enum ImGuiKey_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1346) enum ImGuiKey - None = 0 - # == ImGuiKey_NamedKey_BEGIN - Tab = 512 - LeftArrow = 513 - RightArrow = 514 - UpArrow = 515 - DownArrow = 516 - PageUp = 517 - PageDown = 518 - Home = 519 - End = 520 - Insert = 521 - Delete = 522 - Backspace = 523 - Space = 524 - Enter = 525 - Escape = 526 - LeftCtrl = 527 - LeftShift = 528 - LeftAlt = 529 - LeftSuper = 530 - RightCtrl = 531 - RightShift = 532 - RightAlt = 533 - RightSuper = 534 - Menu = 535 - Num0 = 536 - Num1 = 537 - Num2 = 538 - Num3 = 539 - Num4 = 540 - Num5 = 541 - Num6 = 542 - Num7 = 543 - Num8 = 544 - Num9 = 545 - A = 546 - B = 547 - C = 548 - D = 549 - E = 550 - F = 551 - G = 552 - H = 553 - I = 554 - J = 555 - K = 556 - L = 557 - M = 558 - N = 559 - O = 560 - P = 561 - Q = 562 - R = 563 - S = 564 - T = 565 - U = 566 - V = 567 - W = 568 - X = 569 - Y = 570 - Z = 571 - F1 = 572 - F2 = 573 - F3 = 574 - F4 = 575 - F5 = 576 - F6 = 577 - F7 = 578 - F8 = 579 - F9 = 580 - F10 = 581 - F11 = 582 - F12 = 583 - # ' - Apostrophe = 584 - # , - Comma = 585 - # - - Minus = 586 - # . - Period = 587 - # / - Slash = 588 - # ; - Semicolon = 589 - # = - Equal = 590 - # [ - LeftBracket = 591 - # \ (this text inhibit multiline comment caused by backslash) - Backslash = 592 - # ] - RightBracket = 593 - # ` - GraveAccent = 594 - CapsLock = 595 - ScrollLock = 596 - NumLock = 597 - PrintScreen = 598 - Pause = 599 - Keypad0 = 600 - Keypad1 = 601 - Keypad2 = 602 - Keypad3 = 603 - Keypad4 = 604 - Keypad5 = 605 - Keypad6 = 606 - Keypad7 = 607 - Keypad8 = 608 - Keypad9 = 609 - KeypadDecimal = 610 - KeypadDivide = 611 - KeypadMultiply = 612 - KeypadSubtract = 613 - KeypadAdd = 614 - KeypadEnter = 615 - KeypadEqual = 616 - # Menu (Xbox) + (Switch) Start/Options (PS) - # -- - GamepadStart = 617 - # View (Xbox) - (Switch) Share (PS) - # -- - GamepadBack = 618 - # Y (Xbox) X (Switch) Triangle (PS) - # -> ImGuiNavInput_Input - GamepadFaceUp = 619 - # A (Xbox) B (Switch) Cross (PS) - # -> ImGuiNavInput_Activate - GamepadFaceDown = 620 - # X (Xbox) Y (Switch) Square (PS) - # -> ImGuiNavInput_Menu - GamepadFaceLeft = 621 - # B (Xbox) A (Switch) Circle (PS) - # -> ImGuiNavInput_Cancel - GamepadFaceRight = 622 - # D-pad Up - # -> ImGuiNavInput_DpadUp - GamepadDpadUp = 623 - # D-pad Down - # -> ImGuiNavInput_DpadDown - GamepadDpadDown = 624 - # D-pad Left - # -> ImGuiNavInput_DpadLeft - GamepadDpadLeft = 625 - # D-pad Right - # -> ImGuiNavInput_DpadRight - GamepadDpadRight = 626 - # L Bumper (Xbox) L (Switch) L1 (PS) - # -> ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow - GamepadL1 = 627 - # R Bumper (Xbox) R (Switch) R1 (PS) - # -> ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast - GamepadR1 = 628 - # L Trigger (Xbox) ZL (Switch) L2 (PS) [Analog] - GamepadL2 = 629 - # R Trigger (Xbox) ZR (Switch) R2 (PS) [Analog] - GamepadR2 = 630 - # L Thumbstick (Xbox) L3 (Switch) L3 (PS) - GamepadL3 = 631 - # R Thumbstick (Xbox) R3 (Switch) R3 (PS) - GamepadR3 = 632 - # [Analog] - # -> ImGuiNavInput_LStickUp - GamepadLStickUp = 633 - # [Analog] - # -> ImGuiNavInput_LStickDown - GamepadLStickDown = 634 - # [Analog] - # -> ImGuiNavInput_LStickLeft - GamepadLStickLeft = 635 - # [Analog] - # -> ImGuiNavInput_LStickRight + None = 0 + Tab = 512 + LeftArrow = 513 + RightArrow = 514 + UpArrow = 515 + DownArrow = 516 + PageUp = 517 + PageDown = 518 + Home = 519 + End = 520 + Insert = 521 + Delete = 522 + Backspace = 523 + Space = 524 + Enter = 525 + Escape = 526 + LeftCtrl = 527 + LeftShift = 528 + LeftAlt = 529 + LeftSuper = 530 + RightCtrl = 531 + RightShift = 532 + RightAlt = 533 + RightSuper = 534 + Menu = 535 + Num0 = 536 + Num1 = 537 + Num2 = 538 + Num3 = 539 + Num4 = 540 + Num5 = 541 + Num6 = 542 + Num7 = 543 + Num8 = 544 + Num9 = 545 + A = 546 + B = 547 + C = 548 + D = 549 + E = 550 + F = 551 + G = 552 + H = 553 + I = 554 + J = 555 + K = 556 + L = 557 + M = 558 + N = 559 + O = 560 + P = 561 + Q = 562 + R = 563 + S = 564 + T = 565 + U = 566 + V = 567 + W = 568 + X = 569 + Y = 570 + Z = 571 + F1 = 572 + F2 = 573 + F3 = 574 + F4 = 575 + F5 = 576 + F6 = 577 + F7 = 578 + F8 = 579 + F9 = 580 + F10 = 581 + F11 = 582 + F12 = 583 + Apostrophe = 584 + Comma = 585 + Minus = 586 + Period = 587 + Slash = 588 + Semicolon = 589 + Equal = 590 + LeftBracket = 591 + Backslash = 592 + RightBracket = 593 + GraveAccent = 594 + CapsLock = 595 + ScrollLock = 596 + NumLock = 597 + PrintScreen = 598 + Pause = 599 + Keypad0 = 600 + Keypad1 = 601 + Keypad2 = 602 + Keypad3 = 603 + Keypad4 = 604 + Keypad5 = 605 + Keypad6 = 606 + Keypad7 = 607 + Keypad8 = 608 + Keypad9 = 609 + KeypadDecimal = 610 + KeypadDivide = 611 + KeypadMultiply = 612 + KeypadSubtract = 613 + KeypadAdd = 614 + KeypadEnter = 615 + KeypadEqual = 616 + GamepadStart = 617 + GamepadBack = 618 + GamepadFaceUp = 619 + GamepadFaceDown = 620 + GamepadFaceLeft = 621 + GamepadFaceRight = 622 + GamepadDpadUp = 623 + GamepadDpadDown = 624 + GamepadDpadLeft = 625 + GamepadDpadRight = 626 + GamepadL1 = 627 + GamepadR1 = 628 + GamepadL2 = 629 + GamepadR2 = 630 + GamepadL3 = 631 + GamepadR3 = 632 + GamepadLStickUp = 633 + GamepadLStickDown = 634 + GamepadLStickLeft = 635 GamepadLStickRight = 636 - # [Analog] - GamepadRStickUp = 637 - # [Analog] - GamepadRStickDown = 638 - # [Analog] - GamepadRStickLeft = 639 - # [Analog] + GamepadRStickUp = 637 + GamepadRStickDown = 638 + GamepadRStickLeft = 639 GamepadRStickRight = 640 ModCtrl = 641 ModShift = 642 @@ -762,337 +499,206 @@ module ImGui end alias TopLevel::ImGuiKey = ImGui::ImGuiKey - # [enum ImGuiModFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1458) @[Flags] enum ImGuiModFlags None = 0 Ctrl = 1 << 0 Shift = 1 << 1 - # Menu - Alt = 1 << 2 - # Cmd/Super/Windows key + Alt = 1 << 2 Super = 1 << 3 end alias TopLevel::ImGuiModFlags = ImGui::ImGuiModFlags - # [enum ImGuiNavInput_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1472) enum ImGuiNavInput - # Activate / Open / Toggle / Tweak value - # e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) - Activate = 0 - # Cancel / Close / Exit - # e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) - Cancel = 1 - # Text input / On-Screen keyboard - # e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) - Input = 2 - # Tap: Toggle menu / Hold: Focus, Move, Resize - # e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) - Menu = 3 - # Move / Tweak / Resize window (w/ PadMenu) - # e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) - DpadLeft = 4 - DpadRight = 5 - DpadUp = 6 - DpadDown = 7 - # Scroll / Move window (w/ PadMenu) - # e.g. Left Analog Stick Left/Right/Up/Down + Activate = 0 + Cancel = 1 + Input = 2 + Menu = 3 + DpadLeft = 4 + DpadRight = 5 + DpadUp = 6 + DpadDown = 7 LStickLeft = 8 LStickRight = 9 LStickUp = 10 LStickDown = 11 - # Focus Next window (w/ PadMenu) - # e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) - FocusPrev = 12 - # Focus Prev window (w/ PadMenu) - # e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) - FocusNext = 13 - # Slower tweaks - # e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) - TweakSlow = 14 - # Faster tweaks - # e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) - TweakFast = 15 - # Move left - # = Arrow keys - KeyLeft_ = 16 - # Move right - KeyRight_ = 17 - # Move up - KeyUp_ = 18 - # Move down - KeyDown_ = 19 + FocusPrev = 12 + FocusNext = 13 + TweakSlow = 14 + TweakFast = 15 + KeyLeft_ = 16 + KeyRight_ = 17 + KeyUp_ = 18 + KeyDown_ = 19 end alias TopLevel::ImGuiNavInput = ImGui::ImGuiNavInput - # [enum ImGuiConfigFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1502) @[Flags] enum ImGuiConfigFlags - None = 0 - # Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.AddKeyEvent() calls - NavEnableKeyboard = 1 << 0 - # Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad. - NavEnableGamepad = 1 << 1 - # 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 backend, otherwise ImGui will react as if the mouse is jumping around back and forth. + None = 0 + NavEnableKeyboard = 1 << 0 + NavEnableGamepad = 1 << 1 NavEnableSetMousePos = 1 << 2 - # Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. NavNoCaptureKeyboard = 1 << 3 - # Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend. - NoMouse = 1 << 4 - # Instruct backend to not alter mouse cursor shape and visibility. Use if the backend 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. - NoMouseCursorChange = 1 << 5 - # Application is SRGB-aware. - IsSRGB = 1 << 20 - # Application is using a touch screen instead of a mouse. - IsTouchScreen = 1 << 21 + NoMouse = 1 << 4 + NoMouseCursorChange = 1 << 5 + IsSRGB = 1 << 20 + IsTouchScreen = 1 << 21 end alias TopLevel::ImGuiConfigFlags = ImGui::ImGuiConfigFlags - # [enum ImGuiBackendFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1518) @[Flags] enum ImGuiBackendFlags - None = 0 - # Backend Platform supports gamepad and currently has one connected. - HasGamepad = 1 << 0 - # Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape. - HasMouseCursors = 1 << 1 - # Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). - HasSetMousePos = 1 << 2 - # Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. + None = 0 + HasGamepad = 1 << 0 + HasMouseCursors = 1 << 1 + HasSetMousePos = 1 << 2 RendererHasVtxOffset = 1 << 3 end alias TopLevel::ImGuiBackendFlags = ImGui::ImGuiBackendFlags - # [enum ImGuiCol_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1528) enum ImGuiCol - Text = 0 - TextDisabled = 1 - # Background of normal windows - WindowBg = 2 - # Background of child windows - ChildBg = 3 - # Background of popups, menus, tooltips windows - PopupBg = 4 - Border = 5 - BorderShadow = 6 - # Background of checkbox, radio button, plot, slider, text input - FrameBg = 7 - FrameBgHovered = 8 - FrameBgActive = 9 - TitleBg = 10 - TitleBgActive = 11 - TitleBgCollapsed = 12 - MenuBarBg = 13 - ScrollbarBg = 14 - ScrollbarGrab = 15 - ScrollbarGrabHovered = 16 - ScrollbarGrabActive = 17 - CheckMark = 18 - SliderGrab = 19 - SliderGrabActive = 20 - Button = 21 - ButtonHovered = 22 - ButtonActive = 23 - # Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem - Header = 24 - HeaderHovered = 25 - HeaderActive = 26 - Separator = 27 - SeparatorHovered = 28 - SeparatorActive = 29 - # Resize grip in lower-right and lower-left corners of windows. - ResizeGrip = 30 - ResizeGripHovered = 31 - ResizeGripActive = 32 - # TabItem in a TabBar - Tab = 33 - TabHovered = 34 - TabActive = 35 - TabUnfocused = 36 - TabUnfocusedActive = 37 - PlotLines = 38 - PlotLinesHovered = 39 - PlotHistogram = 40 - PlotHistogramHovered = 41 - # Table header background - TableHeaderBg = 42 - # Table outer and header borders (prefer using Alpha=1.0 here) - TableBorderStrong = 43 - # Table inner borders (prefer using Alpha=1.0 here) - TableBorderLight = 44 - # Table row background (even rows) - TableRowBg = 45 - # Table row background (odd rows) - TableRowBgAlt = 46 - TextSelectedBg = 47 - # Rectangle highlighting a drop target - DragDropTarget = 48 - # Gamepad/keyboard: current highlighted item - NavHighlight = 49 - # Highlight window when using CTRL+TAB + Text = 0 + TextDisabled = 1 + WindowBg = 2 + ChildBg = 3 + PopupBg = 4 + Border = 5 + BorderShadow = 6 + FrameBg = 7 + FrameBgHovered = 8 + FrameBgActive = 9 + TitleBg = 10 + TitleBgActive = 11 + TitleBgCollapsed = 12 + MenuBarBg = 13 + ScrollbarBg = 14 + ScrollbarGrab = 15 + ScrollbarGrabHovered = 16 + ScrollbarGrabActive = 17 + CheckMark = 18 + SliderGrab = 19 + SliderGrabActive = 20 + Button = 21 + ButtonHovered = 22 + ButtonActive = 23 + Header = 24 + HeaderHovered = 25 + HeaderActive = 26 + Separator = 27 + SeparatorHovered = 28 + SeparatorActive = 29 + ResizeGrip = 30 + ResizeGripHovered = 31 + ResizeGripActive = 32 + Tab = 33 + TabHovered = 34 + TabActive = 35 + TabUnfocused = 36 + TabUnfocusedActive = 37 + PlotLines = 38 + PlotLinesHovered = 39 + PlotHistogram = 40 + PlotHistogramHovered = 41 + TableHeaderBg = 42 + TableBorderStrong = 43 + TableBorderLight = 44 + TableRowBg = 45 + TableRowBgAlt = 46 + TextSelectedBg = 47 + DragDropTarget = 48 + NavHighlight = 49 NavWindowingHighlight = 50 - # Darken/colorize entire screen behind the CTRL+TAB window list, when active - NavWindowingDimBg = 51 - # Darken/colorize entire screen behind a modal window, when one is active - ModalWindowDimBg = 52 + NavWindowingDimBg = 51 + ModalWindowDimBg = 52 end alias TopLevel::ImGuiCol = ImGui::ImGuiCol - # [enum ImGuiStyleVar_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1593) enum ImGuiStyleVar - # float Alpha - Alpha = 0 - # float DisabledAlpha - DisabledAlpha = 1 - # ImVec2 WindowPadding - WindowPadding = 2 - # float WindowRounding - WindowRounding = 3 - # float WindowBorderSize - WindowBorderSize = 4 - # ImVec2 WindowMinSize - WindowMinSize = 5 - # ImVec2 WindowTitleAlign - WindowTitleAlign = 6 - # float ChildRounding - ChildRounding = 7 - # float ChildBorderSize - ChildBorderSize = 8 - # float PopupRounding - PopupRounding = 9 - # float PopupBorderSize - PopupBorderSize = 10 - # ImVec2 FramePadding - FramePadding = 11 - # float FrameRounding - FrameRounding = 12 - # float FrameBorderSize - FrameBorderSize = 13 - # ImVec2 ItemSpacing - ItemSpacing = 14 - # ImVec2 ItemInnerSpacing - ItemInnerSpacing = 15 - # float IndentSpacing - IndentSpacing = 16 - # ImVec2 CellPadding - CellPadding = 17 - # float ScrollbarSize - ScrollbarSize = 18 - # float ScrollbarRounding - ScrollbarRounding = 19 - # float GrabMinSize - GrabMinSize = 20 - # float GrabRounding - GrabRounding = 21 - # float TabRounding - TabRounding = 22 - # ImVec2 ButtonTextAlign - ButtonTextAlign = 23 - # ImVec2 SelectableTextAlign + Alpha = 0 + DisabledAlpha = 1 + WindowPadding = 2 + WindowRounding = 3 + WindowBorderSize = 4 + WindowMinSize = 5 + WindowTitleAlign = 6 + ChildRounding = 7 + ChildBorderSize = 8 + PopupRounding = 9 + PopupBorderSize = 10 + FramePadding = 11 + FrameRounding = 12 + FrameBorderSize = 13 + ItemSpacing = 14 + ItemInnerSpacing = 15 + IndentSpacing = 16 + CellPadding = 17 + ScrollbarSize = 18 + ScrollbarRounding = 19 + GrabMinSize = 20 + GrabRounding = 21 + TabRounding = 22 + ButtonTextAlign = 23 SelectableTextAlign = 24 end alias TopLevel::ImGuiStyleVar = ImGui::ImGuiStyleVar - # [enum ImGuiButtonFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1625) @[Flags] enum ImGuiButtonFlags - None = 0 - # React on left mouse button (default) - MouseButtonLeft = 1 << 0 - # React on right mouse button - MouseButtonRight = 1 << 1 - # React on center mouse button + None = 0 + MouseButtonLeft = 1 << 0 + MouseButtonRight = 1 << 1 MouseButtonMiddle = 1 << 2 MouseButtonMask_ = MouseButtonLeft | MouseButtonRight | MouseButtonMiddle MouseButtonDefault_ = MouseButtonLeft end alias TopLevel::ImGuiButtonFlags = ImGui::ImGuiButtonFlags - # [enum ImGuiColorEditFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1638) @[Flags] enum ImGuiColorEditFlags - None = 0 - # ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer). - NoAlpha = 1 << 1 - # ColorEdit: disable picker when clicking on color square. - NoPicker = 1 << 2 - # ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. - NoOptions = 1 << 3 - # ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs) - NoSmallPreview = 1 << 4 - # ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square). - NoInputs = 1 << 5 - # ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. - NoTooltip = 1 << 6 - # ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). - NoLabel = 1 << 7 - # ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead. - NoSidePreview = 1 << 8 - # ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. - NoDragDrop = 1 << 9 - # ColorButton: disable border (which is enforced by default) - NoBorder = 1 << 10 - # ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. - AlphaBar = 1 << 16 - # ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. - AlphaPreview = 1 << 17 - # ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. + None = 0 + NoAlpha = 1 << 1 + NoPicker = 1 << 2 + NoOptions = 1 << 3 + NoSmallPreview = 1 << 4 + NoInputs = 1 << 5 + NoTooltip = 1 << 6 + NoLabel = 1 << 7 + NoSidePreview = 1 << 8 + NoDragDrop = 1 << 9 + NoBorder = 1 << 10 + AlphaBar = 1 << 16 + AlphaPreview = 1 << 17 AlphaPreviewHalf = 1 << 18 - # (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). - HDR = 1 << 19 - # [Display] - # ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. - DisplayRGB = 1 << 20 - # [Display] - # " - DisplayHSV = 1 << 21 - # [Display] - # " - DisplayHex = 1 << 22 - # [DataType] - # ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. - Uint8 = 1 << 23 - # [DataType] - # ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. - Float = 1 << 24 - # [Picker] - # ColorPicker: bar for Hue, rectangle for Sat/Value. - PickerHueBar = 1 << 25 - # [Picker] - # ColorPicker: wheel for Hue, triangle for Sat/Value. - PickerHueWheel = 1 << 26 - # [Input] - # ColorEdit, ColorPicker: input and output data in RGB format. - InputRGB = 1 << 27 - # [Input] - # ColorEdit, ColorPicker: input and output data in HSV format. - InputHSV = 1 << 28 - DefaultOptions_ = Uint8 | DisplayRGB | InputRGB | PickerHueBar - DisplayMask_ = DisplayRGB | DisplayHSV | DisplayHex - DataTypeMask_ = Uint8 | Float - PickerMask_ = PickerHueWheel | PickerHueBar - InputMask_ = InputRGB | InputHSV + HDR = 1 << 19 + DisplayRGB = 1 << 20 + DisplayHSV = 1 << 21 + DisplayHex = 1 << 22 + Uint8 = 1 << 23 + Float = 1 << 24 + PickerHueBar = 1 << 25 + PickerHueWheel = 1 << 26 + InputRGB = 1 << 27 + InputHSV = 1 << 28 + DefaultOptions_ = Uint8 | DisplayRGB | InputRGB | PickerHueBar + DisplayMask_ = DisplayRGB | DisplayHSV | DisplayHex + DataTypeMask_ = Uint8 | Float + PickerMask_ = PickerHueWheel | PickerHueBar + InputMask_ = InputRGB | InputHSV end alias TopLevel::ImGuiColorEditFlags = ImGui::ImGuiColorEditFlags - # [enum ImGuiSliderFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1683) @[Flags] enum ImGuiSliderFlags - None = 0 - # Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds. - AlwaysClamp = 1 << 4 - # Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits. - Logarithmic = 1 << 5 - # Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits) + None = 0 + AlwaysClamp = 1 << 4 + Logarithmic = 1 << 5 NoRoundToFormat = 1 << 6 - # Disable CTRL+Click or Enter key allowing to input text directly into the widget - NoInput = 1 << 7 - # [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. - InvalidMask_ = 0x7000000F + NoInput = 1 << 7 + InvalidMask_ = 0x7000000F end alias TopLevel::ImGuiSliderFlags = ImGui::ImGuiSliderFlags - # [enum ImGuiMouseButton_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1700) enum ImGuiMouseButton Left = 0 Right = 1 @@ -1100,41 +706,26 @@ module ImGui end alias TopLevel::ImGuiMouseButton = ImGui::ImGuiMouseButton - # [enum ImGuiMouseCursor_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1710) enum ImGuiMouseCursor - None = -1 - Arrow = 0 - # When hovering over InputText, etc. - TextInput = 1 - # (Unused by Dear ImGui functions) - ResizeAll = 2 - # When hovering over an horizontal border - ResizeNS = 3 - # When hovering over a vertical border or a column - ResizeEW = 4 - # When hovering over the bottom-left corner of a window - ResizeNESW = 5 - # When hovering over the bottom-right corner of a window - ResizeNWSE = 6 - # (Unused by Dear ImGui functions. Use for e.g. hyperlinks) - Hand = 7 - # When hovering something with disallowed interaction. Usually a crossed circle. - NotAllowed = 8 + None = -1 + Arrow = 0 + TextInput = 1 + ResizeAll = 2 + ResizeNS = 3 + ResizeEW = 4 + ResizeNESW = 5 + ResizeNWSE = 6 + Hand = 7 + NotAllowed = 8 end alias TopLevel::ImGuiMouseCursor = ImGui::ImGuiMouseCursor - # [enum ImGuiCond_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L1728) enum ImGuiCond - # No condition (always set the variable), same as _Always - None = 0 - # No condition (always set the variable) - Always = 1 << 0 - # Set the variable once per runtime session (only the first call will succeed) - Once = 1 << 1 - # Set the variable if the object/window has no persistently saved data (no entry in .ini file) + None = 0 + Always = 1 << 0 + Once = 1 << 1 FirstUseEver = 1 << 2 - # Set the variable if the object/window is appearing after being hidden/inactive (or the first time) - Appearing = 1 << 3 + Appearing = 1 << 3 end alias TopLevel::ImGuiCond = ImGui::ImGuiCond @@ -1212,45 +803,32 @@ module ImGui alias TopLevel::ImDrawChannel = ImGui::ImDrawChannel - # [enum ImDrawFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2467) @[Flags] enum ImDrawFlags - None = 0 - # PathStroke(), AddPolyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason) - Closed = 1 << 0 - # AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners). Was 0x01. - RoundCornersTopLeft = 1 << 4 - # AddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners). Was 0x02. - RoundCornersTopRight = 1 << 5 - # AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners). Was 0x04. - RoundCornersBottomLeft = 1 << 6 - # AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding > 0.0f, we default to all corners). Wax 0x08. + None = 0 + Closed = 1 << 0 + RoundCornersTopLeft = 1 << 4 + RoundCornersTopRight = 1 << 5 + RoundCornersBottomLeft = 1 << 6 RoundCornersBottomRight = 1 << 7 - # AddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag! - RoundCornersNone = 1 << 8 - RoundCornersTop = RoundCornersTopLeft | RoundCornersTopRight - RoundCornersBottom = RoundCornersBottomLeft | RoundCornersBottomRight - RoundCornersLeft = RoundCornersBottomLeft | RoundCornersTopLeft - RoundCornersRight = RoundCornersBottomRight | RoundCornersTopRight - RoundCornersAll = RoundCornersTopLeft | RoundCornersTopRight | RoundCornersBottomLeft | RoundCornersBottomRight - # Default to ALL corners if none of the _RoundCornersXX flags are specified. - RoundCornersDefault_ = RoundCornersAll - RoundCornersMask_ = RoundCornersAll | RoundCornersNone + RoundCornersNone = 1 << 8 + RoundCornersTop = RoundCornersTopLeft | RoundCornersTopRight + RoundCornersBottom = RoundCornersBottomLeft | RoundCornersBottomRight + RoundCornersLeft = RoundCornersBottomLeft | RoundCornersTopLeft + RoundCornersRight = RoundCornersBottomRight | RoundCornersTopRight + RoundCornersAll = RoundCornersTopLeft | RoundCornersTopRight | RoundCornersBottomLeft | RoundCornersBottomRight + RoundCornersDefault_ = RoundCornersAll + RoundCornersMask_ = RoundCornersAll | RoundCornersNone end alias TopLevel::ImDrawFlags = ImGui::ImDrawFlags - # [enum ImDrawListFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2487) @[Flags] enum ImDrawListFlags - None = 0 - # Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) - AntiAliasedLines = 1 << 0 - # Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). + None = 0 + AntiAliasedLines = 1 << 0 AntiAliasedLinesUseTex = 1 << 1 - # Enable anti-aliased edge around filled shapes (rounded rectangles, circles). - AntiAliasedFill = 1 << 2 - # Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. - AllowVtxOffset = 1 << 3 + AntiAliasedFill = 1 << 2 + AllowVtxOffset = 1 << 3 end alias TopLevel::ImDrawListFlags = ImGui::ImDrawListFlags @@ -1285,29 +863,21 @@ module ImGui alias TopLevel::ImFontGlyphRangesBuilder = ImGui::ImFontGlyphRangesBuilder - # [enum ImFontAtlasFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2724) @[Flags] enum ImFontAtlasFlags - None = 0 - # Don't round the height to next power of two + None = 0 NoPowerOfTwoHeight = 1 << 0 - # Don't build software mouse cursors into the atlas (save a little texture memory) - NoMouseCursors = 1 << 1 - # Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). - NoBakedLines = 1 << 2 + NoMouseCursors = 1 << 1 + NoBakedLines = 1 << 2 end alias TopLevel::ImFontAtlasFlags = ImGui::ImFontAtlasFlags - # [enum ImGuiViewportFlags_](https://github.com/ocornut/imgui/blob/v1.88/imgui.h#L2906) @[Flags] enum ImGuiViewportFlags - None = 0 - # Represent a Platform Window - IsPlatformWindow = 1 << 0 - # Represent a Platform Monitor (unused yet) + None = 0 + IsPlatformWindow = 1 << 0 IsPlatformMonitor = 1 << 1 - # Platform Window: is created/managed by the application (rather than a dear imgui backend) - OwnedByApp = 1 << 2 + OwnedByApp = 1 << 2 end alias TopLevel::ImGuiViewportFlags = ImGui::ImGuiViewportFlags diff --git a/tools/build_docs.sh b/tools/build_docs.sh deleted file mode 100755 index bfa5ede..0000000 --- a/tools/build_docs.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -set -ex - -cd "$(dirname "$0")/.." - -rm -rf docs - -crystal doc --project-name=crystal-imgui --project-version='' --source-refname=master - -cd docs - -find . -type f -exec sed -i -r -e 's,,,' {} \; - -cat << EOF > index.html - - - - - Redirecting... - - - - Redirecting... - - -EOF