mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Move examples to new collections
This commit is contained in:
37
example/examples/general/texts/texts.collection
Normal file
37
example/examples/general/texts/texts.collection
Normal file
@@ -0,0 +1,37 @@
|
||||
name: "texts"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
data: "components {\n"
|
||||
" id: \"texts\"\n"
|
||||
" component: \"/example/examples/general/texts/texts.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
|
||||
}
|
||||
}
|
1070
example/examples/general/texts/texts.gui
Normal file
1070
example/examples/general/texts/texts.gui
Normal file
File diff suppressed because it is too large
Load Diff
72
example/examples/general/texts/texts.gui_script
Normal file
72
example/examples/general/texts/texts.gui_script
Normal file
@@ -0,0 +1,72 @@
|
||||
local druid = require("druid.druid")
|
||||
|
||||
local pivots = {
|
||||
gui.PIVOT_CENTER,
|
||||
gui.PIVOT_N,
|
||||
gui.PIVOT_NE,
|
||||
gui.PIVOT_E,
|
||||
gui.PIVOT_SE,
|
||||
gui.PIVOT_S,
|
||||
gui.PIVOT_SW,
|
||||
gui.PIVOT_W,
|
||||
gui.PIVOT_NW
|
||||
}
|
||||
|
||||
|
||||
local function setup_texts(self)
|
||||
self.druid:new_text("text_inline")
|
||||
self.druid:new_text("text_multiline")
|
||||
local anchoring = self.druid:new_text("text_anchoring")
|
||||
self.druid:new_text("text_no_adjust", "Without adjust size", true)
|
||||
self.druid:new_lang_text("text_locale", "ui_text_example")
|
||||
|
||||
local big_text = "Check max size"
|
||||
local width = self.druid:new_text("text_max_width", big_text)
|
||||
local height = self.druid:new_text("text_max_height", big_text)
|
||||
|
||||
local pivot_index = 1
|
||||
timer.delay(0.3, true, function()
|
||||
anchoring:set_pivot(pivots[pivot_index])
|
||||
|
||||
pivot_index = pivot_index + 1
|
||||
if pivot_index > #pivots then
|
||||
pivot_index = 1
|
||||
end
|
||||
end)
|
||||
|
||||
timer.delay(0.2, true, function()
|
||||
big_text = big_text .. " max"
|
||||
width:set_to(big_text)
|
||||
height:set_to(big_text)
|
||||
|
||||
if #big_text > 50 then
|
||||
big_text = "Check max size"
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function init(self)
|
||||
self.druid = druid.new(self)
|
||||
setup_texts(self)
|
||||
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
|
Reference in New Issue
Block a user