Added the Dead ImGUI Combo (dropdown) component. It can be used in two ways:
local JEDI = { "Luke", "Anakin", "Yoda" }
-- this is the old way of creating combo boxes
-- it still exists in the ImGUI API since it's a quick way ti create a combo box
local changed, jedi = imgui.combo("Jedi##array", self.selected_jedi or 1, JEDI)
if changed then
self.selected_jedi = jedi
end
-- new way of creating combo boxes with a begin and end function
if imgui.begin_combo("Jedi##selectable", "Select a Jedi") then
for i=1,#JEDI do
if imgui.selectable(JEDI[i], i == (self.selected_jedi or 1)) then
self.selected_jedi = i
end
end
imgui.end_combo()
end
Note: The ##foobar
at the end of the label is a way to give two components the same label (eg “Jedi”) and at the same time give each component a unique id for the internal state handling done in Dear ImGUI.