Merge branch 'feature/component_polish' into develop

This commit is contained in:
Insality 2020-02-25 00:27:09 +03:00
commit 91198bb86a
57 changed files with 2381 additions and 794 deletions

View File

@ -81,7 +81,7 @@ function on_message(self, message_id, message, sender)
end
function on_input(self, action_id, action)
self.druid:on_input(action_id, action)
return self.druid:on_input(action_id, action)
end
```
@ -113,7 +113,7 @@ function M.update(self, dt)
end
-- Call only if exist interest: const.ON_INPUT or const.ON_SWIPE
-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH
function M.on_input(self, action_id, action)
end
@ -123,8 +123,8 @@ function M.on_message(self, message_id, message, sender)
end
-- Call only if swipe was started on another component (ex. scroll)
function M.on_swipe(self)
-- Call if input was interrupt by previous components (ex. scroll)
function M.on_input_interrupt(self)
end
@ -178,7 +178,7 @@ _TODO_
- update
- on_input
- on_message
- on_swipe
- on_input_interrupt
- setup_component
- get_style
- set_style

38
alpha_todo.txt Normal file
View File

@ -0,0 +1,38 @@
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
- add init/remove stuff for every style in component. How to set custom sprites for button states?
- add druid settings (add auto_focus input and other stuff)
+ button add key trigger
- button polish, actions
+ button and hover click restriction zone?
- unify component api (get/set/to and other general stuff)
- better callbacks for every components
- better scroll size management, check different cases. So implicit now
- better grid + scroll management
- better default style, add template for custom style
- add text component for alpha release
- compare with gooey
- add docs for all components
- add docs folder for every component with gifs? Solutions
- remove component autoremove all children component
-- Low
- 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)

View File

@ -2,6 +2,10 @@ project='Druid'
title='Defold Druid UI Library'
description='Documentation for Druid Library'
file={"./druid"}
package='druid'
sort=false
dir='./docs'
style='!pale'
style='!fixed'
format='discount'
use_markdown_titles=true
no_space_before_args=true

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -37,7 +37,8 @@
<li><a href="modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="modules/druid.grid.html">druid.grid</a></li>
<li><a href="modules/druid.locale.html">druid.locale</a></li>
<li><a href="modules/druid.input.html">druid.input</a></li>
<li><a href="modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="modules/druid.progress.html">druid.progress</a></li>
<li><a href="modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="modules/druid.scroll.html">druid.scroll</a></li>
@ -46,8 +47,8 @@
<li><a href="modules/druid.timer.html">druid.timer</a></li>
<li><a href="modules/component.html">component</a></li>
<li><a href="modules/druid.html">druid</a></li>
<li><a href="modules/helper.html">helper</a></li>
<li><a href="modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="modules/druid_event.html">druid_event</a></li>
<li><a href="modules/druid.helper.html">druid.helper</a></li>
<li><a href="modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -85,7 +86,11 @@
<td class="summary">Component to handle placing components by row and columns.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid.locale.html">druid.locale</a></td>
<td class="name" nowrap><a href="modules/druid.input.html">druid.input</a></td>
<td class="summary">Component to handle hover node interaction</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid.lang_text.html">druid.lang_text</a></td>
<td class="summary">Component to handle all GUI texts
Good working with localization system</td>
</tr>
@ -123,12 +128,12 @@
<td class="summary">Druid UI Library.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/helper.html">helper</a></td>
<td class="summary">Text node or icon node can be nil</td>
<td class="name" nowrap><a href="modules/druid_event.html">druid_event</a></td>
<td class="summary">Lua event small library</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid.progress_rich.html">druid.progress_rich</a></td>
<td class="summary">Component for rich progress component</td>
<td class="name" nowrap><a href="modules/druid.helper.html">druid.helper</a></td>
<td class="summary">Text node or icon node can be nil</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid_instance.html">druid_instance</a></td>
@ -140,7 +145,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -147,16 +147,22 @@ table.index td { text-align: left; vertical-align: top; }
#main {
background-color:#FFFFFF; // #f0f0f0;
//border-left: 2px solid #cccccc;
border-left: 1px solid #cccccc;
}
#navigation {
position: fixed;
top: 0;
left: 0;
float: left;
width: 14em;
vertical-align: top;
background-color:#FFFFFF; // #f0f0f0;
border-right: 2px solid #cccccc;
overflow: visible;
overflow-y: scroll;
height: 100%;
padding-left: 1em;
}
#navigation h2 {
@ -165,7 +171,6 @@ table.index td { text-align: left; vertical-align: top; }
color:#000000;
text-align: left;
padding:0.2em;
//border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
@ -189,6 +194,7 @@ table.index td { text-align: left; vertical-align: top; }
#content {
margin-left: 14em;
padding: 1em;
padding-left: 2em;
width: 700px;
border-left: 2px solid #cccccc;
// border-right: 2px solid #cccccc;
@ -197,8 +203,10 @@ table.index td { text-align: left; vertical-align: top; }
#about {
clear: both;
padding: 5px;
padding-left: 1em;
margin-left: 14em; // avoid the damn sidebar!
border-top: 2px solid #cccccc;
border-left: 2px solid #cccccc;
background-color: #ffffff;
}

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><strong>component</strong></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,16 +65,11 @@
<h1>Module <code>component</code></h1>
<p>Basic class for all Druid components.</p>
<p>
To create you component, use `component.create`</p>
<p> To create you component, use <a href="../modules/component.html#Component.create">component.create</a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#setup_component">setup_component(table, table)</a></td>
<td class="summary">Setup component context and his style table</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_style">get_style()</a></td>
<td class="summary">Get current component style table</td>
@ -115,6 +111,10 @@
<td class="summary">Return druid with context of calling component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#setup_component">setup_component(table, table)</a></td>
<td class="summary">Setup component context and his style table</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Component.create">Component.create(name, interest)</a></td>
<td class="summary">Create new component.</td>
</tr>
@ -127,37 +127,6 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "setup_component"></a>
<strong>setup_component(table, table)</strong>
</dt>
<dd>
Setup component context and his style table
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">table</span>
<span class="types"><span class="type">style</span></span>
Druid style module
</li>
<li><span class="parameter">table</span>
<span class="types"><span class="type">style</span></span>
Druid style module
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Component</span></span>
Component itself
</ol>
</dd>
<dt>
<a name = "get_style"></a>
<strong>get_style()</strong>
@ -362,6 +331,37 @@
</dd>
<dt>
<a name = "setup_component"></a>
<strong>setup_component(table, table)</strong>
</dt>
<dd>
Setup component context and his style table
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">table</span>
<span class="types"><span class="type">style</span></span>
Druid style module
</li>
<li><span class="parameter">table</span>
<span class="types"><span class="type">style</span></span>
Druid style module
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Component</span></span>
Component itself
</ol>
</dd>
<dt>
<a name = "Component.create"></a>
@ -396,7 +396,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,7 +65,9 @@
<h1>Module <code>druid.back_handler</code></h1>
<p>Component to handle back key (android, backspace)</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -148,7 +151,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,7 +61,9 @@
<h1>Module <code>druid.blocker</code></h1>
<p>Component to block input on specify zone (node)</p>
<p></p>
<p>
</p>
@ -74,7 +77,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -33,6 +33,7 @@
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
@ -44,7 +45,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +55,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,7 +66,9 @@
<h1>Module <code>druid.button</code></h1>
<p>Component to handle basic GUI button</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -81,6 +85,25 @@
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict button click area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get key-code to trigger this button</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Events">Events</a></td>
<td class="summary">Component events</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Fields">Fields</a></td>
<td class="summary">Component fields</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Style">Style</a></td>
<td class="summary">Component style params</td>
</tr>
</table>
<br/>
@ -180,6 +203,155 @@
</dd>
<dt>
<a name = "get_key_trigger"></a>
<strong>get_key_trigger(self)</strong>
</dt>
<dd>
Get key-code to trigger this button
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "Events"></a>
<strong>Events</strong>
</dt>
<dd>
Component events
<h3>Fields:</h3>
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">druid_event</span></span>
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
</li>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">druid_event</span></span>
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
</li>
</ul>
</dd>
<dt>
<a name = "Fields"></a>
<strong>Fields</strong>
</dt>
<dd>
Component fields
<h3>Fields:</h3>
<ul>
<li><span class="parameter">node</span>
<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>
<li><span class="parameter">scale_from</span>
<span class="types"><span class="type">vector3</span></span>
Initial scale of anim_node
</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_anim</span>
<span class="types"><span class="type">boolean</span></span>
Is hover anim enabled
</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>
</ul>
</dd>
<dt>
<a name = "Style"></a>
<strong>Style</strong>
</dt>
<dd>
Component style params
<h3>Fields:</h3>
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">function</span></span>
(self, node)
</li>
<li><span class="parameter">on_click_disabled</span>
<span class="types"><span class="type">function</span></span>
(self, node)
</li>
<li><span class="parameter">on_hover</span>
<span class="types"><span class="type">function</span></span>
(self, node, hover_state)
</li>
<li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">function</span></span>
(self, node, enabled_state)
</li>
<li><span class="parameter">IS_HOVER</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
</dl>
@ -188,7 +360,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><strong>druid.checkbox</strong></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,7 +61,9 @@
<h1>Module <code>druid.checkbox</code></h1>
<p>Druid checkbox component</p>
<p></p>
<p>
</p>
@ -74,7 +77,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><strong>druid.checkbox_group</strong></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,7 +61,9 @@
<h1>Module <code>druid.checkbox_group</code></h1>
<p>Checkboux group module</p>
<p></p>
<p>
</p>
@ -74,7 +77,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><strong>druid.grid</strong></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,8 +61,7 @@
<h1>Module <code>druid.grid</code></h1>
<p>Component to handle placing components by row and columns.</p>
<p>
Grid can anchor your elements, get content size and other</p>
<p> Grid can anchor your elements, get content size and other</p>
@ -75,7 +75,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><strong>helper</strong></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><strong>druid.helper</strong></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -62,9 +63,11 @@
<div id="content">
<h1>Module <code>helper</code></h1>
<h1>Module <code>druid.helper</code></h1>
<p>Text node or icon node can be nil</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -77,6 +80,14 @@
<td class="name" nowrap><a href="#centrate_icon_with_text">centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in gui hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pivot_offset">get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given gui pivot</td>
</tr>
</table>
<br/>
@ -152,6 +163,61 @@
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in gui hierarchy.
Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is enabled in hierarchy
</ol>
</dd>
<dt>
<a name = "get_pivot_offset"></a>
<strong>get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given gui pivot
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
The node pivot
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Vector offset with [-1..1] values
</ol>
</dd>
</dl>
@ -160,7 +226,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><strong>druid</strong></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -65,12 +66,23 @@
<h1>Module <code>druid</code></h1>
<p>Druid UI Library.</p>
<p>
Powerful Defold component based UI library. Use standart
<p> Powerful Defold component based UI library. Use standart
components or make your own game-specific to make amazing
GUI in your games.
GUI in your games.</p>
<p> Contains the several basic components and examples
to how to do your custom complex components to
separate UI game logic to small files
separate UI game logic to small files</p>
<pre>
<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>
</pre>
</p>
@ -100,7 +112,7 @@
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
druid<em>instance:new</em>{name}. For example <code>druid:new_button(...)</code>
<h3>Parameters:</h3>
@ -159,7 +171,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><strong>druid.input</strong></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><strong>druid.progress_rich</strong></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -62,24 +63,22 @@
<div id="content">
<h1>Module <code>druid.progress_rich</code></h1>
<p>Component for rich progress component</p>
<p></p>
<h1>Module <code>druid.input</code></h1>
<p>Component to handle hover node interaction</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, value)</a></td>
<td class="summary">Instant fill progress bar to value</td>
<td class="name" nowrap><a href="#hover:init">hover:init(self, node, on_hover_callback)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#empty">empty(self)</a></td>
<td class="summary">Empty a progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to">to(self, to[, callback])</a></td>
<td class="summary">Start animation of a progress bar</td>
<td class="name" nowrap><a href="#button:set_click_zone">button:set_click_zone(self, zone)</a></td>
<td class="summary">Strict button click area.</td>
</tr>
</table>
@ -91,11 +90,11 @@
<dl class="function">
<dt>
<a name = "set_to"></a>
<strong>set_to(self, value)</strong>
<a name = "hover:init"></a>
<strong>hover:init(self, node, on_hover_callback)</strong>
</dt>
<dd>
Instant fill progress bar to value
Component init function
<h3>Parameters:</h3>
@ -104,60 +103,39 @@
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Component instance
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
</dd>
<dt>
<a name = "empty"></a>
<strong>empty(self)</strong>
</dt>
<dd>
Empty a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Component instance
</li>
</ul>
</dd>
<dt>
<a name = "to"></a>
<strong>to(self, to[, callback])</strong>
</dt>
<dd>
Start animation of a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Component instance
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
value between 0..1
</li>
<li><span class="parameter">callback</span>
<li><span class="parameter">on_hover_callback</span>
<span class="types"><span class="type">function</span></span>
Callback on animation ends
(<em>optional</em>)
Hover callback
</li>
</ul>
</dd>
<dt>
<a name = "button:set_click_zone"></a>
<strong>button:set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Component instance
</li>
<li><span class="parameter">zone</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
@ -173,7 +151,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><strong>druid.locale</strong></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><strong>druid.lang_text</strong></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -62,10 +63,12 @@
<div id="content">
<h1>Module <code>druid.locale</code></h1>
<h1>Module <code>druid.lang_text</code></h1>
<p>Component to handle all GUI texts
Good working with localization system</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -115,7 +118,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><strong>druid.progress</strong></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,7 +65,9 @@
<h1>Module <code>druid.progress</code></h1>
<p>Basic progress bar component</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -293,7 +296,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><strong>druid.radio_group</strong></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,7 +61,9 @@
<h1>Module <code>druid.radio_group</code></h1>
<p>Radio group module</p>
<p></p>
<p>
</p>
@ -74,7 +77,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><strong>druid.scroll</strong></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,7 +65,9 @@
<h1>Module <code>druid.scroll</code></h1>
<p>Component to handle scroll content</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -273,7 +276,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -40,7 +40,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -49,8 +50,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -60,7 +61,9 @@
<h1>Module <code>druid.slider</code></h1>
<p>Druid slider component</p>
<p></p>
<p>
</p>
@ -74,7 +77,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -65,7 +66,9 @@
<h1>Module <code>druid.text</code></h1>
<p>Component to handle all GUI texts
Good working with localization system</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -232,7 +235,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><strong>druid.timer</strong></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -64,7 +65,9 @@
<h1>Module <code>druid.timer</code></h1>
<p>Component to handle GUI timers</p>
<p></p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
@ -176,7 +179,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -32,8 +32,7 @@
<h2>Contents</h2>
<ul>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Fields">Fields</a></li>
<li><a href="#Functions">Functions</a></li>
</ul>
@ -45,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,11 +53,9 @@
<li><a href="../modules/druid.text.html">druid.text</a></li>
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><strong>const</strong></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/helper.formats.html">helper.formats</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><strong>druid_event</strong></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
@ -65,23 +63,26 @@
<div id="content">
<h1>Module <code>const</code></h1>
<p>Druid constants</p>
<p></p>
<h1>Module <code>druid_event</code></h1>
<p>Lua event small library</p>
<p>
</p>
<h2><a href="#Tables">Tables</a></h2>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#pivots">pivots</a></td>
<td class="summary"></td>
<td class="name" nowrap><a href="#event:subscribe">event:subscribe(callback)</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#ON_MESSAGE">ON_MESSAGE</a></td>
<td class="summary">Interests</td>
<td class="name" nowrap><a href="#event:unsubscribe">event:unsubscribe(callback)</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#event:trigger">event:trigger(...)</a></td>
<td class="summary">Trigger the event and call all subscribed callbacks</td>
</tr>
</table>
@ -89,21 +90,22 @@
<br/>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "pivots"></a>
<strong>pivots</strong>
<a name = "event:subscribe"></a>
<strong>event:subscribe(callback)</strong>
</dt>
<dd>
Subscribe callback on event
<h3>Fields:</h3>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">test</span>
test
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
</ul>
@ -112,18 +114,41 @@
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "ON_MESSAGE"></a>
<strong>ON_MESSAGE</strong>
<a name = "event:unsubscribe"></a>
<strong>event:unsubscribe(callback)</strong>
</dt>
<dd>
Interests
Unsubscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
</ul>
</dd>
<dt>
<a name = "event:trigger"></a>
<strong>event:trigger(...)</strong>
</dt>
<dd>
Trigger the event and call all subscribed callbacks
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
All event params
</li>
</ul>
@ -137,7 +162,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-02-07 01:01:14 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -44,7 +44,8 @@
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.input.html">druid.input</a></li>
<li><a href="../modules/druid.lang_text.html">druid.lang_text</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
@ -53,8 +54,8 @@
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_event.html">druid_event</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><strong>druid_instance</strong></li>
</ul>
@ -71,8 +72,9 @@
<li><a href="../modules/druid.button.html#">druid.button</a></li>
<li><a href="../modules/druid.blocker.html#">druid.blocker</a></li>
<li><a href="../modules/druid.back_handler.html#">druid.back_handler</a></li>
<li><a href="../modules/druid.input.html#">druid.input</a></li>
<li><a href="../modules/druid.text.html#">druid.text</a></li>
<li><a href="../modules/druid.locale.html#">druid.locale</a></li>
<li><a href="../modules/druid.lang_text.html#">druid.lang_text</a></li>
<li><a href="../modules/druid.timer.html#">druid.timer</a></li>
<li><a href="../modules/druid.progress.html#">druid.progress</a></li>
<li><a href="../modules/druid.grid.html#">druid.grid</a></li>
@ -123,12 +125,16 @@
<td class="summary">Create back_handler basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_hover">druid:new_hover(...)</a></td>
<td class="summary">Create hover basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_text">druid:new_text(...)</a></td>
<td class="summary">Create text basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_locale">druid:new_locale(...)</a></td>
<td class="summary">Create locale basic component</td>
<td class="name" nowrap><a href="#druid:new_lang_text">druid:new_lang_text(...)</a></td>
<td class="summary">Create lang_text basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_timer">druid:new_timer(...)</a></td>
@ -155,6 +161,10 @@
<td class="summary">Create checkbox basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_input">druid:new_input(...)</a></td>
<td class="summary">Create input basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_checkbox_group">druid:new_checkbox_group(...)</a></td>
<td class="summary">Create checkbox_group basic component</td>
</tr>
@ -162,10 +172,6 @@
<td class="name" nowrap><a href="#druid:new_radio_group">druid:new_radio_group(...)</a></td>
<td class="summary">Create radio_group basic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid:new_progress_rich">druid:new_progress_rich(...)</a></td>
<td class="summary">Create progress_rich basic component</td>
</tr>
</table>
<br/>
@ -231,7 +237,7 @@
</dt>
<dd>
Remove component from druid instance.
Component `on_remove` function will be invoked, if exist.
Component <code>on_remove</code> function will be invoked, if exist.
<h3>Parameters:</h3>
@ -280,7 +286,7 @@
<ul>
<li><span class="parameter">action_id</span>
<span class="types"><span class="type">hash</span></span>
Action_id from on_input
Action<em>id from on</em>input
</li>
<li><span class="parameter">action</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
@ -305,7 +311,7 @@
<ul>
<li><span class="parameter">message_id</span>
<span class="types"><span class="type">hash</span></span>
Message_id from on_message
Message<em>id from on</em>message
</li>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
@ -402,6 +408,33 @@
</dd>
<dt>
<a name = "druid:new_hover"></a>
<strong>druid:new_hover(...)</strong>
</dt>
<dd>
Create hover basic component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
<span class="types"><span class="type">args</span></span>
hover init args
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Component</span></span>
hover component
</ol>
</dd>
<dt>
<a name = "druid:new_text"></a>
@ -431,18 +464,18 @@
</dd>
<dt>
<a name = "druid:new_locale"></a>
<strong>druid:new_locale(...)</strong>
<a name = "druid:new_lang_text"></a>
<strong>druid:new_lang_text(...)</strong>
</dt>
<dd>
Create locale basic component
Create lang_text basic component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
<span class="types"><span class="type">args</span></span>
locale init args
lang_text init args
</li>
</ul>
@ -450,7 +483,7 @@
<ol>
<span class="types"><span class="type">Component</span></span>
locale component
lang_text component
</ol>
@ -618,6 +651,33 @@
</dd>
<dt>
<a name = "druid:new_input"></a>
<strong>druid:new_input(...)</strong>
</dt>
<dd>
Create input basic component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
<span class="types"><span class="type">args</span></span>
input init args
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Component</span></span>
input component
</ol>
</dd>
<dt>
<a name = "druid:new_checkbox_group"></a>
@ -672,33 +732,6 @@
</dd>
<dt>
<a name = "druid:new_progress_rich"></a>
<strong>druid:new_progress_rich(...)</strong>
</dt>
<dd>
Create progress_rich basic component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
<span class="types"><span class="type">args</span></span>
progress_rich init args
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Component</span></span>
progress_rich component
</ol>
</dd>
</dl>
@ -707,7 +740,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-02-07 01:09:38 </i>
<i style="float:right;">Last updated 2020-02-24 00:03:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -1,191 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_pale.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/druid.back_handler.html">druid.back_handler</a></li>
<li><a href="../modules/druid.blocker.html">druid.blocker</a></li>
<li><a href="../modules/druid.button.html">druid.button</a></li>
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
<li><a href="../modules/druid.locale.html">druid.locale</a></li>
<li><a href="../modules/druid.progress.html">druid.progress</a></li>
<li><a href="../modules/druid.radio_group.html">druid.radio_group</a></li>
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
<li><a href="../modules/druid.text.html">druid.text</a></li>
<li><a href="../modules/druid.timer.html">druid.timer</a></li>
<li><a href="../modules/component.html">component</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/helper.html">helper</a></li>
<li><strong>helper.formats</strong></li>
<li><a href="../modules/druid.progress_rich.html">druid.progress_rich</a></li>
<li><a href="../modules/druid_instance.html">druid_instance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>helper.formats</code></h1>
<p>Druid module with utils on string formats</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#add_prefix_zeros">add_prefix_zeros(num, count)</a></td>
<td class="summary">Return number with zero number prefix</td>
</tr>
<tr>
<td class="name" nowrap><a href="#second_string_min">second_string_min(sec)</a></td>
<td class="summary">Convert seconds to string minutes:seconds</td>
</tr>
<tr>
<td class="name" nowrap><a href="#second_string_min">second_string_min(s, tab)</a></td>
<td class="summary">Interpolate string with named Parameters in Table</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "add_prefix_zeros"></a>
<strong>add_prefix_zeros(num, count)</strong>
</dt>
<dd>
Return number with zero number prefix
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">num</span>
<span class="types"><span class="type">number</span></span>
Number for conversion
</li>
<li><span class="parameter">count</span>
<span class="types"><span class="type">number</span></span>
Count of numerals
</li>
</ul>
<h3>Returns:</h3>
<ol>
string with need count of zero (1,3) -> 001
</ol>
</dd>
<dt>
<a name = "second_string_min"></a>
<strong>second_string_min(sec)</strong>
</dt>
<dd>
Convert seconds to string minutes:seconds
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">sec</span>
<span class="types"><span class="type">number</span></span>
Seconds
</li>
</ul>
<h3>Returns:</h3>
<ol>
string minutes:seconds
</ol>
</dd>
<dt>
<a name = "second_string_min"></a>
<strong>second_string_min(s, tab)</strong>
</dt>
<dd>
Interpolate string with named Parameters in Table
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">s</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Target string
</li>
<li><span class="parameter">tab</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Table with parameters
</li>
</ul>
<h3>Returns:</h3>
<ol>
string with replaced parameters
</ol>
</dd>
</dl>
</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-02-07 01:01:59 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,6 +1,7 @@
--- Component to handle back key (android, backspace)
-- @module druid.back_handler
local Event = require("druid.event")
local const = require("druid.const")
local component = require("druid.component")
@ -13,9 +14,10 @@ local M = component.create("back_handler", { const.ON_INPUT })
-- @tparam callback callback On back button
-- @tparam[opt] params Callback argument
function M.init(self, callback, params)
self.event = const.ACTION_BACK
self.callback = callback
self.params = params
self.on_back = Event(callback)
end
@ -24,11 +26,12 @@ end
-- @tparam string action_id on_input action id
-- @tparam table action on_input action
function M.on_input(self, action_id, action)
if action[const.RELEASED] then
self.callback(self:get_context(), self.params)
if action_id == const.ACTION_BACK and action[const.RELEASED] then
self.on_back:trigger(self:get_context(), self.params)
return true
end
return true
return false
end

View File

@ -1,20 +1,27 @@
--- Component to block input on specify zone (node)
-- @module druid.blocker
local Event = require("druid.event")
local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local M = component.create("blocker", { const.ON_SWIPE })
local M = component.create("blocker", { const.ON_INPUT_HIGH })
function M.init(self, node)
self.node = self:get_node(node)
self.event = const.ACTION_TOUCH
self.on_click = Event()
self.on_enable_change = Event()
end
function M.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return false
end
if not helper.is_enabled(self.node) then
return false
end
@ -27,4 +34,14 @@ function M.on_input(self, action_id, action)
end
function M.set_enabled(self, state)
end
function M.is_enabled(self, state)
end
return M

View File

@ -1,11 +1,36 @@
--- Component to handle basic GUI button
-- @module druid.button
-- TODO: Add button mode:
-- Long tap
-- Repeated tap
-- Double tap?
--- Button gui component
--@class druid
--- 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
--- 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 boolean hover_anim Is hover anim enabled
-- @tfield druid.hover hover Druid hover logic component
-- @tfield[opt] node click_zone Restriction zone
--- Component style params
-- @table Style
-- @tfield function on_click (self, node)
-- @tfield function on_click_disabled (self, node)
-- @tfield function on_hover (self, node, hover_state)
-- @tfield function on_set_enabled (self, node, enabled_state)
-- @tfield bool IS_HOVER
local Event = require("druid.event")
local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
@ -13,53 +38,94 @@ local component = require("druid.component")
local M = component.create("button", { const.ON_INPUT })
--- Component init function
-- @function button:init
-- @tparam table self Component instance
-- @tparam node node Gui node
-- @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)
assert(callback, "Button should have callback. To block input on zone use blocker component")
local function is_input_match(self, action_id)
if action_id == const.ACTION_TOUCH then
return true
end
self.style = self:get_style()
self.node = self:get_node(node)
if self.key_trigger and action_id == self.key_trigger then
return true
end
-- TODO: match event inside on_input?
self.event = const.ACTION_TOUCH
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.pos = gui.get_position(self.anim_node)
self.callback = callback
self.params = params
self.hover_anim = self.style.IS_HOVER
self.click_zone = nil
return false
end
local function set_hover(self, state)
if self._is_hovered ~= state then
if self.style.on_hover then
self.style.on_hover(self, self.anim_node, state)
end
self._is_hovered = state
local function on_button_hover(self, hover_state)
if not self.style.on_hover then
return
end
self.style.on_hover(self, self.anim_node, hover_state)
end
local function on_button_click(self)
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.click_in_row = 1
self.on_click:trigger(self:get_context(), self.params, self)
end
local function on_button_repeated_click(self)
if not self.is_repeated_started then
self.click_in_row = 0
self.is_repeated_started = true
end
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.click_in_row = self.click_in_row + 1
self.on_repeated_click:trigger(self:get_context(), self.params, self)
end
local function on_button_long_click(self)
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.click_in_row = 1
self.on_long_click:trigger(self:get_context(), self.params, self)
end
local function on_button_double_click(self)
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.click_in_row = self.click_in_row + 1
self.on_double_click:trigger(self:get_context(), self.params, self)
end
local function on_button_release(self)
if self.is_repeated_started then
return false
end
if not self.disabled then
if not self.stub and self.can_action then
if self.can_action then
self.can_action = false
if self.style.on_click then
self.style.on_click(self, self.anim_node)
local time = socket.gettime()
local is_long_click = (time - self.last_pressed_time) > self.style.LONGTAP_TIME
is_long_click = is_long_click and self.on_long_click:is_exist()
local is_double_click = (time - self.last_released_time) < self.style.DOUBLETAP_TIME
is_double_click = is_double_click and self.on_double_click:is_exist()
if is_long_click then
on_button_long_click(self)
elseif is_double_click then
on_button_double_click(self)
else
on_button_click(self)
end
self.callback(self:get_context(), self.params, self)
else
set_hover(self, false)
self.last_released_time = time
end
return true
else
@ -71,53 +137,98 @@ local function on_button_release(self)
end
--- Component init function
-- @function button:init
-- @tparam table self Component instance
-- @tparam node node Gui node
-- @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)
self.druid = self:get_druid()
self.style = self:get_style()
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.params = params
self.hover_anim = self.style.IS_HOVER
self.hover = self.druid:new_hover(node, on_button_hover)
self.click_zone = nil
self.is_repeated_started = false
self.last_pressed_time = 0
self.last_released_time = 0
self.click_in_row = 0
self.key_trigger = nil
-- Event stubs
self.on_click = Event(callback)
self.on_repeated_click = Event()
self.on_long_click = Event()
self.on_double_click = Event()
end
function M.on_input(self, action_id, action)
if not is_input_match(self, action_id) then
return false
end
if not helper.is_enabled(self.node) then
return false
end
local is_pick = gui.pick_node(self.node, action.x, action.y)
if self.click_zone then
is_pick = is_pick and gui.pick_node(self.click_zone, action.x, action.y)
local is_pick = true
local is_key_trigger = (action_id == self.key_trigger)
if not is_key_trigger then
is_pick = gui.pick_node(self.node, action.x, action.y)
if self.click_zone then
is_pick = is_pick and gui.pick_node(self.click_zone, action.x, action.y)
end
end
if not is_pick then
-- Can't interact, if touch outside of button
self.can_action = false
set_hover(self, false)
return false
end
if is_key_trigger then
self.hover:set_hover(not action.released)
end
if action.pressed then
-- Can interact if start touch on the button
self.can_action = true
self.repeated_counter = 0
self.is_repeated_started = false
self.last_pressed_time = socket.gettime()
return true
end
-- While hold button, repeat rate pick from input.repeat_interval
if action.repeated then
if not self.disabled and self.on_repeated_click:is_exist() and self.can_action then
on_button_repeated_click(self)
return true
end
end
if action.released then
set_hover(self, false)
return on_button_release(self)
else
set_hover(self, true)
end
return not self.disabled
end
function M.on_swipe(self)
-- unhover button if start swipe
function M.on_input_interrupt(self)
self.can_action = false
set_hover(self, false)
end
function M.set_enabled(self, state)
-- if self.disabled == state then
-- return
-- end
self.disabled = not state
if self.style.on_set_enabled then
self.style.on_set_enabled(self, self.node, state)
@ -145,6 +256,23 @@ end
-- @tparam node zone Gui node
function M.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)
self.hover:set_click_zone(zone)
end
--- Set key-code to trigger this button
-- @function button:set_key_trigger
-- @tparam hash key The action_id of the key
function M.set_key_trigger(self, key)
self.key_trigger = hash(key)
end
--- Get key-code to trigger this button
-- @function button:get_key_trigger
-- @treturn hash The action_id of the key
function M.get_key_trigger(self)
return self.key_trigger
end

View File

@ -1,6 +1,7 @@
--- Druid checkbox component
-- @module druid.checkbox
local Event = require("druid.event")
local component = require("druid.component")
local M = component.create("checkbox")
@ -17,7 +18,7 @@ function M.set_state(self, state, is_silence)
end
if not is_silence and self.callback then
self.callback(self:get_context(), state)
self.on_change_state:trigger(self:get_context(), state)
end
end
@ -41,6 +42,8 @@ function M.init(self, node, callback, click_node)
self.button = self.druid:new_button(self.click_node or self.node, on_click)
M.set_state(self, false, true)
self.on_change_state = Event(callback)
end

View File

@ -1,18 +1,12 @@
--- Checkboux group module
-- @module druid.checkbox_group
local Event = require("druid.event")
local component = require("druid.component")
local M = component.create("checkbox_group")
local function on_checkbox_click(self, index)
if self.callback then
self.callback(self:get_context(), index)
end
end
function M.set_state(self, indexes)
for i = 1, #indexes do
if self.checkboxes[i] then
@ -36,12 +30,13 @@ end
function M.init(self, nodes, callback, click_nodes)
self.druid = self:get_druid()
self.checkboxes = {}
self.callback = callback
self.on_checkbox_click = Event(callback)
for i = 1, #nodes do
local click_node = click_nodes and click_nodes[i] or nil
local checkbox = self.druid:new_checkbox(nodes[i], function()
on_checkbox_click(self, i)
self.on_checkbox_click:trigger(self:get_context(), i)
end, click_node)
table.insert(self.checkboxes, checkbox)

View File

@ -2,6 +2,7 @@
-- Grid can anchor your elements, get content size and other
-- @module druid.grid
local Event = require("druid.event")
local component = require("druid.component")
local M = component.create("grid")
@ -17,6 +18,11 @@ function M.init(self, parent, element, in_row)
self.node_size = gui.get_size(self:get_node(element))
self.border = vmath.vector4(0)
self.border_offset = vmath.vector3(0)
self.on_add_item = Event()
self.on_remove_item = Event()
self.on_clear = Event()
self.on_update_positions = Event()
end
@ -59,6 +65,8 @@ local function update_pos(self)
local node = self.nodes[i]
gui.set_position(node, get_pos(self, i))
end
self.on_update_positions:trigger(self:get_context())
end
@ -82,6 +90,8 @@ function M.add(self, item, index)
local pos = get_pos(self, index)
check_border(self, pos)
update_pos(self)
self.on_add_item:trigger(self:get_context(), item, index)
end

77
druid/base/hover.lua Normal file
View File

@ -0,0 +1,77 @@
--- Component to handle hover node interaction
-- @module druid.input
local Event = require("druid.event")
local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local M = component.create("hover", { const.ON_INPUT })
--- Component init function
-- @function hover:init
-- @tparam table self Component instance
-- @tparam node node Gui node
-- @tparam function on_hover_callback Hover callback
function M.init(self, node, on_hover_callback)
self.style = self:get_style()
self.node = self:get_node(node)
self._is_hovered = false
self.on_hover = Event(on_hover_callback)
end
function M.set_hover(self, state)
if self._is_hovered ~= state then
self._is_hovered = state
self.on_hover:trigger(self:get_context(), state)
end
end
function M.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return
end
if not helper.is_enabled(self.node) then
return false
end
local is_pick = gui.pick_node(self.node, action.x, action.y)
if self.click_zone then
is_pick = is_pick and gui.pick_node(self.click_zone, action.x, action.y)
end
if not is_pick then
M.set_hover(self, false)
return false
end
if action.released then
M.set_hover(self, false)
else
M.set_hover(self, true)
end
end
function M.on_input_interrupt(self)
M.set_hover(self, false)
end
--- Strict button click area. Useful for
-- no click events outside stencil node
-- @function button:set_click_zone
-- @tparam table self Component instance
-- @tparam node zone Gui node
function M.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)
end
return M

15
druid/base/input.lua Normal file
View File

@ -0,0 +1,15 @@
--- Druid input text component
-- @local unimplemented
-- @module druid.input
local component = require("druid.component")
local M = component.create("input")
function M.init(self, node, callback, click_node)
self.style = self:get_style()
end
return M

View File

@ -1,12 +1,12 @@
--- Component to handle all GUI texts
-- Good working with localization system
-- @module druid.locale
-- @module druid.lang_text
local const = require("druid.const")
local settings = require("druid.system.settings")
local component = require("druid.component")
local M = component.create("locale", { const.ON_CHANGE_LANGUAGE })
local M = component.create("lang_text", { const.ON_CHANGE_LANGUAGE })
function M.init(self, node, lang_id, no_adjust)

View File

@ -1,11 +1,12 @@
--- Component to handle scroll content
-- @module druid.scroll
local Event = require("druid.event")
local helper = require("druid.helper")
local const = require("druid.const")
local component = require("druid.component")
local M = component.create("scroll", { const.ON_UPDATE, const.ON_SWIPE })
local M = component.create("scroll", { const.ON_UPDATE, const.ON_INPUT_HIGH })
-- Global on all scrolls
@ -41,14 +42,21 @@ function M.init(self, scroll_parent, input_zone, border)
}
self:set_border(border)
self.on_scroll = Event()
self.on_scroll_to = Event()
self.on_point_scroll = Event()
end
local function set_pos(self, pos)
self.pos.x = pos.x
self.pos.y = pos.y
if self.pos.x ~= pos.x or self.pos.y ~= pos.y then
self.pos.x = pos.x
self.pos.y = pos.y
gui.set_position(self.node, self.pos)
gui.set_position(self.node, self.pos)
self.on_scroll:trigger(self:get_context(), self.pos)
end
end
@ -337,6 +345,8 @@ function M.scroll_to(self, point, is_instant)
set_pos(self, target)
end)
end
self.on_scroll_to:trigger(self:get_context(), point, is_instant)
end
@ -351,8 +361,8 @@ function M.scroll_to_index(self, index, skip_cb)
if self.selected ~= index then
self.selected = index
if not skip_cb and self.on_point_callback then
self.on_point_callback(self:get_context(), index, self.points[index])
if not skip_cb then
self.on_point_scroll:trigger(self:get_context(), index, self.points[index])
end
end
@ -395,7 +405,7 @@ end
-- @tparam table self Component instance
-- @tparam function callback Callback on scroll to point of interest
function M.on_point_move(self, callback)
self.on_point_callback = callback
self.on_point_scroll:subscribe(callback)
end

View File

@ -1,17 +1,16 @@
--- Druid slider component
-- @module druid.slider
local Event = require("druid.event")
local helper = require("druid.helper")
local const = require("druid.const")
local component = require("druid.component")
local M = component.create("slider", { const.ON_SWIPE })
local M = component.create("slider", { const.ON_INPUT_HIGH })
local function on_change_value(self)
if self.callback then
self.callback(self:get_context(), self.value)
end
self.on_change_value:trigger(self:get_context(), self.value)
end
@ -26,7 +25,8 @@ function M.init(self, node, end_pos, callback)
self.dist = self.end_pos - self.start_pos
self.is_drag = false
self.value = 0
self.callback = callback
self.on_change_value = Event(callback)
assert(self.dist.x == 0 or self.dist.y == 0, "Slider for now can be only vertical or horizontal")
end

View File

@ -2,6 +2,7 @@
-- Good working with localization system
-- @module druid.text
local Event = require("druid.event")
local const = require("druid.const")
local component = require("druid.component")
@ -25,6 +26,10 @@ function M.init(self, node, value, no_adjust)
self.is_no_adjust = no_adjust
self.last_color = gui.get_color(self.node)
self.on_set_text = Event()
self.on_update_text_scale = Event()
self.on_set_pivot = Event()
self:set_to(value or 0)
return self
end
@ -47,6 +52,8 @@ local function update_text_area_size(self)
local new_scale = vmath.vector3(scale_modifier, scale_modifier, cur_scale.z)
gui.set_scale(self.node, new_scale)
self.scale = new_scale
self.on_update_text_scale:trigger(self:get_context(), new_scale)
end
@ -58,6 +65,8 @@ function M.set_to(self, set_to)
self.last_value = set_to
gui.set_text(self.node, set_to)
self.on_set_text:trigger(self:get_context(), set_to)
if not self.is_no_adjust then
update_text_area_size(self)
end
@ -114,6 +123,8 @@ function M.set_pivot(self, pivot)
self.pos = self.pos + pos_offset
gui.set_position(self.node, self.pos)
self.on_set_pivot:trigger(self:get_context(), pivot)
end

View File

@ -1,6 +1,7 @@
--- Component to handle GUI timers
-- @module druid.timer
local Event = require("druid.event")
local const = require("druid.const")
local formats = require("druid.helper.formats")
local helper = require("druid.helper")
@ -13,16 +14,19 @@ function M.init(self, node, seconds_from, seconds_to, callback)
self.node = self:get_node(node)
seconds_from = math.max(seconds_from, 0)
seconds_to = math.max(seconds_to or 0, 0)
callback = callback or const.EMPTY_FUNCTION
self.on_tick = Event()
self.on_set_enabled = Event()
self.on_timer_end = Event(callback)
self:set_to(seconds_from)
self:set_interval(seconds_from, seconds_to)
self.callback = callback
if seconds_to - seconds_from == 0 then
self:set_state(false)
self.callback(self:get_context(), self)
self.on_timer_end:trigger(self:get_context(), self)
end
return self
end
@ -43,6 +47,8 @@ end
-- @tparam boolean is_on Timer enable state
function M.set_state(self, is_on)
self.is_on = is_on
self.on_set_enabled:trigger(self:get_context(), is_on)
end
@ -73,9 +79,12 @@ function M.update(self, dt)
self.temp = self.temp - dist
self.value = helper.step(self.value, self.target, 1)
M.set_to(self, self.value)
self.on_tick:trigger(self:get_context(), self.value)
if self.value == self.target then
self:set_state(false)
self.callback(self:get_context(), self)
self.on_timer_end:trigger(self:get_context(), self)
end
end
end

View File

@ -9,26 +9,6 @@ local class = require("druid.system.middleclass")
local Component = class("druid.component")
--- Setup component context and his style table
-- @function component:setup_component
-- @tparam context table Druid context. Usually it is self of script
-- @tparam style table Druid style module
-- @treturn Component Component itself
function Component.setup_component(self, context, style)
self._meta = {
template = nil,
context = nil,
nodes = nil,
style = nil,
}
self:set_context(context)
self:set_style(style)
return self
end
--- Get current component style table
-- @function component:get_style
-- @treturn table Component style table
@ -136,6 +116,26 @@ function Component.get_druid(self)
end
--- Setup component context and his style table
-- @function component:setup_component
-- @tparam context table Druid context. Usually it is self of script
-- @tparam style table Druid style module
-- @treturn Component Component itself
function Component.setup_component(self, context, style)
self._meta = {
template = nil,
context = nil,
nodes = nil,
style = nil,
}
self:set_context(context)
self:set_style(style)
return self
end
--- Basic constructor of component. It will call automaticaly
-- by `Component.static.create`
-- @function component:initialize

View File

@ -19,14 +19,13 @@ M.ZERO = "0"
M.ALL = "all"
--- Interests
--- Component Interests
M.ON_MESSAGE = hash("on_message")
M.ON_UPDATE = hash("on_update")
-- Input
M.ON_SWIPE = hash("on_swipe")
M.ON_INPUT_HIGH = hash("on_input_high")
M.ON_INPUT = hash("on_input")
M.ON_CHANGE_LANGUAGE = hash("on_change_language")
M.ON_LAYOUT_CHANGED = hash("on_layout_changed")
M.PIVOTS = {
@ -42,43 +41,21 @@ M.PIVOTS = {
}
M.SIDE = {
X = "x",
Y = "y"
}
M.UI_INPUT = {
[M.ON_SWIPE] = true,
[M.ON_INPUT] = true
}
-- UI messages
M.ON_CHANGE_LANGUAGE = hash("on_change_language")
M.ON_LAYOUT_CHANGED = hash("on_layout_changed")
M.SPECIFIC_UI_MESSAGES = {
[M.ON_CHANGE_LANGUAGE] = "on_change_language",
[M.ON_LAYOUT_CHANGED] = "on_layout_changed"
}
-- Basic druid components
M.COMPONENTS = {
BUTTON = "button",
BLOCKER = "blocker",
BACK_HANDLER = "back_handler",
TEXT = "text",
LOCALE = "locale",
TIMER = "timer",
PROGRESS = "progress",
GRID = "grid",
SCROLL = "scroll",
SLIDER = "slider",
CHECKBOX = "checkbox",
CHECKBOX_GROUP = "checkbox_group",
RADIO_GROUP = "radio_group",
M.UI_INPUT = {
[M.ON_INPUT_HIGH] = true,
[M.ON_INPUT] = true
}
M.SIDE = {
X = "x",
Y = "y"
}

View File

@ -7,6 +7,11 @@
-- to how to do your custom complex components to
-- separate UI game logic to small files
--
-- require("druid.druid")
-- function init(self)
-- self.druid = druid.new(self)
-- end
--
-- @module druid
local const = require("druid.const")

71
druid/event.lua Normal file
View File

@ -0,0 +1,71 @@
--- Lua event small library
-- @module druid_event
local class = require("druid.system.middleclass")
-- @class DruidEvent
local M = class("druid.event")
--- Event constructur
-- @function Event
-- @tparam function initial_callback Subscribe the callback on new event, if callback exist
function M.initialize(self, initial_callback)
self._callbacks = {}
if initial_callback then
self:subscribe(initial_callback)
end
end
--- Subscribe callback on event
-- @function event:subscribe
-- @tparam function callback Callback itself
function M.subscribe(self, callback)
assert(type(self) == "table", "You should subscribe to event with : syntax")
assert(type(callback) == "function", "Callback should be function")
table.insert(self._callbacks, callback)
end
--- Unsubscribe callback on event
-- @function event:unsubscribe
-- @tparam function callback Callback itself
function M.unsubscribe(self, callback)
for i = 1, #self._callbacks do
if self._callbacks[i] == callback then
table.remove(self._callbacks, i)
return
end
end
end
--- Return true, if event have at lease one handler
-- @function event:is_exist
-- @treturn boolean True if event have handlers
function M.is_exist(self)
return #self._callbacks > 0
end
--- Clear the all event handlers
-- @function event:clear
function M.clear(self)
self._callbacks = {}
end
--- Trigger the event and call all subscribed callbacks
-- @function event:trigger
-- @param ... All event params
function M.trigger(self, ...)
for i = 1, #self._callbacks do
self._callbacks[i](...)
end
end
return M

View File

@ -1,72 +0,0 @@
--- Component for rich progress component
-- @module druid.progress_rich
local component = require("druid.component")
local M = component.create("progress_rich")
function M.init(self, name, red, green, key)
self.druid = self:get_druid()
self.style = self:get_style()
self.red = self.druid:new_progress(red, key)
self.green = self.druid:new_progress(green, key)
self.fill = self.druid:new_progress(name, key)
end
--- Instant fill progress bar to value
-- @function progress_rich:set_to
-- @tparam table self Component instance
-- @tparam number value Progress bar value, from 0 to 1
function M.set_to(self, value)
self.red:set_to(value)
self.green:set_to(value)
self.fill:set_to(value)
end
--- Empty a progress bar
-- @function progress_rich:empty
-- @tparam table self Component instance
function M.empty(self)
self.red:empty()
self.green:empty()
self.fill:empty()
end
--- Start animation of a progress bar
-- @function progress_rich:to
-- @tparam table self Component instance
-- @tparam number to value between 0..1
-- @tparam[opt] function callback Callback on animation ends
function M.to(self, to, callback)
if self.timer then
timer.cancel(self.timer)
self.timer = nil
end
if self.fill.last_value < to then
self.red:to(self.fill.last_value)
self.green:to(to, function()
self.timer = timer.delay(self.style.DELAY, false, function()
self.red:to(to)
self.fill:to(to, callback)
end)
end)
end
if self.fill.last_value > to then
self.green:to(self.red.last_value)
self.fill:to(to, function()
self.timer = timer.delay(self.style.DELAY, false, function()
self.green:to(to)
self.red:to(to, callback)
end)
end)
end
end
return M

View File

@ -1,5 +1,5 @@
local settings = require("druid.system.settings")
local anims = require("druid.styles.bounce.anims")
local anims = require("druid.styles.default.anims")
local M = {}
@ -12,6 +12,8 @@ M["button"] = {
BTN_SOUND_DISABLED = "click",
DISABLED_COLOR = vmath.vector4(0, 0, 0, 1),
ENABLED_COLOR = vmath.vector4(1),
LONGTAP_TIME = 0.4,
DOUBLETAP_TIME = 0.4,
IS_HOVER = true,
on_hover = function(self, node, state)

View File

@ -6,6 +6,8 @@ M["button"] = {
BTN_SOUND_DISABLED = "click",
DISABLED_COLOR = vmath.vector4(0, 0, 0, 1),
ENABLED_COLOR = vmath.vector4(1),
LONGTAP_TIME = 0.4,
DOUBLETAP_TIME = 0.4,
IS_HOVER = false,
}

View File

@ -4,8 +4,9 @@
-- @see druid.button
-- @see druid.blocker
-- @see druid.back_handler
-- @see druid.input
-- @see druid.text
-- @see druid.locale
-- @see druid.lang_text
-- @see druid.timer
-- @see druid.progress
-- @see druid.grid
@ -23,8 +24,9 @@ local class = require("druid.system.middleclass")
local button = require("druid.base.button")
local blocker = require("druid.base.blocker")
local back_handler = require("druid.base.back_handler")
local hover = require("druid.base.hover")
local text = require("druid.base.text")
local locale = require("druid.base.locale")
local lang_text = require("druid.base.lang_text")
local timer = require("druid.base.timer")
local progress = require("druid.base.progress")
local grid = require("druid.base.grid")
@ -33,9 +35,8 @@ local slider = require("druid.base.slider")
local checkbox = require("druid.base.checkbox")
local checkbox_group = require("druid.base.checkbox_group")
local radio_group = require("druid.base.radio_group")
-- local input - require("druid.base.input")
local input = require("druid.base.input")
-- local infinity_scroll = require("druid.base.infinity_scroll")
local progress_rich = require("druid.rich.progress_rich")
-- @classmod Druid
local Druid = class("druid.druid_instance")
@ -81,29 +82,24 @@ local function create(self, instance_class)
end
local function notify_input_on_swipe(self)
if self.components[const.ON_INPUT] then
local len = #self.components[const.ON_INPUT]
for i = len, 1, -1 do
local comp = self.components[const.ON_INPUT][i]
if comp.on_swipe then
comp:on_swipe()
local function process_input(action_id, action, components, is_input_consumed)
if not components then
return is_input_consumed
end
for i = #components, 1, -1 do
local component = components[i]
if not is_input_consumed then
is_input_consumed = component:on_input(action_id, action)
else
if component.on_input_interrupt then
component:on_input_interrupt()
end
end
end
end
local function match_event(action_id, events)
if type(events) == const.TABLE then
for i = 1, #events do
if action_id == events[i] then
return true
end
end
else
return action_id == events
end
return is_input_consumed
end
@ -181,33 +177,15 @@ end
-- @tparam hash action_id Action_id from on_input
-- @tparam table action Action from on_input
function Druid.on_input(self, action_id, action)
-- TODO: расписать отличия ON_SWIPE и ON_INPUT
-- Почему-то некоторые используют ON_SWIPE, а логичнее ON_INPUT? (blocker, slider)
local components = self.components[const.ON_SWIPE]
if components then
local result
for i = #components, 1, -1 do
local v = components[i]
result = result or v:on_input(action_id, action)
end
if result then
notify_input_on_swipe(self)
return true
end
end
local is_input_consumed = false
components = self.components[const.ON_INPUT]
if components then
for i = #components, 1, -1 do
local v = components[i]
if match_event(action_id, v.event) and v:on_input(action_id, action) then
return true
end
end
return false
end
is_input_consumed = process_input(action_id, action,
self.components[const.ON_INPUT_HIGH], is_input_consumed)
return false
is_input_consumed = process_input(action_id, action,
self.components[const.ON_INPUT], is_input_consumed)
return is_input_consumed
end
@ -262,6 +240,15 @@ function Druid.new_back_handler(self, ...)
end
--- Create hover basic component
-- @function druid:new_hover
-- @tparam args ... hover init args
-- @treturn Component hover component
function Druid.new_hover(self, ...)
return Druid.create(self, hover, ...)
end
--- Create text basic component
-- @function druid:new_text
-- @tparam args ... text init args
@ -271,12 +258,12 @@ function Druid.new_text(self, ...)
end
--- Create locale basic component
-- @function druid:new_locale
-- @tparam args ... locale init args
-- @treturn Component locale component
function Druid.new_locale(self, ...)
return Druid.create(self, locale, ...)
--- Create lang_text basic component
-- @function druid:new_lang_text
-- @tparam args ... lang_text init args
-- @treturn Component lang_text component
function Druid.new_lang_text(self, ...)
return Druid.create(self, lang_text, ...)
end
@ -334,6 +321,15 @@ function Druid.new_checkbox(self, ...)
end
--- Create input basic component
-- @function druid:new_input
-- @tparam args ... input init args
-- @treturn Component input component
function Druid.new_input(self, ...)
return Druid.create(self, input, ...)
end
--- Create checkbox_group basic component
-- @function druid:new_checkbox_group
-- @tparam args ... checkbox_group init args
@ -352,13 +348,4 @@ function Druid.new_radio_group(self, ...)
end
--- Create progress_rich basic component
-- @function druid:new_progress_rich
-- @tparam args ... progress_rich init args
-- @treturn Component progress_rich component
function Druid.new_progress_rich(self, ...)
return Druid.create(self, progress_rich, ...)
end
return Druid

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,18 @@
local druid = require("druid.druid")
local empty_style = require("druid.styles.empty.style")
local bounce_style = require("druid.styles.bounce.style")
local default_style = require("druid.styles.default.style")
local main_page = require("example.kenney.page.main")
local text_page = require("example.kenney.page.texts")
local button_page = require("example.kenney.page.button")
local scroll_page = require("example.kenney.page.scroll")
local pages = {
"main_page",
"texts_page"
"texts_page",
"button_page",
"scroll_page",
}
local function on_control_button(self, delta)
@ -29,18 +33,23 @@ end
local function init_top_panel(self)
self.druid:new_button("button_left/button", on_control_button, -1)
self.druid:new_button("button_right/button", on_control_button, 1)
self.header = self.druid:new_locale("text_header", "main_page")
self.header = self.druid:new_lang_text("text_header", "main_page")
end
function init(self)
druid.set_default_style(bounce_style)
druid.set_default_style(default_style)
self.druid = druid.new(self)
init_top_panel(self)
self.page = 1
self.page = 3
main_page.setup_page(self)
text_page.setup_page(self)
button_page.setup_page(self)
scroll_page.setup_page(self)
-- Refresh state
on_control_button(self, 0)
end

View File

@ -5,6 +5,8 @@ local M = {}
local en = {
main_page = "Main page",
texts_page = "Text page",
button_page = "Button page",
scroll_page = "Scroll page",
ui_section_button = "Button",
ui_section_text = "Text",
ui_section_timer = "Timer",
@ -19,6 +21,8 @@ local en = {
local ru = {
main_page = "Основное",
texts_page = "Текст",
button_page = "Кнопки",
scroll_page = "Скролл",
ui_section_button = "Кнопка",
ui_section_text = "Текст",
ui_section_timer = "Таймер",

View File

@ -0,0 +1,51 @@
local sprite_change_style = {}
local M = {}
local function usual_callback()
print("Usual callback")
end
local function long_tap_callback()
print("Long tap callback")
end
local function repeated_callback(self, params, button)
print("Repeated callback", button.click_in_row)
end
local function double_tap_callback(self, params, button)
print("Double tap callback", button.click_in_row)
end
local function setup_buttons(self)
self.druid:new_button("button_usual/button", usual_callback)
local custom_style = self.druid:new_button("button_custom_style/button", usual_callback)
custom_style:set_style(sprite_change_style)
-- HOVER_IMAGE and DEFAULT_IMAGE - from our custom style params
custom_style.HOVER_IMAGE = "button_yellow"
custom_style.DEFAULT_IMAGE = "button_blue"
self.druid:new_button("button_long_tap/button", usual_callback)
.on_long_click:subscribe(long_tap_callback)
self.druid:new_button("button_repeated_tap/button", usual_callback)
.on_repeated_click:subscribe(repeated_callback)
self.druid:new_button("button_double_tap/button", usual_callback)
.on_double_click:subscribe(double_tap_callback)
local button_space = self.druid:new_button("button_key_trigger/button", usual_callback)
button_space:set_key_trigger("key_space")
button_space.on_long_click:subscribe(long_tap_callback)
button_space.on_double_click:subscribe(double_tap_callback)
end
function M.setup_page(self)
setup_buttons(self)
end
return M

View File

@ -26,16 +26,16 @@ end
local function setup_texts(self)
self.druid:new_locale("text_button", "ui_section_button")
self.druid:new_locale("text_text", "ui_section_text")
self.druid:new_locale("text_timer", "ui_section_timer")
self.druid:new_locale("text_progress", "ui_section_progress")
self.druid:new_locale("text_slider", "ui_section_slider")
self.druid:new_locale("text_radio", "ui_section_radio")
self.druid:new_locale("text_checkbox", "ui_section_checkbox")
self.druid:new_lang_text("text_button", "ui_section_button")
self.druid:new_lang_text("text_text", "ui_section_text")
self.druid:new_lang_text("text_timer", "ui_section_timer")
self.druid:new_lang_text("text_progress", "ui_section_progress")
self.druid:new_lang_text("text_slider", "ui_section_slider")
self.druid:new_lang_text("text_radio", "ui_section_radio")
self.druid:new_lang_text("text_checkbox", "ui_section_checkbox")
self.druid:new_locale("text_translated", "ui_text_example")
self.druid:new_locale("text_button_lang", "ui_text_change_lang")
self.druid:new_lang_text("text_translated", "ui_text_example")
self.druid:new_lang_text("text_button_lang", "ui_text_change_lang")
self.druid:new_text("text_simple", "Simple")
end

View File

@ -0,0 +1,8 @@
local M = {}
function M.setup_page(self)
end
return M

View File

@ -19,7 +19,7 @@ local function setup_texts(self)
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_no_adjust", "Without adjust size", true)
self.druid:new_locale("text_locale", "ui_text_example")
self.druid:new_lang_text("text_locale", "ui_text_example")
local big_text = "Check max size"
local width = self.druid:new_text("text_max_width", big_text)

View File

@ -17,3 +17,6 @@ include_dirs = druid
[graphics]
texture_profiles = /example/res/custom.texture_profiles
[input]
gamepads = /builtins/input/default.gamepadsc

View File

@ -6,6 +6,10 @@ key_trigger {
input: KEY_BACK
action: "back"
}
key_trigger {
input: KEY_SPACE
action: "key_space"
}
mouse_trigger {
input: MOUSE_BUTTON_1
action: "touch"

6
liveupdate.settings Normal file
View File

@ -0,0 +1,6 @@
[liveupdate]
mode = Zip
zip-filepath = /Users/insality/code/defold/defold-eva/dist
supported-versions = "1.0.0"
publickey = /Users/insality/code/provisions/liveupdate/public.der
privatekey = /Users/insality/code/provisions/liveupdate/private.der