├── .gitignore ├── LICENSE ├── README.md ├── assets ├── PressStart2P-Regular.ttf └── thumbnail.png ├── dtimer └── dtimer.lua ├── example ├── main.collection ├── main.font ├── main.go ├── main.gui ├── main.gui_script └── main.script ├── game.project └── input └── game.input_binding /.gitignore: -------------------------------------------------------------------------------- 1 | /.internal 2 | /build 3 | .externalToolBuilders 4 | .DS_Store 5 | Thumbs.db 6 | .lock-wscript 7 | *.pyc 8 | .project 9 | .cproject 10 | builtins 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 White Box Dev 2 | 3 | This software is provided 'as-is', without any express or implied warranty. 4 | In no event will the authors be held liable for any damages arising from the use of this software. 5 | 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 11 | If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 13 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 14 | 15 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Defold Timer 2 | 3 | Defold Timer provides a visual timer widget in a Defold game engine project. 4 | 5 | Please click the ☆ button on GitHub if this repository is useful or interesting. Thank you! 6 | 7 | ![alt text](https://github.com/whiteboxdev/library-defold-timer/blob/main/assets/thumbnail.png?raw=true) 8 | 9 | ## Installation 10 | 11 | Add the latest version to your project's dependencies: 12 | https://github.com/whiteboxdev/library-defold-timer/archive/main.zip 13 | 14 | ## Configuration 15 | 16 | Import the dtimer Lua module into your relevant gui scripts: 17 | `local dtimer = require "dtimer.dtimer"` 18 | 19 | In many games, there exists some kind of on-screen timer counting up or down to track the player's rate of progression through a level or scenario. The elapsed time can then be used for various purposes, for example saving the player's fastest attempt at a level or restarting a level when time runs out. 20 | 21 | This library only handles timer logic and setting the text of a gui node with `gui.set_text()`. The user retains all styling authority over their gui nodes. These philosophies allow for simplicity, robustness, and separation of concerns. 22 | 23 | Timers used in `dtimer` hold four components: hours, minutes, seconds, and centiseconds. The user can specify which of these components to display in their gui nodes. Leading zeros are displayed appropriately. 24 | 25 | See the following code for a basic usage scenario: 26 | 27 | ``` 28 | local dtimer = require "dtimer.dtimer" 29 | 30 | -- Hash of gui node id. 31 | local node_timer = hash("node_timer") 32 | 33 | function init(self) 34 | msg.url(msg.url(), hash("acquire_input_focus")) 35 | dtimer.set_url(msg.url()) 36 | -- Count up to 1 hour and display all timestamp components. 37 | dtimer.add_node(node_timer, true, { hours = true, minutes = true, seconds = true, centiseconds = true }, 3600) 38 | dtimer.start(node_timer) 39 | end 40 | 41 | function update(self, dt) 42 | dtimer.update(dt) 43 | end 44 | 45 | function on_message(self, message_id, message, sender) 46 | if message_id == dtimer.messages.start then 47 | -- If timer starts, turn node green. 48 | gui.set_color(gui.get_node(message.node_id), vmath.vector4(0, 1, 0, 1)) 49 | elseif message_id == dtimer.messages.stop then 50 | -- If timer stops and limit is reached, turn node red. 51 | -- If timer stops and limit is not reached or no limit exists, turn node yellow. 52 | gui.set_color(gui.get_node(message.node_id), message.complete and vmath.vector4(1, 0, 0, 1) or vmath.vector4(1, 1, 0, 1)) 53 | end 54 | end 55 | ``` 56 | 57 | ## API: Properties 58 | 59 | ### dtimer.messages 60 | 61 | Table of hashes which are sent to the `on_message()` function of the corresponding gui script: 62 | 63 | ``` 64 | dtimer.messages 65 | { 66 | start = hash("dtimer_start"), 67 | stop = hash("dtimer_stop") 68 | } 69 | ``` 70 | 71 | `start`: Sent when a timer starts. The `message` table contains the following: 72 | 73 | ``` 74 | { 75 | node_id = , 76 | elapsed = -- Starting value of the timer in seconds. 77 | } 78 | ``` 79 | 80 | `stop`: Sent when a timer stops. The `message` table contains the following: 81 | 82 | ``` 83 | { 84 | node_id = , 85 | elapsed = , -- Stopping value of the timer in seconds. 86 | complete = -- If the timer reached its `duration` limit. 87 | } 88 | ``` 89 | 90 | ## API: Functions 91 | 92 | ### dtimer.add_node(node_id, increasing, [format], [duration]) 93 | 94 | Adds a gui node to the timer system. Timers begin in the stopped state. 95 | 96 | #### Parameters 97 | 1. `node_id`: Hashed id of a gui node. 98 | 2. `increasing`: `bool` if timer should count up or down. 99 | 3. `[format]`: Table that specifies which timestamp components to display: 100 | 101 | ``` 102 | { 103 | hours = false, 104 | minutes = true, 105 | seconds = true, 106 | centiseconds = false 107 | } 108 | ``` 109 | 110 | If `format` is `nil`, then the above default will be used. 111 | 112 | 4. `[duration]`: Maximum elapsed seconds counting up from zero or start time counting down to zero. This argument is required if `increasing` is `false`. 113 | 114 | --- 115 | 116 | ### dtimer.remove_node(node_id) 117 | 118 | Removes a node from the timer system. 119 | 120 | #### Parameters 121 | 1. `node_id`: Hashed id of a gui node. 122 | 123 | --- 124 | 125 | ### dtimer.start(node_id, [reset]) 126 | 127 | Starts the timer attached to a node. If the timer is already started and `reset` is `true`, then its elapsed time will reset and continue counting without stopping. 128 | 129 | #### Parameters 130 | 1. `node_id`: Hashed id of a gui node. 131 | 2. `[reset]`: `bool` if the timer should reset to zero. 132 | 133 | --- 134 | 135 | ### dtimer.stop(node_id, [reset]) 136 | 137 | Stops the timer attached to a node. 138 | 139 | #### Parameters 140 | 1. `node_id`: Hashed id of a gui node. 141 | 2. `[reset]`: `bool` if the timer should reset to zero. 142 | 143 | --- 144 | 145 | ### dtimer.toggle(node_id, [reset]) 146 | 147 | Toggles the timer attached to a node. 148 | 149 | #### Parameters 150 | 1. `node_id`: Hashed id of a gui node. 151 | 2. `[reset]`: `bool` if the timer should reset to zero. 152 | 153 | --- 154 | 155 | ### dtimer.update(dt) 156 | 157 | Updates all timers and displays. Should be called in the `update(self, dt)` function of your gui script. 158 | 159 | #### Parameters 160 | 1. `dt`: Time elapsed since last frame. 161 | 162 | --- 163 | 164 | ### dtimer.set_url(url) 165 | 166 | Sets the url of the gui script to receive `dtimer` messages. 167 | 168 | #### Parameters 169 | 1. `url`: Url of the gui script to receive `dtimer` messages. 170 | 171 | --- 172 | 173 | ### dtimer.set_format(node_id, format) 174 | 175 | Sets the format of a node. 176 | 177 | #### Parameters 178 | 1. `node_id`: Hashed id of a gui node. 179 | 2. `format`: Table that specifies which timestamp components to display: 180 | 181 | ``` 182 | { 183 | hours = false, 184 | minutes = true, 185 | seconds = true, 186 | centiseconds = false 187 | } 188 | ``` 189 | 190 | --- 191 | 192 | ### dtimer.set_timestamp(node_id, format, seconds) 193 | 194 | Applies a timestamp to a node that is not registered with `dtimer`. This is useful when a node should not be tracked by `dtimer.add_node()`, but should display a formatted timestamp. 195 | 196 | #### Parameters 197 | 1. `node_id`: Hashed id of a gui node. 198 | 2. `format`: Table that specifies which timestamp components to display: 199 | 200 | ``` 201 | { 202 | hours = false, 203 | minutes = true, 204 | seconds = true, 205 | centiseconds = false 206 | } 207 | ``` 208 | 209 | 3. `seconds`: Seconds to format into a timestamp. 210 | 211 | --- 212 | 213 | ### dtimer.get_elapsed(node_id) 214 | 215 | Gets the elapsed time of a node in seconds. 216 | 217 | #### Parameters 218 | 1. `node_id`: Hashed id of a gui node. 219 | 220 | #### Returns 221 | Return a `number`. 222 | 223 | --- 224 | 225 | ### dtimer.get_timestamp(node_id) 226 | 227 | Gets a verbose timestamp of a node. 228 | 229 | #### Parameters 230 | 1. `node_id`: Hashed id of a gui node. 231 | 232 | #### Returns 233 | Return a table in the following format: 234 | 235 | ``` 236 | { 237 | hours = , 238 | minutes = , 239 | seconds = , 240 | centiseconds = 241 | } 242 | ``` 243 | 244 | --- 245 | 246 | ### dtimer.is_enabled(node_id) 247 | 248 | Checks if the timer attached to a node is running. 249 | 250 | #### Parameters 251 | 1. `node_id`: Hashed id of a gui node. 252 | 253 | #### Returns 254 | 255 | Returns `true` or `false`. 256 | -------------------------------------------------------------------------------- /assets/PressStart2P-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whiteboxdev/library-defold-timer/77c1f2bc92c70f14e4db7cd1a10abb6ba7c470c2/assets/PressStart2P-Regular.ttf -------------------------------------------------------------------------------- /assets/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whiteboxdev/library-defold-timer/77c1f2bc92c70f14e4db7cd1a10abb6ba7c470c2/assets/thumbnail.png -------------------------------------------------------------------------------- /dtimer/dtimer.lua: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | -- LICENSE 3 | -------------------------------------------------------------------------------- 4 | 5 | -- Copyright (c) 2024 White Box Dev 6 | 7 | -- This software is provided 'as-is', without any express or implied warranty. 8 | -- In no event will the authors be held liable for any damages arising from the use of this software. 9 | 10 | -- Permission is granted to anyone to use this software for any purpose, 11 | -- including commercial applications, and to alter it and redistribute it freely, 12 | -- subject to the following restrictions: 13 | 14 | -- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 15 | -- If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 16 | 17 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 18 | 19 | -- 3. This notice may not be removed or altered from any source distribution. 20 | 21 | -------------------------------------------------------------------------------- 22 | -- INFORMATION 23 | -------------------------------------------------------------------------------- 24 | 25 | -- https://github.com/whiteboxdev/library-defold-timer 26 | 27 | ---------------------------------------------------------------------- 28 | -- PROPERTIES 29 | ---------------------------------------------------------------------- 30 | 31 | local dtimer = {} 32 | 33 | dtimer.messages = 34 | { 35 | start = hash("dtimer_start"), 36 | stop = hash("dtimer_stop") 37 | } 38 | 39 | local nodes = {} 40 | 41 | local on_message_url 42 | 43 | local hour_scalar = 1 / 60 / 60 44 | local minute_scalar = 1 / 60 45 | 46 | ---------------------------------------------------------------------- 47 | -- LOCAL FUNCTIONS 48 | ---------------------------------------------------------------------- 49 | 50 | local function get_timestamp(elapsed) 51 | return 52 | { 53 | hours = math.floor(elapsed * hour_scalar), 54 | minutes = math.floor(elapsed * minute_scalar % 60), 55 | seconds = math.floor(elapsed % 60), 56 | centiseconds = math.floor(elapsed * 100 % 100) 57 | } 58 | end 59 | 60 | local function get_timestamp_components(elapsed) 61 | return math.floor(elapsed * hour_scalar), math.floor(elapsed * minute_scalar % 60), math.floor(elapsed % 60), math.floor(elapsed * 100 % 100) 62 | end 63 | 64 | local function draw(node) 65 | local text = "" 66 | local hours, minutes, seconds, centiseconds = get_timestamp_components(node.elapsed) 67 | if node.format.hours then 68 | text = text .. hours 69 | else 70 | minutes = minutes + hours * 60 71 | end 72 | if node.format.minutes then 73 | if #text > 0 then 74 | text = text .. ":" 75 | if minutes < 10 then 76 | text = text .. "0" 77 | end 78 | end 79 | text = text .. minutes 80 | else 81 | seconds = seconds + minutes * 60 82 | end 83 | if node.format.seconds then 84 | if #text > 0 then 85 | text = text .. ":" 86 | if seconds < 10 then 87 | text = text .. "0" 88 | end 89 | end 90 | text = text .. seconds 91 | else 92 | centiseconds = centiseconds + seconds * 60 93 | end 94 | if node.format.centiseconds then 95 | if #text > 0 then 96 | text = text .. "." 97 | if centiseconds < 10 then 98 | text = text .. "0" 99 | end 100 | end 101 | text = text .. centiseconds 102 | end 103 | gui.set_text(node.node, text) 104 | end 105 | 106 | local function reset_node(node) 107 | if node.increasing then 108 | node.elapsed = 0 109 | else 110 | node.elapsed = node.duration 111 | end 112 | end 113 | 114 | ---------------------------------------------------------------------- 115 | -- MODULE FUNCTIONS 116 | ---------------------------------------------------------------------- 117 | 118 | function dtimer.add_node(node_id, increasing, format, duration) 119 | if not nodes[node_id] then 120 | nodes[node_id] = 121 | { 122 | node = gui.get_node(node_id), 123 | enabled = false, 124 | elapsed = not increasing and duration or 0, 125 | increasing = increasing, 126 | format = format or { minutes = true, seconds = true }, 127 | duration = duration 128 | } 129 | end 130 | end 131 | 132 | function dtimer.remove_node(node_id) 133 | nodes[node_id] = nil 134 | end 135 | 136 | function dtimer.start(node_id, reset) 137 | local node = nodes[node_id] 138 | if node then 139 | node.enabled = true 140 | if reset then 141 | reset_node(node) 142 | end 143 | msg.post(on_message_url, dtimer.messages.start, { node_id = node_id, elapsed = node.elapsed }) 144 | end 145 | end 146 | 147 | function dtimer.stop(node_id, reset) 148 | local node = nodes[node_id] 149 | if node then 150 | node.enabled = false 151 | msg.post(on_message_url, dtimer.messages.stop, { node_id = node_id, elapsed = node.elapsed, complete = node.elapsed == (node.increasing and node.duration or 0) }) 152 | if reset then 153 | reset_node(node) 154 | end 155 | end 156 | end 157 | 158 | function dtimer.toggle(node_id, reset) 159 | if nodes[node_id] then 160 | if nodes[node_id].enabled then 161 | return dtimer.stop(node_id, reset) 162 | end 163 | return dtimer.start(node_id, reset) 164 | end 165 | end 166 | 167 | function dtimer.update(dt) 168 | for node_id, node in pairs(nodes) do 169 | if node.enabled then 170 | if node.increasing then 171 | node.elapsed = node.elapsed + dt 172 | if node.duration and node.duration < node.elapsed then 173 | node.elapsed = node.duration 174 | node.enabled = false 175 | msg.post(on_message_url, dtimer.messages.stop, { node_id = node_id, elapsed = node.elapsed, complete = true }) 176 | end 177 | else 178 | node.elapsed = node.elapsed - dt 179 | if node.elapsed < 0 then 180 | node.elapsed = 0 181 | node.enabled = false 182 | msg.post(on_message_url, dtimer.messages.stop, { node_id = node_id, elapsed = node.elapsed, complete = true }) 183 | end 184 | end 185 | end 186 | draw(node) 187 | end 188 | end 189 | 190 | function dtimer.set_url(url) 191 | on_message_url = url 192 | end 193 | 194 | function dtimer.set_format(node_id, format) 195 | if nodes[node_id] then 196 | nodes[node_id].format = format 197 | end 198 | end 199 | 200 | function dtimer.set_timestamp(node_id, format, seconds) 201 | draw({ node = gui.get_node(node_id), format = format, elapsed = seconds }) 202 | end 203 | 204 | function dtimer.get_elapsed(node_id) 205 | if nodes[node_id] then 206 | return nodes[node_id].elapsed 207 | end 208 | end 209 | 210 | function dtimer.get_timestamp(node_id) 211 | if nodes[node_id] then 212 | return get_timestamp(nodes[node_id].elapsed) 213 | end 214 | end 215 | 216 | function dtimer.is_enabled(node_id) 217 | if nodes[node_id] then 218 | return nodes[node_id].enabled 219 | end 220 | end 221 | 222 | return dtimer 223 | -------------------------------------------------------------------------------- /example/main.collection: -------------------------------------------------------------------------------- 1 | name: "collection_main" 2 | instances { 3 | id: "camera_main" 4 | prototype: "/rendercam/camera.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | component_properties { 17 | id: "script" 18 | properties { 19 | id: "fixedAspectRatio" 20 | value: "true" 21 | type: PROPERTY_TYPE_BOOLEAN 22 | } 23 | properties { 24 | id: "useViewArea" 25 | value: "true" 26 | type: PROPERTY_TYPE_BOOLEAN 27 | } 28 | properties { 29 | id: "viewArea" 30 | value: "960.0, 540.0, 0.0" 31 | type: PROPERTY_TYPE_VECTOR3 32 | } 33 | } 34 | scale3 { 35 | x: 1.0 36 | y: 1.0 37 | z: 1.0 38 | } 39 | } 40 | instances { 41 | id: "main" 42 | prototype: "/example/main.go" 43 | position { 44 | x: 0.0 45 | y: 0.0 46 | z: 0.0 47 | } 48 | rotation { 49 | x: 0.0 50 | y: 0.0 51 | z: 0.0 52 | w: 1.0 53 | } 54 | scale3 { 55 | x: 1.0 56 | y: 1.0 57 | z: 1.0 58 | } 59 | } 60 | scale_along_z: 0 61 | -------------------------------------------------------------------------------- /example/main.font: -------------------------------------------------------------------------------- 1 | font: "/assets/PressStart2P-Regular.ttf" 2 | material: "/builtins/fonts/font.material" 3 | size: 16 4 | antialias: 1 5 | alpha: 1.0 6 | outline_alpha: 0.0 7 | outline_width: 0.0 8 | shadow_alpha: 0.0 9 | shadow_blur: 0 10 | shadow_x: 0.0 11 | shadow_y: 0.0 12 | extra_characters: "" 13 | output_format: TYPE_BITMAP 14 | all_chars: false 15 | cache_width: 0 16 | cache_height: 0 17 | render_mode: MODE_SINGLE_LAYER 18 | -------------------------------------------------------------------------------- /example/main.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "gui" 3 | component: "/example/main.gui" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | components { 17 | id: "script" 18 | component: "/example/main.script" 19 | position { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | } 24 | rotation { 25 | x: 0.0 26 | y: 0.0 27 | z: 0.0 28 | w: 1.0 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/main.gui: -------------------------------------------------------------------------------- 1 | script: "/example/main.gui_script" 2 | fonts { 3 | name: "main" 4 | font: "/example/main.font" 5 | } 6 | background_color { 7 | x: 0.0 8 | y: 0.0 9 | z: 0.0 10 | w: 0.0 11 | } 12 | nodes { 13 | position { 14 | x: 480.0 15 | y: 530.0 16 | z: 0.0 17 | w: 1.0 18 | } 19 | rotation { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 1.0 24 | } 25 | scale { 26 | x: 1.0 27 | y: 1.0 28 | z: 1.0 29 | w: 1.0 30 | } 31 | size { 32 | x: 940.0 33 | y: 16.0 34 | z: 0.0 35 | w: 1.0 36 | } 37 | color { 38 | x: 1.0 39 | y: 1.0 40 | z: 1.0 41 | w: 1.0 42 | } 43 | type: TYPE_TEXT 44 | blend_mode: BLEND_MODE_ALPHA 45 | text: "Defold Timer - Example" 46 | font: "main" 47 | id: "node_title" 48 | xanchor: XANCHOR_NONE 49 | yanchor: YANCHOR_NONE 50 | pivot: PIVOT_N 51 | outline { 52 | x: 1.0 53 | y: 1.0 54 | z: 1.0 55 | w: 1.0 56 | } 57 | shadow { 58 | x: 1.0 59 | y: 1.0 60 | z: 1.0 61 | w: 1.0 62 | } 63 | adjust_mode: ADJUST_MODE_FIT 64 | line_break: false 65 | layer: "" 66 | inherit_alpha: true 67 | alpha: 1.0 68 | outline_alpha: 1.0 69 | shadow_alpha: 1.0 70 | template_node_child: false 71 | text_leading: 1.0 72 | text_tracking: 0.0 73 | custom_type: 0 74 | enabled: true 75 | visible: true 76 | material: "" 77 | } 78 | nodes { 79 | position { 80 | x: 480.0 81 | y: 504.0 82 | z: 0.0 83 | w: 1.0 84 | } 85 | rotation { 86 | x: 0.0 87 | y: 0.0 88 | z: 0.0 89 | w: 1.0 90 | } 91 | scale { 92 | x: 1.0 93 | y: 1.0 94 | z: 1.0 95 | w: 1.0 96 | } 97 | size { 98 | x: 940.0 99 | y: 16.0 100 | z: 0.0 101 | w: 1.0 102 | } 103 | color { 104 | x: 0.5019608 105 | y: 0.5019608 106 | z: 0.5019608 107 | w: 1.0 108 | } 109 | type: TYPE_TEXT 110 | blend_mode: BLEND_MODE_ALPHA 111 | text: "Controls: <1, 2, 3> Toggle corresponding timer." 112 | font: "main" 113 | id: "node_controls" 114 | xanchor: XANCHOR_NONE 115 | yanchor: YANCHOR_NONE 116 | pivot: PIVOT_N 117 | outline { 118 | x: 1.0 119 | y: 1.0 120 | z: 1.0 121 | w: 1.0 122 | } 123 | shadow { 124 | x: 1.0 125 | y: 1.0 126 | z: 1.0 127 | w: 1.0 128 | } 129 | adjust_mode: ADJUST_MODE_FIT 130 | line_break: false 131 | layer: "" 132 | inherit_alpha: true 133 | alpha: 1.0 134 | outline_alpha: 1.0 135 | shadow_alpha: 1.0 136 | template_node_child: false 137 | text_leading: 1.0 138 | text_tracking: 0.0 139 | custom_type: 0 140 | enabled: true 141 | visible: true 142 | material: "" 143 | } 144 | nodes { 145 | position { 146 | x: 220.0 147 | y: 225.0 148 | z: 0.0 149 | w: 1.0 150 | } 151 | rotation { 152 | x: 0.0 153 | y: 0.0 154 | z: 0.0 155 | w: 1.0 156 | } 157 | scale { 158 | x: 1.0 159 | y: 1.0 160 | z: 1.0 161 | w: 1.0 162 | } 163 | size { 164 | x: 250.0 165 | y: 32.0 166 | z: 0.0 167 | w: 1.0 168 | } 169 | color { 170 | x: 0.0 171 | y: 1.0 172 | z: 0.0 173 | w: 1.0 174 | } 175 | type: TYPE_TEXT 176 | blend_mode: BLEND_MODE_ALPHA 177 | text: "" 178 | font: "main" 179 | id: "node_timer_1" 180 | xanchor: XANCHOR_NONE 181 | yanchor: YANCHOR_NONE 182 | pivot: PIVOT_CENTER 183 | outline { 184 | x: 1.0 185 | y: 1.0 186 | z: 1.0 187 | w: 1.0 188 | } 189 | shadow { 190 | x: 1.0 191 | y: 1.0 192 | z: 1.0 193 | w: 1.0 194 | } 195 | adjust_mode: ADJUST_MODE_FIT 196 | line_break: false 197 | layer: "" 198 | inherit_alpha: true 199 | alpha: 1.0 200 | outline_alpha: 1.0 201 | shadow_alpha: 1.0 202 | template_node_child: false 203 | text_leading: 1.0 204 | text_tracking: 0.0 205 | custom_type: 0 206 | enabled: true 207 | visible: true 208 | material: "" 209 | } 210 | nodes { 211 | position { 212 | x: 480.0 213 | y: 225.0 214 | z: 0.0 215 | w: 1.0 216 | } 217 | rotation { 218 | x: 0.0 219 | y: 0.0 220 | z: 0.0 221 | w: 1.0 222 | } 223 | scale { 224 | x: 1.0 225 | y: 1.0 226 | z: 1.0 227 | w: 1.0 228 | } 229 | size { 230 | x: 250.0 231 | y: 32.0 232 | z: 0.0 233 | w: 1.0 234 | } 235 | color { 236 | x: 0.0 237 | y: 1.0 238 | z: 0.0 239 | w: 1.0 240 | } 241 | type: TYPE_TEXT 242 | blend_mode: BLEND_MODE_ALPHA 243 | text: "" 244 | font: "main" 245 | id: "node_timer_2" 246 | xanchor: XANCHOR_NONE 247 | yanchor: YANCHOR_NONE 248 | pivot: PIVOT_CENTER 249 | outline { 250 | x: 1.0 251 | y: 1.0 252 | z: 1.0 253 | w: 1.0 254 | } 255 | shadow { 256 | x: 1.0 257 | y: 1.0 258 | z: 1.0 259 | w: 1.0 260 | } 261 | adjust_mode: ADJUST_MODE_FIT 262 | line_break: false 263 | layer: "" 264 | inherit_alpha: true 265 | alpha: 1.0 266 | outline_alpha: 1.0 267 | shadow_alpha: 1.0 268 | template_node_child: false 269 | text_leading: 1.0 270 | text_tracking: 0.0 271 | custom_type: 0 272 | enabled: true 273 | visible: true 274 | material: "" 275 | } 276 | nodes { 277 | position { 278 | x: 740.0 279 | y: 225.0 280 | z: 0.0 281 | w: 1.0 282 | } 283 | rotation { 284 | x: 0.0 285 | y: 0.0 286 | z: 0.0 287 | w: 1.0 288 | } 289 | scale { 290 | x: 1.0 291 | y: 1.0 292 | z: 1.0 293 | w: 1.0 294 | } 295 | size { 296 | x: 250.0 297 | y: 32.0 298 | z: 0.0 299 | w: 1.0 300 | } 301 | color { 302 | x: 0.0 303 | y: 1.0 304 | z: 0.0 305 | w: 1.0 306 | } 307 | type: TYPE_TEXT 308 | blend_mode: BLEND_MODE_ALPHA 309 | text: "" 310 | font: "main" 311 | id: "node_timer_3" 312 | xanchor: XANCHOR_NONE 313 | yanchor: YANCHOR_NONE 314 | pivot: PIVOT_CENTER 315 | outline { 316 | x: 1.0 317 | y: 1.0 318 | z: 1.0 319 | w: 1.0 320 | } 321 | shadow { 322 | x: 1.0 323 | y: 1.0 324 | z: 1.0 325 | w: 1.0 326 | } 327 | adjust_mode: ADJUST_MODE_FIT 328 | line_break: false 329 | layer: "" 330 | inherit_alpha: true 331 | alpha: 1.0 332 | outline_alpha: 1.0 333 | shadow_alpha: 1.0 334 | template_node_child: false 335 | text_leading: 1.0 336 | text_tracking: 0.0 337 | custom_type: 0 338 | enabled: true 339 | visible: true 340 | material: "" 341 | } 342 | nodes { 343 | position { 344 | x: 220.0 345 | y: 325.0 346 | z: 0.0 347 | w: 1.0 348 | } 349 | rotation { 350 | x: 0.0 351 | y: 0.0 352 | z: 0.0 353 | w: 1.0 354 | } 355 | scale { 356 | x: 1.0 357 | y: 1.0 358 | z: 1.0 359 | w: 1.0 360 | } 361 | size { 362 | x: 250.0 363 | y: 16.0 364 | z: 0.0 365 | w: 1.0 366 | } 367 | color { 368 | x: 0.5019608 369 | y: 0.5019608 370 | z: 0.5019608 371 | w: 1.0 372 | } 373 | type: TYPE_TEXT 374 | blend_mode: BLEND_MODE_ALPHA 375 | text: "Timer 1\n" 376 | "Increasing\n" 377 | "Duration = 20\n" 378 | "Reset = false" 379 | font: "main" 380 | id: "node_timer_1_hint" 381 | xanchor: XANCHOR_NONE 382 | yanchor: YANCHOR_NONE 383 | pivot: PIVOT_N 384 | outline { 385 | x: 1.0 386 | y: 1.0 387 | z: 1.0 388 | w: 1.0 389 | } 390 | shadow { 391 | x: 1.0 392 | y: 1.0 393 | z: 1.0 394 | w: 1.0 395 | } 396 | adjust_mode: ADJUST_MODE_FIT 397 | line_break: true 398 | layer: "" 399 | inherit_alpha: true 400 | alpha: 1.0 401 | outline_alpha: 1.0 402 | shadow_alpha: 1.0 403 | template_node_child: false 404 | text_leading: 1.2 405 | text_tracking: 0.0 406 | custom_type: 0 407 | enabled: true 408 | visible: true 409 | material: "" 410 | } 411 | nodes { 412 | position { 413 | x: 480.0 414 | y: 325.0 415 | z: 0.0 416 | w: 1.0 417 | } 418 | rotation { 419 | x: 0.0 420 | y: 0.0 421 | z: 0.0 422 | w: 1.0 423 | } 424 | scale { 425 | x: 1.0 426 | y: 1.0 427 | z: 1.0 428 | w: 1.0 429 | } 430 | size { 431 | x: 250.0 432 | y: 16.0 433 | z: 0.0 434 | w: 1.0 435 | } 436 | color { 437 | x: 0.5019608 438 | y: 0.5019608 439 | z: 0.5019608 440 | w: 1.0 441 | } 442 | type: TYPE_TEXT 443 | blend_mode: BLEND_MODE_ALPHA 444 | text: "Timer 2\n" 445 | "Decreasing\n" 446 | "Duration = 3610\n" 447 | "Reset = true" 448 | font: "main" 449 | id: "node_timer_2_hint" 450 | xanchor: XANCHOR_NONE 451 | yanchor: YANCHOR_NONE 452 | pivot: PIVOT_N 453 | outline { 454 | x: 1.0 455 | y: 1.0 456 | z: 1.0 457 | w: 1.0 458 | } 459 | shadow { 460 | x: 1.0 461 | y: 1.0 462 | z: 1.0 463 | w: 1.0 464 | } 465 | adjust_mode: ADJUST_MODE_FIT 466 | line_break: true 467 | layer: "" 468 | inherit_alpha: true 469 | alpha: 1.0 470 | outline_alpha: 1.0 471 | shadow_alpha: 1.0 472 | template_node_child: false 473 | text_leading: 1.2 474 | text_tracking: 0.0 475 | custom_type: 0 476 | enabled: true 477 | visible: true 478 | material: "" 479 | } 480 | nodes { 481 | position { 482 | x: 740.0 483 | y: 325.0 484 | z: 0.0 485 | w: 1.0 486 | } 487 | rotation { 488 | x: 0.0 489 | y: 0.0 490 | z: 0.0 491 | w: 1.0 492 | } 493 | scale { 494 | x: 1.0 495 | y: 1.0 496 | z: 1.0 497 | w: 1.0 498 | } 499 | size { 500 | x: 250.0 501 | y: 16.0 502 | z: 0.0 503 | w: 1.0 504 | } 505 | color { 506 | x: 0.5019608 507 | y: 0.5019608 508 | z: 0.5019608 509 | w: 1.0 510 | } 511 | type: TYPE_TEXT 512 | blend_mode: BLEND_MODE_ALPHA 513 | text: "Timer 3\n" 514 | "Increasing\n" 515 | "Reset = true" 516 | font: "main" 517 | id: "node_timer_3_hint" 518 | xanchor: XANCHOR_NONE 519 | yanchor: YANCHOR_NONE 520 | pivot: PIVOT_N 521 | outline { 522 | x: 1.0 523 | y: 1.0 524 | z: 1.0 525 | w: 1.0 526 | } 527 | shadow { 528 | x: 1.0 529 | y: 1.0 530 | z: 1.0 531 | w: 1.0 532 | } 533 | adjust_mode: ADJUST_MODE_FIT 534 | line_break: true 535 | layer: "" 536 | inherit_alpha: true 537 | alpha: 1.0 538 | outline_alpha: 1.0 539 | shadow_alpha: 1.0 540 | template_node_child: false 541 | text_leading: 1.2 542 | text_tracking: 0.0 543 | custom_type: 0 544 | enabled: true 545 | visible: true 546 | material: "" 547 | } 548 | material: "/builtins/materials/gui.material" 549 | adjust_reference: ADJUST_REFERENCE_PARENT 550 | max_nodes: 512 551 | -------------------------------------------------------------------------------- /example/main.gui_script: -------------------------------------------------------------------------------- 1 | local dtimer = require "dtimer.dtimer" 2 | 3 | local node_timer_1 = hash("node_timer_1") 4 | local node_timer_2 = hash("node_timer_2") 5 | local node_timer_3 = hash("node_timer_3") 6 | 7 | function init(self) 8 | msg.post(msg.url(), hash("acquire_input_focus")) 9 | dtimer.set_url(msg.url()) 10 | dtimer.add_node(node_timer_1, true, nil, 20) 11 | dtimer.start(node_timer_1) 12 | dtimer.add_node(node_timer_2, false, { hours = true, minutes = true, seconds = true, centiseconds = true }, 3610) 13 | dtimer.start(node_timer_2) 14 | dtimer.add_node(node_timer_3, true, { seconds = true, centiseconds = true }) 15 | dtimer.start(node_timer_3) 16 | end 17 | 18 | function update(self, dt) 19 | dtimer.update(dt) 20 | end 21 | 22 | function on_input(self, action_id, action) 23 | if action.pressed then 24 | if action_id == hash("key_1") then 25 | dtimer.toggle(node_timer_1) 26 | elseif action_id == hash("key_2") then 27 | dtimer.toggle(node_timer_2, true) 28 | elseif action_id == hash("key_3") then 29 | dtimer.start(node_timer_3, true) 30 | end 31 | end 32 | end 33 | 34 | function on_message(self, message_id, message, sender) 35 | if message_id == dtimer.messages.start then 36 | gui.set_color(gui.get_node(message.node_id), vmath.vector4(0, 1, 0, 1)) 37 | elseif message_id == dtimer.messages.stop then 38 | gui.set_color(gui.get_node(message.node_id), message.complete and vmath.vector4(1, 0, 0, 1) or vmath.vector4(1, 1, 0, 1)) 39 | end 40 | end -------------------------------------------------------------------------------- /example/main.script: -------------------------------------------------------------------------------- 1 | function init(self) 2 | msg.post(msg.url(), hash("acquire_input_focus")) 3 | end 4 | 5 | function on_input(self, action_id, action) 6 | if action.pressed then 7 | if action_id == hash("key_esc") then 8 | sys.exit(0) 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /game.project: -------------------------------------------------------------------------------- 1 | [bootstrap] 2 | main_collection = /example/main.collectionc 3 | render = /rendercam/rendercam.renderc 4 | 5 | [script] 6 | shared_state = 1 7 | 8 | [display] 9 | width = 960 10 | height = 540 11 | 12 | [android] 13 | input_method = HiddenInputField 14 | 15 | [project] 16 | title = Defold Timer 17 | version = 1.0.0 18 | publisher = White Box Dev 19 | developer = White Box Dev 20 | dependencies#0 = https://github.com/rgrams/rendercam/archive/master.zip 21 | 22 | [graphics] 23 | default_texture_min_filter = nearest 24 | default_texture_mag_filter = nearest 25 | 26 | [library] 27 | include_dirs = dtimer 28 | 29 | -------------------------------------------------------------------------------- /input/game.input_binding: -------------------------------------------------------------------------------- 1 | key_trigger { 2 | input: KEY_SPACE 3 | action: "key_space" 4 | } 5 | key_trigger { 6 | input: KEY_EXCLAIM 7 | action: "key_exclamationmark" 8 | } 9 | key_trigger { 10 | input: KEY_QUOTEDBL 11 | action: "key_doublequote" 12 | } 13 | key_trigger { 14 | input: KEY_HASH 15 | action: "key_hash" 16 | } 17 | key_trigger { 18 | input: KEY_DOLLAR 19 | action: "key_dollarsign" 20 | } 21 | key_trigger { 22 | input: KEY_AMPERSAND 23 | action: "key_ampersand" 24 | } 25 | key_trigger { 26 | input: KEY_QUOTE 27 | action: "key_singlequote" 28 | } 29 | key_trigger { 30 | input: KEY_LPAREN 31 | action: "key_lparen" 32 | } 33 | key_trigger { 34 | input: KEY_RPAREN 35 | action: "key_rparen" 36 | } 37 | key_trigger { 38 | input: KEY_ASTERISK 39 | action: "key_asterisk" 40 | } 41 | key_trigger { 42 | input: KEY_PLUS 43 | action: "key_plus" 44 | } 45 | key_trigger { 46 | input: KEY_COMMA 47 | action: "key_comma" 48 | } 49 | key_trigger { 50 | input: KEY_MINUS 51 | action: "key_minus" 52 | } 53 | key_trigger { 54 | input: KEY_PERIOD 55 | action: "key_period" 56 | } 57 | key_trigger { 58 | input: KEY_SLASH 59 | action: "key_slash" 60 | } 61 | key_trigger { 62 | input: KEY_0 63 | action: "key_0" 64 | } 65 | key_trigger { 66 | input: KEY_1 67 | action: "key_1" 68 | } 69 | key_trigger { 70 | input: KEY_2 71 | action: "key_2" 72 | } 73 | key_trigger { 74 | input: KEY_3 75 | action: "key_3" 76 | } 77 | key_trigger { 78 | input: KEY_4 79 | action: "key_4" 80 | } 81 | key_trigger { 82 | input: KEY_5 83 | action: "key_5" 84 | } 85 | key_trigger { 86 | input: KEY_6 87 | action: "key_6" 88 | } 89 | key_trigger { 90 | input: KEY_7 91 | action: "key_7" 92 | } 93 | key_trigger { 94 | input: KEY_8 95 | action: "key_8" 96 | } 97 | key_trigger { 98 | input: KEY_9 99 | action: "key_9" 100 | } 101 | key_trigger { 102 | input: KEY_COLON 103 | action: "key_colon" 104 | } 105 | key_trigger { 106 | input: KEY_SEMICOLON 107 | action: "key_semicolon" 108 | } 109 | key_trigger { 110 | input: KEY_LESS 111 | action: "key_lessthan" 112 | } 113 | key_trigger { 114 | input: KEY_EQUALS 115 | action: "key_equals" 116 | } 117 | key_trigger { 118 | input: KEY_GREATER 119 | action: "key_greaterthan" 120 | } 121 | key_trigger { 122 | input: KEY_QUESTION 123 | action: "key_questionmark" 124 | } 125 | key_trigger { 126 | input: KEY_AT 127 | action: "key_at" 128 | } 129 | key_trigger { 130 | input: KEY_A 131 | action: "key_a" 132 | } 133 | key_trigger { 134 | input: KEY_B 135 | action: "key_b" 136 | } 137 | key_trigger { 138 | input: KEY_C 139 | action: "key_c" 140 | } 141 | key_trigger { 142 | input: KEY_D 143 | action: "key_d" 144 | } 145 | key_trigger { 146 | input: KEY_E 147 | action: "key_e" 148 | } 149 | key_trigger { 150 | input: KEY_F 151 | action: "key_f" 152 | } 153 | key_trigger { 154 | input: KEY_G 155 | action: "key_g" 156 | } 157 | key_trigger { 158 | input: KEY_H 159 | action: "key_h" 160 | } 161 | key_trigger { 162 | input: KEY_I 163 | action: "key_i" 164 | } 165 | key_trigger { 166 | input: KEY_J 167 | action: "key_j" 168 | } 169 | key_trigger { 170 | input: KEY_K 171 | action: "key_k" 172 | } 173 | key_trigger { 174 | input: KEY_L 175 | action: "key_l" 176 | } 177 | key_trigger { 178 | input: KEY_M 179 | action: "key_m" 180 | } 181 | key_trigger { 182 | input: KEY_N 183 | action: "key_n" 184 | } 185 | key_trigger { 186 | input: KEY_O 187 | action: "key_o" 188 | } 189 | key_trigger { 190 | input: KEY_P 191 | action: "key_p" 192 | } 193 | key_trigger { 194 | input: KEY_Q 195 | action: "key_q" 196 | } 197 | key_trigger { 198 | input: KEY_R 199 | action: "key_r" 200 | } 201 | key_trigger { 202 | input: KEY_S 203 | action: "key_s" 204 | } 205 | key_trigger { 206 | input: KEY_T 207 | action: "key_t" 208 | } 209 | key_trigger { 210 | input: KEY_U 211 | action: "key_u" 212 | } 213 | key_trigger { 214 | input: KEY_V 215 | action: "key_v" 216 | } 217 | key_trigger { 218 | input: KEY_W 219 | action: "key_w" 220 | } 221 | key_trigger { 222 | input: KEY_X 223 | action: "key_x" 224 | } 225 | key_trigger { 226 | input: KEY_Y 227 | action: "key_y" 228 | } 229 | key_trigger { 230 | input: KEY_Z 231 | action: "key_z" 232 | } 233 | key_trigger { 234 | input: KEY_LBRACKET 235 | action: "key_lbracket" 236 | } 237 | key_trigger { 238 | input: KEY_RBRACKET 239 | action: "key_rbracket" 240 | } 241 | key_trigger { 242 | input: KEY_BACKSLASH 243 | action: "key_backslash" 244 | } 245 | key_trigger { 246 | input: KEY_CARET 247 | action: "key_caret" 248 | } 249 | key_trigger { 250 | input: KEY_UNDERSCORE 251 | action: "key_underscore" 252 | } 253 | key_trigger { 254 | input: KEY_BACKQUOTE 255 | action: "key_grave" 256 | } 257 | key_trigger { 258 | input: KEY_LBRACE 259 | action: "key_lbrace" 260 | } 261 | key_trigger { 262 | input: KEY_RBRACE 263 | action: "key_rbrace" 264 | } 265 | key_trigger { 266 | input: KEY_PIPE 267 | action: "key_pipe" 268 | } 269 | key_trigger { 270 | input: KEY_ESC 271 | action: "key_esc" 272 | } 273 | key_trigger { 274 | input: KEY_F1 275 | action: "key_f1" 276 | } 277 | key_trigger { 278 | input: KEY_F2 279 | action: "key_f2" 280 | } 281 | key_trigger { 282 | input: KEY_F3 283 | action: "key_f3" 284 | } 285 | key_trigger { 286 | input: KEY_F4 287 | action: "key_f4" 288 | } 289 | key_trigger { 290 | input: KEY_F5 291 | action: "key_f5" 292 | } 293 | key_trigger { 294 | input: KEY_F6 295 | action: "key_f6" 296 | } 297 | key_trigger { 298 | input: KEY_F7 299 | action: "key_f7" 300 | } 301 | key_trigger { 302 | input: KEY_F8 303 | action: "key_f8" 304 | } 305 | key_trigger { 306 | input: KEY_F9 307 | action: "key_f9" 308 | } 309 | key_trigger { 310 | input: KEY_F10 311 | action: "key_f10" 312 | } 313 | key_trigger { 314 | input: KEY_F11 315 | action: "key_f11" 316 | } 317 | key_trigger { 318 | input: KEY_F12 319 | action: "key_f12" 320 | } 321 | key_trigger { 322 | input: KEY_UP 323 | action: "key_up" 324 | } 325 | key_trigger { 326 | input: KEY_DOWN 327 | action: "key_down" 328 | } 329 | key_trigger { 330 | input: KEY_LEFT 331 | action: "key_left" 332 | } 333 | key_trigger { 334 | input: KEY_RIGHT 335 | action: "key_right" 336 | } 337 | key_trigger { 338 | input: KEY_LSHIFT 339 | action: "key_lshift" 340 | } 341 | key_trigger { 342 | input: KEY_RSHIFT 343 | action: "key_rshift" 344 | } 345 | key_trigger { 346 | input: KEY_LCTRL 347 | action: "key_lctrl" 348 | } 349 | key_trigger { 350 | input: KEY_RCTRL 351 | action: "key_rctrl" 352 | } 353 | key_trigger { 354 | input: KEY_LALT 355 | action: "key_lalt" 356 | } 357 | key_trigger { 358 | input: KEY_RALT 359 | action: "key_ralt" 360 | } 361 | key_trigger { 362 | input: KEY_TAB 363 | action: "key_tab" 364 | } 365 | key_trigger { 366 | input: KEY_ENTER 367 | action: "key_enter" 368 | } 369 | key_trigger { 370 | input: KEY_BACKSPACE 371 | action: "key_backspace" 372 | } 373 | key_trigger { 374 | input: KEY_INSERT 375 | action: "key_insert" 376 | } 377 | key_trigger { 378 | input: KEY_DEL 379 | action: "key_del" 380 | } 381 | key_trigger { 382 | input: KEY_PAGEUP 383 | action: "key_pageup" 384 | } 385 | key_trigger { 386 | input: KEY_PAGEDOWN 387 | action: "key_pagedown" 388 | } 389 | key_trigger { 390 | input: KEY_HOME 391 | action: "key_home" 392 | } 393 | key_trigger { 394 | input: KEY_END 395 | action: "key_end" 396 | } 397 | key_trigger { 398 | input: KEY_KP_0 399 | action: "key_numpad_0" 400 | } 401 | key_trigger { 402 | input: KEY_KP_1 403 | action: "key_numpad_1" 404 | } 405 | key_trigger { 406 | input: KEY_KP_2 407 | action: "key_numpad_2" 408 | } 409 | key_trigger { 410 | input: KEY_KP_3 411 | action: "key_numpad_3" 412 | } 413 | key_trigger { 414 | input: KEY_KP_4 415 | action: "key_numpad_4" 416 | } 417 | key_trigger { 418 | input: KEY_KP_5 419 | action: "key_numpad_5" 420 | } 421 | key_trigger { 422 | input: KEY_KP_6 423 | action: "key_numpad_6" 424 | } 425 | key_trigger { 426 | input: KEY_KP_7 427 | action: "key_numpad_7" 428 | } 429 | key_trigger { 430 | input: KEY_KP_8 431 | action: "key_numpad_8" 432 | } 433 | key_trigger { 434 | input: KEY_KP_9 435 | action: "key_numpad_9" 436 | } 437 | key_trigger { 438 | input: KEY_KP_DIVIDE 439 | action: "key_numpad_divide" 440 | } 441 | key_trigger { 442 | input: KEY_KP_MULTIPLY 443 | action: "key_numpad_multiply" 444 | } 445 | key_trigger { 446 | input: KEY_KP_SUBTRACT 447 | action: "key_numpad_subtract" 448 | } 449 | key_trigger { 450 | input: KEY_KP_ADD 451 | action: "key_numpad_add" 452 | } 453 | key_trigger { 454 | input: KEY_KP_DECIMAL 455 | action: "key_numpad_decimal" 456 | } 457 | key_trigger { 458 | input: KEY_KP_EQUAL 459 | action: "key_numpad_equal" 460 | } 461 | key_trigger { 462 | input: KEY_KP_ENTER 463 | action: "key_numpad_enter" 464 | } 465 | key_trigger { 466 | input: KEY_KP_NUM_LOCK 467 | action: "key_numpad_numlock" 468 | } 469 | key_trigger { 470 | input: KEY_CAPS_LOCK 471 | action: "key_capslock" 472 | } 473 | key_trigger { 474 | input: KEY_SCROLL_LOCK 475 | action: "key_scrolllock" 476 | } 477 | key_trigger { 478 | input: KEY_PAUSE 479 | action: "key_pause" 480 | } 481 | key_trigger { 482 | input: KEY_LSUPER 483 | action: "key_lsuper" 484 | } 485 | key_trigger { 486 | input: KEY_RSUPER 487 | action: "key_rsuper" 488 | } 489 | key_trigger { 490 | input: KEY_MENU 491 | action: "key_menu" 492 | } 493 | key_trigger { 494 | input: KEY_BACK 495 | action: "key_back" 496 | } 497 | mouse_trigger { 498 | input: MOUSE_WHEEL_UP 499 | action: "mouse_wheel_up" 500 | } 501 | mouse_trigger { 502 | input: MOUSE_WHEEL_DOWN 503 | action: "mouse_wheel_down" 504 | } 505 | mouse_trigger { 506 | input: MOUSE_BUTTON_LEFT 507 | action: "mouse_button_left" 508 | } 509 | mouse_trigger { 510 | input: MOUSE_BUTTON_MIDDLE 511 | action: "mouse_button_middle" 512 | } 513 | mouse_trigger { 514 | input: MOUSE_BUTTON_RIGHT 515 | action: "mouse_button_right" 516 | } 517 | mouse_trigger { 518 | input: MOUSE_BUTTON_1 519 | action: "mouse_button_1" 520 | } 521 | mouse_trigger { 522 | input: MOUSE_BUTTON_2 523 | action: "mouse_button_2" 524 | } 525 | mouse_trigger { 526 | input: MOUSE_BUTTON_3 527 | action: "mouse_button_3" 528 | } 529 | mouse_trigger { 530 | input: MOUSE_BUTTON_4 531 | action: "mouse_button_4" 532 | } 533 | mouse_trigger { 534 | input: MOUSE_BUTTON_5 535 | action: "mouse_button_5" 536 | } 537 | mouse_trigger { 538 | input: MOUSE_BUTTON_6 539 | action: "mouse_button_6" 540 | } 541 | mouse_trigger { 542 | input: MOUSE_BUTTON_7 543 | action: "mouse_button_7" 544 | } 545 | mouse_trigger { 546 | input: MOUSE_BUTTON_8 547 | action: "mouse_button_8" 548 | } 549 | mouse_trigger { 550 | input: MOUSE_BUTTON_1 551 | action: "touch" 552 | } 553 | gamepad_trigger { 554 | input: GAMEPAD_LSTICK_LEFT 555 | action: "gamepad_lstick_left" 556 | } 557 | gamepad_trigger { 558 | input: GAMEPAD_LSTICK_RIGHT 559 | action: "gamepad_lstick_right" 560 | } 561 | gamepad_trigger { 562 | input: GAMEPAD_LSTICK_DOWN 563 | action: "gamepad_lstick_down" 564 | } 565 | gamepad_trigger { 566 | input: GAMEPAD_LSTICK_UP 567 | action: "gamepad_lstick_up" 568 | } 569 | gamepad_trigger { 570 | input: GAMEPAD_LSTICK_CLICK 571 | action: "gamepad_lstick_click" 572 | } 573 | gamepad_trigger { 574 | input: GAMEPAD_LTRIGGER 575 | action: "gamepad_ltrigger" 576 | } 577 | gamepad_trigger { 578 | input: GAMEPAD_LSHOULDER 579 | action: "gamepad_lshoulder" 580 | } 581 | gamepad_trigger { 582 | input: GAMEPAD_LPAD_LEFT 583 | action: "gamepad_lpad_left" 584 | } 585 | gamepad_trigger { 586 | input: GAMEPAD_LPAD_RIGHT 587 | action: "gamepad_lpad_right" 588 | } 589 | gamepad_trigger { 590 | input: GAMEPAD_LPAD_DOWN 591 | action: "gamepad_lpad_down" 592 | } 593 | gamepad_trigger { 594 | input: GAMEPAD_LPAD_UP 595 | action: "gamepad_lpad_up" 596 | } 597 | gamepad_trigger { 598 | input: GAMEPAD_RSTICK_LEFT 599 | action: "gamepad_rstick_left" 600 | } 601 | gamepad_trigger { 602 | input: GAMEPAD_RSTICK_RIGHT 603 | action: "gamepad_rstick_right" 604 | } 605 | gamepad_trigger { 606 | input: GAMEPAD_RSTICK_DOWN 607 | action: "gamepad_rstick_down" 608 | } 609 | gamepad_trigger { 610 | input: GAMEPAD_RSTICK_UP 611 | action: "gamepad_rstick_up" 612 | } 613 | gamepad_trigger { 614 | input: GAMEPAD_RSTICK_CLICK 615 | action: "gamepad_rstick_click" 616 | } 617 | gamepad_trigger { 618 | input: GAMEPAD_RTRIGGER 619 | action: "gamepad_rtrigger" 620 | } 621 | gamepad_trigger { 622 | input: GAMEPAD_RSHOULDER 623 | action: "gamepad_rshoulder" 624 | } 625 | gamepad_trigger { 626 | input: GAMEPAD_RPAD_LEFT 627 | action: "gamepad_rpad_left" 628 | } 629 | gamepad_trigger { 630 | input: GAMEPAD_RPAD_RIGHT 631 | action: "gamepad_rpad_right" 632 | } 633 | gamepad_trigger { 634 | input: GAMEPAD_RPAD_DOWN 635 | action: "gamepad_rpad_down" 636 | } 637 | gamepad_trigger { 638 | input: GAMEPAD_RPAD_UP 639 | action: "gamepad_rpad_up" 640 | } 641 | gamepad_trigger { 642 | input: GAMEPAD_START 643 | action: "gamepad_start" 644 | } 645 | gamepad_trigger { 646 | input: GAMEPAD_BACK 647 | action: "gamepad_back" 648 | } 649 | gamepad_trigger { 650 | input: GAMEPAD_GUIDE 651 | action: "gamepad_guide" 652 | } 653 | gamepad_trigger { 654 | input: GAMEPAD_CONNECTED 655 | action: "gamepad_connected" 656 | } 657 | gamepad_trigger { 658 | input: GAMEPAD_DISCONNECTED 659 | action: "gamepad_disconnected" 660 | } 661 | touch_trigger { 662 | input: TOUCH_MULTI 663 | action: "touch_multi" 664 | } 665 | text_trigger { 666 | input: TEXT 667 | action: "text" 668 | } 669 | text_trigger { 670 | input: MARKED_TEXT 671 | action: "marked_text" 672 | } 673 | --------------------------------------------------------------------------------