mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Merge branch 'develop'
This commit is contained in:
commit
4f9274c359
80
README.md
80
README.md
@ -1,7 +1,10 @@
|
||||
|
||||
|
||||
|
||||
[](https://insality.github.io/druid/)
|
||||
|
||||
[](https://github.com/Insality/druid/releases)
|
||||
|
||||
**Druid** - powerful defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games.
|
||||
|
||||
|
||||
@ -20,8 +23,8 @@ Or point to the ZIP file of a [specific release](https://github.com/Insality/dr
|
||||
For **Druid** to work requires next input bindings:
|
||||
|
||||
- Mouse trigger - `Button 1` -> `touch` _For basic input components_
|
||||
- Key trigger - `Backspace` -> `backspace` _For back_handler component_
|
||||
- Key trigger - `Back` -> `text` _For back_handler component, Android back button_
|
||||
- Key trigger - `Backspace` -> `back` _For back_handler component_
|
||||
- Key trigger - `Back` -> `back` _For back_handler component, Android back button_
|
||||
|
||||

|
||||
|
||||
@ -63,31 +66,31 @@ druid.set_default_style(your_style)
|
||||
|
||||
- **[Text](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#text)** - Basic Druid text component
|
||||
|
||||
- **Lang text** - Wrap on Text component to handle localization
|
||||
- **[Lang text](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#lang-text)** - Wrap on Text component to handle localization
|
||||
|
||||
- **Scroll** - Basic Druid scroll component
|
||||
- **[Scroll](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#scroll)** - Basic Druid scroll component
|
||||
|
||||
- **Progress** - Basic Druid progress bar component
|
||||
- **[Progress](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#progress)** - Basic Druid progress bar component
|
||||
|
||||
- **Slider** - Basic Druid slider component
|
||||
- **[Slider](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#slider)** - Basic Druid slider component
|
||||
|
||||
- **Input** - Basic Druid text input component (unimplemented)
|
||||
- **[Input](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#input)** - Basic Druid text input component (unimplemented)
|
||||
|
||||
- **Checkbox** - Basic Druid checkbox component
|
||||
- **[Checkbox](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox)** - Basic Druid checkbox component
|
||||
|
||||
- **Checkbox group** - Several checkboxes in one group
|
||||
- **[Checkbox group](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox-group)** - Several checkboxes in one group
|
||||
|
||||
- **Radio group** - Several checkboxes in one group with single choice
|
||||
- **[Radio group](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#radio-group)** - Several checkboxes in one group with single choice
|
||||
|
||||
- **[Blocker](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#blocker)** - Block input in node zone component
|
||||
|
||||
- **Back Handler** - Handle back button (Android back, backspace)
|
||||
- **[Back Handler](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#back-handler)** - Handle back button (Android back, backspace)
|
||||
|
||||
- **Timer** - Handle timer work on gui text node
|
||||
- **[Timer](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#timer)** - Handle timer work on gui text node
|
||||
|
||||
- **Grid** - Component for manage node positions
|
||||
- **[Grid](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#grid)** - Component for manage node positions
|
||||
|
||||
- **Hover** - System Druid component, handle hover node state
|
||||
- **[Hover](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#hover)** - System Druid component, handle hover node state
|
||||
|
||||
Full info see on _[components.md](https://github.com/Insality/druid/blob/master/docs_md/01-components.md)_
|
||||
|
||||
@ -112,14 +115,6 @@ local function init(self)
|
||||
self.druid:new_button("button_node_name", button_callback)
|
||||
end
|
||||
|
||||
function update(self, dt)
|
||||
self.druid:update(dt)
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
end
|
||||
@ -127,7 +122,7 @@ end
|
||||
|
||||
## Druid Events
|
||||
|
||||
Any **Druid** components as callbacks uses Druid Events. In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe on this events by next API:
|
||||
Any **Druid** components as callbacks uses [Druid Events](https://insality.github.io/druid/modules/druid_event.html). In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe on this events by next API:
|
||||
|
||||
- **event:subscribe**(callback)
|
||||
|
||||
@ -137,14 +132,51 @@ Any **Druid** components as callbacks uses Druid Events. In component API ([butt
|
||||
|
||||
Any events can handle several callbacks, if needed.
|
||||
|
||||
|
||||
## Druid lifecycle
|
||||
|
||||
Here is full druid lifecycle setup in your ***.gui_script** file:
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
|
||||
function init(self)
|
||||
self.druid = druid.new(self)
|
||||
end
|
||||
|
||||
function final(self)
|
||||
self.druid:final()
|
||||
end
|
||||
|
||||
function update(self, dt)
|
||||
self.druid:update(dt)
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
end
|
||||
```
|
||||
|
||||
- *on_input* used for almost all basic druid components
|
||||
- *update* used for progress bar, scroll and timer base components
|
||||
- *on_message* used for specific druid events, like language change or layout change (TODO: in future)
|
||||
- *final* used for custom components, what have to do several action before destroy
|
||||
|
||||
Recommended is fully integrate al druid lifecycles functions
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- Druid input goes as stack. Last created button will checked first. So create your GUI from back
|
||||
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
See the [example folder](https://github.com/insality/druid/tree/develop/example/kenney) for examples of how to use **Druid**
|
||||
See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
|
||||
|
||||
See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles
|
||||
|
||||
|
@ -1,38 +1,12 @@
|
||||
Simple to-do for Druid Alpha 0.2.0
|
||||
|
||||
|
||||
-- High
|
||||
+ remove button event and match_event from druid
|
||||
+ add hover component
|
||||
+ add druid events/triggers? better callback system
|
||||
+ better name for locale component? lang? lang_text?
|
||||
+ better name for slider component? Slider is ok
|
||||
+ Druid store assets - separate repository with rich components (progress_rich migrate)
|
||||
+ refactor on_swipe. To on_scroll? Add input priority
|
||||
+ separate custom data and predefined fields in components? Every component have their fields and events
|
||||
+ How to set custom sprites for button states?
|
||||
+ add druid settings (add auto_focus input and other stuff) (to game.project)
|
||||
|
||||
+ button add key trigger
|
||||
+ button and hover click restriction zone?
|
||||
+ button polish, actions
|
||||
+ better scroll size management, check different cases. So implicit now
|
||||
+ better callbacks for every components
|
||||
|
||||
- unify component api (get/set/to and other general stuff)
|
||||
- better grid + scroll management
|
||||
- better default style, add template for custom style
|
||||
- compare with gooey
|
||||
- add docs for all components
|
||||
- add docs folder for every component with gifs? Solutions
|
||||
- remove component autoremove all children component
|
||||
|
||||
|
||||
-- Low
|
||||
- unify component api (get/set/to and other general stuff)
|
||||
- add input_text component for alpha release
|
||||
- add code template and example for user components
|
||||
- custom input settings (name of touch, text, etc)
|
||||
- add good examples with template and/or nodes (basic component no use any of them)
|
||||
- try use final druid in real project (FI uses custom druid) (use in 4321?)
|
||||
- ability to relocalize all locale text nodes
|
||||
- ability to control buttons via controller. Select it by cursor (d-pad)
|
||||
|
@ -54,7 +54,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -185,7 +185,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -117,6 +117,10 @@
|
||||
<td class="summary">Get current component interests</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_node">get_node(node_or_name)</a></td>
|
||||
<td class="summary">Get node for component by name.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_druid">get_druid()</a></td>
|
||||
<td class="summary">Return druid with context of calling component.</td>
|
||||
</tr>
|
||||
@ -320,6 +324,36 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_node"></a>
|
||||
<strong>get_node(node_or_name)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get node for component by name.
|
||||
If component has nodes, node<em>or</em>name should be string
|
||||
It auto pick node by template name or from nodes by clone<em>tree
|
||||
if they was setup via component:set</em>nodes, component:set_template
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">node_or_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <span class="type">node</span></span>
|
||||
Node name or node itself
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Gui node
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_druid"></a>
|
||||
@ -406,7 +440,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -215,7 +215,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -234,7 +234,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -84,7 +84,7 @@
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#init">init(node, callback[, params[, anim_node[, event]]])</a></td>
|
||||
<td class="name" nowrap><a href="#init">init(node, callback[, params[, anim_node]])</a></td>
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -133,7 +133,7 @@
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "init"></a>
|
||||
<strong>init(node, callback[, params[, anim_node[, event]]])</strong>
|
||||
<strong>init(node, callback[, params[, anim_node]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component init function
|
||||
@ -159,11 +159,6 @@
|
||||
Button anim node (node, if not provided)
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
Button react event, const.ACTION_TOUCH by default
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -291,19 +286,23 @@
|
||||
<ul>
|
||||
<li><span class="parameter">on_click</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On release button callback
|
||||
(self, params, button_instance) On release button callback
|
||||
</li>
|
||||
<li><span class="parameter">on_repeated_click</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On repeated action button callback
|
||||
(self, params, button<em>instance, click</em>amount) On repeated action button callback
|
||||
</li>
|
||||
<li><span class="parameter">on_long_click</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On long tap button callback
|
||||
(self, params, button_instance, time) On long tap button callback
|
||||
</li>
|
||||
<li><span class="parameter">on_double_click</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On double tap button callback
|
||||
(self, params, button<em>instance, click</em>amount) On double tap button callback
|
||||
</li>
|
||||
<li><span class="parameter">on_hold_callback</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
(self, params, button<em>instance, time) On button hold before long</em>click callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -331,7 +330,7 @@
|
||||
Animation node
|
||||
(<em>default</em> node)
|
||||
</li>
|
||||
<li><span class="parameter">scale_from</span>
|
||||
<li><span class="parameter">start_scale</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Initial scale of anim_node
|
||||
</li>
|
||||
@ -405,7 +404,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -277,7 +277,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -88,7 +88,7 @@
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(state)</a></td>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(indexes)</a></td>
|
||||
<td class="summary">Set checkbox group state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -147,7 +147,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_state"></a>
|
||||
<strong>set_state(state)</strong>
|
||||
<strong>set_state(indexes)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set checkbox group state
|
||||
@ -155,7 +155,7 @@
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">state</span>
|
||||
<li><span class="parameter">indexes</span>
|
||||
<span class="types"><span class="type">bool[]</span></span>
|
||||
Array of checkbox state
|
||||
</li>
|
||||
@ -239,7 +239,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -370,7 +370,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -236,7 +236,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -211,7 +211,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -181,7 +181,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -57,7 +57,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -86,7 +86,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -240,7 +240,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -82,7 +82,7 @@
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#init">init(node, key, init_value)</a></td>
|
||||
<td class="name" nowrap><a href="#init">init(node, key[, init_value=1])</a></td>
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -135,7 +135,7 @@
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "init"></a>
|
||||
<strong>init(node, key, init_value)</strong>
|
||||
<strong>init(node, key[, init_value=1])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component init function
|
||||
@ -154,6 +154,7 @@
|
||||
<li><span class="parameter">init_value</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Initial value of progress bar
|
||||
(<em>default</em> 1)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -378,7 +379,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -88,7 +88,7 @@
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(state)</a></td>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(index)</a></td>
|
||||
<td class="summary">Set radio group state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -147,7 +147,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_state"></a>
|
||||
<strong>set_state(state)</strong>
|
||||
<strong>set_state(index)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set radio group state
|
||||
@ -155,9 +155,9 @@
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">state</span>
|
||||
<span class="types"><span class="type">bool[]</span></span>
|
||||
Array of checkbox state
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Index in radio group
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -178,8 +178,8 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bool[]</span></span>
|
||||
Array if checkboxes state
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Index in radio group
|
||||
</ol>
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -389,7 +389,7 @@
|
||||
</li>
|
||||
<li><span class="parameter">on_point_scroll</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On scroll<em>to</em>index function callbck
|
||||
On scroll<em>to</em>index function callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -507,7 +507,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -278,7 +278,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -142,7 +142,7 @@
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
Initial text
|
||||
Initial text. Default value is node text from GUI scene.
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">no_adjust</span>
|
||||
@ -352,7 +352,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -267,31 +267,17 @@
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Trigger node
|
||||
</li>
|
||||
<li><span class="parameter">anim_node</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Animation node
|
||||
(<em>default</em> node)
|
||||
<li><span class="parameter">from</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Initial timer value
|
||||
</li>
|
||||
<li><span class="parameter">scale_from</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Initial scale of anim_node
|
||||
<li><span class="parameter">target</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Target timer value
|
||||
</li>
|
||||
<li><span class="parameter">pos</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Initial pos of anim_node
|
||||
</li>
|
||||
<li><span class="parameter">params</span>
|
||||
<span class="types"><span class="type">any</span></span>
|
||||
Params to click callbacks
|
||||
</li>
|
||||
<li><span class="parameter">hover</span>
|
||||
<span class="types"><span class="type">druid.hover</span></span>
|
||||
Druid hover logic component
|
||||
</li>
|
||||
<li><span class="parameter">click_zone</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Restriction zone
|
||||
(<em>optional</em>)
|
||||
<li><span class="parameter">value</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Current timer value
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -307,7 +293,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -239,7 +239,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -107,6 +107,10 @@
|
||||
<td class="summary">Create new druid component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:final">druid:final()</a></td>
|
||||
<td class="summary">Call on final function on gui_script.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:remove">druid:remove(component)</a></td>
|
||||
<td class="summary">Remove component from druid instance.</td>
|
||||
</tr>
|
||||
@ -240,6 +244,21 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:final"></a>
|
||||
<strong>druid:final()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Call on final function on gui<em>script. It will call on</em>remove
|
||||
on all druid components
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:remove"></a>
|
||||
@ -750,7 +769,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><strong>Druid components</strong></li>
|
||||
<li><strong>01-components</strong></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -88,24 +88,33 @@
|
||||
<div id="content">
|
||||
|
||||
|
||||
|
||||
|
||||
<h1>Druid components</h1>
|
||||
|
||||
|
||||
<p><a name="Button"></a></p>
|
||||
<h2>Button</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.button.html">Button API here</a></p>
|
||||
|
||||
<p>Basic Druid input component</p>
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid input component. Handle input on node and provide different callbacks on touch events.</p>
|
||||
|
||||
<ul>
|
||||
<li>Button callback have next params: (self, params, button_instance)
|
||||
<h3>Setup</h3>
|
||||
<p>Create button with druid: <code>button = druid:new_button(node_name, callback, [params], [animation_node])</code>
|
||||
Where node name is name of node from GUI scene. You can use <code>node_name</code> as input trigger zone and point another node for animation via <code>animation_node</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Button callback have next params: (self, params, button_instance)</p>
|
||||
|
||||
<pre>
|
||||
- **self** - Druid self context
|
||||
- **params** - Additional params, specified on button creating
|
||||
- **button_instance** - button itself
|
||||
</pre>
|
||||
</li>
|
||||
<li>Button have next events:
|
||||
|
||||
<p>- You can set <em>params</em> on button callback on button creating: <code>druid:new_button("node_name", callback, params)</code>. This <em>params</em> will pass in callback as second argument
|
||||
- Button have next events:</p>
|
||||
|
||||
<pre>
|
||||
- **on_click** - basic button callback
|
||||
@ -114,20 +123,24 @@
|
||||
- **on_hold_click** - hold callback, before long_click trigger, don<span class="string">'t trigger if callback is empty
|
||||
- **on_double_click** - different callback, if tap button 2+ in row, don'</span>t trigger <span class="keyword">if</span> callback is empty
|
||||
</pre>
|
||||
</li>
|
||||
<li>If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use <a href="../modules/druid.button.html#set_click_zone">button:set_click_zone</a> to restrict button click zone</li>
|
||||
<li>Button can have key trigger to use then by key: <a href="../modules/druid.button.html#set_key_trigger">button:set_key_trigger</a></li>
|
||||
</ul>
|
||||
|
||||
<p>- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use <a href="../modules/druid.button.html#set_click_zone">button:set_click_zone</a> to restrict button click zone
|
||||
- Button can have key trigger to use then by key: <a href="../modules/druid.button.html#set_key_trigger">button:set_key_trigger</a>
|
||||
- Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be <code>big panel</code> and animation node will be <code>small icon</code></p>
|
||||
|
||||
|
||||
<p><a name="Text"></a></p>
|
||||
<h2>Text</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.text.html">Text API here</a></p>
|
||||
|
||||
<p>Basic Druid text component</p>
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid text component. Text components by default have the text size adjusting.</p>
|
||||
|
||||
<ul>
|
||||
<li>Text component by default have auto adjust text sizing. Text never will be more, than text size, which you can setup in gui scene. It can be disabled on component creating</li>
|
||||
</ul>
|
||||
<h3>Setup</h3>
|
||||
<p>Create text node with druid: <code>text = druid:new_text(node_name, [initial_value])</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Text component by default have auto adjust text sizing. Text never will be bigger, than text node size, which you can setup in GUI scene. It can be disabled on component creating by settings argument <code>is_no_adjust</code> to <em>true</em></p>
|
||||
|
||||
<p><img src="../media/text_autosize.png" alt=""/></p>
|
||||
|
||||
@ -140,14 +153,17 @@
|
||||
|
||||
<p><a name="Blocker"></a></p>
|
||||
<h2>Blocker</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.button.html">Blocker API here</a></p>
|
||||
|
||||
<p>Druid component for block input</p>
|
||||
<h3>Overview</h3>
|
||||
<p>Druid component for block input. Use it to block input in special zone.</p>
|
||||
|
||||
<p>It can be used for block input in special zone.</p>
|
||||
<h3>Setup</h3>
|
||||
<p>Create blocker component with druid: <code>druid:new_blocker(node_name)</code></p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<p><img src="../media/blocker_scheme.png" alt=""/></p>
|
||||
<h3>Notes</h3>
|
||||
<p>Explanation:
|
||||
<img src="../media/blocker_scheme.png" alt=""/></p>
|
||||
|
||||
<p>Blue zone is <strong>button</strong> with close_window callback</p>
|
||||
|
||||
@ -155,62 +171,209 @@
|
||||
|
||||
<p>So you can do the safe zones, when you have the big buttons</p>
|
||||
|
||||
|
||||
<p><a name="Back_Handler"></a></p>
|
||||
<h2>Back Handler</h2>
|
||||
<p>Component to handle back button</p>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.back_handler.html">Back handler API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Component to handle back button. It handle Android back button and Backspace key. Key triggers in <code>input.binding</code> should be setup for correct working.</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Setup callback with <code>druid:new_back_handler(callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
<p>It works on Android back button and Backspace. Key triggers in <code>input.binding</code> should be setup</p>
|
||||
|
||||
<p><a name="Lang_text"></a></p>
|
||||
<h2>Lang text</h2>
|
||||
<p>Wrap on Text component to handle localization</p>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.lang_text.html">Lang text API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Wrap on Text component to handle localization. It uses druid get<em>text</em>function to set text by it's id</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create lang text component with druid <code>text = druid:new_lang_text(node_name, locale_id)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
|
||||
<p><a name="Scroll"></a></p>
|
||||
<h2>Scroll</h2>
|
||||
<p>Basic Druid scroll component</p>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.scroll.html">Scroll API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid scroll component. Handle all scrolling stuff in druid GUI</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create scroll component with druid: <code>scroll = druid:new_scroll(scroll_parent, scroll_input)</code>.</p>
|
||||
|
||||
<p><em>Scroll parent</em> - is dynamic part. This node will change position by scroll system</p>
|
||||
|
||||
<p><em>Scroll input</em> - is static part. It capturing user input and recognize scrolling touches</p>
|
||||
|
||||
<p>Initial scroll size will be equal to <em>scroll parent</em> node size. The initial view box will be equal to <em>scroll input</em> node size</p>
|
||||
|
||||
<p>Usually, Place static input zone part, and as children add scroll parent part:
|
||||
<img src="../media/scroll_scheme.png" alt=""/>
|
||||
<img src="../media/scroll_outline.png" alt=""/></p>
|
||||
|
||||
<p>*Here scroll<em>content</em>zone below input zone, in game content zone be able to scroll left until end*</p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Scroll by default style have inertion and "back moving". It can be adjust via scroll <a href="https://insality.github.io/druid/modules/druid.scroll.html#Style">style settings</a>
|
||||
- You can setup "points of interest". Scroll always will be centered on closes point of interest. It is able to create slider without inertion and points of interest on each scroll element.
|
||||
- Scroll have next events:</p>
|
||||
|
||||
<pre>
|
||||
- *on_scroll* On scroll move callback
|
||||
- *on_scroll_to* On scroll_to <span class="keyword">function</span> callback
|
||||
- *on_point_scroll* On scroll_to_index <span class="keyword">function</span> callback
|
||||
</pre>
|
||||
|
||||
<p>- You can adjust scroll content size by <code>scroll:set_border(node_size)</code>. It will setup new size to content node.</p>
|
||||
|
||||
|
||||
<p><a name="Progress"></a></p>
|
||||
<h2>Progress</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.progress.html">Progress API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid progress bar component</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create progress bar component with druid: <code>progress = druid:new_progress(node_name, key, init_value)</code></p>
|
||||
|
||||
<p>Node name should have maximum node size, so in GUI scene, node_name should be fully filled.
|
||||
Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or just "y")</p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Progress correct working with 9slice nodes, it trying to set size by <em>set</em>size_ first, if it is not possible, it set up sizing via <em>set</em>scale_
|
||||
- Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
|
||||
- If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles</p>
|
||||
|
||||
<p><a name="Slider"></a></p>
|
||||
<h2>Slider</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.slider.html">Slider API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid slider component</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create slider component with druid: <code>slider = druid:new_slider(node_name, end_pos, callback)</code></p>
|
||||
|
||||
<p>Pin node (node_name in params) should be placed in zero position (initial). It will be available to mode Pin node between start pos and end pos. </p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- You can setup points of interests on slider via <a href="../modules/druid.slider.html#set_steps">slider:set_steps</a>. If steps are exist, slider values will be only from this steps (notched slider)
|
||||
- For now, start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)</p>
|
||||
|
||||
<p><a name="Input"></a></p>
|
||||
<h2>Input</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.input.html">Input API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid text input component (unimplemented)</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
|
||||
<p><a name="Checkbox"></a></p>
|
||||
<h2>Checkbox</h2>
|
||||
<p>Basic Druid checkbox component</p>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.checkbox.html">Checkbox API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid checkbox component.</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create checkbox component with druid: <code>checkbox = druid:new_checkbox(node, callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Checkbox uses button to handle click
|
||||
- You can setup another node to handle input with click_node arg in component init: <code>druid:new_checkbox(node, callback, [click_node])</code></p>
|
||||
|
||||
<p><a name="Checkbox_group"></a></p>
|
||||
<h2>Checkbox group</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.checkbox_group.html">Checkbox group API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Several checkboxes in one group</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create checkbox_group component with druid: <code>group = druid:new_checkbox_group(nodes[], callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Callback arguments: <code>function(self, checkbox_index)</code>. Index is equals in <em>nodes[]</em> array in component constructor
|
||||
- You can get/set checkbox_group state with <code>group:set_state()</code> and <code>group:get_state()</code></p>
|
||||
|
||||
|
||||
<p><a name="Radio_group"></a></p>
|
||||
<h2>Radio group</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.radio_group.html">Radio group API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Several checkboxes in one group with single choice</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create radio_group component with druid: <code>group = druid:new_radio_group(nodes[], callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Callback arguments: <code>function(self, checkbox_index)</code>. Index is equals in <em>nodes[]</em> array in component constructor
|
||||
- You can get/set radio_group state with <code>group:set_state()</code> and <code>group:get_state()</code>
|
||||
- Only different from checkbox_group: on click another checkboxes in this group will be unchecked</p>
|
||||
|
||||
<p><a name="Timer"></a></p>
|
||||
<h2>Timer</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.timer.html">Timer API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Handle timer work on gui text node</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create timer component with druid: <code>timer = druid:new_timer(text_node, from_seconds, to_seconds, callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Timer fires callback, when timer value equals to <em>to</em>seconds_
|
||||
- Timer will setup text node with current timer value
|
||||
- Timer uses update function to handle time</p>
|
||||
|
||||
<p><a name="Grid"></a></p>
|
||||
<h2>Grid</h2>
|
||||
<p>Component for manage node positions </p>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.grid.html">Grid API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Component for manage node positions. Very simple implementation for nodes with equal size</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create grid component with druid: <code>grid = druid:new_grid(parent_node, prefab_node, max_in_row_elements)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Grid on <em>adding elements</em> will setup parent to <em>parent</em>node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can adjust anchor and border between elements
|
||||
- <em>Prefab node</em> in component init used to get grid item size</p>
|
||||
|
||||
<p><a name="Hover"></a></p>
|
||||
<h2>Hover</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.hover.html">Hover API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>System Druid component, handle hover node state</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create grid component with druid: <code>hover = druid:new_hover(node, callback)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><strong>Creating custom components</strong></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -120,6 +120,15 @@
|
||||
</span><span class="keyword">function</span> M.on_layout_change(self)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="comment">-- Call, if input was capturing before this component
|
||||
</span><span class="comment">-- Example: scroll is start scrolling, so you need unhover button
|
||||
</span><span class="keyword">function</span> M.on_input_interrupt(self)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="comment">-- Call on component remove or on druid:final
|
||||
</span><span class="keyword">function</span> M.on_remove(self)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">return</span> M
|
||||
</pre>
|
||||
|
||||
@ -131,12 +140,26 @@
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
<span class="keyword">local</span> my_component = <span class="global">require</span>(<span class="string">"my.amazing.component"</span>)
|
||||
|
||||
<span class="keyword">local</span> <span class="keyword">function</span> init(self)
|
||||
<span class="keyword">function</span> init(self)
|
||||
druid.register(<span class="string">"my_component"</span>, my_component)
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
|
||||
<p>Registering make new function with "new<em>{component</em>name}". In our example it will be: <code>druid:new_my_component()</code></p>
|
||||
|
||||
<p>As component registered, you can create your component with next code:</p>
|
||||
|
||||
<pre>
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
|
||||
<span class="keyword">function</span> init(self)
|
||||
self.druid = druid.new(self)
|
||||
<span class="keyword">local</span> my_component = self.druid:new_my_component(...)
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
|
||||
<h3>Interest</h3>
|
||||
<p>Interest - is a way to indicate what events your component will respond to.
|
||||
There is next interests in druid:
|
||||
@ -202,7 +225,7 @@ There is next interests in druid:
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><strong>Styles</strong></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -138,7 +138,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><strong>Druid assets</strong></li>
|
||||
@ -80,7 +80,7 @@
|
||||
<h2>Overview</h2>
|
||||
<p>I've created <a href="https://github.com/Insality/druid-assets">druid-assets repository</a> to make a <em>marketplace</em> with custom styles and components.</p>
|
||||
|
||||
<p>Any of druid users can push their own components and styles to share it with the other users</p>
|
||||
<p>Any of Druid users can push their own components and styles to share it with the other users</p>
|
||||
|
||||
<p>Also, this marketplace is great example to how you can create your custom components</p>
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -87,7 +87,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -36,6 +36,7 @@
|
||||
<li><a href="#Components">Components </a></li>
|
||||
<li><a href="#Basic_usage">Basic usage </a></li>
|
||||
<li><a href="#Druid_Events">Druid Events </a></li>
|
||||
<li><a href="#Druid_lifecycle">Druid lifecycle </a></li>
|
||||
<li><a href="#Features">Features </a></li>
|
||||
<li><a href="#Examples">Examples </a></li>
|
||||
<li><a href="#Documentation">Documentation </a></li>
|
||||
@ -48,7 +49,7 @@
|
||||
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">Druid components</a></li>
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
@ -85,6 +86,8 @@
|
||||
|
||||
<a href="https://insality.github.io/druid/"><img src="media/druid_logo.png" alt=""/></a></p>
|
||||
|
||||
<p><a href="https://github.com/Insality/druid/releases"><img src="https://img.shields.io/github/v/release/insality/druid" alt="GitHub release (latest by date)"/></a></p>
|
||||
|
||||
<p><strong>Druid</strong> - powerful defold component UI library. Use basic <strong>Druid</strong> components or make your own game-specific components to make amazing GUI in your games.</p>
|
||||
|
||||
|
||||
@ -107,8 +110,8 @@
|
||||
|
||||
<ul>
|
||||
<li>Mouse trigger - <code>Button 1</code> -> <code>touch</code> <em>For basic input components</em></li>
|
||||
<li>Key trigger - <code>Backspace</code> -> <code>backspace</code> <em>For back</em>handler component_</li>
|
||||
<li>Key trigger - <code>Back</code> -> <a href="../modules/druid.text.html#">text</a> <em>For back</em>handler component, Android back button_</li>
|
||||
<li>Key trigger - <code>Backspace</code> -> <code>back</code> <em>For back</em>handler component_</li>
|
||||
<li>Key trigger - <code>Back</code> -> <code>back</code> <em>For back</em>handler component, Android back button_</li>
|
||||
</ul>
|
||||
|
||||
<p><img src="media/input_binding.png" alt=""/></p>
|
||||
@ -193,14 +196,6 @@
|
||||
self.druid:new_button(<span class="string">"button_node_name"</span>, button_callback)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> update(self, dt)
|
||||
self.druid:update(dt)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> on_message(self, message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> on_input(self, action_id, action)
|
||||
<span class="keyword">return</span> self.druid:on_input(action_id, action)
|
||||
<span class="keyword">end</span>
|
||||
@ -210,7 +205,7 @@
|
||||
<p><a name="Druid_Events"></a></p>
|
||||
<h2>Druid Events</h2>
|
||||
|
||||
<p>Any <strong>Druid</strong> components as callbacks uses Druid Events. In component API (<a href="https://insality.github.io/druid/modules/druid.button.html#Events">button example</a>) pointed list of component events. You can manually subscribe on this events by next API:</p>
|
||||
<p>Any <strong>Druid</strong> components as callbacks uses <a href="https://insality.github.io/druid/modules/druid_event.html">Druid Events</a>. In component API (<a href="https://insality.github.io/druid/modules/druid.button.html#Events">button example</a>) pointed list of component events. You can manually subscribe on this events by next API:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><strong>event:subscribe</strong>(callback)</p></li>
|
||||
@ -220,6 +215,47 @@
|
||||
|
||||
<p>Any events can handle several callbacks, if needed.</p>
|
||||
|
||||
|
||||
<p><a name="Druid_lifecycle"></a></p>
|
||||
<h2>Druid lifecycle</h2>
|
||||
|
||||
<p>Here is full druid lifecycle setup in your <strong>*.gui_script</strong> file:</p>
|
||||
|
||||
<pre>
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
|
||||
<span class="keyword">function</span> init(self)
|
||||
self.druid = druid.new(self)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> final(self)
|
||||
self.druid:final()
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> update(self, dt)
|
||||
self.druid:update(dt)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> on_input(self, action_id, action)
|
||||
<span class="keyword">return</span> self.druid:on_input(action_id, action)
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="keyword">function</span> on_message(self, message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>*on_input* used for almost all basic druid components</li>
|
||||
<li><em>update</em> used for progress bar, scroll and timer base components</li>
|
||||
<li>*on_message* used for specific druid events, like language change or layout change (TODO: in future)</li>
|
||||
<li><em>final</em> used for custom components, what have to do several action before destroy</li>
|
||||
</ul>
|
||||
|
||||
<p>Recommended is fully integrate al druid lifecycles functions</p>
|
||||
|
||||
|
||||
<p><a name="Features"></a></p>
|
||||
<h2>Features</h2>
|
||||
|
||||
@ -228,10 +264,11 @@
|
||||
<li>Don't forget about <code>return</code> in <code>on_input</code>: <code>return self.druid:on_input()</code>. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p><a name="Examples"></a></p>
|
||||
<h2>Examples</h2>
|
||||
|
||||
<p>See the <a href="https://github.com/insality/druid/tree/develop/example/kenney">example folder</a> for examples of how to use <strong>Druid</strong></p>
|
||||
<p>See the <a href="https://github.com/Insality/druid/tree/develop/example">example folder</a> for examples of how to use <strong>Druid</strong></p>
|
||||
|
||||
<p>See the <a href="https://github.com/insality/druid-assets">druid-assets repository</a> for examples of how to create custom components and styles</p>
|
||||
|
||||
@ -291,7 +328,7 @@ https://insality.github.io/druid/</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -1,14 +1,24 @@
|
||||
|
||||
|
||||
# Druid components
|
||||
|
||||
|
||||
## Button
|
||||
[Button API here](https://insality.github.io/druid/modules/druid.button.html)
|
||||
|
||||
Basic Druid input component
|
||||
### Overview
|
||||
Basic Druid input component. Handle input on node and provide different callbacks on touch events.
|
||||
|
||||
### Setup
|
||||
Create button with druid: `button = druid:new_button(node_name, callback, [params], [animation_node])`
|
||||
Where node name is name of node from GUI scene. You can use `node_name` as input trigger zone and point another node for animation via `animation_node`
|
||||
|
||||
### Notes
|
||||
- Button callback have next params: (self, params, button_instance)
|
||||
- **self** - Druid self context
|
||||
- **params** - Additional params, specified on button creating
|
||||
- **button_instance** - button itself
|
||||
- You can set _params_ on button callback on button creating: `druid:new_button("node_name", callback, params)`. This _params_ will pass in callback as second argument
|
||||
- Button have next events:
|
||||
- **on_click** - basic button callback
|
||||
- **on_repeated_click** - repeated click callback, while holding the button, don't trigger if callback is empty
|
||||
@ -17,13 +27,20 @@ Basic Druid input component
|
||||
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
|
||||
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone
|
||||
- Button can have key trigger to use then by key: `button:set_key_trigger`
|
||||
- Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be `big panel` and animation node will be `small icon`
|
||||
|
||||
|
||||
## Text
|
||||
[Text API here](https://insality.github.io/druid/modules/druid.text.html)
|
||||
|
||||
Basic Druid text component
|
||||
### Overview
|
||||
Basic Druid text component. Text components by default have the text size adjusting.
|
||||
|
||||
- Text component by default have auto adjust text sizing. Text never will be more, than text size, which you can setup in gui scene. It can be disabled on component creating
|
||||
### Setup
|
||||
Create text node with druid: `text = druid:new_text(node_name, [initial_value])`
|
||||
|
||||
### Notes
|
||||
- Text component by default have auto adjust text sizing. Text never will be bigger, than text node size, which you can setup in GUI scene. It can be disabled on component creating by settings argument `is_no_adjust` to _true_
|
||||
|
||||

|
||||
|
||||
@ -33,13 +50,16 @@ Basic Druid text component
|
||||
|
||||
|
||||
## Blocker
|
||||
[Blocker API here](https://insality.github.io/druid/modules/druid.button.html)
|
||||
|
||||
Druid component for block input
|
||||
### Overview
|
||||
Druid component for block input. Use it to block input in special zone.
|
||||
|
||||
It can be used for block input in special zone.
|
||||
|
||||
Example:
|
||||
### Setup
|
||||
Create blocker component with druid: `druid:new_blocker(node_name)`
|
||||
|
||||
### Notes
|
||||
Explanation:
|
||||

|
||||
|
||||
Blue zone is **button** with close_window callback
|
||||
@ -48,40 +68,183 @@ Yellow zone is blocker with window content
|
||||
|
||||
So you can do the safe zones, when you have the big buttons
|
||||
|
||||
## Back Handler
|
||||
Component to handle back button
|
||||
|
||||
It works on Android back button and Backspace. Key triggers in `input.binding` should be setup
|
||||
## Back Handler
|
||||
[Back handler API here](https://insality.github.io/druid/modules/druid.back_handler.html)
|
||||
|
||||
### Overview
|
||||
Component to handle back button. It handle Android back button and Backspace key. Key triggers in `input.binding` should be setup for correct working.
|
||||
|
||||
### Setup
|
||||
Setup callback with `druid:new_back_handler(callback)`
|
||||
|
||||
### Notes
|
||||
|
||||
|
||||
## Lang text
|
||||
Wrap on Text component to handle localization
|
||||
[Lang text API here](https://insality.github.io/druid/modules/druid.lang_text.html)
|
||||
|
||||
### Overview
|
||||
Wrap on Text component to handle localization. It uses druid get_text_function to set text by it's id
|
||||
|
||||
### Setup
|
||||
Create lang text component with druid `text = druid:new_lang_text(node_name, locale_id)`
|
||||
|
||||
### Notes
|
||||
|
||||
|
||||
## Scroll
|
||||
Basic Druid scroll component
|
||||
[Scroll API here](https://insality.github.io/druid/modules/druid.scroll.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid scroll component. Handle all scrolling stuff in druid GUI
|
||||
|
||||
### Setup
|
||||
Create scroll component with druid: `scroll = druid:new_scroll(scroll_parent, scroll_input)`.
|
||||
|
||||
_Scroll parent_ - is dynamic part. This node will change position by scroll system
|
||||
|
||||
_Scroll input_ - is static part. It capturing user input and recognize scrolling touches
|
||||
|
||||
Initial scroll size will be equal to _scroll parent_ node size. The initial view box will be equal to _scroll input_ node size
|
||||
|
||||
Usually, Place static input zone part, and as children add scroll parent part:
|
||||

|
||||

|
||||
|
||||
*Here scroll_content_zone below input zone, in game content zone be able to scroll left until end*
|
||||
|
||||
### Notes
|
||||
- Scroll by default style have inertion and "back moving". It can be adjust via scroll [style settings](https://insality.github.io/druid/modules/druid.scroll.html#Style)
|
||||
- You can setup "points of interest". Scroll always will be centered on closes point of interest. It is able to create slider without inertion and points of interest on each scroll element.
|
||||
- Scroll have next events:
|
||||
- *on_scroll* On scroll move callback
|
||||
- *on_scroll_to* On scroll_to function callback
|
||||
- *on_point_scroll* On scroll_to_index function callback
|
||||
- You can adjust scroll content size by `scroll:set_border(node_size)`. It will setup new size to content node.
|
||||
|
||||
|
||||
## Progress
|
||||
[Progress API here](https://insality.github.io/druid/modules/druid.progress.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid progress bar component
|
||||
|
||||
### Setup
|
||||
Create progress bar component with druid: `progress = druid:new_progress(node_name, key, init_value)`
|
||||
|
||||
Node name should have maximum node size, so in GUI scene, node_name should be fully filled.
|
||||
Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or just "y")
|
||||
|
||||
### Notes
|
||||
- Progress correct working with 9slice nodes, it trying to set size by _set_size_ first, if it is not possible, it set up sizing via _set_scale_
|
||||
- Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
|
||||
- If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles
|
||||
|
||||
## Slider
|
||||
[Slider API here](https://insality.github.io/druid/modules/druid.slider.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid slider component
|
||||
|
||||
### Setup
|
||||
Create slider component with druid: `slider = druid:new_slider(node_name, end_pos, callback)`
|
||||
|
||||
Pin node (node_name in params) should be placed in zero position (initial). It will be available to mode Pin node between start pos and end pos.
|
||||
|
||||
### Notes
|
||||
- You can setup points of interests on slider via `slider:set_steps`. If steps are exist, slider values will be only from this steps (notched slider)
|
||||
- For now, start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)
|
||||
|
||||
## Input
|
||||
[Input API here](https://insality.github.io/druid/modules/druid.input.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid text input component (unimplemented)
|
||||
|
||||
### Setup
|
||||
|
||||
### Notes
|
||||
|
||||
|
||||
## Checkbox
|
||||
Basic Druid checkbox component
|
||||
[Checkbox API here](https://insality.github.io/druid/modules/druid.checkbox.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid checkbox component.
|
||||
|
||||
### Setup
|
||||
Create checkbox component with druid: `checkbox = druid:new_checkbox(node, callback)`
|
||||
|
||||
### Notes
|
||||
- Checkbox uses button to handle click
|
||||
- You can setup another node to handle input with click_node arg in component init: `druid:new_checkbox(node, callback, [click_node])`
|
||||
|
||||
## Checkbox group
|
||||
[Checkbox group API here](https://insality.github.io/druid/modules/druid.checkbox_group.html)
|
||||
|
||||
### Overview
|
||||
Several checkboxes in one group
|
||||
|
||||
### Setup
|
||||
Create checkbox_group component with druid: `group = druid:new_checkbox_group(nodes[], callback)`
|
||||
|
||||
### Notes
|
||||
- Callback arguments: `function(self, checkbox_index)`. Index is equals in _nodes[]_ array in component constructor
|
||||
- You can get/set checkbox_group state with `group:set_state()` and `group:get_state()`
|
||||
|
||||
|
||||
## Radio group
|
||||
[Radio group API here](https://insality.github.io/druid/modules/druid.radio_group.html)
|
||||
|
||||
### Overview
|
||||
Several checkboxes in one group with single choice
|
||||
|
||||
### Setup
|
||||
Create radio_group component with druid: `group = druid:new_radio_group(nodes[], callback)`
|
||||
|
||||
### Notes
|
||||
- Callback arguments: `function(self, checkbox_index)`. Index is equals in _nodes[]_ array in component constructor
|
||||
- You can get/set radio_group state with `group:set_state()` and `group:get_state()`
|
||||
- Only different from checkbox_group: on click another checkboxes in this group will be unchecked
|
||||
|
||||
## Timer
|
||||
[Timer API here](https://insality.github.io/druid/modules/druid.timer.html)
|
||||
|
||||
### Overview
|
||||
Handle timer work on gui text node
|
||||
|
||||
### Setup
|
||||
Create timer component with druid: `timer = druid:new_timer(text_node, from_seconds, to_seconds, callback)`
|
||||
|
||||
### Notes
|
||||
- Timer fires callback, when timer value equals to _to_seconds_
|
||||
- Timer will setup text node with current timer value
|
||||
- Timer uses update function to handle time
|
||||
|
||||
## Grid
|
||||
Component for manage node positions
|
||||
[Grid API here](https://insality.github.io/druid/modules/druid.grid.html)
|
||||
|
||||
### Overview
|
||||
Component for manage node positions. Very simple implementation for nodes with equal size
|
||||
|
||||
### Setup
|
||||
Create grid component with druid: `grid = druid:new_grid(parent_node, prefab_node, max_in_row_elements)`
|
||||
|
||||
### Notes
|
||||
- Grid on _adding elements_ will setup parent to _parent_node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can adjust anchor and border between elements
|
||||
- _Prefab node_ in component init used to get grid item size
|
||||
|
||||
## Hover
|
||||
[Hover API here](https://insality.github.io/druid/modules/druid.hover.html)
|
||||
|
||||
### Overview
|
||||
System Druid component, handle hover node state
|
||||
|
||||
### Setup
|
||||
Create grid component with druid: `hover = druid:new_hover(node, callback)`
|
||||
|
||||
### Notes
|
@ -38,6 +38,15 @@ end
|
||||
function M.on_layout_change(self)
|
||||
end
|
||||
|
||||
-- Call, if input was capturing before this component
|
||||
-- Example: scroll is start scrolling, so you need unhover button
|
||||
function M.on_input_interrupt(self)
|
||||
end
|
||||
|
||||
-- Call on component remove or on druid:final
|
||||
function M.on_remove(self)
|
||||
end
|
||||
|
||||
return M
|
||||
```
|
||||
|
||||
@ -47,11 +56,23 @@ Add your custom component to druid via `druid.register`
|
||||
local druid = require("druid.druid")
|
||||
local my_component = require("my.amazing.component")
|
||||
|
||||
local function init(self)
|
||||
function init(self)
|
||||
druid.register("my_component", my_component)
|
||||
end
|
||||
```
|
||||
|
||||
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`
|
||||
|
||||
As component registered, you can create your component with next code:
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
|
||||
function init(self)
|
||||
self.druid = druid.new(self)
|
||||
local my_component = self.druid:new_my_component(...)
|
||||
end
|
||||
```
|
||||
|
||||
### Interest
|
||||
Interest - is a way to indicate what events your component will respond to.
|
||||
There is next interests in druid:
|
||||
|
@ -3,6 +3,6 @@
|
||||
## Overview
|
||||
I've created [druid-assets repository](https://github.com/Insality/druid-assets) to make a _marketplace_ with custom styles and components.
|
||||
|
||||
Any of druid users can push their own components and styles to share it with the other users
|
||||
Any of Druid users can push their own components and styles to share it with the other users
|
||||
|
||||
Also, this marketplace is great example to how you can create your custom components
|
@ -3,16 +3,17 @@
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_click On release button callback
|
||||
-- @tfield druid_event on_repeated_click On repeated action button callback
|
||||
-- @tfield druid_event on_long_click On long tap button callback
|
||||
-- @tfield druid_event on_double_click On double tap button callback
|
||||
-- @tfield druid_event on_click (self, params, button_instance) On release button callback
|
||||
-- @tfield druid_event on_repeated_click (self, params, button_instance, click_amount) On repeated action button callback
|
||||
-- @tfield druid_event on_long_click (self, params, button_instance, time) On long tap button callback
|
||||
-- @tfield druid_event on_double_click (self, params, button_instance, click_amount) On double tap button callback
|
||||
-- @tfield druid_event on_hold_callback (self, params, button_instance, time) On button hold before long_click callback
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield node node Trigger node
|
||||
-- @tfield[opt=node] node anim_node Animation node
|
||||
-- @tfield vector3 scale_from Initial scale of anim_node
|
||||
-- @tfield vector3 start_scale Initial scale of anim_node
|
||||
-- @tfield vector3 pos Initial pos of anim_node
|
||||
-- @tfield any params Params to click callbacks
|
||||
-- @tfield druid.hover hover Druid hover logic component
|
||||
@ -145,14 +146,12 @@ end
|
||||
-- @tparam function callback Button callback
|
||||
-- @tparam[opt] table params Button callback params
|
||||
-- @tparam[opt] node anim_node Button anim node (node, if not provided)
|
||||
-- @tparam[opt] string event Button react event, const.ACTION_TOUCH by default
|
||||
function M.init(self, node, callback, params, anim_node, event)
|
||||
function M.init(self, node, callback, params, anim_node)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
|
||||
self.anim_node = anim_node and helper:get_node(anim_node) or self.node
|
||||
-- TODO: rename to start_scale
|
||||
self.scale_from = gui.get_scale(self.anim_node)
|
||||
self.start_scale = gui.get_scale(self.anim_node)
|
||||
self.params = params
|
||||
self.hover = self.druid:new_hover(node, on_button_hover)
|
||||
self.click_zone = nil
|
||||
|
@ -39,7 +39,7 @@ end
|
||||
|
||||
--- Set checkbox group state
|
||||
-- @function checkbox_group:set_state
|
||||
-- @tparam bool[] state Array of checkbox state
|
||||
-- @tparam bool[] indexes Array of checkbox state
|
||||
function M.set_state(self, indexes)
|
||||
for i = 1, #indexes do
|
||||
if self.checkboxes[i] then
|
||||
|
@ -74,7 +74,7 @@ end
|
||||
-- @function progress:init
|
||||
-- @tparam string|node node Progress bar fill node or node name
|
||||
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||
-- @tparam number init_value Initial value of progress bar
|
||||
-- @tparam[opt=1] number init_value Initial value of progress bar
|
||||
function M.init(self, node, key, init_value)
|
||||
assert(key == const.SIDE.X or const.SIDE.Y, "Progress bar key should be 'x' or 'y'")
|
||||
|
||||
|
@ -48,7 +48,7 @@ end
|
||||
|
||||
--- Set radio group state
|
||||
-- @function radio_group:set_state
|
||||
-- @tparam bool[] state Array of checkbox state
|
||||
-- @tparam number index Index in radio group
|
||||
function M.set_state(self, index)
|
||||
on_checkbox_click(self, index)
|
||||
end
|
||||
@ -56,7 +56,7 @@ end
|
||||
|
||||
--- Return radio group state
|
||||
-- @function radio_group:get_state
|
||||
-- @treturn bool[] Array if checkboxes state
|
||||
-- @treturn number Index in radio group
|
||||
function M.get_state(self)
|
||||
local result = -1
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_scroll On scroll move callback
|
||||
-- @tfield druid_event on_scroll_to On scroll_to function callback
|
||||
-- @tfield druid_event on_point_scroll On scroll_to_index function callbck
|
||||
-- @tfield druid_event on_point_scroll On scroll_to_index function callback
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
|
@ -67,7 +67,7 @@ end
|
||||
--- Component init function
|
||||
-- @function text:init
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam[opt] string value Initial text
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam[opt] bool no_adjust If true, text will be not auto-adjust size
|
||||
function M.init(self, node, value, no_adjust)
|
||||
self.node = self:get_node(node)
|
||||
@ -85,10 +85,10 @@ function M.init(self, node, value, no_adjust)
|
||||
self.color = gui.get_color(self.node)
|
||||
|
||||
self.on_set_text = Event()
|
||||
self.on_update_text_scale = Event()
|
||||
self.on_set_pivot = Event()
|
||||
self.on_update_text_scale = Event()
|
||||
|
||||
self:set_to(value or 0)
|
||||
self:set_to(value or gui.get_text(self.node))
|
||||
return self
|
||||
end
|
||||
|
||||
|
@ -12,12 +12,9 @@
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield node node Trigger node
|
||||
-- @tfield[opt=node] node anim_node Animation node
|
||||
-- @tfield vector3 scale_from Initial scale of anim_node
|
||||
-- @tfield vector3 pos Initial pos of anim_node
|
||||
-- @tfield any params Params to click callbacks
|
||||
-- @tfield druid.hover hover Druid hover logic component
|
||||
-- @tfield[opt] node click_zone Restriction zone
|
||||
-- @tfield number from Initial timer value
|
||||
-- @tfield number target Target timer value
|
||||
-- @tfield number value Current timer value
|
||||
|
||||
local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
|
@ -86,10 +86,13 @@ function Component.get_interests(self)
|
||||
end
|
||||
|
||||
|
||||
-- TODO: Определиться с get_node и node
|
||||
-- get_node - берет ноду по ноде или строке
|
||||
-- node - может брать ноду у компонента по схеме (если есть
|
||||
-- template или таблица нод после gui.clone_tree)
|
||||
--- Get node for component by name.
|
||||
-- If component has nodes, node_or_name should be string
|
||||
-- It auto pick node by template name or from nodes by clone_tree
|
||||
-- if they was setup via component:set_nodes, component:set_template
|
||||
-- @function component:get_node
|
||||
-- @tparam string|node node_or_name Node name or node itself
|
||||
-- @treturn node Gui node
|
||||
function Component.get_node(self, node_or_name)
|
||||
local template_name = self:get_template() or const.EMPTY_STRING
|
||||
local nodes = self:get_nodes()
|
||||
|
@ -31,13 +31,10 @@ local M = {}
|
||||
-- @tparam table module lua table with component
|
||||
function M.register(name, module)
|
||||
-- TODO: Find better solution to creating elements?
|
||||
-- Possibly: druid.new(druid.BUTTON, etc?)
|
||||
-- Current way is very implicit
|
||||
druid_instance["new_" .. name] = function(self, ...)
|
||||
return druid_instance.create(self, module, ...)
|
||||
end
|
||||
|
||||
-- print("Register component", name)
|
||||
end
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ end
|
||||
function M.tap_scale_animation(self, node, target_scale)
|
||||
scale_to(self, node, target_scale,
|
||||
function()
|
||||
M.back_scale_animation(self, node, self.scale_from)
|
||||
M.back_scale_animation(self, node, self.start_scale)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
@ -18,14 +18,14 @@ M["button"] = {
|
||||
IS_HOVER = true,
|
||||
|
||||
on_hover = function(self, node, state)
|
||||
local scale_to = self.scale_from + M.button.HOVER_SCALE
|
||||
local scale_to = self.start_scale + M.button.HOVER_SCALE
|
||||
|
||||
local target_scale = state and scale_to or self.scale_from
|
||||
local target_scale = state and scale_to or self.start_scale
|
||||
anims.hover_scale(self, target_scale, M.button.HOVER_TIME)
|
||||
end,
|
||||
|
||||
on_click = function(self, node)
|
||||
local scale_to = self.scale_from + M.button.SCALE_CHANGE
|
||||
local scale_to = self.start_scale + M.button.SCALE_CHANGE
|
||||
anims.tap_scale_animation(self, node, scale_to)
|
||||
settings.play_sound(M.button.BTN_SOUND)
|
||||
end,
|
||||
|
@ -128,12 +128,27 @@ function Druid.create(self, component, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Call on final function on gui_script. It will call on_remove
|
||||
-- on all druid components
|
||||
-- @function druid:final
|
||||
function Druid.final(self)
|
||||
local components = self.components[const.ALL]
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
if components[i].on_remove then
|
||||
components[i]:on_remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Remove component from druid instance.
|
||||
-- Component `on_remove` function will be invoked, if exist.
|
||||
-- @function druid:remove
|
||||
-- @tparam Component component Component instance
|
||||
function Druid.remove(self, component)
|
||||
local all_components = self.components[const.ALL]
|
||||
|
||||
for i = #all_components, 1, -1 do
|
||||
if all_components[i] == component then
|
||||
if component.on_remove then
|
||||
@ -204,11 +219,13 @@ function Druid.on_message(self, message_id, message, sender)
|
||||
end
|
||||
end
|
||||
else
|
||||
local components = self.components[const.ON_MESSAGE] or const.EMPTY_TABLE
|
||||
local components = self.components[const.ON_MESSAGE]
|
||||
if components then
|
||||
for i = 1, #components do
|
||||
components[i]:on_message(message_id, message, sender)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -3518,7 +3518,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Inline:"
|
||||
text: "Simple inline text"
|
||||
font: "game"
|
||||
id: "text_inline"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -3581,7 +3581,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Multiline"
|
||||
text: "Simple multiline text with smth"
|
||||
font: "game"
|
||||
id: "text_multiline"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -3699,7 +3699,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Anchoring:"
|
||||
text: "Anchoring"
|
||||
font: "game"
|
||||
id: "text_anchoring"
|
||||
xanchor: XANCHOR_NONE
|
||||
|
@ -13,9 +13,9 @@ local pivots = {
|
||||
}
|
||||
|
||||
local function setup_texts(self)
|
||||
self.druid:new_text("text_inline", "Simple inline text")
|
||||
self.druid:new_text("text_multiline", "Simple multiline text with smth")
|
||||
local anchoring = self.druid:new_text("text_anchoring", "Anchoring")
|
||||
self.druid:new_text("text_inline")
|
||||
self.druid:new_text("text_multiline")
|
||||
local anchoring = self.druid:new_text("text_anchoring")
|
||||
self.druid:new_text("text_no_adjust", "Without adjust size", true)
|
||||
self.druid:new_lang_text("text_locale", "ui_text_example")
|
||||
|
||||
|
BIN
media/scroll_outline.png
Normal file
BIN
media/scroll_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
media/scroll_scheme.png
Normal file
BIN
media/scroll_scheme.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Loading…
x
Reference in New Issue
Block a user