From ea94ece1b6b87e78ec712a5fd7395dd6ff832f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ritzl?= Date: Sun, 13 Oct 2024 23:00:12 +0200 Subject: [PATCH 1/2] Cleanup --- README.md | 103 +- example/allfeatures/allfeatures.collection | 96 - example/allfeatures/camera_controls.gui | 2714 +---------------- .../allfeatures/camera_controls.gui_script | 12 +- example/basics/basics.collection | 89 +- example/bounds/bounds.collection | 87 - example/controller.script | 2 - example/dragtoscroll/dragtoscroll.collection | 73 - example/dragtoscroll/dragtoscroll.script | 4 +- example/menu.gui | 491 +-- example/multicamera/player.script | 1 - example/zoom/zoom.collection | 134 +- game.project | 1 - orthographic/camera.go | 21 +- orthographic/camera.lua | 225 +- orthographic/camera.script | 33 +- 16 files changed, 250 insertions(+), 3836 deletions(-) diff --git a/README.md b/README.md index 7db3370..191d237 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,7 @@ https://github.com/britzl/defold-orthographic/archive/master.zip Or point to the ZIP file of a [specific release](https://github.com/britzl/defold-orthographic/releases). ## Quick Start -Getting started with Orthographic is easy: - -1. Add `camera.go` to your game. -2. Open `game.project` and make sure to reference `orthographic/render/orthographic.render` in the `Render` field in the `Bootstrap` section. - -Next step is to read the section on "Camera Configuration" to learn how to change the behavior of the camera. - -## Camera Configuration -Select the script component attached to the `camera.go` to modify the properties. The camera has the following configurable properties: +Getting started with Orthographic is easy. Just add a `camera.go` to your game and configure the script properties of the `camera.script` attached to `camera.go`. The camera has the following configurable properties: #### near_z (number) and far_z (number) This is the near and far z-values used in the projection matrix, ie the near and far clipping plane. Anything with a z-value inside this range will be drawn by the render script. @@ -33,18 +25,11 @@ Note that when using `go.animate()`, `go.get()` and `go.set()` you need to make * `go.set("mycamera#camerascript", "zoom")` * `go.get("mycamera#camerascript", "zoom")` -#### order (number) -The order in which multiple cameras should be drawn, lower is drawn first. - -#### projection (hash) -The camera can be configured to support different kinds of orthographic projections. The default projection (aptly named `DEFAULT`) uses the same orthographic projection matrix as in the default render script (ie aspect ratio isn't maintained and content is stretched). Other projections are available out-of-the box: +#### auto_zoom (boolean) +Check this property if you wish the camera to automatically adjust the zoom to fit the area covered by the display width and height defined in game.project on the screen regardless of actual physical screen resolution. This means that the camera will zoom out when the content is viewed on a screen with a lower resolution, and zoom in when the content is viewed on a higher resolution screen. -* `FIXED_AUTO` - A fixed aspect ratio projection that automatically zooms in/out to fit the original viewport contents regardless of window size. -* `FIXED_ZOOM` - A fixed aspect ratio projection with zoom. - -Note: For the above projections to work you need to pass the window dimensions from your render script to the camera. See [the section on render script integration](#render-script-integration). - -Additional custom projections can be added, see `camera.add_projector()` below. +#### order (number) +This value is used to sort the cameras in the list returned by `camera.get_cameras()`, from low to high values. In a multi-camera scenario the order can be used to control which camera to render first. This is for instance used in `orthographic/render/orthographic.render_script`. #### enabled (boolean) This controls if the camera is enabled by default or not. Send `enable` and `disable` messages to the script or use `go.set(id, "enable", true|false)` to toggle this value. @@ -80,37 +65,8 @@ The camera deadzone. See `camera.deadzone()` for details. The camera viewport. -## Render script integration -In order for the Orthographic camera to function properly you need to integrate it in your render script. You can do this in a number of different ways: - -### 1. Using the provided render script -The Orthographic API comes with a ready to use render script in `orthographic/render/orthograpic.render_script`. Open `game.project` and make sure to reference `orthographic/render/orthograpic.render` in the `Render` field in the `Bootstrap` section. - -### 2. Integrating in an existing render script -Get a list of active cameras and apply the camera viewport, view and projection before drawing: - -``` - local camera = require "orthographic.camera" - - function update(self) - ... - for _,camera_id in ipairs(camera.get_cameras()) do - local viewport = camera.get_viewport(camera_id) - local view = camera.get_view(camera_id) - local projection = camera.get_projection(camera_id) - - render.set_viewport(viewport.x, viewport.y, viewport.z, viewport.w) - render.set_view(view) - render.set_projection(projection) - - -- draw using the viewport, view and projection - ... - end - end -``` - -### Example render script -The `orthographic/render` folder contains a render script that does the above mentioned integration of the Orthographic Camera API. Use it as it is or copy it into your project and make whatever modifications that you need. +### Using multiple cameras or custom viewports +The default render script will always only render a single camera with a viewport covering the entire screen. In order to use multiple cameras or render the camera using a custom viewport you need to modify the render script or use the render script included in `orthographic/render/orthographic.render_script` ## Window vs Screen coordinates @@ -161,15 +117,6 @@ Get the current projection of the camera. **RETURN** * `projection` (matrix) The current projection -### camera.get_projection_id(camera_id) -Get the current projection id of the camera. - -**PARAMETERS** -* `camera_id` (hash|url|nil) nil for the first camera - -**RETURN** -* `projection_id` (hash) The current projection id - --- ### camera.shake(camera_id, [intensity], [duration], [direction], [cb]) @@ -224,6 +171,20 @@ Change the zoom level of the camera. * `camera_id` (hash|url|nil) nil for the first camera * `zoom` (number) The new zoom level of the camera + +### camera.get_automatic_zoom(camera_id) +Get if the camera is configured to use automatic zoom level. + +**RETURN** +* `auto_zoom` (boolean) True if automatic zoom is enabled + + +### camera.set_automatic_zoom(camera_id, enabled) +Set if the camera should use automatic zoom level. + +**PARAM** +* `enabled` (boolean) True if automatic zoom should be enabled + --- ### camera.follow(camera_id, target, [options]) @@ -361,23 +322,6 @@ Translate world coordinates to [screen coordinates](#screen-coordinates) using t --- -### camera.add_projector(projector_id, projector_fn) -Add a custom projector that can be used by cameras in your project (see configuration above). - -**PARAMETERS** -* `projector_id` (hash) - Id of the projector. Used as a value in the `projection` field of the camera script. -* `projector_fn` (function) - The function to call when a projection matrix is needed for the camera. The function will receive the id, near_z and far_z values of the camera. - - -### camera.use_projector(camera_id, projector_id) -Set a specific projector for a camera. This must be either one of the predefined projectors (see above) or a custom projector added using `camera.add_projector()`. - -**PARAMETERS** -* `camera_id` (hash|url|nil) nil for the first camera -* `projector_id` (hash) - Id of the projector. - ---- - ### camera.set_window_scaling_factor(scaling_factor) Set window scaling factor (basically retina or no retina screen). There is no built-in way to detect if Defold is running on a retina or non retina screen. This information combined with the High DPI setting in game.project can be used to ensure that the zoom behaves the same way regardless of screen type and High DPI setting. You can use an extension such as [DefOS](https://github.com/subsoap/defos) to get the window scaling factor. @@ -453,6 +397,11 @@ Message equivalent to `camera.zoom_to()`. Accepted message keys: `zoom`. msg.post("camera", "zoom_to", { zoom = 2.5 }) +### set_automatic_zoom +Message equivalent to `camera.set_automatic_zoom()`. Accepted message keys: `enabled`. + + msg.post("camera", "set_automatic_zoom", { enabled = true }) + ### enable Enable the camera. While the camera is enabled it will update it's view and projection and send these to the render script. diff --git a/example/allfeatures/allfeatures.collection b/example/allfeatures/allfeatures.collection index 94a8ef2..5abccf1 100644 --- a/example/allfeatures/allfeatures.collection +++ b/example/allfeatures/allfeatures.collection @@ -5,21 +5,9 @@ instances { position { x: 199.937 y: 470.962 - z: 0.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 } component_properties { id: "script" - properties { - id: "projection" - value: "FIXED_ZOOM" - type: PROPERTY_TYPE_HASH - } properties { id: "follow" value: "true" @@ -36,29 +24,11 @@ instances { type: PROPERTY_TYPE_HASH } } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } instances { id: "crosshair" prototype: "/example/shared/objects/crosshair.go" position { - x: 0.0 - y: 0.0 - z: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale3 { - x: 1.0 - y: 1.0 z: 1.0 } } @@ -70,12 +40,6 @@ instances { y: 321.0 z: 0.5 } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } component_properties { id: "script" properties { @@ -89,11 +53,6 @@ instances { type: PROPERTY_TYPE_NUMBER } } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } scale_along_z: 0 embedded_instances { @@ -101,72 +60,17 @@ embedded_instances { data: "components {\n" " id: \"tilemap\"\n" " component: \"/example/allfeatures/top_down.tilemap\"\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: -1.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: "controls" data: "components {\n" " id: \"camera_controls\"\n" " component: \"/example/allfeatures/camera_controls.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 - } } diff --git a/example/allfeatures/camera_controls.gui b/example/allfeatures/camera_controls.gui index e01e802..f6b2196 100644 --- a/example/allfeatures/camera_controls.gui +++ b/example/allfeatures/camera_controls.gui @@ -7,3182 +7,617 @@ textures { name: "examples" texture: "/example/shared/examples.atlas" } -background_color { - x: 0.0 - y: 0.0 - z: 0.0 - w: 0.0 -} nodes { position { - x: 0.0 y: 35.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: 0.0 - y: 0.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: "buttons" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } nodes { position { x: 732.562 - 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_TEMPLATE id: "bounds" parent: "buttons" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "bounds/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "bounds" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "BOUNDS" - font: "silkscreen" id: "bounds/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: true parent: "bounds/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 623.572 - 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_TEMPLATE id: "deadzone" parent: "buttons" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "deadzone/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "deadzone" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "DEADZONE" - font: "silkscreen" id: "deadzone/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: true parent: "deadzone/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 321.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: 0.0 - y: 0.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: "shake" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "buttons" - 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 - custom_type: 0 } nodes { position { x: 110.0 y: 50.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_TEMPLATE id: "shake_vertical" parent: "shake" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "shake_vertical/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "shake_vertical" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 +} +nodes { + type: TYPE_TEXT + text: "SHAKE VERTICAL" + id: "shake_vertical/text" + parent: "shake_vertical/button" + overridden_fields: 8 + template_node_child: true } 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: 90.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: "SHAKE VERTICAL" - font: "silkscreen" - id: "shake_vertical/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: true - parent: "shake_vertical/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - overridden_fields: 8 - template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 -} -nodes { - position { - x: 0.0 y: 50.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_TEMPLATE id: "stop_shaking" parent: "shake" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "stop_shaking/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "stop_shaking" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "STOP SHAKING" - font: "silkscreen" id: "stop_shaking/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: true parent: "stop_shaking/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 110.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_TEMPLATE id: "shake_horizontal" parent: "shake" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "shake_horizontal/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "shake_horizontal" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "SHAKE HORIZONTAL" - font: "silkscreen" id: "shake_horizontal/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: true parent: "shake_horizontal/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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_TEMPLATE id: "shake_both" parent: "shake" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "shake_both/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "shake_both" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 +} +nodes { + type: TYPE_TEXT + text: "SHAKE" + id: "shake_both/text" + parent: "shake_both/button" + overridden_fields: 8 + template_node_child: true } 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: 90.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: "SHAKE" - font: "silkscreen" - id: "shake_both/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: true - parent: "shake_both/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - overridden_fields: 8 - template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 -} -nodes { - position { - x: 72.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: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - color { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 + x: 72.0 } type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "" id: "follow" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "buttons" - 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 - custom_type: 0 } nodes { position { - x: 0.0 y: 50.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_TEMPLATE id: "follow_lerp" parent: "follow" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "follow_lerp/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "follow_lerp" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "FOLLOW LERP" - font: "silkscreen" id: "follow_lerp/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: true parent: "follow_lerp/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 110.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_TEMPLATE id: "unfollow" parent: "follow" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "unfollow/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "unfollow" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "UNFOLLOW" - font: "silkscreen" id: "unfollow/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: true parent: "unfollow/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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_TEMPLATE id: "follow_basic" parent: "follow" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "follow_basic/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "follow_basic" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "FOLLOW BASIC" - font: "silkscreen" id: "follow_basic/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: true parent: "follow_basic/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 0.0 y: 100.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_TEMPLATE id: "follow_horizontal" parent: "follow" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "follow_horizontal/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "follow_horizontal" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "FOLLOW HORIZONTAL" - font: "silkscreen" id: "follow_horizontal/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: true parent: "follow_horizontal/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 0.0 y: 149.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_TEMPLATE id: "follow_vertical" parent: "follow" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "follow_vertical/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "follow_vertical" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: 90.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: "FOLLOW VERTICAL" - font: "silkscreen" id: "follow_vertical/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: true parent: "follow_vertical/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 1047.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: 0.0 - y: 0.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: "zoom" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "buttons" - 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 - custom_type: 0 } nodes { position { x: 158.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_TEMPLATE id: "zoomout" parent: "zoom" - layer: "" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 } 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: 100.0 - y: 40.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: "main/space" id: "zoomout/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT parent: "zoomout" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 - template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 -} -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: 90.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: "ZOOM OUT" - font: "silkscreen" - id: "zoomout/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: true - parent: "zoomout/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - overridden_fields: 8 - template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 -} -nodes { - position { - x: 80.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.0" - font: "silkscreen" - id: "zoomlevel" - 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: "zoom" - layer: "" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 -} -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_TEMPLATE - id: "zoomin" - parent: "zoom" - layer: "" - inherit_alpha: true - alpha: 1.0 - template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 -} -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: 100.0 - y: 40.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: "main/space" - id: "zoomin/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "zoomin" - layer: "below" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 - template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 -} -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: 90.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: "ZOOM IN" - font: "silkscreen" - id: "zoomin/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: true - parent: "zoomin/button" - layer: "text" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - overridden_fields: 8 - template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 -} -nodes { - position { - x: 892.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: 0.0 - y: 0.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: "projection" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "buttons" - 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 - custom_type: 0 + template_node_child: true +} +nodes { + type: TYPE_TEXT + text: "ZOOM OUT" + id: "zoomout/text" + parent: "zoomout/button" + overridden_fields: 8 + template_node_child: true } nodes { position { - x: 0.0 - y: 36.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 + x: 80.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: "" + text: "1.0" font: "silkscreen" - id: "current_projection" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER + id: "zoomlevel" 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: "projection" - layer: "" + parent: "zoom" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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_TEMPLATE - id: "change_projection" - parent: "projection" - layer: "" + id: "zoomin" + parent: "zoom" inherit_alpha: true - alpha: 1.0 template: "/example/shared/button.gui" - template_node_child: false - custom_type: 0 +} +nodes { + type: TYPE_BOX + id: "zoomin/button" + parent: "zoomin" + template_node_child: true +} +nodes { + type: TYPE_TEXT + text: "ZOOM IN" + id: "zoomin/text" + parent: "zoomin/button" + overridden_fields: 8 + template_node_child: true } 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: 100.0 - y: 40.0 - z: 0.0 - w: 1.0 - } - color { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 + x: 892.0 } type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "main/space" - id: "change_projection/button" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "change_projection" - layer: "below" + id: "auto_zoom" + parent: "buttons" inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } - clipping_mode: CLIPPING_MODE_NONE - clipping_visible: true - clipping_inverted: false - alpha: 1.0 - template_node_child: true - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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 + y: 36.0 } size { - x: 90.0 + 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: "PROJECTION" + text: "" font: "silkscreen" - id: "change_projection/text" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER + id: "auto_zoom_state" 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: true - parent: "change_projection/button" - layer: "text" + parent: "auto_zoom" + inherit_alpha: true +} +nodes { + type: TYPE_TEMPLATE + id: "toggle_auto_zoom" + parent: "auto_zoom" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 + template: "/example/shared/button.gui" +} +nodes { + type: TYPE_BOX + id: "toggle_auto_zoom/button" + parent: "toggle_auto_zoom" + template_node_child: true +} +nodes { + type: TYPE_TEXT + text: "AUTO\n" + "ZOOM" + id: "toggle_auto_zoom/text" + parent: "toggle_auto_zoom/button" overridden_fields: 8 template_node_child: true - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 640.0 y: 360.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: 400.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: "deadzone_visualizer" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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: 0.16 - template_node_child: false - size_mode: SIZE_MODE_MANUAL - custom_type: 0 } 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: "BOTTOMLEFT" font: "silkscreen" id: "bottom_left" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE pivot: PIVOT_SW 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 - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 1280.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: "BOTTOMRIGHT" font: "silkscreen" id: "bottom_right" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE pivot: PIVOT_SE 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 - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 0.0 y: 720.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: "TOPLEFT" font: "silkscreen" id: "top_left" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE pivot: PIVOT_NW 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 - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 1280.0 y: 720.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: "TOPRIGHT" font: "silkscreen" id: "top_right" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE pivot: PIVOT_NE 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 - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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: 0.0 z: 0.0 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "STRETCH" font: "silkscreen" id: "w2s_stretch" - 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_STRETCH - line_break: false layer: "text" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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: 0.0 - y: 1.0 z: 0.0 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "ZOOM" font: "silkscreen" id: "w2s_zoom" - 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_ZOOM - line_break: false layer: "text" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } 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: 0.0 y: 0.0 - z: 1.0 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "FIT" font: "silkscreen" id: "w2s_fit" - 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 layer: "text" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } layers { name: "below" @@ -3192,4 +627,3 @@ layers { } material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT -max_nodes: 512 diff --git a/example/allfeatures/camera_controls.gui_script b/example/allfeatures/camera_controls.gui_script index b4d2bda..9e19e22 100644 --- a/example/allfeatures/camera_controls.gui_script +++ b/example/allfeatures/camera_controls.gui_script @@ -4,12 +4,10 @@ local CAMERA_ID = hash("/camera") local PLAYER_ID = hash("/hitman") local PROJECTIONS = { - camera.PROJECTOR.DEFAULT, camera.PROJECTOR.FIXED_AUTO, camera.PROJECTOR.FIXED_ZOOM, } local PROJECTION_NAMES = { - [camera.PROJECTOR.DEFAULT] = "Default", [camera.PROJECTOR.FIXED_AUTO] = "Fixed Auto", [camera.PROJECTOR.FIXED_ZOOM] = "Fixed Zoom", } @@ -35,8 +33,6 @@ end function update(self, dt) - camera.set_window_scaling_factor(get_scaling_factor()) - local w2s_fit = gui.get_node("w2s_fit") local w2s_zoom = gui.get_node("w2s_zoom") local w2s_stretch = gui.get_node("w2s_stretch") @@ -54,7 +50,7 @@ function update(self, dt) gui.set_text(gui.get_node("top_left"), ("%d,%d"):format(bounds.x, bounds.y)) gui.set_text(gui.get_node("top_right"), ("%d,%d"):format(bounds.z, bounds.y)) gui.set_text(gui.get_node("zoomlevel"), ("%.2f"):format(tostring(camera.get_zoom(CAMERA_ID)))) - gui.set_text(gui.get_node("current_projection"), PROJECTION_NAMES[camera.get_projection_id(CAMERA_ID)]) + gui.set_text(gui.get_node("auto_zoom_state"), ("%s"):format(tostring(camera.get_automatic_zoom(CAMERA_ID)))) end local function post_follow_message(self) @@ -153,10 +149,8 @@ function on_input(self, action_id, action) update_deadzone(self, zoomlevel) msg.post(CAMERA_ID, "zoom_to", { zoom = zoomlevel } ) return true - elseif gui.pick_node(gui.get_node("change_projection/button"), action.x, action.y) then - self.current_projection = self.current_projection + 1 - if self.current_projection > #PROJECTIONS then self.current_projection = 1 end - camera.use_projector(CAMERA_ID, PROJECTIONS[self.current_projection]) + elseif gui.pick_node(gui.get_node("toggle_auto_zoom/button"), action.x, action.y) then + camera.set_automatic_zoom(CAMERA_ID, not camera.get_automatic_zoom(CAMERA_ID)) return true end end diff --git a/example/basics/basics.collection b/example/basics/basics.collection index 1ba6e07..b8eaeb4 100644 --- a/example/basics/basics.collection +++ b/example/basics/basics.collection @@ -2,24 +2,8 @@ name: "default" instances { id: "camera" prototype: "/orthographic/camera.go" - position { - x: 0.0 - y: 0.0 - z: 0.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } component_properties { id: "script" - properties { - id: "projection" - value: "FIXED_ZOOM" - type: PROPERTY_TYPE_HASH - } properties { id: "follow" value: "true" @@ -31,11 +15,6 @@ instances { type: PROPERTY_TYPE_HASH } } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } scale_along_z: 0 embedded_instances { @@ -43,72 +22,25 @@ embedded_instances { data: "components {\n" " id: \"top_down\"\n" " component: \"/example/allfeatures/top_down.tilemap\"\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: "hitman" data: "components {\n" " id: \"topdownmovement\"\n" " component: \"/example/shared/scripts/topdownmovement.script\"\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" "embedded_components {\n" " id: \"sprite\"\n" " type: \"sprite\"\n" - " data: \"tile_set: \\\"/example/shared/examples.atlas\\\"\\n" - "default_animation: \\\"hitman1_gun\\\"\\n" + " data: \"default_animation: \\\"hitman1_gun\\\"\\n" "material: \\\"/builtins/materials/sprite.material\\\"\\n" - "blend_mode: BLEND_MODE_ALPHA\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/example/shared/examples.atlas\\\"\\n" + "}\\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 { @@ -116,15 +48,4 @@ embedded_instances { y: 205.0 z: 1.0 } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } diff --git a/example/bounds/bounds.collection b/example/bounds/bounds.collection index e535c44..fb5d0fe 100644 --- a/example/bounds/bounds.collection +++ b/example/bounds/bounds.collection @@ -2,24 +2,8 @@ name: "default" instances { id: "camera" prototype: "/orthographic/camera.go" - position { - x: 0.0 - y: 0.0 - z: 0.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } component_properties { id: "script" - properties { - id: "projection" - value: "FIXED_ZOOM" - type: PROPERTY_TYPE_HASH - } properties { id: "follow" value: "true" @@ -31,29 +15,11 @@ instances { type: PROPERTY_TYPE_HASH } } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } instances { id: "crosshair" prototype: "/example/shared/objects/crosshair.go" position { - x: 0.0 - y: 0.0 - z: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale3 { - x: 1.0 - y: 1.0 z: 1.0 } } @@ -65,12 +31,6 @@ instances { y: 161.0 z: 0.5 } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } component_properties { id: "script" properties { @@ -84,11 +44,6 @@ instances { type: PROPERTY_TYPE_BOOLEAN } } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } scale_along_z: 0 embedded_instances { @@ -96,52 +51,10 @@ embedded_instances { data: "components {\n" " id: \"top_down\"\n" " component: \"/example/allfeatures/top_down.tilemap\"\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" "components {\n" " id: \"bounds\"\n" " component: \"/example/bounds/bounds.script\"\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 - } } diff --git a/example/controller.script b/example/controller.script index aaa9da5..f0d4cb3 100644 --- a/example/controller.script +++ b/example/controller.script @@ -18,7 +18,5 @@ function on_message(self, message_id, message, sender) elseif message_id == hash("show") then local id = message.id show(self, "#" .. id) - else - print(message_id) end end diff --git a/example/dragtoscroll/dragtoscroll.collection b/example/dragtoscroll/dragtoscroll.collection index a0e773b..c920aa2 100644 --- a/example/dragtoscroll/dragtoscroll.collection +++ b/example/dragtoscroll/dragtoscroll.collection @@ -2,30 +2,6 @@ name: "default" instances { id: "camera" prototype: "/orthographic/camera.go" - position { - x: 0.0 - y: 0.0 - z: 0.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - component_properties { - id: "script" - properties { - id: "projection" - value: "FIXED_ZOOM" - type: PROPERTY_TYPE_HASH - } - } - scale3 { - x: 1.0 - y: 1.0 - z: 1.0 - } } scale_along_z: 0 embedded_instances { @@ -33,17 +9,6 @@ embedded_instances { data: "components {\n" " id: \"dragtoscroll\"\n" " component: \"/example/dragtoscroll/dragtoscroll.script\"\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 { @@ -51,50 +16,12 @@ embedded_instances { y: 205.0 z: 1.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: "level" data: "components {\n" " id: \"top_down\"\n" " component: \"/example/allfeatures/top_down.tilemap\"\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 - } } diff --git a/example/dragtoscroll/dragtoscroll.script b/example/dragtoscroll/dragtoscroll.script index 2184bca..961a1bd 100644 --- a/example/dragtoscroll/dragtoscroll.script +++ b/example/dragtoscroll/dragtoscroll.script @@ -11,6 +11,7 @@ function on_input(self, action_id, action) -- store the position where the pressed action happened -- also store the camera position at that time if action.pressed then + print("pressed") self.pressed_pos = vmath.vector3(action.x, action.y, 0) self.camera_pos = go.get_position(CAMERA_ID) elseif action.released then @@ -31,7 +32,8 @@ function on_input(self, action_id, action) -- also take the zoom into account local zoom = camera.get_zoom(CAMERA_ID) local action_pos = vmath.vector3(action.x, action.y, 0) - local camera_pos = self.camera_pos + (self.pressed_pos - action_pos) / zoom + local diff = (action_pos - self.pressed_pos) / zoom + local camera_pos = self.camera_pos - diff go.set_position(camera_pos, CAMERA_ID) end end diff --git a/example/menu.gui b/example/menu.gui index 4ec324c..6db609c 100644 --- a/example/menu.gui +++ b/example/menu.gui @@ -3,725 +3,245 @@ fonts { name: "example" font: "/example/shared/fonts/example.font" } -background_color { - x: 0.0 - y: 0.0 - z: 0.0 - w: 0.0 -} nodes { position { x: 320.0 y: 400.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: 50.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: "boundsbutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "BOUNDS" font: "example" id: "boundstext" - 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: "boundsbutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 320.0 - y: 340.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 + x: 535.0 + y: 462.0 } size { x: 200.0 y: 50.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: "dragtoscrollbutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "DRAG TO SCROLL" font: "example" id: "dragtoscrollbuttontext" - 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: "dragtoscrollbutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 320.0 y: 462.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: 50.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: "multicamerabutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "MULTICAMERA" font: "example" id: "multtcameratext" - 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: "multicamerabutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { x: 320.0 y: 523.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: 50.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: "basicsbutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "BASICS" font: "example" id: "basicstext" - 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: "basicsbutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 320.0 - y: 278.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 + x: 535.0 + y: 400.0 } size { x: 200.0 y: 50.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: "allfeaturesbutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "ALL FEATURES" font: "example" id: "allfeaturestext" - 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: "allfeaturesbutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } nodes { position { - x: 533.0 + x: 535.0 y: 523.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: 50.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: "zoombutton" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - 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 - custom_type: 0 } 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: 50.0 - z: 0.0 - w: 1.0 } color { x: 0.2 y: 0.2 z: 0.2 - w: 1.0 } type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA text: "ZOOM" font: "example" id: "zoomtext" - 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: "zoombutton" - layer: "" inherit_alpha: true - alpha: 1.0 - outline_alpha: 1.0 - shadow_alpha: 1.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 - custom_type: 0 } layers { name: "below" @@ -731,4 +251,3 @@ layers { } material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT -max_nodes: 512 diff --git a/example/multicamera/player.script b/example/multicamera/player.script index 3289c26..5b45cba 100644 --- a/example/multicamera/player.script +++ b/example/multicamera/player.script @@ -8,7 +8,6 @@ local SPEED = 300 function init(self) msg.post(".", "acquire_input_focus") self.actions = {} - print("player") end function final(self) diff --git a/example/zoom/zoom.collection b/example/zoom/zoom.collection index cdd6e32..a77fe1f 100644 --- a/example/zoom/zoom.collection +++ b/example/zoom/zoom.collection @@ -1,152 +1,52 @@ name: "zoom" +instances { + id: "camera" + prototype: "/orthographic/camera.go" +} scale_along_z: 0 embedded_instances { id: "level" data: "components {\n" " id: \"top_down\"\n" " component: \"/example/allfeatures/top_down.tilemap\"\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: -1.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: "zoom" data: "components {\n" " id: \"zoom\"\n" " component: \"/example/zoom/zoom.script\"\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" "embedded_components {\n" " id: \"sprite\"\n" " type: \"sprite\"\n" - " data: \"tile_set: \\\"/example/shared/examples.atlas\\\"\\n" - "default_animation: \\\"crosshair_outline_large\\\"\\n" + " data: \"default_animation: \\\"crosshair_outline_large\\\"\\n" "material: \\\"/builtins/materials/sprite.material\\\"\\n" - "blend_mode: BLEND_MODE_ALPHA\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/example/shared/examples.atlas\\\"\\n" + "}\\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 - } } embedded_instances { - id: "camera" - data: "components {\n" - " id: \"camera\"\n" - " component: \"/orthographic/camera.script\"\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" - " properties {\n" - " id: \"projection\"\n" - " value: \"FIXED_ZOOM\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - "}\n" - "embedded_components {\n" + id: "go" + children: "camera" + data: "embedded_components {\n" " id: \"sprite\"\n" " type: \"sprite\"\n" - " data: \"tile_set: \\\"/builtins/graphics/particle_blob.tilesource\\\"\\n" - "default_animation: \\\"anim\\\"\\n" + " data: \"default_animation: \\\"anim\\\"\\n" "material: \\\"/builtins/materials/sprite.material\\\"\\n" - "blend_mode: BLEND_MODE_ALPHA\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/builtins/graphics/particle_blob.tilesource\\\"\\n" + "}\\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 - } } diff --git a/game.project b/game.project index 924bbd5..67edd86 100644 --- a/game.project +++ b/game.project @@ -3,7 +3,6 @@ title = Orthographic version = 0.9 dependencies#0 = https://github.com/britzl/deftest/archive/2.7.0.zip dependencies#1 = https://github.com/britzl/gooey/archive/refs/tags/10.4.0.zip -dependencies#2 = https://github.com/subsoap/defos/archive/refs/tags/v2.7.1.zip [bootstrap] main_collection = /example/controller.collectionc diff --git a/orthographic/camera.go b/orthographic/camera.go index be6d462..aa636f8 100644 --- a/orthographic/camera.go +++ b/orthographic/camera.go @@ -1,15 +1,14 @@ components { id: "script" component: "/orthographic/camera.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: "camera" + type: "camera" + data: "aspect_ratio: 0.0\n" + "fov: 0.0\n" + "near_z: -1.0\n" + "far_z: 1.0\n" + "orthographic_projection: 1\n" + "" } diff --git a/orthographic/camera.lua b/orthographic/camera.lua index 2d7925d..65db066 100644 --- a/orthographic/camera.lua +++ b/orthographic/camera.lua @@ -17,19 +17,18 @@ M.MSG_DEADZONE = hash("deadzone") M.MSG_BOUNDS = hash("bounds") M.MSG_UPDATE_CAMERA = hash("update_camera") M.MSG_ZOOM_TO = hash("zoom_to") -M.MSG_USE_PROJECTION = hash("use_projection") +M.MSG_SET_AUTOMATIC_ZOOM = hash("set_automatic_zoom") M.MSG_VIEWPORT = hash("viewport") local HIGH_DPI = (sys.get_config("display.high_dpi", "0") == "1") -local dpi_ratio = 1 +local dpi_ratio = nil M.SHAKE_BOTH = hash("both") M.SHAKE_HORIZONTAL = hash("horizontal") M.SHAKE_VERTICAL = hash("vertical") M.PROJECTOR = {} -M.PROJECTOR.DEFAULT = hash("DEFAULT") M.PROJECTOR.FIXED_AUTO = hash("FIXED_AUTO") M.PROJECTOR.FIXED_ZOOM = hash("FIXED_ZOOM") @@ -66,51 +65,13 @@ local camera_ids = {} -- track if the cameras list has changed or not local cameras_dirty = true ---- projection providers (projectors) --- a mapping of id to function to calculate and return a projection matrix -local projectors = {} - --- the default projector from the default render script --- will stretch content -projectors[M.PROJECTOR.DEFAULT] = function(camera_id, near_z, far_z, zoom) - return vmath.matrix4_orthographic(0, DISPLAY_WIDTH, 0, DISPLAY_HEIGHT, near_z, far_z) -end - --- setup a fixed aspect ratio projection that zooms in/out to fit the original viewport contents --- regardless of window size -projectors[M.PROJECTOR.FIXED_AUTO] = function(camera_id, near_z, far_z, zoom) - local camera = cameras[camera_id] - local ww = camera.viewport and camera.viewport.z or WINDOW_WIDTH - local wh = camera.viewport and camera.viewport.w or WINDOW_HEIGHT - - local zoom_factor = math.min(ww / DISPLAY_WIDTH, wh / DISPLAY_HEIGHT) * zoom * dpi_ratio - local projected_width = ww / (zoom_factor / dpi_ratio) - local projected_height = wh / (zoom_factor / dpi_ratio) - local xoffset = -(projected_width - DISPLAY_WIDTH) / 2 - local yoffset = -(projected_height - DISPLAY_HEIGHT) / 2 - return vmath.matrix4_orthographic(xoffset, xoffset + projected_width, yoffset, yoffset + projected_height, near_z, far_z) -end - --- setup a fixed aspect ratio projection with a fixed zoom -projectors[M.PROJECTOR.FIXED_ZOOM] = function(camera_id, near_z, far_z, zoom) - local camera = cameras[camera_id] - local ww = camera.viewport and camera.viewport.z or WINDOW_WIDTH - local wh = camera.viewport and camera.viewport.w or WINDOW_HEIGHT - - local projected_width = ww / (zoom / dpi_ratio) - local projected_height = wh / (zoom / dpi_ratio) - local xoffset = -(projected_width - DISPLAY_WIDTH) / 2 - local yoffset = -(projected_height - DISPLAY_HEIGHT) / 2 - return vmath.matrix4_orthographic(xoffset, xoffset + projected_width, yoffset, yoffset + projected_height, near_z, far_z) -end local function log(s, ...) if s then print(s:format(...)) end end local function check_game_object(id) - local ok, err = pcall(go.get_position, id) - return ok + return go.exists(id) end -- http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ @@ -123,26 +84,18 @@ local function lerp_with_dt(t, dt, v1, v2) --return vmath.lerp(t, v1, v2) end ---- Add a custom projector --- @param projector_id Unique id of the projector (hash) --- @param projector_fn The function to call when the projection matrix needs to be calculated --- The function will receive near_z and far_z as arguments -function M.add_projector(projector_id, projector_fn) - assert(projector_id, "You must provide a projector id") - assert(projector_fn, "You must provide a projector function") - projectors[projector_id] = projector_fn -end ---- Set the projector used by a camera --- @param camera_id or nil for the first camera --- @param projector_id The projector to use -function M.use_projector(camera_id, projector_id) - camera_id = camera_id or camera_ids[1] - assert(camera_id, "You must provide a camera id") - assert(projector_id, "You must provide a projector id") - assert(projectors[projector_id], "Unknown projection id") - local camera = cameras[camera_id] - msg.post(camera.url, "use_projection", { projection = projector_id }) +function M.add_projector() + error("add_projector is deprecated") +end +function M.use_projector() + error("use_projector is deprecated") +end +function M.get_projection_id() + error("get_projection_id is deprecated") +end +function M.send_view_projection() + error("send_view_projection is deprecated") end --- Set window scaling factor (basically retina or no retina screen) @@ -169,6 +122,10 @@ local function update_window_size() if width == 0 or height == 0 then return end + -- calculate an initial dpi_ratio + if not dpi_ratio then + dpi_ratio = width / DISPLAY_WIDTH + end if width == WINDOW_WIDTH and height == WINDOW_HEIGHT then return end @@ -215,27 +172,6 @@ function M.get_display_size() return DISPLAY_WIDTH, DISPLAY_HEIGHT end -local function calculate_projection(camera) - local projection_id = camera.projection_id - assert(projectors[projection_id], "Unknown projection id") - local projector_fn = projectors[projection_id] or projectors[M.PROJECTOR.DEFAULT] - return projector_fn(camera.id, camera.near_z, camera.far_z, camera.zoom) -end - - -local function calculate_view(camera, camera_world_pos, offset) - local rot = go.get_world_rotation(camera.id) - local pos = camera_world_pos - vmath.rotate(rot, OFFSET) - if offset then - pos = pos + offset - end - - local look_at = pos + vmath.rotate(rot, VECTOR3_MINUS1_Z) - local up = vmath.rotate(rot, VECTOR3_UP) - local view = vmath.matrix4_look_at(pos, look_at, up) - return view -end - local function refresh_cameras() if cameras_dirty then cameras_dirty = false @@ -257,32 +193,59 @@ local function refresh_cameras() end end +local world_position = nil +world_position = function(id) + local pos = go.get_position(id) + local parent = go.get_parent(id) + if parent then + pos = pos + world_position(parent) + end + return pos +end + +local function calculate_auto_zoom(camera) + local viewport = camera.viewport + local ww = (viewport.z or WINDOW_WIDTH) / dpi_ratio + local wh = (viewport.w or WINDOW_HEIGHT) / dpi_ratio + + return math.min(ww / DISPLAY_WIDTH, wh / DISPLAY_HEIGHT) +end + +local function update_from_properties(camera) + -- from camera component + camera.near_z = go.get(camera.component_url, "near_z") + camera.far_z = go.get(camera.component_url, "far_z") + camera.zoom = go.get(camera.component_url, "orthographic_zoom") + camera.view = go.get(camera.component_url, "view") + camera.projection = go.get(camera.component_url, "projection") + + -- from script component + camera.automatic_zoom = go.get(camera.url, "automatic_zoom") + if camera.automatic_zoom then + local zoom = calculate_auto_zoom(camera) + camera.zoom = zoom + msg.post(camera.url, M.MSG_ZOOM_TO, { zoom = zoom }) + end +end + --- Initialize a camera -- Note: This is called automatically from the init() function of the camera.script -- @param camera_id -- @param camera_script_url -function M.init(camera_id, camera_script_url, settings) +function M.init(camera_id, _, settings) assert(camera_id, "You must provide a camera id") - assert(camera_script_url, "You must provide a camera script url") cameras[camera_id] = settings cameras_dirty = true local camera = cameras[camera_id] camera.id = camera_id - camera.url = camera_script_url - camera.projection_id = go.get(camera_script_url, "projection") - camera.near_z = go.get(camera_script_url, "near_z") - camera.far_z = go.get(camera_script_url, "far_z") - camera.view = calculate_view(camera, go.get_world_position(camera_id)) - camera.projection = calculate_projection(camera) + camera.url = msg.url(nil, camera_id, "script") + camera.component_url = msg.url(nil, camera_id, "camera") camera.viewport = vmath.vector4(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT) + update_from_properties(camera) if not sys.get_engine_info().is_debug then log = function() end end - - if not M.ORTHOGRAPHIC_RENDER_SCRIPT_USED then - log("WARNING: orthographic.render_script not used. Did you forget to change render file in game.project?") - end end --- Finalize a camera @@ -326,9 +289,10 @@ function M.update(camera_id, dt) return end + update_from_properties(camera) update_window_size() - local camera_world_pos = go.get_world_position(camera_id) + local camera_world_pos = world_position(camera_id) local camera_world_to_local_diff = camera_world_pos - go.get_position(camera_id) local follow_enabled = go.get(camera.url, "follow") if follow_enabled then @@ -414,18 +378,25 @@ function M.update(camera_id, dt) local viewport_right = go.get(camera.url, "viewport_right") if viewport_top == 0 then viewport_top = WINDOW_HEIGHT + else + viewport_top = viewport_top * dpi_ratio end if viewport_right == 0 then viewport_right = WINDOW_WIDTH + else + viewport_right = viewport_right * dpi_ratio + end + if viewport_left ~= 0 then + viewport_left = viewport_left * dpi_ratio + end + if viewport_bottom ~= 0 then + viewport_bottom = viewport_bottom * dpi_ratio end camera.viewport.x = viewport_left camera.viewport.y = viewport_bottom camera.viewport.z = math.max(viewport_right - viewport_left, 1) camera.viewport.w = math.max(viewport_top - viewport_bottom, 1) - go.set_position(camera_world_pos + camera_world_to_local_diff, camera_id) - - if camera.shake then camera.shake.duration = camera.shake.duration - dt if camera.shake.duration < 0 then @@ -448,28 +419,28 @@ function M.update(camera_id, dt) else local t = camera.recoil.time_left / camera.recoil.duration camera.recoil.offset = vmath.lerp(t, VECTOR3_ZERO, camera.recoil.offset) + camera.recoil.offset.z = 0 end end - local offset + local offset = VECTOR3_ZERO + local previous_offset = camera.offset or VECTOR3_ZERO if camera.shake or camera.recoil then - offset = VECTOR3_ZERO if camera.shake then offset = offset + camera.shake.offset end if camera.recoil then offset = offset + camera.recoil.offset end + offset.z = 0 end camera.offset = offset - camera.projection_id = go.get(camera.url, "projection") - camera.near_z = go.get(camera.url, "near_z") - camera.far_z = go.get(camera.url, "far_z") - camera.zoom = go.get(camera.url, "zoom") - camera.view = calculate_view(camera, camera_world_pos, offset) - camera.projection = calculate_projection(camera) + local new_camera_position = camera_world_pos + camera_world_to_local_diff + camera.offset - previous_offset + --local new_camera_position = camera.offset - previous_offset + go.set_position(new_camera_position, camera_id) + refresh_cameras() end @@ -500,7 +471,7 @@ function M.follow(camera_id, target, options) local immediate = options and options.immediate if horizontal == nil then horizontal = true end if vertical == nil then vertical = true end - + msg.post(cameras[camera_id].url, M.MSG_FOLLOW, { target = target, lerp = lerp, @@ -611,6 +582,19 @@ function M.recoil(camera_id, offset, duration) } end +function M.get_automatic_zoom(camera_id) + camera_id = camera_id or camera_ids[1] + assert(camera_id, "You must provide a camera id") + local camera = cameras[camera_id] + return camera.automatic_zoom +end + +function M.set_automatic_zoom(camera_id, enabled) + camera_id = camera_id or camera_ids[1] + assert(camera_id, "You must provide a camera id") + local camera = cameras[camera_id] + msg.post(camera.url, M.MSG_SET_AUTOMATIC_ZOOM, { enabled = enabled}) +end --- Set the zoom level of a camera -- @param camera_id or nil for the first camera @@ -621,11 +605,8 @@ function M.set_zoom(camera_id, zoom) assert(zoom, "You must provide a zoom level") local camera = cameras[camera_id] msg.post(camera.url, M.MSG_ZOOM_TO, { zoom = zoom }) - camera.zoom = zoom - camera.projection = calculate_projection(camera) end - --- Get the zoom level of a camera -- @param camera_id or nil for the first camera -- @return Current zoom level of the camera @@ -635,7 +616,6 @@ function M.get_zoom(camera_id) return cameras[camera_id].zoom end - --- Get the projection matrix for a camera -- @param camera_id or nil for the first camera -- @return Projection matrix @@ -645,17 +625,6 @@ function M.get_projection(camera_id) return cameras[camera_id].projection end - ---- Get the projection id for a camera --- @param camera_id or nil for the first camera --- @return Projection id -function M.get_projection_id(camera_id) - camera_id = camera_id or camera_ids[1] - assert(camera_id, "You must provide a camera id") - return cameras[camera_id].projection_id -end - - --- Get the view matrix for a specific camera, based on the camera position -- and rotation -- @param camera_id or nil for the first camera @@ -686,18 +655,6 @@ function M.get_offset(camera_id) return cameras[camera_id].offset end - ---- Send the view and projection matrix for a camera to the render script --- @param camera_id -function M.send_view_projection(camera_id) - assert(camera_id, "You must provide a camera id") - local camera = cameras[camera_id] - local view = camera.view or MATRIX4 - local projection = camera.projection or MATRIX4 - msg.post("@render:", "set_view_projection", { id = camera_id, view = view, projection = projection }) -end - - --- Convert screen coordinates to world coordinates based -- on a specific camera's view and projection -- Screen coordinates are the scaled coordinates provided by action.x and action.y diff --git a/orthographic/camera.script b/orthographic/camera.script index 9222f3d..c29fafd 100644 --- a/orthographic/camera.script +++ b/orthographic/camera.script @@ -1,7 +1,7 @@ go.property("near_z", -1) go.property("far_z", 1) go.property("zoom", 1) -go.property("projection", hash("DEFAULT")) +go.property("automatic_zoom", false) go.property("enabled", true) go.property("order", 1) @@ -31,8 +31,7 @@ go.property("viewport_top", 0) local camera = require "orthographic.camera" local function has_active_follow_target(follow_id) - local ok, err = pcall(go.get_position, follow_id) - return ok + return go.exists(follow_id) end local function position_on_follow(self) @@ -44,37 +43,35 @@ local function position_on_follow(self) end end +local function set_camera_properties(self) + go.set("#camera", "far_z", self.far_z + 0.0001) + go.set("#camera", "near_z", self.near_z - 0.0001) + go.set("#camera", "orthographic_zoom", self.zoom) +end + function init(self) - camera.init(go.get_id(), msg.url(), { zoom = self.zoom }) + msg.post("@render:", "use_camera_projection") + set_camera_properties(self) + camera.init(go.get_id(), nil, { zoom = self.zoom }) camera.update(go.get_id(), 0) if self.enabled then - camera.send_view_projection(go.get_id()) if self.follow and self.follow_immediately then position_on_follow(self) end end end - function final(self) camera.final(go.get_id()) end - function update(self, dt) - -- update camera and view projection after all game objects have been updated - -- will jitter otherwise - msg.post("#", camera.MSG_UPDATE_CAMERA, { dt = dt }) + camera.update(go.get_id(), dt) + set_camera_properties(self) end - function on_message(self, message_id, message, sender) - if message_id == camera.MSG_UPDATE_CAMERA then - camera.update(go.get_id(), message.dt) - if self.enabled then - camera.send_view_projection(go.get_id()) - end - elseif message_id == camera.MSG_ENABLE then + if message_id == camera.MSG_ENABLE then self.enabled = true elseif message_id == camera.MSG_DISABLE then self.enabled = false @@ -129,5 +126,7 @@ function on_message(self, message_id, message, sender) elseif message_id == camera.MSG_ZOOM_TO then assert(message.zoom, "You must provide a zoom level") self.zoom = message.zoom + elseif message_id == camera.MSG_SET_AUTOMATIC_ZOOM then + self.automatic_zoom = message.enabled end end \ No newline at end of file From c2a201ebbd71e0d509a1ed8daebde268f633e53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ritzl?= Date: Mon, 14 Oct 2024 08:56:08 +0200 Subject: [PATCH 2/2] Cleanup --- orthographic/camera.lua | 7 +++---- orthographic/camera.script | 15 ++++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/orthographic/camera.lua b/orthographic/camera.lua index 65db066..78ba125 100644 --- a/orthographic/camera.lua +++ b/orthographic/camera.lua @@ -213,13 +213,13 @@ end local function update_from_properties(camera) -- from camera component - camera.near_z = go.get(camera.component_url, "near_z") - camera.far_z = go.get(camera.component_url, "far_z") - camera.zoom = go.get(camera.component_url, "orthographic_zoom") camera.view = go.get(camera.component_url, "view") camera.projection = go.get(camera.component_url, "projection") -- from script component + camera.near_z = go.get(camera.url, "near_z") + camera.far_z = go.get(camera.url, "far_z") + camera.zoom = go.get(camera.url, "zoom") camera.automatic_zoom = go.get(camera.url, "automatic_zoom") if camera.automatic_zoom then local zoom = calculate_auto_zoom(camera) @@ -438,7 +438,6 @@ function M.update(camera_id, dt) local new_camera_position = camera_world_pos + camera_world_to_local_diff + camera.offset - previous_offset - --local new_camera_position = camera.offset - previous_offset go.set_position(new_camera_position, camera_id) refresh_cameras() diff --git a/orthographic/camera.script b/orthographic/camera.script index c29fafd..ffedea8 100644 --- a/orthographic/camera.script +++ b/orthographic/camera.script @@ -51,9 +51,10 @@ end function init(self) msg.post("@render:", "use_camera_projection") + self.id = go.get_id() set_camera_properties(self) - camera.init(go.get_id(), nil, { zoom = self.zoom }) - camera.update(go.get_id(), 0) + camera.init(self.id, nil, { zoom = self.zoom }) + camera.update(self.id, 0) if self.enabled then if self.follow and self.follow_immediately then position_on_follow(self) @@ -62,11 +63,11 @@ function init(self) end function final(self) - camera.final(go.get_id()) + camera.final(self.id) end function update(self, dt) - camera.update(go.get_id(), dt) + camera.update(self.id, dt) set_camera_properties(self) end @@ -116,13 +117,13 @@ function on_message(self, message_id, message, sender) self.viewport_left = message.left or 0 self.viewport_bottom = message.bottom or 0 elseif message_id == camera.MSG_SHAKE then - camera.shake(go.get_id(), message.intensity, message.duration, message.direction, function() + camera.shake(self.id, message.intensity, message.duration, message.direction, function() msg.post(sender, camera.MSG_SHAKE_COMPLETED) end) elseif message_id == camera.MSG_RECOIL then - camera.recoil(go.get_id(), message.offset, message.duration) + camera.recoil(self.id, message.offset, message.duration) elseif message_id == camera.MSG_STOP_SHAKING then - camera.stop_shaking(go.get_id()) + camera.stop_shaking(self.id) elseif message_id == camera.MSG_ZOOM_TO then assert(message.zoom, "You must provide a zoom level") self.zoom = message.zoom