mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Update layout component, add layout fit example
This commit is contained in:
@@ -70,7 +70,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
x: 0.0
|
||||
y: 250.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -190,7 +190,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
x: 0.0
|
||||
y: 100.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -310,7 +310,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
x: 0.0
|
||||
y: -50.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -430,7 +430,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
x: 0.0
|
||||
y: -200.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
@@ -637,7 +637,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Layout Stretch by Y Anchor W"
|
||||
text: "Layout Stretch by X Anchor W"
|
||||
font: "game"
|
||||
id: "text_layout_stretch3"
|
||||
xanchor: XANCHOR_NONE
|
||||
|
@@ -9,7 +9,7 @@ function init(self)
|
||||
self.druid:new_layout("node_layout_stretch", const_druid.LAYOUT_MODE.STRETCH)
|
||||
self.druid:new_layout("node_layout_stretch_x", const_druid.LAYOUT_MODE.STRETCH_X)
|
||||
self.druid:new_layout("node_layout_stretch_y", const_druid.LAYOUT_MODE.STRETCH_Y)
|
||||
self.druid:new_layout("node_layout_stretch_y_anchor_w", const_druid.LAYOUT_MODE.STRETCH_Y)
|
||||
self.druid:new_layout("node_layout_stretch_y_anchor_w", const_druid.LAYOUT_MODE.STRETCH_X)
|
||||
end
|
||||
|
||||
|
||||
|
37
example/examples/layout/layout_fit/layout_fit.collection
Normal file
37
example/examples/layout/layout_fit/layout_fit.collection
Normal file
@@ -0,0 +1,37 @@
|
||||
name: "layout_fit"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
data: "components {\n"
|
||||
" id: \"layout_fit\"\n"
|
||||
" component: \"/example/examples/layout/layout_fit/layout_fit.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
|
||||
}
|
||||
}
|
1247
example/examples/layout/layout_fit/layout_fit.gui
Normal file
1247
example/examples/layout/layout_fit/layout_fit.gui
Normal file
File diff suppressed because it is too large
Load Diff
44
example/examples/layout/layout_fit/layout_fit.gui_script
Normal file
44
example/examples/layout/layout_fit/layout_fit.gui_script
Normal file
@@ -0,0 +1,44 @@
|
||||
local druid = require("druid.druid")
|
||||
local const_druid = require("druid.const")
|
||||
local layout = require("druid.extended.layout")
|
||||
|
||||
function init(self)
|
||||
druid.register("layout", layout)
|
||||
self.druid = druid.new(self)
|
||||
|
||||
self.druid:new_layout("node_zoom_test", const_druid.LAYOUT_MODE.STRETCH)
|
||||
:fit_into_window()
|
||||
|
||||
self.druid:new_layout("image_1", const_druid.LAYOUT_MODE.STRETCH)
|
||||
:fit_into_node(gui.get_node("back_1"))
|
||||
self.druid:new_layout("image_2", const_druid.LAYOUT_MODE.ZOOM_MAX)
|
||||
:fit_into_node(gui.get_node("back_2"))
|
||||
self.druid:new_layout("image_3", const_druid.LAYOUT_MODE.ZOOM_MIN)
|
||||
:fit_into_node(gui.get_node("back_3"))
|
||||
self.druid:new_layout("image_4", const_druid.LAYOUT_MODE.STRETCH_X)
|
||||
:fit_into_node(gui.get_node("back_4"))
|
||||
self.druid:new_layout("image_5", const_druid.LAYOUT_MODE.STRETCH_Y)
|
||||
:fit_into_node(gui.get_node("back_5"))
|
||||
self.druid:new_layout("image_6", const_druid.LAYOUT_MODE.FIT)
|
||||
:fit_into_node(gui.get_node("back_6"))
|
||||
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