Add checkboxes example

This commit is contained in:
Insality
2022-03-11 01:06:13 +02:00
parent fbe5db7875
commit 02601c142d
6 changed files with 1601 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
name: "checkboxes"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"checkboxes\"\n"
" component: \"/example/examples/general/checkboxes/checkboxes.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
local druid = require("druid.druid")
local function on_single_checkbox(self, value)
print("Single checkbox callback. Value:", value)
end
function init(self)
self.druid = druid.new(self)
local single_checkbox = self.druid:new_checkbox("checkbox/check", on_single_checkbox)
local radio_group = self.druid:new_radio_group(
{"radio1/check", "radio2/check", "radio3/check"},
nil,
{"radio1/back", "radio2/back", "radio3/back"}) -- last row optional. It's input node (default - click node)
radio_group:set_state(2, true)
local checkbox_group = self.druid:new_checkbox_group(
{"checkbox1/check", "checkbox2/check", "checkbox3/check"},
nil,
{"checkbox1/back", "checkbox2/back", "checkbox3/back"}) -- last row optional. It's input node (default - click node)
checkbox_group:set_state({true, false, true}, true)
end
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end