Skip to content

Commit 2891124

Browse files
committed
Update sol_imgui documentation with changes
1 parent e4f349a commit 2891124

File tree

1 file changed

+54
-17
lines changed

1 file changed

+54
-17
lines changed

src/sol_imgui/README.md

+54-17
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ You can find all the supported functions and overloads below.
3232
## Child Windows
3333
```lua
3434
-- ImGui.BeginChild(...)
35-
-- Parameters: text (name), float (size_x) [O], float (size_y) [O], bool (border) [O], ImGuiWindowFlags (flags) [O]
35+
-- Parameters: text (name), float (size_x) [O], float (size_y) [O], ImGuiChildFlags (child_flags) [O], ImGuiWindowFlags (window_flags) [O]
3636
-- Returns: bool (shouldDraw)
3737
-- Overloads
3838
shouldDraw = ImGui.BeginChild("Name")
3939
shouldDraw = ImGui.BeginChild("Name", 100)
4040
shouldDraw = ImGui.BeginChild("Name", 100, 200)
41+
shouldDraw = ImGui.BeginChild("Name", 100, 200, ImGuiChildFlags.Border)
42+
shouldDraw = ImGui.BeginChild("Name", 100, 200, ImGuiChildFlags.Border, ImGuiWindowFlags.NoMove)
43+
44+
-- The following will still work, but are considered deprecated and the newer overloads above should be used.
45+
-- Parameters: text (name), float (size_x) [O], float (size_y) [O], bool (border) [O], ImGuiWindowFlags (flags) [O]
4146
shouldDraw = ImGui.BeginChild("Name", 100, 200, true)
4247
shouldDraw = ImGui.BeginChild("Name", 100, 200, true, ImGuiWindowFlags.NoMove)
4348

@@ -272,6 +277,13 @@ You can find all the supported functions and overloads below.
272277
ImGui.PopStyleVar()
273278
ImGui.PopStyleVar(2)
274279

280+
-- ImGui.PushItemFlag(...)
281+
-- Parameters: int/ImGuiItemFlags (option), bool (enabled)
282+
ImGui.PushItemFlag(ImGuiItemFlags.NoTabStop, true)
283+
284+
-- ImGui.PopItemFlag()
285+
ImGui.PopItemFlag()
286+
275287
-- ImGui.GetStyleColorVec4(...)
276288
-- Parameters: ImGuiCol (idx)
277289
-- Returns: float (color_r), float (color_g), float (color_b), float (color_a)
@@ -321,19 +333,28 @@ You can find all the supported functions and overloads below.
321333
-- ImGui.PopTextWrapPos()
322334
ImGui.PopTextWrapPos()
323335

324-
-- ImGui.PushAllowKeyboardFocus(...)
325-
-- Parameters: bool (allow_keyboard_focus)
326-
ImGui.PushAllowKeyboardFocus(true)
336+
-- ImGui.PushTabStop(...)
337+
-- Parameters: bool (tab_stop)
338+
ImGui.PushTabStop(true)
327339

328-
-- ImGui.PopAllowKeyboardFocus()
329-
ImGui.PopAllowKeyboardFocus()
340+
-- ImGui.PopTabStop()
341+
ImGui.PopTabStop()
330342

331343
-- ImGui.PushButtonRepeat(...)
332344
-- Parameters: bool (repeat)
333345
ImGui.PushButtonRepeat(true)
334346

335347
-- ImGui.PopButtonRepeat()
336348
ImGui.PopButtonRepeat()
349+
350+
-- DEPRECATED
351+
-- ImGui.PushAllowKeyboardFocus(...)
352+
-- Parameters: bool (allow_keyboard_focus)
353+
ImGui.PushAllowKeyboardFocus(true)
354+
355+
-- DEPRECATED
356+
-- ImGui.PopAllowKeyboardFocus()
357+
ImGui.PopAllowKeyboardFocus()
337358
```
338359

339360
## Cursor / Layout
@@ -1009,6 +1030,7 @@ selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true)
10091030

10101031
## Tooltips
10111032
```lua
1033+
-- returns bool (n/a) [value will always be true in current implementations]
10121034
-- ImGui.BeginTooltip()
10131035
ImGui.BeginTooltip()
10141036

@@ -1351,6 +1373,10 @@ selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true)
13511373
-- Returns: float (x), float (y)
13521374
x, y = ImGui.GetItemRectSize()
13531375

1376+
-- ImGuiSetNextItemAllowOverlap()
1377+
ImGui.ImGuiSetNextItemAllowOverlap()
1378+
1379+
-- DEPRECATED
13541380
-- ImGui.SetItemAllowOverlap()
13551381
ImGui.SetItemAllowOverlap()
13561382
```
@@ -1378,6 +1404,7 @@ selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true)
13781404
-- Returns: text (style_color_name)
13791405
style_color_name = ImGui.GetStyleColorName(ImGuiCol.Text)
13801406

1407+
-- DEPRECATED (use BeginChild() with ImGuiChildFlags.FrameStyle!)
13811408
-- ImGui.BeginChildFrame(...)
13821409
-- Parameters: unsigned int (id), float (size_x), float (size_y), ImGuiWindowFlags (flags) [O]
13831410
-- Returns: bool (open)
@@ -1426,33 +1453,38 @@ selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true)
14261453

14271454
## Inputs Utilities: Keyboard
14281455
```lua
1429-
-- ImGui.GetKeyIndex(...)
1430-
-- Parameters: ImGuiKey (key)
1431-
-- Returns: int (index)
1432-
index = ImGui.GetKeyIndex(ImGuiKey.Tab)
1433-
14341456
-- ImGui.IsKeyDown(...)
1435-
-- Parameters: int (key_index)
1457+
-- Parameters: int/ImGuiKey (key_index)
14361458
-- Returns: bool (down)
14371459
down = ImGui.IsKeyDown(0)
1460+
down = ImGui.IsKeyDown(ImGuiKey.Z)
14381461

14391462
-- ImGui.IsKeyPressed(...)
1440-
-- Parameters: int (key_index), bool (repeat) [O]
1463+
-- Parameters: int/ImGuiKey (key_index), bool (repeat) [O]
14411464
-- Returns: bool (pressed)
14421465
-- Overloads
14431466
pressed = ImGui.IsKeyPressed(0)
1467+
pressed = ImGui.IsKeyPressed(ImGuiKey.Z)
14441468
pressed = ImGui.IsKeyPressed(0, true)
1469+
pressed = ImGui.IsKeyPressed(ImGuiKey.Z, true)
14451470

14461471
-- ImGui.IsKeyReleased(...)
1447-
-- Parameters: int (key_index)
1472+
-- Parameters: int/ImGuiKey (key_index)
14481473
-- Returns: bool (released)
14491474
released = ImGui.IsKeyReleased(0)
1475+
released = ImGui.IsKeyReleased(ImGuiKey.Z)
14501476

14511477
-- ImGui.GetKeyPressedAmount(...)
1452-
-- Parameters: int (key_index), float (repeat_delay), float (rate)
1478+
-- Parameters: int/ImGuiKey (key_index), float (repeat_delay), float (rate)
14531479
-- Returns: int (pressed_amount)
14541480
pressed_amount = ImGui.GetKeyPressedAmount(0, 0.5, 5)
1455-
1481+
pressed_amount = ImGui.GetKeyPressedAmount(ImGuiKey.Z, 0.5, 5)
1482+
1483+
-- ImGui.SetNextFrameWantCaptureKeyboard(...)
1484+
-- Parameters bool (want_capture_keyboard_valvue)
1485+
ImGui.SetNextFrameWantCaptureKeyboard(true)
1486+
1487+
-- DEPRECATED (use ImGui.SetNextFrameWantCaptureKeyboard())
14561488
-- ImGui.CaptureKeyboardFromApp(...)
14571489
-- Parameters: bool (want_capture_keyboard_value) [O]
14581490
-- Overloads
@@ -1530,7 +1562,12 @@ selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true)
15301562
-- ImGui.SetMouseCursor(...)
15311563
-- Parameters: ImGuiMouseCursor (cursor_type)
15321564
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand)
1533-
1565+
1566+
-- ImGui.SetNextFrameWantCaptureMouse(...)
1567+
-- Parameters: bool (want_capture_mouse_value)
1568+
ImGui.SetNextFrameWantCaptureMouse(true)
1569+
1570+
-- DEPRECATED (Use ImGui.SetNextFrameWantCaptureMouse())
15341571
-- ImGui.CaptureMouseFromApp()
15351572
-- Parameters: bool (want_capture_mouse_value) [O]
15361573
-- Overloads

0 commit comments

Comments
 (0)