Remove old examples

This commit is contained in:
Insality 2020-03-21 23:18:59 +03:00
parent 762620f710
commit 11b2120baa
55 changed files with 116 additions and 2995 deletions

View File

@ -1,4 +1,4 @@
font: "/example/kenney/assets/fonts/exo2.ttf"
font: "/example/assets/fonts/exo2.ttf"
material: "/builtins/fonts/font-df.material"
size: 40
antialias: 1

View File

Before

Width:  |  Height:  |  Size: 438 B

After

Width:  |  Height:  |  Size: 438 B

View File

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 585 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,79 @@
images {
image: "/example/assets/images/back/back_blue.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/back/back_gray.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/back/back_green.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/back/back_red.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/buttons/button_green.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/buttons/button_red.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/buttons/button_yellow.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/empty.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/progress/progress_back.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/progress/progress_fill_green.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/progress/progress_fill_red.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/progress/progress_fill_yellow.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/radio/check_back_circle.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/radio/check_back_square.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/radio/checkmark.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/radio/tick.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/slider/slider_back.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/slider/slider_move.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/assets/images/buttons/button_blue.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
margin: 0
extrude_borders: 2
inner_padding: 0

View File

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

View File

Before

Width:  |  Height:  |  Size: 471 B

After

Width:  |  Height:  |  Size: 471 B

View File

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 479 B

View File

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 458 B

View File

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 817 B

View File

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

View File

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

View File

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 293 B

View File

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

View File

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 897 B

View File

@ -1,79 +0,0 @@
name: "main"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"example\"\n"
" component: \"/example/example.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
}
}
embedded_instances {
id: "sounds"
data: "embedded_components {\n"
" id: \"click\"\n"
" type: \"sound\"\n"
" data: \"sound: \\\"/example/res/click.ogg\\\"\\n"
"looping: 0\\n"
"group: \\\"master\\\"\\n"
"gain: 0.4\\n"
"pan: 0.0\\n"
"speed: 1.0\\n"
"\"\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

@ -1,155 +0,0 @@
local druid = require("druid.druid")
local druid_settings = require("druid.system.settings")
local lang = {
locale_text = "Localized"
}
local start_x = 300
local page_width = 600
local cur_page = 1
local max_page = 3
local function log(self, params)
print(params)
end
local function setup_druid(self)
-- two different way of exernal component regesstration
druid.comps["my_mega_test_comp"] = require "druid.base.text"
druid.register("my_custom_component", {})
druid_settings.is_debug = true
druid_settings.play_sound = function(name)
sound.play("sounds#" .. name)
end
druid_settings.get_text = function(text_id)
return lang[text_id]
end
end
local function change_page(self, delta)
cur_page = cur_page + delta
cur_page = math.max(1, cur_page)
cur_page = math.min(cur_page, max_page)
gui.animate(gui.get_node("center"), "position.x",
start_x - (page_width * (cur_page - 1)), gui.EASING_OUTSINE, 0.1)
end
local function init_pages(self)
self.druid:new_button("prev", change_page, -1)
self.druid:new_button("next", change_page, 1)
end
local function init_buttons(self)
self.druid:new_button("button_1", log, "button 1")
self.druid:new(druid.comps.button, "button_2", log, "button 2")
end
local function init_progress(self)
local val = 0.4
local simple = self.druid:new_progress("simple_fill", "x", val)
local vert = self.druid:new_progress("simple_vert_fill", "y", val)
simple:set_steps({0, 0.3, 0.6, 1}, function(_, step)
print("STEP:", step)
end)
timer.delay(0.4, true, function()
val = val + 0.1
if val > 1 then
simple:empty()
vert:empty()
val = 0
end
simple:to(val)
vert:to(val)
end)
local rich = self.druid:new_progress_rich("rich_fill", "rich_red", "rich_green", "x")
rich:set_to(0.3)
local rich_val = 0.3
self.druid:new_button("rich_add", function()
rich_val = rich_val + 0.1
rich:to(rich_val)
end)
self.druid:new_button("rich_dec", function()
rich_val = rich_val - 0.1
rich:to(rich_val)
end)
end
local function init_grid(self)
local prefab = gui.get_node("prefab")
-- 4 items per row
local grid = self.druid:new_grid("grid_1", prefab, 4)
grid:set_anchor(vmath.vector3(0))
grid:set_offset(vmath.vector3(2, 2, 0))
for i = 1, 16 do
local node = gui.clone(prefab)
grid:add(node)
end
local val = 0
timer.delay(0.1, true, function()
val = val + 0.5
grid:set_offset(vmath.vector3(val))
if val > 4 then
val = 0
end
end)
-- 1 item per row
local grid2 = self.druid:new_grid("grid_2", prefab, 1)
grid2:set_offset(vmath.vector3(0, 10, 0))
for i = 1, 4 do
local node = gui.clone(prefab)
grid2:add(node)
end
local grid3 = self.druid:new_grid("grid_3", prefab, 10)
grid3:set_anchor(vmath.vector3(0))
grid3:set_offset(vmath.vector3(5, 0, 0))
for i = 1, 4 do
local node = gui.clone(prefab)
grid3:add(node)
end
end
function init(self)
setup_druid(self)
self.druid = druid.new(self)
init_pages(self)
init_buttons(self)
init_progress(self)
init_grid(self)
self.druid:new_android_back(log, "some")
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)
self.druid:on_input(action_id, action)
end

View File

@ -1,17 +0,0 @@
font: "/example/res/exo2.ttf"
material: "/builtins/fonts/font.material"
size: 64
antialias: 1
alpha: 1.0
outline_alpha: 0.0
outline_width: 0.0
shadow_alpha: 1.0
shadow_blur: 0
shadow_x: 3.0
shadow_y: -5.0
extra_characters: ""
output_format: TYPE_BITMAP
all_chars: false
cache_width: 0
cache_height: 0
render_mode: MODE_MULTI_LAYER

View File

@ -1,24 +0,0 @@
images {
image: "/example/res/gray_long.png"
}
images {
image: "/example/res/green_long.png"
}
images {
image: "/example/res/progress_back.png"
}
images {
image: "/example/res/progress_green.png"
}
images {
image: "/example/res/progress_red.png"
}
images {
image: "/example/res/progress_yellow.png"
}
images {
image: "/example/res/empty.png"
}
margin: 2
extrude_borders: 2
inner_padding: 0

View File

@ -1,11 +1,11 @@
script: "/example/kenney/gui/main/main.gui_script"
script: "/example/gui/main/main.gui_script"
fonts {
name: "game"
font: "/example/kenney/assets/fonts/game.font"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/kenney/assets/images/kenney.atlas"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
@ -387,7 +387,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -1843,7 +1843,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/radio.gui"
template: "/example/templates/radio.gui"
template_node_child: false
}
nodes {
@ -1993,7 +1993,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/radio.gui"
template: "/example/templates/radio.gui"
template_node_child: false
}
nodes {
@ -2143,7 +2143,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/radio.gui"
template: "/example/templates/radio.gui"
template_node_child: false
}
nodes {
@ -2466,7 +2466,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/checkbox.gui"
template: "/example/templates/checkbox.gui"
template_node_child: false
}
nodes {
@ -2616,7 +2616,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/checkbox.gui"
template: "/example/templates/checkbox.gui"
template_node_child: false
}
nodes {
@ -2766,7 +2766,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/checkbox.gui"
template: "/example/templates/checkbox.gui"
template_node_child: false
}
nodes {
@ -4128,7 +4128,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -4287,7 +4287,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -4447,7 +4447,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -4607,7 +4607,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -4767,7 +4767,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -4927,7 +4927,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -6062,7 +6062,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
@ -6221,7 +6221,7 @@ nodes {
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/kenney/templates/button.gui"
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {

View File

@ -3,10 +3,10 @@ local druid = require("druid.druid")
local empty_style = require("druid.styles.empty.style")
local default_style = require("druid.styles.default.style")
local main_page = require("example.kenney.page.main")
local text_page = require("example.kenney.page.texts")
local button_page = require("example.kenney.page.button")
local scroll_page = require("example.kenney.page.scroll")
local main_page = require("example.page.main")
local text_page = require("example.page.texts")
local button_page = require("example.page.button")
local scroll_page = require("example.page.scroll")
local pages = {
"main_page",

View File

@ -1,6 +1,6 @@
local druid = require("druid.druid")
local const = require("druid.const")
local lang = require("example.kenney.lang")
local lang = require("example.lang")
local function setup_druid()

View File

@ -4,7 +4,7 @@ embedded_instances {
id: "gui"
data: "components {\n"
" id: \"main\"\n"
" component: \"/example/kenney/gui/main/main.gui\"\n"
" component: \"/example/gui/main/main.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
@ -39,7 +39,7 @@ embedded_instances {
id: "system"
data: "components {\n"
" id: \"init\"\n"
" component: \"/example/kenney/init.script\"\n"
" component: \"/example/init.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
@ -75,7 +75,7 @@ embedded_instances {
data: "embedded_components {\n"
" id: \"click\"\n"
" type: \"sound\"\n"
" data: \"sound: \\\"/example/kenney/assets/sounds/click.ogg\\\"\\n"
" data: \"sound: \\\"/example/assets/sounds/click.ogg\\\"\\n"
"looping: 0\\n"
"group: \\\"master\\\"\\n"
"gain: 1.0\\n"

View File

@ -1,60 +0,0 @@
images {
image: "/example/kenney/assets/images/back/back_blue.png"
}
images {
image: "/example/kenney/assets/images/back/back_gray.png"
}
images {
image: "/example/kenney/assets/images/back/back_green.png"
}
images {
image: "/example/kenney/assets/images/back/back_red.png"
}
images {
image: "/example/kenney/assets/images/buttons/button_green.png"
}
images {
image: "/example/kenney/assets/images/buttons/button_red.png"
}
images {
image: "/example/kenney/assets/images/buttons/button_yellow.png"
}
images {
image: "/example/kenney/assets/images/empty.png"
}
images {
image: "/example/kenney/assets/images/progress/progress_back.png"
}
images {
image: "/example/kenney/assets/images/progress/progress_fill_green.png"
}
images {
image: "/example/kenney/assets/images/progress/progress_fill_red.png"
}
images {
image: "/example/kenney/assets/images/progress/progress_fill_yellow.png"
}
images {
image: "/example/kenney/assets/images/radio/check_back_circle.png"
}
images {
image: "/example/kenney/assets/images/radio/check_back_square.png"
}
images {
image: "/example/kenney/assets/images/radio/checkmark.png"
}
images {
image: "/example/kenney/assets/images/radio/tick.png"
}
images {
image: "/example/kenney/assets/images/slider/slider_back.png"
}
images {
image: "/example/kenney/assets/images/slider/slider_move.png"
}
images {
image: "/example/kenney/assets/images/buttons/button_blue.png"
}
margin: 0
extrude_borders: 2
inner_padding: 0

View File

@ -1,4 +1,4 @@
local lang = require("example.kenney.lang")
local lang = require("example.lang")
local M = {}

View File

@ -14,11 +14,12 @@ local function init_grid(self)
grid:add(clone_prefab["grid_prefab"])
gui.set_text(clone_prefab["grid_prefab_text"], "Node " .. i)
self.druid:new_button(clone_prefab["grid_button"], function()
local button = self.druid:new_button(clone_prefab["grid_button"], function()
local position = gui.get_position(clone_prefab["grid_prefab"])
position.x = -position.x
grid_scroll:scroll_to(position)
end)
button:set_click_zone(gui.get_node("scroll_with_grid_size"))
end
gui.set_enabled(prefab, false)

View File

@ -1,5 +1,3 @@
local lang = require("example.kenney.lang")
local M = {}
local pivots = {

Binary file not shown.

View File

@ -1,18 +0,0 @@
path_settings {
path: "**"
profile: "Default"
}
profiles {
name: "Default"
platforms {
os: OS_ID_GENERIC
formats {
format: TEXTURE_FORMAT_RGBA
compression_level: BEST
compression_type: COMPRESSION_TYPE_DEFAULT
}
mipmaps: false
max_texture_size: 0
premultiply_alpha: true
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,37 +0,0 @@
name: "default"
scale_along_z: 0
embedded_instances {
id: "scroll"
data: "components {\n"
" id: \"scroll\"\n"
" component: \"/example/scroll/scroll.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
}
}

View File

@ -1,821 +0,0 @@
script: "/example/scroll/scroll.gui_script"
fonts {
name: "game"
font: "/example/game.font"
}
textures {
name: "gui"
texture: "/example/gui.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 300.0
y: 450.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 600.0
y: 900.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "input_zone"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "parent"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
parent: "input_zone"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "main_page"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "parent"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Main scroll page"
font: "game"
id: "main_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "main_page"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: -600.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "left_page"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
parent: "parent"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 330.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Left text\n"
""
font: "game"
id: "left_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "left_page"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: 554.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 400.0
y: 80.0
z: 0.0
w: 1.0
}
color {
x: 0.0
y: 0.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "prefab"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "left_page"
layer: ""
inherit_alpha: false
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "1"
font: "game"
id: "number"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "prefab"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: -150.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 600.0
y: 600.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "page_input"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
parent: "left_page"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_STENCIL
clipping_visible: true
clipping_inverted: false
alpha: 0.3
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 300.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 600.0
y: 600.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "page_parent"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_STRETCH
parent: "page_input"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 600.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "right_page"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
parent: "parent"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 330.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Right text\n"
""
font: "game"
id: "right_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "right_page"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: 150.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 600.0
y: 600.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "right_input"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_STRETCH
parent: "right_page"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_STENCIL
clipping_visible: true
clipping_inverted: false
alpha: 0.3
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 600.0
y: 600.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "gui/empty"
id: "right_parent"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_STRETCH
parent: "right_input"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -1,84 +0,0 @@
local druid = require("druid.druid")
local function init_left_page(self)
local prefab = gui.get_node("prefab")
self.left_grid = self.druid:new_grid("page_parent", prefab, 1)
self.left_grid:set_offset(vmath.vector3(0, 5, 0))
for i = 1, 7 do
local nodes = gui.clone_tree(prefab)
gui.set_text(nodes["number"], i)
self.left_grid:add(nodes["prefab"])
end
local size = self.left_grid:get_size()
local view_size = gui.get_size(gui.get_node("page_parent"))
self.left_scroll = self.druid:new_scroll("page_parent", "page_input",
vmath.vector4(0, view_size.y/2, 0, -size.y - view_size.y/2))
self.left_scroll:set_points(self.left_grid:get_all_pos())
end
local function log(self, index)
print("Click on", index)
end
local function init_right_page(self)
local prefab = gui.get_node("prefab")
self.right_grid = self.druid:new_grid("right_parent", prefab, 1)
self.right_grid:set_offset(vmath.vector3(0, 5, 0))
for i = 1, 20 do
local nodes = gui.clone_tree(prefab)
gui.set_text(nodes["number"], i)
self.druid:new_button(nodes["prefab"], log, i)
self.right_grid:add(nodes["prefab"])
end
local size = self.right_grid:get_size()
local view_size = gui.get_size(gui.get_node("right_parent"))
-- TODO: Should we calc scrolle size with parent size?
-- If yes, we will pass only content size to correct scrolling
self.right_scroll = self.druid:new_scroll("right_parent", "right_input",
vmath.vector4(0, 0, 0, -size.y - view_size.y))
self.right_scroll:set_points(self.right_grid:get_all_pos())
self.right_scroll:on_point_move(function(self, index, pos)
print("Point to element:", index)
end)
end
function init(self)
self.druid = druid.new(self)
-- -600 to 600 - left and right pos.x pages
-- border is vmath.vector4(left_x, top_y, right_x, bot_y)
self.main_scroll = self.druid:new_scroll("parent", "input_zone",
vmath.vector4(-600, 0, 600, 0))
self.main_scroll:set_points({
vmath.vector3(600, 0, 0),
vmath.vector3(0, 0, 0),
vmath.vector3(-600, 0, 0),
})
-- Disable free inert and we only scroll via points, if exist
self.main_scroll:set_inert(false)
init_left_page(self)
init_right_page(self)
end
function update(self, dt)
self.druid:update(dt)
end
function on_input(self, action_id, action)
self.druid:on_input(action_id, action)
end

View File

@ -1,11 +1,11 @@
script: ""
fonts {
name: "game"
font: "/example/kenney/assets/fonts/game.font"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/kenney/assets/images/kenney.atlas"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0

View File

@ -1,7 +1,7 @@
script: ""
textures {
name: "kenney"
texture: "/example/kenney/assets/images/kenney.atlas"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0

View File

@ -1,7 +1,7 @@
script: ""
textures {
name: "kenney"
texture: "/example/kenney/assets/images/kenney.atlas"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0

View File

@ -1,5 +1,5 @@
[bootstrap]
main_collection = /example/kenney/kenney.collectionc
main_collection = /example/kenney.collectionc
[script]
shared_state = 1
@ -14,11 +14,9 @@ title = druid
[library]
include_dirs = druid
[graphics]
texture_profiles = /example/res/custom.texture_profiles
[input]
gamepads = /builtins/input/default.gamepadsc
[druid]
autofocus = 1