feat(lua): much more complete imgui bindings, allow lua imgui callbacks from outside yimmenu classic tabs through gui.add_imgui(func) but also inside yimmenu classic tabs through tab:add_imgui(func) (#1736)

This commit is contained in:
Quentin
2023-07-17 14:55:42 +02:00
committed by GitHub
parent 0417fbf0f9
commit 664b5c6c40
18 changed files with 5294 additions and 11 deletions

View File

@ -0,0 +1,6 @@
# Class: raw_imgui_callback
## Inherit from 1 class: gui_element
Class for representing a raw imgui callback.

View File

@ -8,7 +8,7 @@ Class for gta script utils, the instance is usually given to you.
Yield execution.
**Exemple Usage:**
**Example Usage:**
```lua
script_util:yield()
```
@ -20,7 +20,7 @@ Sleep for the given amount of time, time is in milliseconds.
- **Parameters:**
- `ms` (integer): The amount of time in milliseconds that we will sleep for.
**Exemple Usage:**
**Example Usage:**
```lua
script_util:sleep(ms)
```

View File

@ -2,7 +2,7 @@
Class for representing a tab within the GUI.
## Functions (10)
## Functions (11)
### `clear()`
@ -134,4 +134,30 @@ Add a ImGui::InputText.
input_string = tab:add_input_string(name)
```
### `add_imgui(imgui_rendering)`
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
tab:add_imgui(function()
if ImGui.Begin("My Custom Window") then
if ImGui.Button("Label") then
script.run_in_fiber(function(script)
-- call natives in there
end)
end
ImGui.End()
end
end)
```
- **Parameters:**
- `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
tab:add_imgui(imgui_rendering)
```

View File

@ -766,7 +766,7 @@ Arg Count: 0
Arg Count: 0
### alwaysfullammo
Refills your ammo every tick
Refills your ammo every tick
Arg Count: 0
### incrdamage

1464
docs/lua/tables/ImGui.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Table containing functions for modifying the menu GUI.
## Functions (6)
## Functions (7)
### `get_tab(tab_name)`
@ -79,4 +79,30 @@ gui.show_error(title, message)
bool = gui.is_open()
```
### `add_imgui(imgui_rendering)`
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
gui.add_imgui(function()
if ImGui.Begin("My Custom Window") then
if ImGui.Button("Label") then
script.run_in_fiber(function(script)
-- call natives in there
end)
end
ImGui.End()
end
end)
```
- **Parameters:**
- `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
gui.add_imgui(imgui_rendering)
```

View File

@ -75,3 +75,4 @@ end)
script.run_in_fiber(func)
```

View File

@ -13,11 +13,12 @@ end)
For a complete list of available gui functions, please refer to the tab class documentation and the gui table documentation.
## Tab Count: 42
## Tab Count: 43
### `GUI_TAB_SELF`
### `GUI_TAB_WEAPONS`
### `GUI_TAB_TELEPORT`
### `GUI_TAB_CUSTOM_TELEPORT`
### `GUI_TAB_MOBILE`
### `GUI_TAB_OUTFIT_EDITOR`
### `GUI_TAB_OUTFIT_SLOTS`