> For the complete documentation index, see [llms.txt](https://sakura-9.gitbook.io/sakura/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sakura-9.gitbook.io/sakura/documentation/namespaces/imgui-menu.md).

# ImGui (Menu)

Contains all functions from ImGui namespace

Remember to call these functions in **SAKURA\_MENU\_RENDER** callback.

```lua
-- Creates an Menu tab item with a specified title and associates it with a Lua function to call.
-- Parameters:
--     title: the title of the tab item to create.
--     function: the Lua function to call when the tab item is selected.
ImGui.Menu(title, function)
```

<pre class="language-lua"><code class="lang-lua">-- Creates an ImGui window with a specified title and flags and associates it with a Lua function to call.
-- Parameters:
--     title: the title of the window to create.
--     <a data-footnote-ref href="#user-content-fn-1">flags</a>: the ImGui window flags to apply.
--     function: the Lua function to call when the window is opened.
ImGui.Window(title, <a data-footnote-ref href="#user-content-fn-1">flags</a>, function)
</code></pre>

```lua
-- Adds a new line of text to the current ImGui window.
-- Parameters:
--     text: the text to display.
ImGui.Text(text)
```

<pre class="language-lua"><code class="lang-lua">-- Creates a clickable button widget in the current ImGui window.
-- Parameters:
    -- text: the text to display on the button.
-- Returns:
<strong>    -- True if the button was clicked, false otherwise.
</strong><strong>ImGui.Button(text)
</strong></code></pre>

```lua
-- Displays a checkbox with a label in the current ImGui window.
-- Parameters:
--     text: the text to be displayed as the checkbox label
--     value: the current value of the checkbox (true for checked, false for unchecked)
-- Returns:
--     The new value of the checkbox after the user interaction.
ImGui.Checkbox(text, value)
```

```lua
-- Puts the next widget on the same line as the previous one.
ImGui.SameLine()
```

```lua
-- Creates a combo box widget that allows the user to select an item from a list of options.
-- Parameters:
--     text: the label text to display next to the combo box.
--     value: the current value of the combo box.
--     options: a null-terminated string containing the options, separated by '\0' characters.
-- Returns:
--     The selected value of the combo box.
ImGui.Combo(text, value, options)
```

```lua
-- Display an integer slider control and return its value.
-- Parameters:
--     text: the label next to the slider control.
--     value: the current integer value of the slider.
--     minimum: the minimum integer value that the slider can be set to.
--     maximum: the maximum integer value that the slider can be set to.
-- Returns:
--     The new integer value of the slider.
ImGui.Slider(text, value, minimum, maximum)
```

```lua
-- Creates a key binding UI element for a given text label and key value.
-- Parameters:
--     text: string label displayed next to the key binding element,
--     key: integer representing the default key bind value.
-- Returns:
--     The integer key value selected by the user through the UI element.
ImGui.KeyBind(text, key)
```

```lua
-- Retrieves the current size of the ImGui window in screen coordinates.
-- Returns:
--     An ImVec2 struct containing the width and height of the window in screen coordinates.
ImGui.GetWindowSize()
```

[^1]: Check the window flags in [ImGui Window Flags](/sakura/documentation/variables/imgui-window-flags.md)
