-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
980 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
components { | ||
id: "change_resolution" | ||
component: "/examples/gui/layouts/change_canvas/change_resolution.script" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
} | ||
embedded_components { | ||
id: "label" | ||
type: "label" | ||
data: "size {\n" | ||
" x: 800.0\n" | ||
" y: 120.0\n" | ||
" z: 0.0\n" | ||
" w: 0.0\n" | ||
"}\n" | ||
"color {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
"}\n" | ||
"outline {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
"}\n" | ||
"shadow {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
"}\n" | ||
"leading: 1.0\n" | ||
"tracking: 0.0\n" | ||
"pivot: PIVOT_CENTER\n" | ||
"blend_mode: BLEND_MODE_ALPHA\n" | ||
"line_break: false\n" | ||
"text: \"Click me to change layout\"\n" | ||
"font: \"/assets/text64.font\"\n" | ||
"material: \"/builtins/fonts/label.material\"\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale { | ||
x: 0.9 | ||
y: 0.9 | ||
z: 1.0 | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
examples/gui/layouts/change_canvas/change_resolution.script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local init_width, init_height = 0, 0 | ||
|
||
function init(self) | ||
msg.post(".", "acquire_input_focus") | ||
init_width, init_height = window.get_size() | ||
self.curr_width, self.curr_height = init_width, init_height | ||
|
||
|
||
timer.delay(1, true, function() | ||
msg.post("/go#layoutsui", "update_score", {score = math.random(1, 3)}) | ||
end) | ||
end | ||
|
||
function on_input(self, action_id, action) | ||
if action_id == hash("touch") and action.released then | ||
if self.curr_width == init_width then | ||
self.curr_width = self.curr_width + 20 | ||
else | ||
self.curr_width = init_width | ||
end | ||
msg.post("@render:", "resize", { width = self.curr_width, height = self.curr_height } ) | ||
end | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "slice" | ||
instances { | ||
id: "change_resolution" | ||
prototype: "/examples/gui/layouts/change_canvas/change_resolution.go" | ||
position { | ||
x: 360.0 | ||
y: 359.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 0.8 | ||
y: 0.8 | ||
z: 1.0 | ||
} | ||
} | ||
scale_along_z: 0 | ||
embedded_instances { | ||
id: "go" | ||
data: "components {\n" | ||
" id: \"layoutsui\"\n" | ||
" component: \"/examples/gui/layouts/layouts.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" | ||
" property_decls {\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 | ||
} | ||
} |
Oops, something went wrong.