Update layout component, add layout fit example

This commit is contained in:
Insality
2022-09-09 20:45:08 +03:00
parent 25a17773e7
commit ba383261b0
10 changed files with 1472 additions and 76 deletions

View File

@@ -62,6 +62,10 @@ images {
image: "/example/assets/images/buttons/button_blue.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/logo.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
margin: 0
extrude_borders: 2
inner_padding: 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -162,6 +162,9 @@ local function init_lobby(self)
self.lobby_grid:add(get_button(self, "Reinit data", "data_list_reinit_data", "/data_list/reinit_data/reinit_data.gui_script"))
self.lobby_grid:add(get_button(self, "With component", "data_list_with_component", "/data_list/with_component/with_component.gui_script"))
self.lobby_grid:add(get_title(self, "Layouts"))
self.lobby_grid:add(get_button(self, "Layout fit", "layout_fit", "/custom/layout_fit/layout_fit.gui_script"))
self.lobby_grid:add(get_title(self, "Custom components"))
self.lobby_grid:add(get_button(self, "Rich Input", "custom_rich_input", "/custom/rich_input/rich_input.gui_script"))
self.lobby_grid:add(get_button(self, "Pin Knob", "custom_pin_knob", "/custom/pin_knob/pin_knob.gui_script"))

View File

@@ -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

View File

@@ -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

View 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
}
}

File diff suppressed because it is too large Load Diff

View 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