Merge branch 'develop'

This commit is contained in:
Insality 2020-04-13 19:37:51 +03:00
commit cd2315bb0a
42 changed files with 1806 additions and 84 deletions

View File

@ -200,21 +200,6 @@ https://insality.github.io/druid/
_Will fill later_
## Future plans
- Basic input component
- Add on_layout_change support (to keep gui data between layout change)
- Add on_change_language support (call single function to update all Druid instance)
- Unit tests
- Better documentation and examples
- Add more comfortable gamepad support for GUI (ability to select button with DPAD and other stuff)
## License
Original created by [AGulev](https://github.com/AGulev)

View File

@ -1 +1 @@
{"content":[{"name":"game.projectc","size":2709,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":4608,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":263313,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":9895,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
{"content":[{"name":"game.projectc","size":2713,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":4688,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":264687,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":10104,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -155,7 +155,7 @@ max_count = 16
max_tile_count = 2048
[druid]
autofocus = 1
no_auto_input = 0
[native_extension]
app_manifest = /example/game.appmanifest

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -440,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -404,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -379,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -293,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -769,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -124,7 +124,8 @@ Where node name is name of node from GUI scene. You can use <code>node_name</cod
- **on_double_click** - different callback, if tap button 2+ in row, don'</span>t trigger <span class="keyword">if</span> callback is empty
</pre>
<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
<p>- If button have double click event and it is triggered, usual callback will be not invoked
- 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>
@ -137,7 +138,7 @@ Where node name is name of node from GUI scene. You can use <code>node_name</cod
<p>Basic Druid text component. Text components by default have the text size adjusting.</p>
<h3>Setup</h3>
<p>Create text node with druid: <code>text = druid:new_text(node_name, [initial_value])</code></p>
<p>Create text node with druid: <code>text = druid:new_text(node_name, [initial_value], [is_disable_size_adjust])</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>
@ -373,7 +374,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
</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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -82,7 +82,9 @@
<p><a name="Overview"></a></p>
<h2>Overview</h2>
<p>Druid allows you to create your custom components from druid basic components or other custom components</p>
<p>Druid allows you to create your custom components from druid basic components or other custom components.</p>
<p>Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name}</p>
<p><a name="Custom_components"></a></p>
@ -94,7 +96,7 @@
<span class="keyword">local</span> const = <span class="global">require</span>(<span class="string">"druid.const"</span>)
<span class="keyword">local</span> component = <span class="global">require</span>(<span class="string">"druid.component"</span>)
<span class="keyword">local</span> M = component.create(<span class="string">"name_your_component"</span>)
<span class="keyword">local</span> M = component.create(<span class="string">"my_component"</span>)
<span class="comment">-- Component constructor
</span><span class="keyword">function</span> M.init(self, ...)
@ -146,16 +148,22 @@
</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>Registering make new function with "new<em>{component</em>name}". In our example it will be: <code>druid:new_my_component()</code>.</p>
<p>Or you can create component without registering with <code>druid:create(my_component_module)</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">local</span> my_component = <span class="global">require</span>(<span class="string">"my.amazing.component"</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="comment">-- or --
</span> <span class="keyword">local</span> my_component = self.druid:create(my_component, ...)
<span class="keyword">end</span>
</pre>
@ -225,7 +233,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -41,7 +41,6 @@
<li><a href="#Examples">Examples </a></li>
<li><a href="#Documentation">Documentation </a></li>
<li><a href="#Games_powered_by_Druid">Games powered by Druid </a></li>
<li><a href="#Future_plans">Future plans </a></li>
<li><a href="#License">License </a></li>
<li><a href="#Issues_and_suggestions">Issues and suggestions </a></li>
</ul>
@ -156,19 +155,19 @@
<ul>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#button">Button</a></strong> - Basic Druid input component</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#text">Text</a></strong> - Basic Druid text component</p></li>
<li><p><strong>Lang text</strong> - Wrap on Text component to handle localization</p></li>
<li><p><strong>Scroll</strong> - Basic Druid scroll component</p></li>
<li><p><strong>Progress</strong> - Basic Druid progress bar component</p></li>
<li><p><strong>Slider</strong> - Basic Druid slider component</p></li>
<li><p><strong>Input</strong> - Basic Druid text input component (unimplemented)</p></li>
<li><p><strong>Checkbox</strong> - Basic Druid checkbox component</p></li>
<li><p><strong>Checkbox group</strong> - Several checkboxes in one group</p></li>
<li><p><strong>Radio group</strong> - Several checkboxes in one group with single choice</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#lang-text">Lang text</a></strong> - Wrap on Text component to handle localization</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#scroll">Scroll</a></strong> - Basic Druid scroll component</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#progress">Progress</a></strong> - Basic Druid progress bar component</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#slider">Slider</a></strong> - Basic Druid slider component</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#input">Input</a></strong> - Basic Druid text input component (unimplemented)</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox">Checkbox</a></strong> - Basic Druid checkbox component</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox-group">Checkbox group</a></strong> - Several checkboxes in one group</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#radio-group">Radio group</a></strong> - Several checkboxes in one group with single choice</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#blocker">Blocker</a></strong> - Block input in node zone component</p></li>
<li><p><strong>Back Handler</strong> - Handle back button (Android back, backspace)</p></li>
<li><p><strong>Timer</strong> - Handle timer work on gui text node</p></li>
<li><p><strong>Grid</strong> - Component for manage node positions </p></li>
<li><p><strong>Hover</strong> - System Druid component, handle hover node state</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#back-handler">Back Handler</a></strong> - Handle back button (Android back, backspace)</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#timer">Timer</a></strong> - Handle timer work on gui text node</p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#grid">Grid</a></strong> - Component for manage node positions </p></li>
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#hover">Hover</a></strong> - System Druid component, handle hover node state</p></li>
</ul>
<p>Full info see on <em><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md">components.md</a></em></p>
@ -294,19 +293,6 @@ https://insality.github.io/druid/</p>
<p><em>Will fill later</em></p>
<p><a name="Future_plans"></a></p>
<h2>Future plans</h2>
<ul>
<li><p>Basic input component</p></li>
<li><p>Add on<em>layout</em>change support (to keep gui data between layout change)</p></li>
<li><p>Add on<em>change</em>language support (call single function to update all Druid instance)</p></li>
<li><p>Unit tests</p></li>
<li><p>Better documentation and examples</p></li>
<li><p>Add more comfortable gamepad support for GUI (ability to select button with DPAD and other stuff)</p></li>
</ul>
<p><a name="License"></a></p>
<h2>License</h2>
@ -328,7 +314,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-04-09 22:11:32 </i>
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -25,6 +25,7 @@ Where node name is name of node from GUI scene. You can use `node_name` as input
- **on_long_click** - callback on long button tap, don't trigger if callback is empty
- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
- If button have double click event and it is triggered, usual callback will be not invoked
- 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`
@ -37,7 +38,7 @@ Where node name is name of node from GUI scene. You can use `node_name` as input
Basic Druid text component. Text components by default have the text size adjusting.
### Setup
Create text node with druid: `text = druid:new_text(node_name, [initial_value])`
Create text node with druid: `text = druid:new_text(node_name, [initial_value], [is_disable_size_adjust])`
### 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_

View File

@ -2,7 +2,9 @@
## Overview
Druid allows you to create your custom components from druid basic components or other custom components
Druid allows you to create your custom components from druid basic components or other custom components.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name}
## Custom components
@ -12,7 +14,7 @@ Basic custom component template looks like this:
local const = require("druid.const")
local component = require("druid.component")
local M = component.create("name_your_component")
local M = component.create("my_component")
-- Component constructor
function M.init(self, ...)
@ -61,15 +63,21 @@ function init(self)
end
```
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`.
Or you can create component without registering with `druid:create(my_component_module)`
As component registered, you can create your component with next code:
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
function init(self)
self.druid = druid.new(self)
local my_component = self.druid:new_my_component(...)
-- or --
local my_component = self.druid:create(my_component, ...)
end
```

View File

@ -5,7 +5,7 @@ local function scale_to(self, node, to, callback, time, delay, easing)
easing = easing or gui.EASING_INSINE
time = time or M.SCALE_ANIMATION_TIME
delay = delay or 0
time = time or 0.25
time = time or 0.10
gui.animate(node, gui.PROP_SCALE, to, easing, time, delay,
function()
if callback then

View File

@ -5,9 +5,9 @@ local M = {}
M["button"] = {
HOVER_SCALE = vmath.vector3(-0.025, -0.025, 1),
HOVER_TIME = 0.05,
SCALE_CHANGE = vmath.vector3(-0.05, -0.05, 1),
HOVER_SCALE = vmath.vector3(0.02, 0.02, 1),
HOVER_TIME = 0.04,
SCALE_CHANGE = vmath.vector3(0.035, 0.035, 1),
BTN_SOUND = "click",
BTN_SOUND_DISABLED = "click",
DISABLED_COLOR = vmath.vector4(0, 0, 0, 1),

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,14 @@ local main_page = require("example.page.main")
local text_page = require("example.page.texts")
local button_page = require("example.page.button")
local scroll_page = require("example.page.scroll")
local slider_page = require("example.page.slider")
local pages = {
"main_page",
"texts_page",
"button_page",
"scroll_page",
"slider_page",
}
local function on_control_button(self, delta)
@ -47,6 +49,7 @@ function init(self)
text_page.setup_page(self)
button_page.setup_page(self)
scroll_page.setup_page(self)
slider_page.setup_page(self)
-- Refresh state
on_control_button(self, 0)

View File

@ -7,6 +7,7 @@ local en = {
texts_page = "Text page",
button_page = "Button page",
scroll_page = "Scroll page",
slider_page = "Slider page",
ui_section_button = "Button",
ui_section_text = "Text",
ui_section_timer = "Timer",
@ -23,6 +24,7 @@ local ru = {
texts_page = "Текст",
button_page = "Кнопки",
scroll_page = "Скролл",
slider_page = "Слайдеры",
ui_section_button = "Кнопка",
ui_section_text = "Текст",
ui_section_timer = "Таймер",
@ -48,4 +50,4 @@ function M.toggle_locale()
msg.post("/gui#main", const.ON_CHANGE_LANGUAGE)
end
return M
return M

View File

@ -39,6 +39,15 @@ end
function M.setup_page(self)
self.druid:new_scroll("scroll_page_content", "scroll_page")
self.druid:new_scroll("simple_scroll_content", "simple_scroll_input")
-- scroll contain scrolls:
-- parent first
self.druid:new_scroll("children_scroll_content", "children_scroll")
-- chilren next
self.druid:new_scroll("children_scroll_content_1", "children_scroll_1")
self.druid:new_scroll("children_scroll_content_2", "children_scroll_2")
self.druid:new_scroll("children_scroll_content_3", "children_scroll_3")
init_grid(self)
end

20
example/page/slider.lua Normal file
View File

@ -0,0 +1,20 @@
local M = {}
function M.setup_page(self)
local slider = self.druid:new_slider("slider_simple_pin", vmath.vector3(95, 0, 0), function(_, value)
gui.set_text(gui.get_node("slider_simple_text"), math.ceil(value * 100) .. "%")
end)
slider:set(0.2)
local slider_notched = self.druid:new_slider("slider_notched_pin", vmath.vector3(95, 0, 0), function(_, value)
gui.set_text(gui.get_node("slider_notched_text"), math.ceil(value * 100) .. "%")
end)
slider_notched:set_steps({0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1})
slider_notched:set(0.2)
end
return M