Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 9c93e07

Browse files
integer functions
1 parent 68a79bd commit 9c93e07

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

LuaDox/stubs.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ function ofs.Button(txt) end
9595
-- end
9696
function ofs.Input(txt, value, stepSize) end
9797

98+
--- Create an input field
99+
-- @tparam string txt
100+
-- @tparam string|number value
101+
-- @tparam number|nil stepSize only applies to numeric inputs,
102+
-- @treturn number value
103+
-- @treturn bool valueChanged
104+
function ofs.InputInt(txt, value, stepSize) end
105+
98106
--- Create a numeric drag input
99107
-- @tparam string txt
100108
-- @tparam number value
@@ -103,6 +111,14 @@ function ofs.Input(txt, value, stepSize) end
103111
-- @treturn bool valueChanged
104112
function ofs.Drag(txt, value, stepSize) end
105113

114+
--- Create a numeric integer drag input
115+
-- @tparam string txt
116+
-- @tparam number value
117+
-- @tparam number|nil stepSize
118+
-- @treturn number value
119+
-- @treturn bool valueChanged
120+
function ofs.DragInt(txt, value, stepSize) end
121+
106122
--- Create a numeric slider
107123
-- @tparam string txt
108124
-- @tparam number value
@@ -112,6 +128,16 @@ function ofs.Drag(txt, value, stepSize) end
112128
-- @treturn bool valueChanged
113129
function ofs.Slider(txt, value, min, max) end
114130

131+
132+
--- Create a numeric integer slider
133+
-- @tparam string txt
134+
-- @tparam number value
135+
-- @tparam number min
136+
-- @tparam number max
137+
-- @treturn number value
138+
-- @treturn bool valueChanged
139+
function ofs.SliderInt(txt, value, min, max) end
140+
115141
--- Create a checkbox
116142
-- @tparam string txt
117143
-- @tparam bool checked

src/lua/api/OFS_LuaImGuiAPI.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,34 @@ OFS_ImGuiAPI::OFS_ImGuiAPI(sol::usertype<class OFS_ExtensionAPI>& ofs) noexcept
99
ofs.set_function("Input",
1010
sol::overload(
1111
OFS_ImGuiAPI::InputText,
12-
OFS_ImGuiAPI::InputIntWithoutStepSize,
13-
OFS_ImGuiAPI::InputInt,
1412
OFS_ImGuiAPI::InputNumberWithoutStepSize,
1513
OFS_ImGuiAPI::InputNumber
1614
)
1715
);
16+
17+
ofs.set_function("InputInt",
18+
sol::overload(
19+
OFS_ImGuiAPI::InputInt,
20+
OFS_ImGuiAPI::InputIntWithoutStepSize
21+
)
22+
);
23+
1824
ofs.set_function("Drag",
1925
sol::overload(
20-
OFS_ImGuiAPI::DragIntWithoutStepSize,
21-
OFS_ImGuiAPI::DragInt,
2226
OFS_ImGuiAPI::DragNumberWithoutStepSize,
2327
OFS_ImGuiAPI::DragNumber
2428
)
2529
);
26-
ofs.set_function("Slider",
30+
ofs.set_function("DragInt",
2731
sol::overload(
28-
OFS_ImGuiAPI::SliderInt,
29-
OFS_ImGuiAPI::SliderNumber
32+
OFS_ImGuiAPI::DragIntWithoutStepSize,
33+
OFS_ImGuiAPI::DragInt
3034
)
3135
);
36+
37+
ofs["Slider"] = OFS_ImGuiAPI::SliderNumber;
38+
ofs["SliderInt"] = OFS_ImGuiAPI::SliderInt;
39+
3240
ofs["Checkbox"] = OFS_ImGuiAPI::Checkbox;
3341
ofs["Combo"] = OFS_ImGuiAPI::Combo;
3442
ofs["SameLine"] = OFS_ImGuiAPI::SameLine;

0 commit comments

Comments
 (0)