Skip to content

Commit

Permalink
Added imgui.drag_float()
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Feb 3, 2025
1 parent 1b83482 commit 174f923
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 28 deletions.
144 changes: 125 additions & 19 deletions api.json
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@
{
"description": "",
"has_params": true,
"has_returns": false,
"has_returns": true,
"name": "begin_drag_drop_source",
"params": [
{
Expand All @@ -948,9 +948,14 @@
}
],
"params_string": "flags",
"returns": [],
"returns": [
{
"description": "",
"name": "result",
"type": "boolean"
}
],
"summary": "BeginDragDropSource",
"tresult": "boolean result",
"usage": null
},
{
Expand All @@ -966,12 +971,17 @@
{
"description": "",
"has_params": false,
"has_returns": false,
"has_returns": true,
"name": "begin_drag_drop_target",
"params": [],
"returns": [],
"returns": [
{
"description": "",
"name": "result",
"type": "boolean"
}
],
"summary": "BeginDragDropTarget",
"tresult": "boolean result",
"usage": null
},
{
Expand All @@ -987,7 +997,7 @@
{
"description": "",
"has_params": true,
"has_returns": false,
"has_returns": true,
"name": "set_drag_drop_payload",
"params": [
{
Expand All @@ -1002,15 +1012,20 @@
}
],
"params_string": "type,payload",
"returns": [],
"returns": [
{
"description": "",
"name": "result",
"type": "boolean"
}
],
"summary": "SetDragDropPayload",
"tresult": "boolean result",
"usage": null
},
{
"description": "",
"has_params": true,
"has_returns": false,
"has_returns": true,
"name": "accept_drag_drop_payload",
"params": [
{
Expand All @@ -1025,15 +1040,20 @@
}
],
"params_string": "type,flags",
"returns": [],
"returns": [
{
"description": "",
"name": "payload",
"type": "string"
}
],
"summary": "AcceptDragDropPayload",
"tresult": "string payload",
"usage": null
},
{
"description": "",
"has_params": true,
"has_returns": false,
"has_returns": true,
"name": "begin_combo",
"params": [
{
Expand All @@ -1048,9 +1068,14 @@
}
],
"params_string": "label,preview",
"returns": [],
"returns": [
{
"description": "",
"name": "result",
"type": "boolean"
}
],
"summary": "BeginCombo",
"tresult": "boolean result",
"usage": null
},
{
Expand Down Expand Up @@ -1343,11 +1368,92 @@
},
{
"description": "",
"has_params": false,
"has_returns": false,
"has_params": true,
"has_returns": true,
"name": "drag_float",
"params": [
{
"description": "",
"name": "label",
"type": "string"
},
{
"description": "",
"name": "value",
"type": "number"
},
{
"description": "",
"name": "speed",
"type": "number"
},
{
"description": "",
"name": "min",
"type": "number"
},
{
"description": "",
"name": "max",
"type": "number"
},
{
"description": "",
"name": "precision",
"type": "number"
}
],
"params_string": "label,value,speed,min,max,precision",
"returns": [
{
"description": "",
"name": "value",
"type": "number"
}
],
"summary": "DragFloat",
"usage": null
},
{
"description": "",
"has_params": true,
"has_returns": true,
"name": "slider_float",
"params": [],
"returns": [],
"params": [
{
"description": "",
"name": "label",
"type": "string"
},
{
"description": "",
"name": "value",
"type": "number"
},
{
"description": "",
"name": "min",
"type": "number"
},
{
"description": "",
"name": "max",
"type": "number"
},
{
"description": "",
"name": "precision",
"type": "number"
}
],
"params_string": "label,value,min,max,precision",
"returns": [
{
"description": "",
"name": "value",
"type": "number"
}
],
"summary": "SliderFloat",
"usage": null
},
Expand Down
43 changes: 42 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ BeginDragDropSource
PARAMS
* `flags` [`number`] -

RETURNS
* `result` [`boolean`] -


### end_drag_drop_source()
EndDragDropSource
Expand All @@ -403,6 +406,9 @@ EndDragDropSource
BeginDragDropTarget


RETURNS
* `result` [`boolean`] -


### end_drag_drop_target()
EndDragDropTarget
Expand All @@ -417,6 +423,9 @@ PARAMS
* `type` [`string`] -
* `payload` [`string`] -

RETURNS
* `result` [`boolean`] -


### accept_drag_drop_payload(type,flags)
AcceptDragDropPayload
Expand All @@ -426,6 +435,9 @@ PARAMS
* `type` [`string`] -
* `flags` [`number`] -

RETURNS
* `payload` [`string`] -


### begin_combo(label,preview)
BeginCombo
Expand All @@ -435,6 +447,9 @@ PARAMS
* `label` [`string`] -
* `preview` [`string`] -

RETURNS
* `result` [`boolean`] -


### end_combo()
EndCombo
Expand Down Expand Up @@ -575,10 +590,36 @@ InputFloat4



### slider_float()
### drag_float(label,value,speed,min,max,precision)
DragFloat


PARAMS
* `label` [`string`] -
* `value` [`number`] -
* `speed` [`number`] -
* `min` [`number`] -
* `max` [`number`] -
* `precision` [`number`] -

RETURNS
* `value` [`number`] -


### slider_float(label,value,min,max,precision)
SliderFloat


PARAMS
* `label` [`string`] -
* `value` [`number`] -
* `min` [`number`] -
* `max` [`number`] -
* `precision` [`number`] -

RETURNS
* `value` [`number`] -


### selectable()
Selectable
Expand Down
7 changes: 6 additions & 1 deletion example/tab2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ return function(self)
imgui.draw_progress(progress, -1, 0.0)
imgui.separator()

local changed, p = imgui.drag_float("drag float", self.drag_float or 0, 0.2, 0.0, 100.0)
if changed then
self.drag_float = p
end

local changed, p = imgui.slider_float("slider float", self.slider_float or 0, 0.0, 100.0)
if changed then
self.slider_float = p
end

imgui.push_id("first")
if imgui.button("Same name") then
pprint("first same button")
Expand Down
Loading

0 comments on commit 174f923

Please sign in to comment.