mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Merge branch 'develop'
This commit is contained in:
commit
9ab9e7b21a
112
README.md
112
README.md
@ -1,11 +1,8 @@
|
||||
|
||||
|
||||
|
||||
[](https://insality.github.io/druid/)
|
||||
|
||||
[](https://github.com/Insality/druid/releases)
|
||||
|
||||
**Druid** - powerful Defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games.
|
||||
**Druid** - powerful Defold component UI library. Use basic and extended **Druid** components or make your own game-specific components to make amazing GUI in your games.
|
||||
|
||||
|
||||
## Setup
|
||||
@ -35,7 +32,7 @@ For **Druid** to work requires next input bindings:
|
||||
|
||||
### Input capturing [optional]
|
||||
|
||||
By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus)"`
|
||||
By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus")`
|
||||
|
||||
If you not need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_:
|
||||
```
|
||||
@ -64,10 +61,6 @@ druid.set_default_style(your_style)
|
||||
-- to retranslate all lang_text components:
|
||||
druid.on_language_change()
|
||||
|
||||
-- Call this function on layout changing in the game,
|
||||
-- to reapply layouts
|
||||
druid.on_layout_change()
|
||||
|
||||
-- Call this function inside window.set_listener
|
||||
-- to catch game focus lost/gained callbacks:
|
||||
druid.on_window_callback(event)
|
||||
@ -76,43 +69,49 @@ druid.on_window_callback(event)
|
||||
|
||||
## Components
|
||||
|
||||
**Druid** provides next basic components:
|
||||
**Druid** provides next *basic* components:
|
||||
|
||||
- **[Button](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#button)** - Basic Druid input component
|
||||
- **[Button](master/docs_md/01-components.md#button)** - Basic Druid button input component. Handles all types of interaction (tap, long-tap, hold-tap, double-tap, simple key triggers, etc)
|
||||
|
||||
- **[Text](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#text)** - Basic Druid text component
|
||||
- **[Text](master/docs_md/01-components.md#text)** - Basic Druid text component. Wrap on gui text node, handle text size adjusting.
|
||||
|
||||
- **[Lang text](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#lang-text)** - Wrap on Text component to handle localization
|
||||
- **[Scroll](master/docs_md/01-components.md#scroll)** - Basic Druid scroll component
|
||||
|
||||
- **[Scroll](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#scroll)** - Basic Druid scroll component
|
||||
- **[Blocker](master/docs_md/01-components.md#blocker)** - Block input in node zone component
|
||||
|
||||
- **[Progress](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#progress)** - Basic Druid progress bar component
|
||||
- **[Back Handler](master/docs_md/01-components.md#back-handler)** - Handle back button (Android back button, backspace key)
|
||||
|
||||
- **[Slider](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#slider)** - Basic Druid slider component
|
||||
- **[Static Grid](master/docs_md/01-components.md#static-grid)** - Component for manage node positions with equal sizes
|
||||
|
||||
- **[Input](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#input)** - Basic Druid text input component (unimplemented)
|
||||
- **[Hover](master/docs_md/01-components.md#hover)** - System Druid component, handle hover node state
|
||||
|
||||
- **[Checkbox](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox)** - Basic Druid checkbox component
|
||||
- **[Swipe](master/docs_md/01-components.md#swipe)** - System Druid component, handle swipe gestures on node
|
||||
|
||||
- **[Checkbox group](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox-group)** - Several checkboxes in one group
|
||||
- **[Drag](master/docs_md/01-components.md#drag)** - System Druid component, handle drag input on node
|
||||
|
||||
- **[Radio group](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#radio-group)** - Several checkboxes in one group with single choice
|
||||
**Druid** also provides next *extended* components:
|
||||
|
||||
- **[Blocker](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#blocker)** - Block input in node zone component
|
||||
***Note**: In future, to use extended components, you should register them first. It's required for make **Druid** modular - to exclude unused components from build*
|
||||
|
||||
- **[Back Handler](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#back-handler)** - Handle back button (Android back, backspace)
|
||||
- **[Checkbox](master/docs_md/01-components.md#checkbox)** - Checkbox component
|
||||
|
||||
- **[Timer](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#timer)** - Handle timer work on gui text node
|
||||
- **[Checkbox group](master/docs_md/01-components.md#checkbox-group)** - Several checkboxes in one group
|
||||
|
||||
- **[Grid](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#grid)** - Component for manage node positions
|
||||
- **[Dynamic Grid](master/docs_md/01-components.md#dynamic-grid)** - Component for manage node positions with different sizes. Only in one row or column
|
||||
|
||||
- **[Hover](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#hover)** - System Druid component, handle hover node state
|
||||
- **[Input](master/docs_md/01-components.md#input)** - User text input component
|
||||
|
||||
- **[Swipe](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#swipe)** - System Druid component, handle swipe gestures on node
|
||||
- **[Lang text](master/docs_md/01-components.md#lang-text)** - Wrap on Text component to handle localization
|
||||
|
||||
- **[Drag](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#drag)** - System Druid component, handle drag input on node
|
||||
- **[Progress](master/docs_md/01-components.md#progress)** - Progress bar component
|
||||
|
||||
Full info see on _[components.md](https://github.com/Insality/druid/blob/master/docs_md/01-components.md)_
|
||||
- **[Radio group](master/docs_md/01-components.md#radio-group)** - Several checkboxes in one group with single choice
|
||||
|
||||
- **[Slider](master/docs_md/01-components.md#slider)** - Slider component
|
||||
|
||||
- **[Timer](master/docs_md/01-components.md#timer)** - Handle timer work on gui text node
|
||||
|
||||
Full info see on _[components.md](master/docs_md/01-components.md)_
|
||||
|
||||
|
||||
## Basic usage
|
||||
@ -127,23 +126,25 @@ All **Druid** and component methods calling with `:` like `self.druid:new_button
|
||||
local druid = require("druid.druid")
|
||||
|
||||
local function button_callback(self)
|
||||
print("Button was clicked!")
|
||||
print("Button was clicked!")
|
||||
end
|
||||
|
||||
function init(self)
|
||||
self.druid = druid.new(self)
|
||||
self.druid:new_button("button_node_name", button_callback)
|
||||
self.druid = druid.new(self)
|
||||
self.druid:new_button("button_node_name", button_callback)
|
||||
end
|
||||
|
||||
function final(self)
|
||||
self.druid:final()
|
||||
self.druid:final()
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
end
|
||||
```
|
||||
|
||||
Learn **Druid** instance [functions here](https://insality.github.io/druid/modules/druid_instance.html))
|
||||
|
||||
## Druid Events
|
||||
|
||||
Any **Druid** components as callbacks uses [Druid Events](https://insality.github.io/druid/modules/druid_event.html). In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe on this events by next API:
|
||||
@ -154,49 +155,51 @@ Any **Druid** components as callbacks uses [Druid Events](https://insality.githu
|
||||
|
||||
- **event:clear**()
|
||||
|
||||
Any events can handle several callbacks, if needed.
|
||||
You can subscribe several callbacks on single event.
|
||||
|
||||
## Druid Lifecycle
|
||||
|
||||
## Druid lifecycle
|
||||
|
||||
Here is full druid lifecycle setup in your ***.gui_script** file:
|
||||
Here is full Druid lifecycle setup in your ***.gui_script** file:
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
|
||||
function init(self)
|
||||
self.druid = druid.new(self)
|
||||
self.druid = druid.new(self)
|
||||
end
|
||||
|
||||
function final(self)
|
||||
self.druid:final()
|
||||
self.druid:final()
|
||||
end
|
||||
|
||||
function update(self, dt)
|
||||
self.druid:update(dt)
|
||||
self.druid:update(dt)
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
return self.druid:on_input(action_id, action)
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
end
|
||||
```
|
||||
|
||||
- *final* required function for correct druid lifecycle
|
||||
- *on_input* used for almost all basic druid components
|
||||
- *final* **required** function for correct Druid lifecycle
|
||||
- *on_input* used for almost all Druid components
|
||||
- *update* used for progress bar, scroll and timer base components
|
||||
- *on_message* used for specific druid events, like language change or layout change
|
||||
- *on_message* used for specific Druid events, like language change or layout change
|
||||
|
||||
Recommended is fully integrate all druid lifecycles functions
|
||||
Recommended is fully integrate all **Druid** lifecycles functions
|
||||
|
||||
|
||||
## Features
|
||||
## Details
|
||||
|
||||
- Druid input goes as stack. Last created button will checked first. So create your GUI from back
|
||||
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
|
||||
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several Druid, other input system, etc)
|
||||
- Druid by default do _acquire_input_focus_. So you don't need do it manually. Buy only if you have components, which requires _on_input_
|
||||
- If you want to delete node with declared Druid component, don't forget to remove them via `druid:remove(component)`
|
||||
|
||||
See full [See FAQ here](master/docs_md/FAQ.md)
|
||||
|
||||
|
||||
## Examples
|
||||
@ -211,10 +214,11 @@ Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example
|
||||
## Documentation
|
||||
|
||||
To learn **Druid** better, read next documentation:
|
||||
- [Druid components](https://github.com/Insality/druid/blob/master/docs_md/01-components.md)
|
||||
- [Create custom components](https://github.com/Insality/druid/blob/master/docs_md/02-creating_custom_components.md)
|
||||
- [Druid styles](https://github.com/Insality/druid/blob/master/docs_md/03-styles.md)
|
||||
- [Druid asset store](https://github.com/Insality/druid/blob/master/docs_md/04-druid_assets.md)
|
||||
- [Druid components](master/docs_md/01-components.md)
|
||||
- [Create custom components](master/docs_md/02-creating_custom_components.md)
|
||||
- [See FAQ article](master/docs_md/FAQ.md)
|
||||
- [Druid styles](master/docs_md/03-styles.md)
|
||||
- [Druid asset store](master/docs_md/04-druid_assets.md)
|
||||
|
||||
Full **Druid** documentation you can find here:
|
||||
https://insality.github.io/druid/
|
||||
@ -222,13 +226,13 @@ https://insality.github.io/druid/
|
||||
|
||||
## Games powered by Druid
|
||||
|
||||
_Will fill later_
|
||||
_You published your game and you using Druid? Note me!_
|
||||
|
||||
|
||||
## License
|
||||
|
||||
- Original created by [AGulev](https://github.com/AGulev)
|
||||
- Developed and supporting by [Insality](https://github.com/Insality)
|
||||
- Original idea by [AGulev](https://github.com/AGulev)
|
||||
- Assets from [Kenney](http://www.kenney.nl/)
|
||||
|
||||
**MIT** License
|
||||
|
@ -1 +1 @@
|
||||
{"content":[{"name":"game.projectc","size":2838,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":5008,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":279217,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":10936,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
|
||||
{"content":[{"name":"game.projectc","size":3140,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":5168,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":287011,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":11332,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
title = druid
|
||||
version = 0.4.0
|
||||
version = 0.5.0
|
||||
write_log = 0
|
||||
compress_archive = 1
|
||||
|
||||
@ -30,6 +30,7 @@ world_count = 4
|
||||
gravity_x = 0
|
||||
gravity_z = 0
|
||||
scale = 1
|
||||
allow_dynamic_transforms = 0
|
||||
debug_scale = 30
|
||||
max_collisions = 64
|
||||
max_contacts = 128
|
||||
@ -49,6 +50,10 @@ max_draw_calls = 1024
|
||||
max_characters = 8192
|
||||
max_debug_vertices = 10000
|
||||
texture_profiles = /example/custom.texture_profiles
|
||||
verify_graphics_calls = 1
|
||||
|
||||
[shader]
|
||||
output_spirv = 0
|
||||
|
||||
[sound]
|
||||
gain = 1
|
||||
@ -56,6 +61,7 @@ max_sound_data = 128
|
||||
max_sound_buffers = 32
|
||||
max_sound_sources = 16
|
||||
max_sound_instances = 256
|
||||
max_component_count = 32
|
||||
|
||||
[resource]
|
||||
http_cache = 0
|
||||
@ -85,6 +91,7 @@ max_particle_count = 1024
|
||||
|
||||
[collection]
|
||||
max_instances = 1024
|
||||
max_input_stack_entries = 16
|
||||
|
||||
[collection_proxy]
|
||||
max_count = 8
|
||||
@ -96,24 +103,30 @@ max_count = 128
|
||||
max_count = 128
|
||||
|
||||
[ios]
|
||||
launch_screen = /builtins/manifests/ios/LaunchScreen.storyboardc
|
||||
pre_renderered_icons = 0
|
||||
bundle_identifier = example.unnamed
|
||||
infoplist = /builtins/manifests/ios/Info.plist
|
||||
default_language = en
|
||||
localizations = en
|
||||
|
||||
[android]
|
||||
version_code = 1
|
||||
minimum_sdk_version = 16
|
||||
target_sdk_version = 28
|
||||
target_sdk_version = 29
|
||||
package = com.insality.druid
|
||||
manifest = /builtins/manifests/android/AndroidManifest.xml
|
||||
iap_provider = GooglePlay
|
||||
input_method = HiddenInputField
|
||||
immersive_mode = 0
|
||||
display_cutout = 1
|
||||
debuggable = 0
|
||||
|
||||
[osx]
|
||||
infoplist = /builtins/manifests/osx/Info.plist
|
||||
bundle_identifier = example.unnamed
|
||||
default_language = en
|
||||
localizations = en
|
||||
|
||||
[windows]
|
||||
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
|
||||
<title>druid 0.4.0</title>
|
||||
<title>druid 0.5.0</title>
|
||||
<style type='text/css'>
|
||||
/* Disable user selection to avoid strange bug in Chrome on Windows:
|
||||
* Selecting a text outside the canvas, then clicking+draging would
|
||||
|
102
docs/index.html
102
docs/index.html
@ -34,23 +34,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="modules/component.html">component</a></li>
|
||||
<li><a href="modules/druid.html">druid</a></li>
|
||||
<li><a href="modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -61,7 +62,8 @@
|
||||
<li><a href="topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="topics/faq.md.html">faq</a></li>
|
||||
<li><a href="topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -86,6 +88,42 @@
|
||||
<td class="name" nowrap><a href="modules/druid.button.html">druid.button</a></td>
|
||||
<td class="summary">Component to handle basic GUI button</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.drag.html">druid.drag</a></td>
|
||||
<td class="summary">Component to handle drag action on node.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.hover.html">druid.hover</a></td>
|
||||
<td class="summary">Component to handle hover node interaction</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.scroll.html">druid.scroll</a></td>
|
||||
<td class="summary">Component to handle scroll content.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.static_grid.html">druid.static_grid</a></td>
|
||||
<td class="summary">Component to handle placing components by row and columns.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.swipe.html">druid.swipe</a></td>
|
||||
<td class="summary">Component to handle swipe gestures on node.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.text.html">druid.text</a></td>
|
||||
<td class="summary">Component to handle all GUI texts.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/component.html">component</a></td>
|
||||
<td class="summary">Basic class for all Druid components.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.html">druid</a></td>
|
||||
<td class="summary">Druid UI Library.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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.checkbox.html">druid.checkbox</a></td>
|
||||
<td class="summary">Druid checkbox component</td>
|
||||
@ -95,16 +133,8 @@
|
||||
<td class="summary">Checkbox group module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.drag.html">druid.drag</a></td>
|
||||
<td class="summary">Component to handle drag action on node.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.grid.html">druid.grid</a></td>
|
||||
<td class="summary">Component to handle placing components by row and columns.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.hover.html">druid.hover</a></td>
|
||||
<td class="summary">Component to handle hover node interaction</td>
|
||||
<td class="name" nowrap><a href="modules/druid.dynamic_grid.html">druid.dynamic_grid</a></td>
|
||||
<td class="summary">Component to handle placing components in row</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.input.html">druid.input</a></td>
|
||||
@ -123,45 +153,21 @@
|
||||
<td class="name" nowrap><a href="modules/druid.radio_group.html">druid.radio_group</a></td>
|
||||
<td class="summary">Radio group module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.scroll.html">druid.scroll</a></td>
|
||||
<td class="summary">Component to handle scroll content.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.slider.html">druid.slider</a></td>
|
||||
<td class="summary">Druid slider component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.swipe.html">druid.swipe</a></td>
|
||||
<td class="summary">Component to handle swipe gestures on node.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.text.html">druid.text</a></td>
|
||||
<td class="summary">Component to handle all GUI texts.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.timer.html">druid.timer</a></td>
|
||||
<td class="summary">Component to handle GUI timers.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/component.html">component</a></td>
|
||||
<td class="summary">Basic class for all Druid components.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/druid.html">druid</a></td>
|
||||
<td class="summary">Druid UI Library.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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.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>
|
||||
<td class="summary">Druid main class.</td>
|
||||
<td class="summary">Instance of Druid.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>Topics</h2>
|
||||
@ -190,6 +196,10 @@
|
||||
<td class="name" nowrap><a href="topics/changelog.md.html">changelog.md</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="topics/faq.md.html">faq.md</a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="topics/README.md.html">README.md</a></td>
|
||||
<td class="summary"></td>
|
||||
@ -200,7 +210,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -41,23 +41,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><strong>component</strong></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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><strong>component</strong></li>
|
||||
<li><a href="../modules/druid.html">druid</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>
|
||||
@ -68,7 +69,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -88,18 +90,10 @@
|
||||
<td class="summary">Set current component style table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_template">get_template()</a></td>
|
||||
<td class="summary">Get current component template name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_template">set_template(template)</a></td>
|
||||
<td class="summary">Set current component template name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_nodes">get_nodes()</a></td>
|
||||
<td class="summary">Get current component nodes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_nodes">set_nodes(nodes)</a></td>
|
||||
<td class="summary">Set current component nodes</td>
|
||||
</tr>
|
||||
@ -108,14 +102,6 @@
|
||||
<td class="summary">Get current component context</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_context">set_context(context)</a></td>
|
||||
<td class="summary">Set current component context</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_interests">get_interests()</a></td>
|
||||
<td class="summary">Get current component interests</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#increase_input_priority">increase_input_priority()</a></td>
|
||||
<td class="summary">Increase input priority in current input stack</td>
|
||||
</tr>
|
||||
@ -132,18 +118,46 @@
|
||||
<td class="summary">Return druid with context of calling component.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#is_child_of">is_child_of()</a></td>
|
||||
<td class="summary">Return true, if current component is child of another component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_name">get_name()</a></td>
|
||||
<td class="summary">Return component name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(state)</a></td>
|
||||
<td class="summary">Set component input state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_parent_component">get_parent_component()</a></td>
|
||||
<td class="summary">Return the parent for current component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#setup_component">setup_component(table, table, table)</a></td>
|
||||
<td class="summary">Setup component context and his style table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__set_context">__set_context(context)</a></td>
|
||||
<td class="summary">Set current component context</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__get_interests">__get_interests()</a></td>
|
||||
<td class="summary">Get current component interests</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__get_template">__get_template()</a></td>
|
||||
<td class="summary">Get current component template name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__get_nodes">__get_nodes()</a></td>
|
||||
<td class="summary">Get current component nodes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__add_children">__add_children(children)</a></td>
|
||||
<td class="summary">Add child to component children list</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__remove_children">__remove_children(children)</a></td>
|
||||
<td class="summary">Remove child from component children list</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>
|
||||
@ -178,26 +192,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_template"></a>
|
||||
<strong>get_template()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component template name
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
Component template name
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_template"></a>
|
||||
@ -219,26 +213,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_nodes"></a>
|
||||
<strong>get_nodes()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component nodes
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
Component nodes table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_nodes"></a>
|
||||
@ -280,47 +254,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_context"></a>
|
||||
<strong>set_context(context)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set current component context
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
Druid context. Usually it is self of script
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_interests"></a>
|
||||
<strong>get_interests()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component interests
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
List of component interests
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "increase_input_priority"></a>
|
||||
@ -400,26 +333,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "is_child_of"></a>
|
||||
<strong>is_child_of()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return true, if current component is child of another component
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
True, if current component is child of another
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_name"></a>
|
||||
@ -440,6 +353,54 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_input_enabled"></a>
|
||||
<strong>set_input_enabled(state)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set component input state. By default it enabled
|
||||
You can disable any input of component by this function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">state</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
The component input state
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
Component itself
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_parent_component"></a>
|
||||
<strong>get_parent_component()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return the parent for current component
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span> or <span class="type">nil</span></span>
|
||||
The druid component instance or nil
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "setup_component"></a>
|
||||
@ -468,13 +429,136 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
<span class="types"><span class="type">component</span></span>
|
||||
Component itself
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__set_context"></a>
|
||||
<strong>__set_context(context)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set current component context
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
Druid context. Usually it is self of script
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__get_interests"></a>
|
||||
<strong>__get_interests()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component interests
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
List of component interests
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__get_template"></a>
|
||||
<strong>__get_template()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component template name
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
Component template name
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__get_nodes"></a>
|
||||
<strong>__get_nodes()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get current component nodes
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
Component nodes table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__add_children"></a>
|
||||
<strong>__add_children(children)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add child to component children list
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">children</span>
|
||||
<span class="types"><span class="type">component</span></span>
|
||||
The druid component instance
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__remove_children"></a>
|
||||
<strong>__remove_children(children)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Remove child from component children list
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">children</span>
|
||||
<span class="types"><span class="type">component</span></span>
|
||||
The druid component instance
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Component.create"></a>
|
||||
@ -510,7 +594,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<li><strong>druid.back_handler</strong></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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -218,7 +220,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<li><a href="../modules/druid.back_handler.html">druid.back_handler</a></li>
|
||||
<li><strong>druid.blocker</strong></li>
|
||||
<li><a href="../modules/druid.button.html">druid.button</a></li>
|
||||
<li><a href="../modules/druid.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -237,7 +239,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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><strong>druid.button</strong></li>
|
||||
<li><a href="../modules/druid.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -448,7 +450,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</a></li>
|
||||
<li><strong>druid.checkbox</strong></li>
|
||||
<li><a href="../modules/druid.checkbox_group.html">druid.checkbox_group</a></li>
|
||||
<li><a href="../modules/druid.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -282,7 +284,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</a></li>
|
||||
<li><a href="../modules/druid.checkbox.html">druid.checkbox</a></li>
|
||||
<li><strong>druid.checkbox_group</strong></li>
|
||||
<li><a href="../modules/druid.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -242,7 +244,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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><strong>druid.drag</strong></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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><strong>druid.drag</strong></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -282,7 +284,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
496
docs/modules/druid.dynamic_grid.html
Normal file
496
docs/modules/druid.dynamic_grid.html
Normal file
@ -0,0 +1,496 @@
|
||||
<!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_fixed.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>
|
||||
<li><a href="#Tables">Tables</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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><strong>druid.dynamic_grid</strong></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.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.timer.html">druid.timer</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>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>druid.dynamic_grid</code></h1>
|
||||
<p>Component to handle placing components in row</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#init">init(parent)</a></td>
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_pos">get_pos(index, node)</a></td>
|
||||
<td class="summary">Return pos for grid node index</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add(node[, index[, is_shift_left=false]])</a></td>
|
||||
<td class="summary">Add new node to the grid</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#remove">remove(index[, is_shift_left=false])</a></td>
|
||||
<td class="summary">Remove the item from the grid.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_size">get_size()</a></td>
|
||||
<td class="summary">Return grid content size</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_index_by_node">get_index_by_node(node)</a></td>
|
||||
<td class="summary">Return grid index by node</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_all_pos">get_all_pos()</a></td>
|
||||
<td class="summary">Return array of all node positions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_position_function">set_position_function(callback)</a></td>
|
||||
<td class="summary">Change set position function for grid nodes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#clear">clear()</a></td>
|
||||
<td class="summary">Clear grid nodes array.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#DynamicGrid:_get_side_vector">DynamicGrid:_get_side_vector(side, is_forward)</a></td>
|
||||
<td class="summary">Return side vector to correct node shifting</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>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "init"></a>
|
||||
<strong>init(parent)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component init function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
The gui node parent, where items will be placed
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_pos"></a>
|
||||
<strong>get_pos(index, node)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return pos for grid node index
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The grid element index
|
||||
</li>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
The node to be placed
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Node position
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add(node[, index[, is_shift_left=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add new node to the grid
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Gui node
|
||||
</li>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The node position. By default add as last node
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">is_shift_left</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
If true, shift all nodes to the left, otherwise shift nodes to the right
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "remove"></a>
|
||||
<strong>remove(index[, is_shift_left=false])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Remove the item from the grid. Note that gui node will be not deleted
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The grid node index to remove
|
||||
</li>
|
||||
<li><span class="parameter">is_shift_left</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
If true, shift all nodes to the left, otherwise shift nodes to the right
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_size"></a>
|
||||
<strong>get_size()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return grid content size
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
The grid content size
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_index_by_node"></a>
|
||||
<strong>get_index_by_node(node)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return grid index by node
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
The gui node in the grid
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The node index
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_all_pos"></a>
|
||||
<strong>get_all_pos()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return array of all node positions
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3[]</span></span>
|
||||
All grid node positions
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_position_function"></a>
|
||||
<strong>set_position_function(callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Change set position function for grid nodes. It will call on
|
||||
update poses on grid elements. Default: gui.set_position
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
Function on node set position
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.dynamic_grid</span></span>
|
||||
Current grid instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "clear"></a>
|
||||
<strong>clear()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Clear grid nodes array. GUI nodes will be not deleted!
|
||||
If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.dynamic_grid</span></span>
|
||||
Current grid instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "DynamicGrid:_get_side_vector"></a>
|
||||
<strong>DynamicGrid:_get_side_vector(side, is_forward)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return side vector to correct node shifting
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">side</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">is_forward</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_add_item</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item add callback
|
||||
</li>
|
||||
<li><span class="parameter">on_remove_item</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item remove callback
|
||||
</li>
|
||||
<li><span class="parameter">on_change_items</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item add or remove callback
|
||||
</li>
|
||||
<li><span class="parameter">on_clear</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On grid clear callback
|
||||
</li>
|
||||
<li><span class="parameter">on_update_positions</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On update item positions callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Fields"></a>
|
||||
<strong>Fields</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component fields
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Parent gui node
|
||||
</li>
|
||||
<li><span class="parameter">nodes</span>
|
||||
<span class="types"><span class="type">node[]</span></span>
|
||||
List of all grid nodes
|
||||
</li>
|
||||
<li><span class="parameter">first_index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The first index of node in grid
|
||||
</li>
|
||||
<li><span class="parameter">last_index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The last index of node in grid
|
||||
</li>
|
||||
<li><span class="parameter">node_size</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Item size
|
||||
</li>
|
||||
<li><span class="parameter">border</span>
|
||||
<span class="types"><span class="type">vector4</span></span>
|
||||
The size of item content
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</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-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
@ -41,23 +41,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -68,7 +69,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -113,6 +115,10 @@
|
||||
<td class="name" nowrap><a href="#get_border">get_border()</a></td>
|
||||
<td class="summary">Distance from node to size border</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#deprecated">deprecated(message)</a></td>
|
||||
<td class="summary">Show deprecated message.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
@ -290,6 +296,27 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "deprecated"></a>
|
||||
<strong>deprecated(message)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Show deprecated message. Once time per message
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">message</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
The deprecated message
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@ -298,7 +325,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><strong>druid.hover</strong></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><strong>druid.hover</strong></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -294,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -41,23 +41,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><strong>druid</strong></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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><strong>druid</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>
|
||||
@ -68,7 +69,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -329,7 +331,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -388,7 +390,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</a></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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -243,7 +245,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -386,7 +388,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -242,7 +244,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><strong>druid.scroll</strong></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -133,6 +135,23 @@
|
||||
<td class="name" nowrap><a href="#set_points">set_points(points)</a></td>
|
||||
<td class="summary">Set points of interest.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_horizontal_scroll">set_horizontal_scroll(state)</a></td>
|
||||
<td class="summary">Lock or unlock horizontal scroll</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_vertical_scroll">set_vertical_scroll(state)</a></td>
|
||||
<td class="summary">Lock or unlock vertical scroll</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#bind_grid">bind_grid(Druid)</a></td>
|
||||
<td class="summary">Bind the grid component (Static or Dynamic) to recalculate
|
||||
scroll size on grid changes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Scroll:_cancel_animate">Scroll:_cancel_animate()</a></td>
|
||||
<td class="summary">Cancel animation on other animation or input touch</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
@ -443,6 +462,102 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_horizontal_scroll"></a>
|
||||
<strong>set_horizontal_scroll(state)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Lock or unlock horizontal scroll
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">state</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
True, if horizontal scroll is enabled
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.scroll</span></span>
|
||||
Current scroll instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_vertical_scroll"></a>
|
||||
<strong>set_vertical_scroll(state)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Lock or unlock vertical scroll
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">state</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
True, if vertical scroll is enabled
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.scroll</span></span>
|
||||
Current scroll instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "bind_grid"></a>
|
||||
<strong>bind_grid(Druid)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Bind the grid component (Static or Dynamic) to recalculate
|
||||
scroll size on grid changes
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">Druid</span>
|
||||
<span class="types"><span class="type">druid.static_grid</span> or <span class="type">druid.dynamic_grid</span></span>
|
||||
grid component
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.scroll</span></span>
|
||||
Current scroll instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Scroll:_cancel_animate"></a>
|
||||
<strong>Scroll:_cancel_animate()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Cancel animation on other animation or input touch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
@ -610,7 +725,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><strong>druid.slider</strong></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -281,7 +283,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
522
docs/modules/druid.static_grid.html
Normal file
522
docs/modules/druid.static_grid.html
Normal file
@ -0,0 +1,522 @@
|
||||
<!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_fixed.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>
|
||||
<li><a href="#Tables">Tables</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><strong>druid.static_grid</strong></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.dynamic_grid.html">druid.dynamic_grid</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.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.timer.html">druid.timer</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>
|
||||
<h2>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>druid.static_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>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#init">init(parent, element[, in_row=1])</a></td>
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_pos">get_pos(index)</a></td>
|
||||
<td class="summary">Return pos for grid node index</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_index">get_index(pos)</a></td>
|
||||
<td class="summary">Return index for grid pos</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_index_by_node">get_index_by_node(node)</a></td>
|
||||
<td class="summary">Return grid index by node</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_anchor">set_anchor(anchor)</a></td>
|
||||
<td class="summary">Set grid anchor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add(item[, index])</a></td>
|
||||
<td class="summary">Add new item to the grid</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#remove">remove(index, is_shift_nodes)</a></td>
|
||||
<td class="summary">Remove the item from the grid.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_size">get_size()</a></td>
|
||||
<td class="summary">Return grid content size</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_all_pos">get_all_pos()</a></td>
|
||||
<td class="summary">Return array of all node positions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_position_function">set_position_function(callback)</a></td>
|
||||
<td class="summary">Change set position function for grid nodes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#clear">clear()</a></td>
|
||||
<td class="summary">Clear grid nodes array.</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>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "init"></a>
|
||||
<strong>init(parent, element[, in_row=1])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component init function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
The gui node parent, where items will be placed
|
||||
</li>
|
||||
<li><span class="parameter">element</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Element prefab. Need to get it size
|
||||
</li>
|
||||
<li><span class="parameter">in_row</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
How many nodes in row can be placed
|
||||
(<em>default</em> 1)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_pos"></a>
|
||||
<strong>get_pos(index)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return pos for grid node index
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The grid element index
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Node position
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_index"></a>
|
||||
<strong>get_index(pos)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return index for grid pos
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">pos</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
The node position in the grid
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The node index
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_index_by_node"></a>
|
||||
<strong>get_index_by_node(node)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return grid index by node
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
The gui node in the grid
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The node index
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_anchor"></a>
|
||||
<strong>set_anchor(anchor)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set grid anchor. Default anchor is equal to anchor of grid parent node
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">anchor</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Anchor
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add(item[, index])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add new item to the grid
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">item</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Gui node
|
||||
</li>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The item position. By default add as last item
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "remove"></a>
|
||||
<strong>remove(index, is_shift_nodes)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Remove the item from the grid. Note that gui node will be not deleted
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The grid node index to remove
|
||||
</li>
|
||||
<li><span class="parameter">is_shift_nodes</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
If true, will shift nodes left after index
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_size"></a>
|
||||
<strong>get_size()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return grid content size
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
The grid content size
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_all_pos"></a>
|
||||
<strong>get_all_pos()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return array of all node positions
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">vector3[]</span></span>
|
||||
All grid node positions
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_position_function"></a>
|
||||
<strong>set_position_function(callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Change set position function for grid nodes. It will call on
|
||||
update poses on grid elements. Default: gui.set_position
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
Function on node set position
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.static_grid</span></span>
|
||||
Current grid instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "clear"></a>
|
||||
<strong>clear()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Clear grid nodes array. GUI nodes will be not deleted!
|
||||
If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">druid.static_grid</span></span>
|
||||
Current grid instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</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_add_item</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item add callback
|
||||
</li>
|
||||
<li><span class="parameter">on_remove_item</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item remove callback
|
||||
</li>
|
||||
<li><span class="parameter">on_change_items</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On item add or remove callback
|
||||
</li>
|
||||
<li><span class="parameter">on_clear</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On grid clear callback
|
||||
</li>
|
||||
<li><span class="parameter">on_update_positions</span>
|
||||
<span class="types"><span class="type">druid_event</span></span>
|
||||
On update item positions callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Fields"></a>
|
||||
<strong>Fields</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component fields
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">parent</span>
|
||||
<span class="types"><span class="type">node</span></span>
|
||||
Parent gui node
|
||||
</li>
|
||||
<li><span class="parameter">nodes</span>
|
||||
<span class="types"><span class="type">node[]</span></span>
|
||||
List of all grid nodes
|
||||
</li>
|
||||
<li><span class="parameter">first_index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The first index of node in grid
|
||||
</li>
|
||||
<li><span class="parameter">last_index</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The last index of node in grid
|
||||
</li>
|
||||
<li><span class="parameter">anchor</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Item anchor
|
||||
</li>
|
||||
<li><span class="parameter">node_size</span>
|
||||
<span class="types"><span class="type">vector3</span></span>
|
||||
Item size
|
||||
</li>
|
||||
<li><span class="parameter">border</span>
|
||||
<span class="types"><span class="type">vector4</span></span>
|
||||
The size of item content
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</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-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><strong>druid.swipe</strong></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><strong>druid.swipe</strong></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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -256,7 +258,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><strong>druid.text</strong></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><strong>druid.text</strong></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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -407,7 +409,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -42,23 +42,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<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/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>
|
||||
@ -69,7 +70,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -296,7 +298,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -41,23 +41,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><strong>druid_event</strong></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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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><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>
|
||||
@ -68,7 +69,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -242,7 +244,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -41,23 +41,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -68,7 +69,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
|
||||
@ -77,9 +79,19 @@
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>druid_instance</code></h1>
|
||||
<p>Druid main class.</p>
|
||||
<p> Create instance of this
|
||||
to start creating components</p>
|
||||
<p>Instance of Druid.</p>
|
||||
<p> Make one instance per gui_script with next code:</p>
|
||||
|
||||
|
||||
<pre>
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
<span class="keyword">function</span> init(self)
|
||||
self.druid = druid.new(self)
|
||||
<span class="keyword">local</span> button = self.druid:new_button(...)
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
<p> Learn Druid instance function here</p>
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<li><a href="../modules/druid.button.html#">druid.button</a></li>
|
||||
@ -90,7 +102,8 @@
|
||||
<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>
|
||||
<li><a href="../modules/druid.static_grid.html#">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html#">druid.dynamic_grid</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.checkbox.html#">druid.checkbox</a></li>
|
||||
@ -168,46 +181,19 @@
|
||||
<td class="summary">Create text basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<td class="summary">Create timer basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_progress">druid:new_progress(...)</a></td>
|
||||
<td class="summary">Create progress basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_grid">druid:new_grid(...)</a></td>
|
||||
<td class="summary">Create grid basic component</td>
|
||||
<td class="summary">Create grid basic component
|
||||
Deprecated</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_static_grid">druid:new_static_grid(...)</a></td>
|
||||
<td class="summary">Create static grid basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_scroll">druid:new_scroll(...)</a></td>
|
||||
<td class="summary">Create scroll basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_slider">druid:new_slider(...)</a></td>
|
||||
<td class="summary">Create slider basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_checkbox">druid:new_checkbox(...)</a></td>
|
||||
<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>
|
||||
<tr>
|
||||
<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_swipe">druid:new_swipe(...)</a></td>
|
||||
<td class="summary">Create swipe basic component</td>
|
||||
</tr>
|
||||
@ -215,6 +201,42 @@
|
||||
<td class="name" nowrap><a href="#druid:new_drag">druid:new_drag(...)</a></td>
|
||||
<td class="summary">Create drag basic component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_dynamic_grid">druid:new_dynamic_grid(...)</a></td>
|
||||
<td class="summary">Create dynamic grid component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_lang_text">druid:new_lang_text(...)</a></td>
|
||||
<td class="summary">Create lang_text component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_slider">druid:new_slider(...)</a></td>
|
||||
<td class="summary">Create slider component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_checkbox">druid:new_checkbox(...)</a></td>
|
||||
<td class="summary">Create checkbox component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_input">druid:new_input(...)</a></td>
|
||||
<td class="summary">Create input 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 component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_radio_group">druid:new_radio_group(...)</a></td>
|
||||
<td class="summary">Create radio_group component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_timer">druid:new_timer(...)</a></td>
|
||||
<td class="summary">Create timer component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#druid:new_progress">druid:new_progress(...)</a></td>
|
||||
<td class="summary">Create progress component</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
@ -581,87 +603,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_lang_text"></a>
|
||||
<strong>druid:new_lang_text(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create lang_text basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
lang_text init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
lang_text component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_timer"></a>
|
||||
<strong>druid:new_timer(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create timer basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
timer init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
timer component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_progress"></a>
|
||||
<strong>druid:new_progress(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create progress basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
progress init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
progress component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_grid"></a>
|
||||
@ -669,6 +610,34 @@
|
||||
</dt>
|
||||
<dd>
|
||||
Create grid basic component
|
||||
Deprecated
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
grid init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
grid component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_static_grid"></a>
|
||||
<strong>druid:new_static_grid(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create static grid basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
@ -716,141 +685,6 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_slider"></a>
|
||||
<strong>druid:new_slider(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create slider basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
slider init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
slider component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_checkbox"></a>
|
||||
<strong>druid:new_checkbox(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create checkbox basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
checkbox init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
checkbox component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</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>
|
||||
<strong>druid:new_checkbox_group(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create checkbox_group basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
checkbox_group init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
checkbox_group component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_radio_group"></a>
|
||||
<strong>druid:new_radio_group(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create radio_group basic component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
radio_group init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
radio_group component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_swipe"></a>
|
||||
@ -905,6 +739,249 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_dynamic_grid"></a>
|
||||
<strong>druid:new_dynamic_grid(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create dynamic grid component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
grid init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
grid component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_lang_text"></a>
|
||||
<strong>druid:new_lang_text(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create lang_text component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
lang_text init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
lang_text component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_slider"></a>
|
||||
<strong>druid:new_slider(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create slider component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
slider init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
slider component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_checkbox"></a>
|
||||
<strong>druid:new_checkbox(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create checkbox component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
checkbox init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
checkbox component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_input"></a>
|
||||
<strong>druid:new_input(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create input 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>
|
||||
<strong>druid:new_checkbox_group(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create checkbox_group component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
checkbox_group init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
checkbox_group component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_radio_group"></a>
|
||||
<strong>druid:new_radio_group(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create radio_group component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
radio_group init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
radio_group component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_timer"></a>
|
||||
<strong>druid:new_timer(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create timer component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
timer init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
timer component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "druid:new_progress"></a>
|
||||
<strong>druid:new_progress(...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create progress component
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><span class="type">args</span></span>
|
||||
progress init args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Component</span></span>
|
||||
progress component
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@ -913,7 +990,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -45,7 +45,8 @@
|
||||
<li><a href="#Checkbox_group">Checkbox group </a></li>
|
||||
<li><a href="#Radio_group">Radio group </a></li>
|
||||
<li><a href="#Timer">Timer </a></li>
|
||||
<li><a href="#Grid">Grid </a></li>
|
||||
<li><a href="#Static_Grid">Static Grid </a></li>
|
||||
<li><a href="#Dynamic_Grid">Dynamic Grid </a></li>
|
||||
<li><a href="#Hover">Hover </a></li>
|
||||
<li><a href="#Swipe">Swipe </a></li>
|
||||
<li><a href="#Drag">Drag </a></li>
|
||||
@ -59,7 +60,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -67,23 +69,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -109,6 +112,9 @@
|
||||
<p>Create button with druid: <code>button = druid:new_button(node_name, callback, [params], [animation_node])</code>
|
||||
Where node name is name of node from GUI scene. You can use <code>node_name</code> as input trigger zone and point another node for animation via <code>animation_node</code></p>
|
||||
|
||||
<h3>Usecase</h3>
|
||||
<p><em>fill example usecases</em></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Button callback have next params: (self, params, button_instance)</p>
|
||||
|
||||
@ -262,6 +268,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
- Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
|
||||
- If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles</p>
|
||||
|
||||
|
||||
<p><a name="Slider"></a></p>
|
||||
<h2>Slider</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.slider.html">Slider API here</a></p>
|
||||
@ -278,12 +285,13 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
<p>- You can setup points of interests on slider via <a href="../modules/druid.slider.html#set_steps">slider:set_steps</a>. If steps are exist, slider values will be only from this steps (notched slider)
|
||||
- For now, start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)</p>
|
||||
|
||||
|
||||
<p><a name="Input"></a></p>
|
||||
<h2>Input</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.input.html">Input API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Basic Druid text input component (unimplemented)</p>
|
||||
<p>Basic Druid text input component</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create input component with druid: <code>input = druid:new_input(button_node_name, text_node_name, keyboard_type)</code></p>
|
||||
@ -313,6 +321,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
<p>- Checkbox uses button to handle click
|
||||
- You can setup another node to handle input with click_node arg in component init: <code>druid:new_checkbox(node, callback, [click_node])</code></p>
|
||||
|
||||
|
||||
<p><a name="Checkbox_group"></a></p>
|
||||
<h2>Checkbox group</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.checkbox_group.html">Checkbox group API here</a></p>
|
||||
@ -343,6 +352,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
- You can get/set radio_group state with <code>group:set_state()</code> and <code>group:get_state()</code>
|
||||
- Only different from checkbox_group: on click another checkboxes in this group will be unchecked</p>
|
||||
|
||||
|
||||
<p><a name="Timer"></a></p>
|
||||
<h2>Timer</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.timer.html">Timer API here</a></p>
|
||||
@ -358,22 +368,53 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
- Timer will setup text node with current timer value
|
||||
- Timer uses update function to handle time</p>
|
||||
|
||||
<p><a name="Grid"></a></p>
|
||||
<h2>Grid</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.grid.html">Grid API here</a></p>
|
||||
|
||||
<p><a name="Static_Grid"></a></p>
|
||||
<h2>Static Grid</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.static_grid.html">Static Grid API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Component for manage node positions. Very simple implementation for nodes with equal size</p>
|
||||
<p>Component for manage node positions.
|
||||
Static grid have constant node size, so it possible to calculate node positions before placement. Nodes can be placed with gaps.
|
||||
Static grid can shift elements on add/remove functions.</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create component with druid: <code>grid = druid:new_grid(parent_node, prefab_node, max_in_row_elements)</code></p>
|
||||
<p>Create component with druid: <code>grid = druid:new_static_grid(parent_node, prefab_node, max_in_row_elements)</code></p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- Grid on <em>adding elements</em> will setup parent to <em>parent</em>node_
|
||||
<p>- On <em>add node</em> grid will set node parent to <em>parent</em>node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can adjust anchor and border between elements
|
||||
- <em>Prefab node</em> in component init used to get grid item size</p>
|
||||
- You can also bind the grid to the scroll component for auto resize scroll content size
|
||||
- Pivot of parent_node matter for node placement
|
||||
- <em>Prefab node</em> used to get node size and anchor
|
||||
- You can point *position_function* for animations with <em>static</em>grid:set<em>position</em>function(node, pos)_ callback. Default - *gui.set_position()*</p>
|
||||
|
||||
|
||||
<p><a name="Dynamic_Grid"></a></p>
|
||||
<h2>Dynamic Grid</h2>
|
||||
<p><a href="https://insality.github.io/druid/modules/druid.dynamic_grid.html">Dynamic Grid API here</a></p>
|
||||
|
||||
<h3>Overview</h3>
|
||||
<p>Component for manage node positions with different node sizes.
|
||||
Unlike Static Grid, Dynamic Grid can place nodes only in one row or in one column.
|
||||
Dynamic Grid can't have gaps between elements - you will get error, if try spawn element far away from others.
|
||||
Dynamic Grid should have <strong>West</strong>, <strong>East</strong>, <strong>South</strong> or <strong>North</strong> pivot (vertical or horizontal element placement)</p>
|
||||
|
||||
<h3>Setup</h3>
|
||||
<p>Create component with druid: <code>grid = druid:new_dynamic_grid(parent_node)</code></p>
|
||||
|
||||
<p>Check the <em>parent</em>node_ have correct pivot point. You will get the error otherwise.</p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>- On <em>add node</em> grid will set node parent to <em>parent</em>node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can also bind the grid to the scroll component for auto resize scroll content size
|
||||
- Pivot of parent<em>node matter for node placement
|
||||
- You can point *position</em>function* for animations with <em>static</em>grid:set<em>position</em>function(node, pos)_ callback. Default - *gui.set_position()*
|
||||
- First node placed at Grid pivot point. Other nodes placed nearby of other nodes.
|
||||
- On <em>add/remove</em> nodes always shifted. You can point the shift side in this functions (*is<em>shift</em>left* boolean argument)</p>
|
||||
|
||||
<p><a name="Hover"></a></p>
|
||||
<h2>Hover</h2>
|
||||
@ -465,7 +506,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -46,7 +46,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -54,23 +55,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -245,7 +247,7 @@ There is next interests in druid:
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -45,7 +45,8 @@
|
||||
<li><strong>Styles</strong></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -53,23 +54,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -155,7 +157,7 @@ You can pass <em>nil</em> or <em>empty</em>table_ to use default values for all
|
||||
</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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -43,7 +43,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><strong>Druid assets</strong></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -51,23 +52,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -92,7 +94,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -43,7 +43,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><strong>Examples</strong></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -51,23 +52,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -90,7 +92,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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -36,8 +36,8 @@
|
||||
<li><a href="#Components">Components </a></li>
|
||||
<li><a href="#Basic_usage">Basic usage </a></li>
|
||||
<li><a href="#Druid_Events">Druid Events </a></li>
|
||||
<li><a href="#Druid_lifecycle">Druid lifecycle </a></li>
|
||||
<li><a href="#Features">Features </a></li>
|
||||
<li><a href="#Druid_Lifecycle">Druid Lifecycle </a></li>
|
||||
<li><a href="#Details">Details </a></li>
|
||||
<li><a href="#Examples">Examples </a></li>
|
||||
<li><a href="#Documentation">Documentation </a></li>
|
||||
<li><a href="#Games_powered_by_Druid">Games powered by Druid </a></li>
|
||||
@ -53,7 +53,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">changelog</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><strong>README</strong></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -61,23 +62,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -90,7 +92,7 @@
|
||||
|
||||
<p><a href="https://github.com/Insality/druid/releases"><img src="https://img.shields.io/github/v/release/insality/druid" alt="GitHub release (latest by date)"/></a></p>
|
||||
|
||||
<p><strong>Druid</strong> - powerful Defold component UI library. Use basic <strong>Druid</strong> components or make your own game-specific components to make amazing GUI in your games.</p>
|
||||
<p><strong>Druid</strong> - powerful Defold component UI library. Use basic and extended <strong>Druid</strong> components or make your own game-specific components to make amazing GUI in your games.</p>
|
||||
|
||||
|
||||
<p><a name="Setup"></a></p>
|
||||
@ -125,7 +127,7 @@
|
||||
|
||||
<h3>Input capturing [optional]</h3>
|
||||
|
||||
<p>By default, <strong>Druid</strong> will auto-capture input focus, if any input component will be created. So you don't need to call <code>msg.post(".", "acquire_input_focus)"</code></p>
|
||||
<p>By default, <strong>Druid</strong> will auto-capture input focus, if any input component will be created. So you don't need to call <code>msg.post(".", "acquire_input_focus")</code></p>
|
||||
|
||||
<p>If you not need this behaviour, you can disable it by settings <code>druid.no_auto_input</code> field in <em>game.project</em>:</p>
|
||||
<pre><code> [druid]
|
||||
@ -155,10 +157,6 @@
|
||||
</span><span class="comment">-- to retranslate all lang_text components:
|
||||
</span>druid.on_language_change()
|
||||
|
||||
<span class="comment">-- Call this function on layout changing in the game,
|
||||
</span><span class="comment">-- to reapply layouts
|
||||
</span>druid.on_layout_change()
|
||||
|
||||
<span class="comment">-- Call this function inside window.set_listener
|
||||
</span><span class="comment">-- to catch game focus lost/gained callbacks:
|
||||
</span>druid.on_window_callback(event)
|
||||
@ -169,29 +167,37 @@
|
||||
<p><a name="Components"></a></p>
|
||||
<h2>Components</h2>
|
||||
|
||||
<p><strong>Druid</strong> provides next basic components:</p>
|
||||
<p><strong>Druid</strong> provides next <em>basic</em> components:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#button">Button</a></strong> - Basic Druid input component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#text">Text</a></strong> - Basic Druid text component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#lang-text">Lang text</a></strong> - Wrap on Text component to handle localization</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#scroll">Scroll</a></strong> - Basic Druid scroll component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#progress">Progress</a></strong> - Basic Druid progress bar component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#slider">Slider</a></strong> - Basic Druid slider component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#input">Input</a></strong> - Basic Druid text input component (unimplemented)</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox">Checkbox</a></strong> - Basic Druid checkbox component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#checkbox-group">Checkbox group</a></strong> - Several checkboxes in one group</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#radio-group">Radio group</a></strong> - Several checkboxes in one group with single choice</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#blocker">Blocker</a></strong> - Block input in node zone component</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#back-handler">Back Handler</a></strong> - Handle back button (Android back, backspace)</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#timer">Timer</a></strong> - Handle timer work on gui text node</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#grid">Grid</a></strong> - Component for manage node positions </p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#hover">Hover</a></strong> - System Druid component, handle hover node state</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#swipe">Swipe</a></strong> - System Druid component, handle swipe gestures on node</p></li>
|
||||
<li><p><strong><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#drag">Drag</a></strong> - System Druid component, handle drag input on node </p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#button">Button</a></strong> - Basic Druid button input component. Handles all types of interaction (tap, long-tap, hold-tap, double-tap, simple key triggers, etc)</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#text">Text</a></strong> - Basic Druid text component. Wrap on gui text node, handle text size adjusting.</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#scroll">Scroll</a></strong> - Basic Druid scroll component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#blocker">Blocker</a></strong> - Block input in node zone component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#back-handler">Back Handler</a></strong> - Handle back button (Android back button, backspace key)</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#static-grid">Static Grid</a></strong> - Component for manage node positions with equal sizes</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#hover">Hover</a></strong> - System Druid component, handle hover node state</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#swipe">Swipe</a></strong> - System Druid component, handle swipe gestures on node</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#drag">Drag</a></strong> - System Druid component, handle drag input on node </p></li>
|
||||
</ul>
|
||||
|
||||
<p>Full info see on <em><a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md">components.md</a></em></p>
|
||||
<p><strong>Druid</strong> also provides next <em>extended</em> components:</p>
|
||||
|
||||
<p><strong>*Note</strong>: In future, to use extended components, you should register them first. It's required for make <strong>Druid</strong> modular - to exclude unused components from build*</p>
|
||||
|
||||
<ul>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#checkbox">Checkbox</a></strong> - Checkbox component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#checkbox-group">Checkbox group</a></strong> - Several checkboxes in one group</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#dynamic-grid">Dynamic Grid</a></strong> - Component for manage node positions with different sizes. Only in one row or column</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#input">Input</a></strong> - User text input component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#lang-text">Lang text</a></strong> - Wrap on Text component to handle localization</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#progress">Progress</a></strong> - Progress bar component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#radio-group">Radio group</a></strong> - Several checkboxes in one group with single choice</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#slider">Slider</a></strong> - Slider component</p></li>
|
||||
<li><p><strong><a href="master/docs_md/01-components.md#timer">Timer</a></strong> - Handle timer work on gui text node</p></li>
|
||||
</ul>
|
||||
|
||||
<p>Full info see on <em><a href="master/docs_md/01-components.md">components.md</a></em></p>
|
||||
|
||||
|
||||
<p><a name="Basic_usage"></a></p>
|
||||
@ -226,6 +232,8 @@
|
||||
</pre>
|
||||
|
||||
|
||||
<p>Learn <strong>Druid</strong> instance <a href="https://insality.github.io/druid/modules/druid_instance.html">functions here</a>)</p>
|
||||
|
||||
<p><a name="Druid_Events"></a></p>
|
||||
<h2>Druid Events</h2>
|
||||
|
||||
@ -237,13 +245,12 @@
|
||||
<li><p><strong>event:clear</strong>()</p></li>
|
||||
</ul>
|
||||
|
||||
<p>Any events can handle several callbacks, if needed.</p>
|
||||
<p>You can subscribe several callbacks on single event.</p>
|
||||
|
||||
<p><a name="Druid_Lifecycle"></a></p>
|
||||
<h2>Druid Lifecycle</h2>
|
||||
|
||||
<p><a name="Druid_lifecycle"></a></p>
|
||||
<h2>Druid lifecycle</h2>
|
||||
|
||||
<p>Here is full druid lifecycle setup in your <strong>*.gui_script</strong> file:</p>
|
||||
<p>Here is full Druid lifecycle setup in your <strong>*.gui_script</strong> file:</p>
|
||||
|
||||
<pre>
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
@ -271,24 +278,27 @@
|
||||
|
||||
|
||||
<ul>
|
||||
<li><em>final</em> required function for correct druid lifecycle</li>
|
||||
<li>*on_input* used for almost all basic druid components</li>
|
||||
<li><em>final</em> <strong>required</strong> function for correct Druid lifecycle</li>
|
||||
<li>*on_input* used for almost all Druid components</li>
|
||||
<li><em>update</em> used for progress bar, scroll and timer base components</li>
|
||||
<li>*on_message* used for specific druid events, like language change or layout change</li>
|
||||
<li>*on_message* used for specific Druid events, like language change or layout change</li>
|
||||
</ul>
|
||||
|
||||
<p>Recommended is fully integrate all druid lifecycles functions</p>
|
||||
<p>Recommended is fully integrate all <strong>Druid</strong> lifecycles functions</p>
|
||||
|
||||
|
||||
<p><a name="Features"></a></p>
|
||||
<h2>Features</h2>
|
||||
<p><a name="Details"></a></p>
|
||||
<h2>Details</h2>
|
||||
|
||||
<ul>
|
||||
<li>Druid input goes as stack. Last created button will checked first. So create your GUI from back</li>
|
||||
<li>Don't forget about <code>return</code> in <code>on_input</code>: <code>return self.druid:on_input()</code>. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)</li>
|
||||
<li>Don't forget about <code>return</code> in <code>on_input</code>: <code>return self.druid:on_input()</code>. It need, if you have more than 1 acquire inputs (several Druid, other input system, etc)</li>
|
||||
<li>Druid by default do <em>acquire</em>input<em>focus</em>. So you don't need do it manually. Buy only if you have components, which requires <em>on</em>input_ </li>
|
||||
<li>If you want to delete node with declared Druid component, don't forget to remove them via <code>druid:remove(component)</code></li>
|
||||
</ul>
|
||||
|
||||
<p>See full <a href="master/docs_md/FAQ.md">See FAQ here</a></p>
|
||||
|
||||
|
||||
<p><a name="Examples"></a></p>
|
||||
<h2>Examples</h2>
|
||||
@ -304,10 +314,11 @@
|
||||
<h2>Documentation</h2>
|
||||
|
||||
<p>To learn <strong>Druid</strong> better, read next documentation:
|
||||
- <a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md">Druid components</a>
|
||||
- <a href="https://github.com/Insality/druid/blob/master/docs_md/02-creating_custom_components.md">Create custom components</a>
|
||||
- <a href="https://github.com/Insality/druid/blob/master/docs_md/03-styles.md">Druid styles</a>
|
||||
- <a href="https://github.com/Insality/druid/blob/master/docs_md/04-druid_assets.md">Druid asset store</a></p>
|
||||
- <a href="master/docs_md/01-components.md">Druid components</a>
|
||||
- <a href="master/docs_md/02-creating_custom_components.md">Create custom components</a>
|
||||
- <a href="master/docs_md/FAQ.md">See FAQ article</a>
|
||||
- <a href="master/docs_md/03-styles.md">Druid styles</a>
|
||||
- <a href="master/docs_md/04-druid_assets.md">Druid asset store</a></p>
|
||||
|
||||
<p>Full <strong>Druid</strong> documentation you can find here:
|
||||
https://insality.github.io/druid/</p>
|
||||
@ -316,15 +327,15 @@ https://insality.github.io/druid/</p>
|
||||
<p><a name="Games_powered_by_Druid"></a></p>
|
||||
<h2>Games powered by Druid</h2>
|
||||
|
||||
<p><em>Will fill later</em></p>
|
||||
<p><em>You published your game and you using Druid? Note me!</em></p>
|
||||
|
||||
|
||||
<p><a name="License"></a></p>
|
||||
<h2>License</h2>
|
||||
|
||||
<ul>
|
||||
<li>Original created by <a href="https://github.com/AGulev">AGulev</a></li>
|
||||
<li>Developed and supporting by <a href="https://github.com/Insality">Insality</a></li>
|
||||
<li>Original idea by <a href="https://github.com/AGulev">AGulev</a></li>
|
||||
<li>Assets from <a href="http://www.kenney.nl/">Kenney</a></li>
|
||||
</ul>
|
||||
|
||||
@ -340,7 +351,7 @@ https://insality.github.io/druid/</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -39,7 +39,8 @@
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><strong>changelog</strong></li>
|
||||
<li><strong>Druid 0.3.0:</strong></li>
|
||||
<li><a href="../topics/faq.md.html">faq</a></li>
|
||||
<li><a href="../topics/README.md.html">README</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
@ -47,23 +48,24 @@
|
||||
<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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.grid.html">druid.grid</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.dynamic_grid.html">druid.dynamic_grid</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>
|
||||
<li><a href="../modules/druid.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</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/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>
|
||||
@ -72,7 +74,8 @@
|
||||
|
||||
<div id="content">
|
||||
|
||||
Druid 0.3.0:</p>
|
||||
|
||||
<h3>Druid 0.3.0:</h3>
|
||||
|
||||
<ul>
|
||||
<li><p><code>Druid:final()</code> now is important function for correct working</p></li>
|
||||
@ -119,7 +122,7 @@
|
||||
- Space is <span class="keyword">not</span> working <span class="keyword">in</span> HTML5
|
||||
</pre>
|
||||
|
||||
<p>Druid 0.4.0:</p></li>
|
||||
<h3>Druid 0.4.0:</h3></li>
|
||||
<li><p>Add <em>Drag</em> basic component</p>
|
||||
|
||||
<pre>
|
||||
@ -157,7 +160,7 @@
|
||||
|
||||
<pre>
|
||||
- Anchor by default equals to node pivot (so, more component settings <span class="keyword">in</span> _.gui_ settings) (#<span class="number">51</span>)
|
||||
- Function <span class="backtick"><a href="../modules/druid.grid.html#clear">grid:clear</a></span> now don't delete any GUI nodes. Druid will <span class="keyword">not</span> care about <span class="backtick"><code>gui.delete_node</code></span> logic anymore (#<span class="number">56</span>)
|
||||
- Function <span class="backtick"><code>grid:clear</code></span> now don't delete any GUI nodes. Druid will <span class="keyword">not</span> care about <span class="backtick"><code>gui.delete_node</code></span> logic anymore (#<span class="number">56</span>)
|
||||
</pre>
|
||||
</li>
|
||||
<li><p>Druid <em>Hover</em> component now have two <em>hover</em> events (#49):</p>
|
||||
@ -188,18 +191,61 @@
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Druid 0.5.0:
|
||||
- <strong>Fix #61:</strong> Button component: fix button animation node creation
|
||||
- <strong>Fix #64:</strong> Hover component: wrong mouse_hover default state
|
||||
- <strong>Fix #71:</strong> Blocker: blocker now correct block mouse hover event
|
||||
- <strong>Fix #72:</strong> Fix <code>return nil</code> in some <code>on_input</code> functions
|
||||
- <strong>Fix #74:</strong> Fix typo: strech -> stretch. Scroll function <code>set_extra_stretch_size</code> renamed
|
||||
<h3>Druid 0.5.0:</h3>
|
||||
|
||||
<p>Besides a lot of fixes (thanks for feedback!) two components was add: <em>StaticGrid</em> and <em>DynamicGrid</em> instead of usual <em>Grid</em> component (it is deprecated now).
|
||||
Add <em>component:set</em>input<em>enabled</em> for basic component class. So you can enable/disable user input for any component.
|
||||
Finaly implemented <em>on</em>layout<em>changed</em> support. Druid components now will try keep their data between layout changing! You also can use this callback in your custom components.
|
||||
Also check <em>component.template.lua</em> what you can use for your own custom components!</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>#77</strong> Grid update:
|
||||
|
||||
<pre>
|
||||
- The _grid_ component now is __deprecated__. Use _static_grid_ instead. Druid will show you deprecated message, <span class="keyword">if</span> you still using _grid_ component
|
||||
- __[BREAKING]__ Remove the _grid:set_offset_ grid functions. To adjust the distance between nodes inside grid - setup correct node sizes
|
||||
- Add _static_grid_ component
|
||||
- The behaviour like previous _grid_ component
|
||||
- Have constant element size, so have ability to precalculate positions, indexes <span class="keyword">and</span> size of content
|
||||
- By default, <span class="keyword">not</span> shifting elements on removing element. Add _is_shift_ flag to _static_grid:remove_ <span class="keyword">function</span>
|
||||
- This grid can spawn elements with several rows <span class="keyword">and</span> columns
|
||||
- Add _dynamic_grid_ component
|
||||
- Can have different element size. So have no ability to precalculate stuff like _static_grid_
|
||||
- This grid can't have gaps between elements. You will get the <span class="global">error</span>, <span class="keyword">if</span> spawn element far away from other elements
|
||||
- The grid can spawn elements only <span class="keyword">in</span> row <span class="keyword">or</span> <span class="keyword">in</span> column
|
||||
- The grid node should have __West__, __East__, __South__ <span class="keyword">or</span> __North__ pivot (vertical <span class="keyword">or</span> horizontal element placement)
|
||||
- Able to shift nodes left <span class="keyword">or</span> right on _grid:add_ / _grid:remove_ functions
|
||||
</pre>
|
||||
</li>
|
||||
<li>Scroll update:
|
||||
|
||||
<pre>
|
||||
- Add _scroll:set_vertical_scroll_ <span class="keyword">and</span> _scroll:set_horizontal_scroll_ <span class="keyword">for</span> disable scroll sides
|
||||
- Add _scroll:bind_grid_ <span class="keyword">function</span>. Now is possible to bind Druid Grid component (Static <span class="keyword">or</span> Dynamic) to the scroll <span class="keyword">for</span> auto refresh the scroll size on grid nodes changing
|
||||
</pre>
|
||||
</li>
|
||||
<li><strong>#37</strong> Add <em>on</em>layout<em>change</em> support. Druid will keep and restore GUI component data between changing game layout. Override function <em>on</em>layout<em>change</em> in your custom components to do stuff you need.</li>
|
||||
<li><strong>#85</strong> Move several components from <code>base</code> folder to <code>extended</code>. In future to use them, you have to register them manually. This is done for decrease build size by excluding unused components</li>
|
||||
<li><strong>Fix #61:</strong> Button component: fix button animation node creation</li>
|
||||
<li><strong>Fix #64:</strong> Hover component: wrong mouse_hover default state</li>
|
||||
<li><strong>Fix #71:</strong> Blocker: blocker now correct block mouse hover event</li>
|
||||
<li><strong>Fix #72:</strong> Fix <code>return nil</code> in some <code>on_input</code> functions</li>
|
||||
<li><strong>Fix #74:</strong> <strong>[BREAKING]</strong> Fix typo: strech -> stretch. Scroll function <code>set_extra_stretch_size</code> renamed</li>
|
||||
<li><strong>Fix #76:</strong> Add params for lang text localization component</li>
|
||||
<li><strong>Fix #79:</strong> Fix <em>druid:remove</em> inside on_input callback</li>
|
||||
<li><strong>Fix #80:</strong> Fix <em>hover:set</em>enable_ typo function call</li>
|
||||
<li><strong>Fix #88:</strong> Add <em>component:set</em>input<em>enabled</em> function to enable/disable input for druid component. Now you can disable input of any druid component, even complex (with other components inside)</li>
|
||||
<li>Add <code>component.template.lua</code> as template for Druid custom component</li>
|
||||
<li>Update the example app</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</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-06-14 20:13:02 </i>
|
||||
<i style="float:right;">Last updated 2020-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
161
docs/topics/faq.md.html
Normal file
161
docs/topics/faq.md.html
Normal file
@ -0,0 +1,161 @@
|
||||
<!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_fixed.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>Topics</h2>
|
||||
<ul class="">
|
||||
<li><a href="../topics/01-components.md.html">01-components</a></li>
|
||||
<li><a href="../topics/02-creating_custom_components.md.html">Creating custom components</a></li>
|
||||
<li><a href="../topics/03-styles.md.html">Styles</a></li>
|
||||
<li><a href="../topics/04-druid_assets.md.html">Druid assets</a></li>
|
||||
<li><a href="../topics/05-examples.md.html">Examples</a></li>
|
||||
<li><a href="../topics/changelog.md.html">Druid 0.3.0:</a></li>
|
||||
<li><strong>faq</strong></li>
|
||||
<li><a href="../topics/README.md.html">README</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.drag.html">druid.drag</a></li>
|
||||
<li><a href="../modules/druid.hover.html">druid.hover</a></li>
|
||||
<li><a href="../modules/druid.scroll.html">druid.scroll</a></li>
|
||||
<li><a href="../modules/druid.static_grid.html">druid.static_grid</a></li>
|
||||
<li><a href="../modules/druid.swipe.html">druid.swipe</a></li>
|
||||
<li><a href="../modules/druid.text.html">druid.text</a></li>
|
||||
<li><a href="../modules/component.html">component</a></li>
|
||||
<li><a href="../modules/druid.html">druid</a></li>
|
||||
<li><a href="../modules/druid_event.html">druid_event</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.dynamic_grid.html">druid.dynamic_grid</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.slider.html">druid.slider</a></li>
|
||||
<li><a href="../modules/druid.timer.html">druid.timer</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>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
|
||||
<h1>Druid FAQ</h1>
|
||||
|
||||
<blockquote>
|
||||
<p><em>Have questions about Druid? Ask me!</em>
|
||||
<em>Here is questions you might have</em></p>
|
||||
</blockquote>
|
||||
|
||||
<h3>Q: Why I want use Druid?</h3>
|
||||
<p><strong>A:</strong> ---</p>
|
||||
|
||||
|
||||
<h3>Q: How to remove the Druid component instance?</h3>
|
||||
<p><strong>A:</strong> Any created <strong>Druid</strong> component can be removed with <em>druid:remove</em>. <a href="https://insality.github.io/druid/modules/druid_instance.html#druid:remove">API reference link</a>.</p>
|
||||
|
||||
|
||||
<h3>Q: How to make scroll work?</h3>
|
||||
<p><strong>A:</strong> ---</p>
|
||||
|
||||
|
||||
<h3>Q: How the input is processing?</h3>
|
||||
<p><strong>A:</strong>
|
||||
<em>SImply</em>: the <strong>Druid</strong> has a LIFO queue to check input. Last added buttons have more priority than first. Placing your buttons from behind to the front is correct in most cases.</p>
|
||||
|
||||
|
||||
<h3>Q: For what purpose Blocker component is exist?</h3>
|
||||
<p><strong>A:</strong> Component explanation <a href="https://github.com/Insality/druid/blob/master/docs_md/01-components.md#notes-2">here</a>.
|
||||
With Blocker you can block input in some zone. It is useful for make unclickable zone in buttons or kind of buttons panel on other big button (ex. close windows on window background click)</p>
|
||||
|
||||
|
||||
<h3>Q: Which stuff can I do with custom components?</h3>
|
||||
<p><strong>A:</strong> Any of you can imagine! There is a lot of examples, but in general: custom components allow you place component and some game logic separately from other stuff. It will be reusable, easier for testing and developing.</p>
|
||||
|
||||
<p>For example it can be element in scroll with buttons, your custom GUI widget or even component with your game logic. Usually custom components going with templates. You can do several templates for single component module (for different visuals!)</p>
|
||||
|
||||
<p>Some examples of custom components you can find <a href="https://github.com/Insality/druid-assets">here</a>.</p>
|
||||
|
||||
|
||||
<h3>Q: How *self:get_node()* is working?</h3>
|
||||
<p><strong>A:</strong> The node can be placed in gui directly or can be cloned via *gui.clone_tree()*. Also nodes can be placed as templates, so full node id will be composed from template name and node name (in cloned nodes too).</p>
|
||||
|
||||
<p><strong>Druid</strong> component *self:get<em>node()* trying to search in all of this places. Use *self:set</em>template()* and *self:set<em>component</em>nodes()* for correct setup component nodes before any call of *self:get_node()*.</p>
|
||||
|
||||
<p>Remember, usually you should pass <em><strong>string name</strong> of the node</em>, not gui node itself. It's better and more druid-way. </p>
|
||||
|
||||
|
||||
<h3>Q: My button in scroll is clickable outside the stencil node</h3>
|
||||
<p><strong>A:</strong> Since <strong>Druid</strong> checking click node with <em>gui.pick</em>node_, stencil is not prevent this. You can setup additional click zone on your buttons with <em>button:set</em>click<em>zone</em>.</p>
|
||||
|
||||
<p>The usual Druid way after add button to the scroll do:</p>
|
||||
|
||||
<pre>
|
||||
<span class="comment">-- Scroll view node usually is stencil node
|
||||
</span>button:set_click_zone(scroll.view_node)
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<h3>Q: How to use EmmyLua annotations? <em>(from Druid 0.6.0)</em></h3>
|
||||
<p><strong>A:</strong> Since the dependencies can't be processed by external editors, for use generated EmmyLua annotations you should copy the <em>annotations.lua</em> to your project. For EmmyLua it will be enough. Remember you can <em>restart emmylua server</em> for refresh the changes, if something goes wrong.
|
||||
After the annotations is processed, you should point the type of druid in requires:</p>
|
||||
|
||||
<pre>
|
||||
<span class="comment">---@type druid
|
||||
</span><span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
|
||||
<span class="comment">-- Now the autocomplete is working</span>
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<h3>Q: When I should use *on<em>layout</em>change*?</h3>
|
||||
<p><strong>A:</strong> ---</p>
|
||||
|
||||
|
||||
</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-09-29 23:46:16 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
@ -13,6 +13,9 @@ Basic Druid input component. Handle input on node and provide different callback
|
||||
Create button with druid: `button = druid:new_button(node_name, callback, [params], [animation_node])`
|
||||
Where node name is name of node from GUI scene. You can use `node_name` as input trigger zone and point another node for animation via `animation_node`
|
||||
|
||||
### Usecase
|
||||
_fill example usecases_
|
||||
|
||||
### Notes
|
||||
- Button callback have next params: (self, params, button_instance)
|
||||
- **self** - Druid self context
|
||||
@ -146,6 +149,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
||||
- Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
|
||||
- If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles
|
||||
|
||||
|
||||
## Slider
|
||||
[Slider API here](https://insality.github.io/druid/modules/druid.slider.html)
|
||||
|
||||
@ -161,11 +165,12 @@ Pin node (node_name in params) should be placed in zero position (initial). It w
|
||||
- You can setup points of interests on slider via `slider:set_steps`. If steps are exist, slider values will be only from this steps (notched slider)
|
||||
- For now, start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)
|
||||
|
||||
|
||||
## Input
|
||||
[Input API here](https://insality.github.io/druid/modules/druid.input.html)
|
||||
|
||||
### Overview
|
||||
Basic Druid text input component (unimplemented)
|
||||
Basic Druid text input component
|
||||
|
||||
### Setup
|
||||
Create input component with druid: `input = druid:new_input(button_node_name, text_node_name, keyboard_type)`
|
||||
@ -194,6 +199,7 @@ Create checkbox component with druid: `checkbox = druid:new_checkbox(node, callb
|
||||
- Checkbox uses button to handle click
|
||||
- You can setup another node to handle input with click_node arg in component init: `druid:new_checkbox(node, callback, [click_node])`
|
||||
|
||||
|
||||
## Checkbox group
|
||||
[Checkbox group API here](https://insality.github.io/druid/modules/druid.checkbox_group.html)
|
||||
|
||||
@ -222,6 +228,7 @@ Create radio_group component with druid: `group = druid:new_radio_group(nodes[],
|
||||
- You can get/set radio_group state with `group:set_state()` and `group:get_state()`
|
||||
- Only different from checkbox_group: on click another checkboxes in this group will be unchecked
|
||||
|
||||
|
||||
## Timer
|
||||
[Timer API here](https://insality.github.io/druid/modules/druid.timer.html)
|
||||
|
||||
@ -236,21 +243,51 @@ Create timer component with druid: `timer = druid:new_timer(text_node, from_seco
|
||||
- Timer will setup text node with current timer value
|
||||
- Timer uses update function to handle time
|
||||
|
||||
## Grid
|
||||
[Grid API here](https://insality.github.io/druid/modules/druid.grid.html)
|
||||
|
||||
## Static Grid
|
||||
[Static Grid API here](https://insality.github.io/druid/modules/druid.static_grid.html)
|
||||
|
||||
### Overview
|
||||
Component for manage node positions. Very simple implementation for nodes with equal size
|
||||
Component for manage node positions.
|
||||
Static grid have constant node size, so it possible to calculate node positions before placement. Nodes can be placed with gaps.
|
||||
Static grid can shift elements on add/remove functions.
|
||||
|
||||
### Setup
|
||||
Create component with druid: `grid = druid:new_grid(parent_node, prefab_node, max_in_row_elements)`
|
||||
Create component with druid: `grid = druid:new_static_grid(parent_node, prefab_node, max_in_row_elements)`
|
||||
|
||||
### Notes
|
||||
- Grid on _adding elements_ will setup parent to _parent_node_
|
||||
- On _add node_ grid will set node parent to _parent_node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can adjust anchor and border between elements
|
||||
- _Prefab node_ in component init used to get grid item size
|
||||
- You can also bind the grid to the scroll component for auto resize scroll content size
|
||||
- Pivot of parent_node matter for node placement
|
||||
- _Prefab node_ used to get node size and anchor
|
||||
- You can point *position_function* for animations with _static_grid:set_position_function(node, pos)_ callback. Default - *gui.set_position()*
|
||||
|
||||
|
||||
## Dynamic Grid
|
||||
[Dynamic Grid API here](https://insality.github.io/druid/modules/druid.dynamic_grid.html)
|
||||
|
||||
### Overview
|
||||
Component for manage node positions with different node sizes.
|
||||
Unlike Static Grid, Dynamic Grid can place nodes only in one row or in one column.
|
||||
Dynamic Grid can't have gaps between elements - you will get error, if try spawn element far away from others.
|
||||
Dynamic Grid should have __West__, __East__, __South__ or __North__ pivot (vertical or horizontal element placement)
|
||||
|
||||
### Setup
|
||||
Create component with druid: `grid = druid:new_dynamic_grid(parent_node)`
|
||||
|
||||
Check the _parent_node_ have correct pivot point. You will get the error otherwise.
|
||||
|
||||
### Notes
|
||||
- On _add node_ grid will set node parent to _parent_node_
|
||||
- You can get array of position of every element for setup points of interest in scroll component
|
||||
- You can get size of all elements for setup size in scroll component
|
||||
- You can also bind the grid to the scroll component for auto resize scroll content size
|
||||
- Pivot of parent_node matter for node placement
|
||||
- You can point *position_function* for animations with _static_grid:set_position_function(node, pos)_ callback. Default - *gui.set_position()*
|
||||
- First node placed at Grid pivot point. Other nodes placed nearby of other nodes.
|
||||
- On *add/remove* nodes always shifted. You can point the shift side in this functions (*is_shift_left* boolean argument)
|
||||
|
||||
## Hover
|
||||
[Hover API here](https://insality.github.io/druid/modules/druid.hover.html)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Druid 0.3.0:
|
||||
### Druid 0.3.0:
|
||||
|
||||
- `Druid:final()` now is important function for correct working
|
||||
|
||||
@ -42,7 +42,7 @@ Druid 0.3.0:
|
||||
|
||||
|
||||
|
||||
Druid 0.4.0:
|
||||
### Druid 0.4.0:
|
||||
|
||||
- Add _Drag_ basic component
|
||||
- Drag component allow you detect dragging on GUI node
|
||||
@ -93,14 +93,41 @@ Druid 0.4.0:
|
||||
- **Fix #53:** Bug with final _Druid instance_ without any components
|
||||
|
||||
|
||||
Druid 0.5.0:
|
||||
### Druid 0.5.0:
|
||||
|
||||
Besides a lot of fixes (thanks for feedback!) two components was add: _StaticGrid_ and _DynamicGrid_ instead of usual _Grid_ component (it is deprecated now).
|
||||
Add _component:set_input_enabled_ for basic component class. So you can enable/disable user input for any component.
|
||||
Finaly implemented _on_layout_changed_ support. Druid components now will try keep their data between layout changing! You also can use this callback in your custom components.
|
||||
Also check _component.template.lua_ what you can use for your own custom components!
|
||||
|
||||
- **#77** Grid update:
|
||||
- The _grid_ component now is __deprecated__. Use _static_grid_ instead. Druid will show you deprecated message, if you still using _grid_ component
|
||||
- __[BREAKING]__ Remove the _grid:set_offset_ grid functions. To adjust the distance between nodes inside grid - setup correct node sizes
|
||||
- Add _static_grid_ component
|
||||
- The behaviour like previous _grid_ component
|
||||
- Have constant element size, so have ability to precalculate positions, indexes and size of content
|
||||
- By default, not shifting elements on removing element. Add _is_shift_ flag to _static_grid:remove_ function
|
||||
- This grid can spawn elements with several rows and columns
|
||||
- Add _dynamic_grid_ component
|
||||
- Can have different element size. So have no ability to precalculate stuff like _static_grid_
|
||||
- This grid can't have gaps between elements. You will get the error, if spawn element far away from other elements
|
||||
- The grid can spawn elements only in row or in column
|
||||
- The grid node should have __West__, __East__, __South__ or __North__ pivot (vertical or horizontal element placement)
|
||||
- Able to shift nodes left or right on _grid:add_ / _grid:remove_ functions
|
||||
- Scroll update:
|
||||
- Add _scroll:set_vertical_scroll_ and _scroll:set_horizontal_scroll_ for disable scroll sides
|
||||
- Add _scroll:bind_grid_ function. Now is possible to bind Druid Grid component (Static or Dynamic) to the scroll for auto refresh the scroll size on grid nodes changing
|
||||
- **#37** Add _on_layout_change_ support. Druid will keep and restore GUI component data between changing game layout. Override function _on_layout_change_ in your custom components to do stuff you need.
|
||||
- **#85** Move several components from `base` folder to `extended`. In future to use them, you have to register them manually. This is done for decrease build size by excluding unused components
|
||||
- **Fix #61:** Button component: fix button animation node creation
|
||||
- **Fix #64:** Hover component: wrong mouse_hover default state
|
||||
- **Fix #71:** Blocker: blocker now correct block mouse hover event
|
||||
- **Fix #72:** Fix `return nil` in some `on_input` functions
|
||||
- **Fix #74:** Fix typo: strech -> stretch. Scroll function `set_extra_stretch_size` renamed
|
||||
- **Fix #74:** __[BREAKING]__ Fix typo: strech -> stretch. Scroll function `set_extra_stretch_size` renamed
|
||||
- **Fix #76:** Add params for lang text localization component
|
||||
- **Fix #79:** Fix druid:remove inside on_input callback
|
||||
- **Fix #80:** Fix hover set_enable typo function call
|
||||
- Add `component.tempalte.lua` as template for Druid custom component
|
||||
- **Fix #79:** Fix _druid:remove_ inside on_input callback
|
||||
- **Fix #80:** Fix _hover:set_enable_ typo function call
|
||||
- **Fix #88:** Add _component:set_input_enabled_ function to enable/disable input for druid component. Now you can disable input of any druid component, even complex (with other components inside)
|
||||
- Add `component.template.lua` as template for Druid custom component
|
||||
- Update the example app
|
||||
|
||||
|
67
docs_md/faq.md
Normal file
67
docs_md/faq.md
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
# Druid FAQ
|
||||
|
||||
>_Have questions about Druid? Ask me!_
|
||||
> _Here is questions you might have_
|
||||
|
||||
### Q: Why I want use Druid?
|
||||
**A:** ---
|
||||
|
||||
|
||||
### Q: How to remove the Druid component instance?
|
||||
**A:** Any created **Druid** component can be removed with _druid:remove_. [API reference link](https://insality.github.io/druid/modules/druid_instance.html#druid:remove).
|
||||
|
||||
|
||||
### Q: How to make scroll work?
|
||||
**A:** ---
|
||||
|
||||
|
||||
### Q: How the input is processing?
|
||||
**A:**
|
||||
*SImply*: the **Druid** has a LIFO queue to check input. Last added buttons have more priority than first. Placing your buttons from behind to the front is correct in most cases.
|
||||
|
||||
|
||||
### Q: For what purpose Blocker component is exist?
|
||||
**A:** Component explanation [here](https://github.com/Insality/druid/blob/master/docs_md/01-components.md#notes-2).
|
||||
With Blocker you can block input in some zone. It is useful for make unclickable zone in buttons or kind of buttons panel on other big button (ex. close windows on window background click)
|
||||
|
||||
|
||||
### Q: Which stuff can I do with custom components?
|
||||
**A:** Any of you can imagine! There is a lot of examples, but in general: custom components allow you place component and some game logic separately from other stuff. It will be reusable, easier for testing and developing.
|
||||
|
||||
For example it can be element in scroll with buttons, your custom GUI widget or even component with your game logic. Usually custom components going with templates. You can do several templates for single component module (for different visuals!)
|
||||
|
||||
Some examples of custom components you can find [here](https://github.com/Insality/druid-assets).
|
||||
|
||||
|
||||
### Q: How *self:get_node()* is working?
|
||||
**A:** The node can be placed in gui directly or can be cloned via *gui.clone_tree()*. Also nodes can be placed as templates, so full node id will be composed from template name and node name (in cloned nodes too).
|
||||
|
||||
**Druid** component *self:get_node()* trying to search in all of this places. Use *self:set_template()* and *self:set_component_nodes()* for correct setup component nodes before any call of *self:get_node()*.
|
||||
|
||||
Remember, usually you should pass *__string name__ of the node*, not gui node itself. It's better and more druid-way.
|
||||
|
||||
|
||||
### Q: My button in scroll is clickable outside the stencil node
|
||||
**A:** Since **Druid** checking click node with _gui.pick_node_, stencil is not prevent this. You can setup additional click zone on your buttons with _button:set_click_zone_.
|
||||
|
||||
The usual Druid way after add button to the scroll do:
|
||||
```lua
|
||||
-- Scroll view node usually is stencil node
|
||||
button:set_click_zone(scroll.view_node)
|
||||
```
|
||||
|
||||
|
||||
### Q: How to use EmmyLua annotations? _(from Druid 0.6.0)_
|
||||
**A:** Since the dependencies can't be processed by external editors, for use generated EmmyLua annotations you should copy the _annotations.lua_ to your project. For EmmyLua it will be enough. Remember you can _restart emmylua server_ for refresh the changes, if something goes wrong.
|
||||
After the annotations is processed, you should point the type of druid in requires:
|
||||
```lua
|
||||
---@type druid
|
||||
local druid = require("druid.druid")
|
||||
|
||||
-- Now the autocomplete is working
|
||||
```
|
||||
|
||||
|
||||
### Q: When I should use *on_layout_change*?
|
||||
**A:** ---
|
@ -13,14 +13,14 @@ local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("back_handler", { const.ON_INPUT })
|
||||
local BackHandler = component.create("back_handler", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function back_handler:init
|
||||
-- @tparam callback callback On back button
|
||||
-- @tparam[opt] params Callback argument
|
||||
function M.init(self, callback, params)
|
||||
function BackHandler:init(callback, params)
|
||||
self.params = params
|
||||
|
||||
self.on_back = Event(callback)
|
||||
@ -31,7 +31,7 @@ end
|
||||
-- @function back_handler:on_input
|
||||
-- @tparam string action_id on_input action id
|
||||
-- @tparam table action on_input action
|
||||
function M.on_input(self, action_id, action)
|
||||
function BackHandler:on_input(action_id, action)
|
||||
if not action[const.RELEASED] then
|
||||
return false
|
||||
end
|
||||
@ -45,4 +45,4 @@ function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return BackHandler
|
||||
|
@ -14,13 +14,13 @@ local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("blocker", { const.ON_INPUT })
|
||||
local Blocker = component.create("blocker", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function blocker:init
|
||||
-- @tparam node node Gui node
|
||||
function M.init(self, node)
|
||||
function Blocker:init(node)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
self.on_click = Event()
|
||||
@ -28,7 +28,7 @@ function M.init(self, node)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Blocker:on_input(action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH and
|
||||
action_id ~= const.ACTION_MULTITOUCH and
|
||||
action_id ~= nil then
|
||||
@ -50,7 +50,7 @@ end
|
||||
--- Set enabled blocker component state
|
||||
-- @function blocker:set_enabled
|
||||
-- @tparam bool state Enabled state
|
||||
function M.set_enabled(self, state)
|
||||
function Blocker:set_enabled(state)
|
||||
gui.set_enabled(self.node, state)
|
||||
end
|
||||
|
||||
@ -58,9 +58,9 @@ end
|
||||
--- Return blocked enabled state
|
||||
-- @function blocker:is_enabled
|
||||
-- @treturn bool True, if blocker is enabled
|
||||
function M.is_enabled(self, state)
|
||||
function Blocker:is_enabled(state)
|
||||
return gui.is_enabled(self.node)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Blocker
|
||||
|
@ -26,7 +26,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("button", { const.ON_INPUT })
|
||||
local Button = component.create("button", { const.ON_INPUT })
|
||||
|
||||
|
||||
local function is_input_match(self, action_id)
|
||||
@ -141,7 +141,7 @@ end
|
||||
-- @tfield function on_hover (self, node, hover_state)
|
||||
-- @tfield function on_mouse_hover (self, node, hover_state)
|
||||
-- @tfield function on_set_enabled (self, node, enabled_state)
|
||||
function M.on_style_change(self, style)
|
||||
function Button:on_style_change(style)
|
||||
self.style = {}
|
||||
self.style.LONGTAP_TIME = style.LONGTAP_TIME or 0.4
|
||||
self.style.AUTOHOLD_TRIGGER = style.AUTOHOLD_TRIGGER or 0.8
|
||||
@ -161,7 +161,7 @@ end
|
||||
-- @tparam function callback Button callback
|
||||
-- @tparam[opt] table params Button callback params
|
||||
-- @tparam[opt] node anim_node Button anim node (node, if not provided)
|
||||
function M.init(self, node, callback, params, anim_node)
|
||||
function Button:init(node, callback, params, anim_node)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
|
||||
@ -188,7 +188,7 @@ function M.init(self, node, callback, params, anim_node)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Button:on_input(action_id, action)
|
||||
if not is_input_match(self, action_id) then
|
||||
return false
|
||||
end
|
||||
@ -257,7 +257,7 @@ function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input_interrupt(self)
|
||||
function Button:on_input_interrupt()
|
||||
self.can_action = false
|
||||
end
|
||||
|
||||
@ -266,7 +266,7 @@ end
|
||||
-- @function button:set_enabled
|
||||
-- @tparam bool state Enabled state
|
||||
-- @treturn druid.button Current button instance
|
||||
function M.set_enabled(self, state)
|
||||
function Button:set_enabled(state)
|
||||
self.disabled = not state
|
||||
self.hover:set_enabled(state)
|
||||
self.style.on_set_enabled(self, self.node, state)
|
||||
@ -278,7 +278,7 @@ end
|
||||
--- Return button enabled state
|
||||
-- @function button:is_enabled
|
||||
-- @treturn bool True, if button is enabled
|
||||
function M.is_enabled(self)
|
||||
function Button:is_enabled()
|
||||
return not self.disabled
|
||||
end
|
||||
|
||||
@ -288,7 +288,7 @@ end
|
||||
-- @function button:set_click_zone
|
||||
-- @tparam node zone Gui node
|
||||
-- @treturn druid.button Current button instance
|
||||
function M.set_click_zone(self, zone)
|
||||
function Button:set_click_zone(zone)
|
||||
self.click_zone = self:get_node(zone)
|
||||
self.hover:set_click_zone(zone)
|
||||
|
||||
@ -300,7 +300,7 @@ end
|
||||
-- @function button:set_key_trigger
|
||||
-- @tparam hash key The action_id of the key
|
||||
-- @treturn druid.button Current button instance
|
||||
function M.set_key_trigger(self, key)
|
||||
function Button:set_key_trigger(key)
|
||||
self.key_trigger = hash(key)
|
||||
|
||||
return self
|
||||
@ -310,9 +310,9 @@ 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)
|
||||
function Button:get_key_trigger()
|
||||
return self.key_trigger
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Button
|
||||
|
@ -27,7 +27,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("drag", { const.ON_INPUT_HIGH })
|
||||
local Drag = component.create("drag", { const.ON_INPUT_HIGH })
|
||||
|
||||
|
||||
local function start_touch(self, touch)
|
||||
@ -129,7 +129,7 @@ end
|
||||
-- or create your own style
|
||||
-- @table Style
|
||||
-- @tfield[opt=10] number DRAG_DEADZONE Distance in pixels to start dragging
|
||||
function M.on_style_change(self, style)
|
||||
function Drag:on_style_change(style)
|
||||
self.style = {}
|
||||
self.style.DRAG_DEADZONE = style.DRAG_DEADZONE or 10
|
||||
end
|
||||
@ -139,7 +139,7 @@ end
|
||||
-- @tparam node node GUI node to detect dragging
|
||||
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
||||
-- @function drag:init
|
||||
function M.init(self, node, on_drag_callback)
|
||||
function Drag:init(node, on_drag_callback)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
self.dx = 0
|
||||
@ -163,14 +163,14 @@ function M.init(self, node, on_drag_callback)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input_interrupt(self)
|
||||
function Drag:on_input_interrupt()
|
||||
if self.is_drag or self.is_touch then
|
||||
end_touch(self)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Drag:on_input(action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then
|
||||
return false
|
||||
end
|
||||
@ -243,9 +243,9 @@ end
|
||||
-- restrict events outside stencil node
|
||||
-- @function drag:set_click_zone
|
||||
-- @tparam node zone Gui node
|
||||
function M.set_click_zone(self, zone)
|
||||
function Drag:set_click_zone(zone)
|
||||
self.click_zone = self:get_node(zone)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Drag
|
||||
|
@ -1,173 +0,0 @@
|
||||
--- Component to handle placing components by row and columns.
|
||||
-- Grid can anchor your elements, get content size and other
|
||||
-- @module druid.grid
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_add_item On item add callback
|
||||
-- @tfield druid_event on_remove_item On item remove callback
|
||||
-- @tfield druid_event on_clear On grid clear callback
|
||||
-- @tfield druid_event on_update_positions On update item positions callback
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield node parent Parent gui node
|
||||
-- @tfield node[] nodes List of all grid nodes
|
||||
-- @tfield vector3 offset Item distance between each other items
|
||||
-- @tfield vector3 anchor Item anchor
|
||||
-- @tfield vector3 node_size Item size
|
||||
-- @tfield vector4 border The size of item content
|
||||
-- @tfield vector3 border_offer The border offset for correct anchor calculations
|
||||
|
||||
local Event = require("druid.event")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("grid")
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function grid:init
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
function M.init(self, parent, element, in_row)
|
||||
self.parent = self:get_node(parent)
|
||||
self.nodes = {}
|
||||
|
||||
self.offset = vmath.vector3(0)
|
||||
|
||||
local pivot = helper.get_pivot_offset(gui.get_pivot(self.parent))
|
||||
self.anchor = vmath.vector3(0.5 + pivot.x, 0.5 - pivot.y, 0)
|
||||
|
||||
self.in_row = in_row or 1
|
||||
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
|
||||
|
||||
|
||||
local function check_border(self, pos)
|
||||
local border = self.border
|
||||
local size = self.node_size
|
||||
|
||||
local W = pos.x - size.x/2 + self.border_offset.x
|
||||
local E = pos.x + size.x/2 + self.border_offset.x
|
||||
local N = pos.y + size.y/2 + self.border_offset.y
|
||||
local S = pos.y - size.y/2 + self.border_offset.y
|
||||
|
||||
border.x = math.min(border.x, W)
|
||||
border.y = math.max(border.y, N)
|
||||
border.z = math.max(border.z, E)
|
||||
border.w = math.min(border.w, S)
|
||||
|
||||
self.border_offset = vmath.vector3(
|
||||
(border.x + (border.z - border.x) * self.anchor.x),
|
||||
(border.y + (border.w - border.y) * self.anchor.y),
|
||||
0
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
local temp_pos = vmath.vector3(0)
|
||||
local function get_pos(self, index)
|
||||
local row = math.ceil(index / self.in_row) - 1
|
||||
local col = (index - row * self.in_row) - 1
|
||||
|
||||
temp_pos.x = col * (self.node_size.x + self.offset.x) - self.border_offset.x
|
||||
temp_pos.y = -row * (self.node_size.y + self.offset.y) - self.border_offset.y
|
||||
temp_pos.z = 0
|
||||
|
||||
return temp_pos
|
||||
end
|
||||
|
||||
|
||||
local function update_pos(self)
|
||||
for i = 1, #self.nodes do
|
||||
local node = self.nodes[i]
|
||||
gui.set_position(node, get_pos(self, i))
|
||||
end
|
||||
|
||||
self.on_update_positions:trigger(self:get_context())
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Set grid items offset, the distance between items
|
||||
-- @function grid:set_offset
|
||||
-- @tparam vector3 offset Offset
|
||||
function M.set_offset(self, offset)
|
||||
self.offset = offset
|
||||
update_pos(self)
|
||||
end
|
||||
|
||||
|
||||
--- Set grid anchor
|
||||
-- @function grid:set_anchor
|
||||
-- @tparam vector3 acnhor Anchor
|
||||
function M.set_anchor(self, anchor)
|
||||
self.anchor = anchor
|
||||
update_pos(self)
|
||||
end
|
||||
|
||||
|
||||
--- Add new item to the grid
|
||||
-- @function grid:add
|
||||
-- @tparam node item Gui node
|
||||
-- @tparam[opt] number index The item position. By default add as last item
|
||||
function M.add(self, item, index)
|
||||
index = index or (#self.nodes + 1)
|
||||
table.insert(self.nodes, index, item)
|
||||
gui.set_parent(item, self.parent)
|
||||
|
||||
local pos = get_pos(self, index)
|
||||
check_border(self, pos)
|
||||
update_pos(self)
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), item, index)
|
||||
end
|
||||
|
||||
|
||||
--- Return grid content size
|
||||
-- @function grid:get_size
|
||||
-- @treturn vector3 The grid content size
|
||||
function M.get_size(self)
|
||||
return vmath.vector3(
|
||||
self.border.z - self.border.x,
|
||||
self.border.y - self.border.w,
|
||||
0)
|
||||
end
|
||||
|
||||
|
||||
--- Return array of all node positions
|
||||
-- @function grid:get_all_pos
|
||||
-- @treturn vector3[] All grid node positions
|
||||
function M.get_all_pos(self)
|
||||
local result = {}
|
||||
for i = 1, #self.nodes do
|
||||
table.insert(result, gui.get_position(self.nodes[i]))
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--- Clear grid nodes array. GUI nodes will be not deleted!
|
||||
-- If you want to delete GUI nodes, use grid.nodes array before grid:clear
|
||||
-- @function grid:clear
|
||||
function M.clear(self)
|
||||
self.border.x = 0
|
||||
self.border.y = 0
|
||||
self.border.w = 0
|
||||
self.border.z = 0
|
||||
|
||||
self.nodes = {}
|
||||
end
|
||||
|
||||
|
||||
return M
|
@ -11,14 +11,14 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("hover", { const.ON_INPUT })
|
||||
local Hover = component.create("hover", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function hover:init
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function on_hover_callback Hover callback
|
||||
function M.init(self, node, on_hover_callback)
|
||||
function Hover:init(node, on_hover_callback)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
self._is_hovered = false
|
||||
@ -31,7 +31,7 @@ function M.init(self, node, on_hover_callback)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Hover:on_input(action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH and action_id ~= nil then
|
||||
return false
|
||||
end
|
||||
@ -49,7 +49,7 @@ function M.on_input(self, action_id, action)
|
||||
is_pick = is_pick and gui.pick_node(self.click_zone, action.x, action.y)
|
||||
end
|
||||
|
||||
local hover_function = action_id and M.set_hover or M.set_mouse_hover
|
||||
local hover_function = action_id and self.set_hover or self.set_mouse_hover
|
||||
|
||||
if not is_pick then
|
||||
hover_function(self, false)
|
||||
@ -64,7 +64,7 @@ function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input_interrupt(self)
|
||||
function Hover:on_input_interrupt()
|
||||
self:set_hover(false)
|
||||
end
|
||||
|
||||
@ -72,7 +72,7 @@ end
|
||||
--- Set hover state
|
||||
-- @function hover:set_hover
|
||||
-- @tparam bool state The hover state
|
||||
function M.set_hover(self, state)
|
||||
function Hover:set_hover(state)
|
||||
if self._is_hovered ~= state then
|
||||
self._is_hovered = state
|
||||
self.on_hover:trigger(self:get_context(), state)
|
||||
@ -82,7 +82,7 @@ end
|
||||
--- Set mouse hover state
|
||||
-- @function hover:set_mouse_hover
|
||||
-- @tparam bool state The mouse hover state
|
||||
function M.set_mouse_hover(self, state)
|
||||
function Hover:set_mouse_hover(state)
|
||||
if self._is_mouse_hovered ~= state then
|
||||
self._is_mouse_hovered = state
|
||||
self.on_mouse_hover:trigger(self:get_context(), state)
|
||||
@ -94,7 +94,7 @@ end
|
||||
-- no click events outside stencil node
|
||||
-- @function hover:set_click_zone
|
||||
-- @tparam node zone Gui node
|
||||
function M.set_click_zone(self, zone)
|
||||
function Hover:set_click_zone(zone)
|
||||
self.click_zone = self:get_node(zone)
|
||||
end
|
||||
|
||||
@ -104,7 +104,7 @@ end
|
||||
-- any hover events
|
||||
-- @function hover:set_enabled
|
||||
-- @tparam bool state The hover enabled state
|
||||
function M.set_enabled(self, state)
|
||||
function Hover:set_enabled(state)
|
||||
self._is_enabled = state
|
||||
|
||||
if not state then
|
||||
@ -121,9 +121,9 @@ end
|
||||
--- Return current hover enabled state
|
||||
-- @function hover:is_enabled
|
||||
-- @treturn bool The hover enabled state
|
||||
function M.is_enabled(self)
|
||||
function Hover:is_enabled()
|
||||
return self._is_enabled
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Hover
|
||||
|
@ -32,7 +32,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("scroll", { const.ON_UPDATE })
|
||||
local Scroll = component.create("scroll", { const.ON_UPDATE, const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function inverse_lerp(min, max, current)
|
||||
@ -61,7 +61,300 @@ local function get_size_vector(vector)
|
||||
end
|
||||
|
||||
|
||||
local function on_scroll_drag(self, dx, dy)
|
||||
--- Component style params.
|
||||
-- You can override this component styles params in druid styles table
|
||||
-- or create your own style
|
||||
-- @table Style
|
||||
-- @tfield[opt=0] number FRICT Multiplier for free inertion
|
||||
-- @tfield[opt=0] number FRICT_HOLD Multiplier for inertion, while touching
|
||||
-- @tfield[opt=3] number INERT_THRESHOLD Scroll speed to stop inertion
|
||||
-- @tfield[opt=30] number INERT_SPEED Multiplier for inertion speed
|
||||
-- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode
|
||||
-- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed
|
||||
-- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function
|
||||
-- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect)
|
||||
-- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled
|
||||
function Scroll:on_style_change(style)
|
||||
self.style = {}
|
||||
self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0
|
||||
self.style.ANIM_SPEED = style.ANIM_SPEED or 0.2
|
||||
self.style.BACK_SPEED = style.BACK_SPEED or 0.35
|
||||
|
||||
self.style.FRICT = style.FRICT or 0
|
||||
self.style.FRICT_HOLD = style.FRICT_HOLD or 0
|
||||
|
||||
self.style.INERT_THRESHOLD = style.INERT_THRESHOLD or 3
|
||||
self.style.INERT_SPEED = style.INERT_SPEED or 30
|
||||
self.style.POINTS_DEADZONE = style.POINTS_DEADZONE or 20
|
||||
self.style.SMALL_CONTENT_SCROLL = style.SMALL_CONTENT_SCROLL or false
|
||||
|
||||
self._is_inert = not (self.style.FRICT == 0 or
|
||||
self.style.FRICT_HOLD == 0 or
|
||||
self.style.INERT_SPEED == 0)
|
||||
end
|
||||
|
||||
|
||||
--- Scroll constructor.
|
||||
-- @function scroll:init
|
||||
-- @tparam node view_node GUI view scroll node
|
||||
-- @tparam node content_node GUI content scroll node
|
||||
function Scroll:init(view_node, content_node)
|
||||
self.druid = self:get_druid()
|
||||
|
||||
self.view_node = self:get_node(view_node)
|
||||
self.content_node = self:get_node(content_node)
|
||||
|
||||
self.position = gui.get_position(self.content_node)
|
||||
self.target_position = vmath.vector3(self.position)
|
||||
self.inertion = vmath.vector3(0)
|
||||
|
||||
self.drag = self.druid:new_drag(view_node, self._on_scroll_drag)
|
||||
self.drag.on_touch_start:subscribe(self._on_touch_start)
|
||||
self.drag.on_touch_end:subscribe(self._on_touch_end)
|
||||
|
||||
self.on_scroll = Event()
|
||||
self.on_scroll_to = Event()
|
||||
self.on_point_scroll = Event()
|
||||
|
||||
self.selected = nil
|
||||
self.is_animate = false
|
||||
|
||||
self._is_horizontal_scroll = true
|
||||
self._is_vertical_scroll = true
|
||||
self._grid_on_change = nil
|
||||
self._grid_on_change_callback = nil
|
||||
|
||||
self:_update_size()
|
||||
end
|
||||
|
||||
|
||||
function Scroll:on_layout_change()
|
||||
gui.set_position(self.content_node, self.position)
|
||||
end
|
||||
|
||||
|
||||
function Scroll:update(dt)
|
||||
if self.drag.is_drag then
|
||||
self:_update_hand_scroll(dt)
|
||||
else
|
||||
self:_update_free_scroll(dt)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Scroll:on_remove()
|
||||
self:bind_grid(nil)
|
||||
end
|
||||
|
||||
|
||||
--- Start scroll to target point.
|
||||
-- @function scroll:scroll_to
|
||||
-- @tparam point vector3 Target point
|
||||
-- @tparam[opt] bool is_instant Instant scroll flag
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0), true)
|
||||
function Scroll:scroll_to(point, is_instant)
|
||||
local b = self.available_pos
|
||||
local target = vmath.vector3(-point.x, -point.y, 0)
|
||||
target.x = helper.clamp(target.x, b.x, b.z)
|
||||
target.y = helper.clamp(target.y, b.y, b.w)
|
||||
|
||||
self:_cancel_animate()
|
||||
|
||||
self.is_animate = not is_instant
|
||||
|
||||
if is_instant then
|
||||
self.target_position = target
|
||||
self:_set_scroll_position(target)
|
||||
else
|
||||
gui.animate(self.content_node, gui.PROP_POSITION, target, gui.EASING_OUTSINE, self.style.ANIM_SPEED, 0, function()
|
||||
self.is_animate = false
|
||||
self.target_position = target
|
||||
self:_set_scroll_position(target)
|
||||
end)
|
||||
end
|
||||
|
||||
self.on_scroll_to:trigger(self:get_context(), target, is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Scroll to item in scroll by point index.
|
||||
-- @function scroll:scroll_to_index
|
||||
-- @tparam number index Point index
|
||||
-- @tparam[opt] bool skip_cb If true, skip the point callback
|
||||
function Scroll:scroll_to_index(index, skip_cb)
|
||||
if not self.points then
|
||||
return
|
||||
end
|
||||
|
||||
index = helper.clamp(index, 1, #self.points)
|
||||
|
||||
if self.selected ~= index then
|
||||
self.selected = index
|
||||
|
||||
if not skip_cb then
|
||||
self.on_point_scroll:trigger(self:get_context(), index, self.points[index])
|
||||
end
|
||||
end
|
||||
|
||||
self:scroll_to(self.points[index])
|
||||
end
|
||||
|
||||
|
||||
--- Start scroll to target scroll percent
|
||||
-- @function scroll:scroll_to_percent
|
||||
-- @tparam point vector3 target percent
|
||||
-- @tparam[opt] bool is_instant instant scroll flag
|
||||
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
||||
function Scroll:scroll_to_percent(percent, is_instant)
|
||||
local border = self.available_pos
|
||||
|
||||
local pos = vmath.vector3(
|
||||
-helper.lerp(border.x, border.z, 1 - percent.x),
|
||||
-helper.lerp(border.w, border.y, 1 - percent.y),
|
||||
0
|
||||
)
|
||||
|
||||
self:scroll_to(pos, is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Return current scroll progress status.
|
||||
-- Values will be in [0..1] interval
|
||||
-- @function scroll:get_percent
|
||||
-- @treturn vector3 New vector with scroll progress values
|
||||
function Scroll:get_percent()
|
||||
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
|
||||
local y_perc = inverse_lerp(self.available_pos.w, self.available_pos.y, self.position.y)
|
||||
|
||||
return vmath.vector3(x_perc, y_perc, 0)
|
||||
end
|
||||
|
||||
|
||||
--- Set scroll content size.
|
||||
-- It will change content gui node size
|
||||
-- @function scroll:set_size
|
||||
-- @tparam vector3 size The new size for content node
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_size(size)
|
||||
gui.set_size(self.content_node, size)
|
||||
self:_update_size()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Enable or disable scroll inert.
|
||||
-- If disabled, scroll through points (if exist)
|
||||
-- If no points, just simple drag without inertion
|
||||
-- @function scroll:set_inert
|
||||
-- @tparam bool state Inert scroll state
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_inert(state)
|
||||
self._is_inert = state
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return if scroll have inertion.
|
||||
-- @function scroll:is_inert
|
||||
-- @treturn bool If scroll have inertion
|
||||
function Scroll:is_inert()
|
||||
return self._is_inert
|
||||
end
|
||||
|
||||
|
||||
--- Set extra size for scroll stretching.
|
||||
-- Set 0 to disable stretching effect
|
||||
-- @function scroll:set_extra_stretch_size
|
||||
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_extra_stretch_size(stretch_size)
|
||||
self.style.EXTRA_STRETCH_SIZE = stretch_size or 0
|
||||
self:_update_size()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return vector of scroll size with width and height.
|
||||
-- @function scroll:get_scroll_size
|
||||
-- @treturn vector3 Available scroll size
|
||||
function Scroll:get_scroll_size()
|
||||
return self.available_size
|
||||
end
|
||||
|
||||
|
||||
--- Set points of interest.
|
||||
-- Scroll will always centered on closer points
|
||||
-- @function scroll:set_points
|
||||
-- @tparam table points Array of vector3 points
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_points(points)
|
||||
self.points = points
|
||||
|
||||
table.sort(self.points, function(a, b)
|
||||
return a.x > b.x or a.y < b.y
|
||||
end)
|
||||
|
||||
self:_check_threshold()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Lock or unlock horizontal scroll
|
||||
-- @function scroll:set_horizontal_scroll
|
||||
-- @tparam bool state True, if horizontal scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_horizontal_scroll(state)
|
||||
self._is_horizontal_scroll = state
|
||||
self.drag.can_x = self.available_size.x > 0 and state
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Lock or unlock vertical scroll
|
||||
-- @function scroll:set_vertical_scroll
|
||||
-- @tparam bool state True, if vertical scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:set_vertical_scroll(state)
|
||||
self._is_vertical_scroll = state
|
||||
self.drag.can_y = self.available_size.y > 0 and state
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Bind the grid component (Static or Dynamic) to recalculate
|
||||
-- scroll size on grid changes
|
||||
-- @function scroll:bind_grid
|
||||
-- @tparam druid.static_grid|druid.dynamic_grid Druid grid component
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll:bind_grid(grid)
|
||||
if self._grid_on_change then
|
||||
self._grid_on_change:unsubscribe(self._grid_on_change_callback)
|
||||
|
||||
self._grid_on_change = nil
|
||||
self._grid_on_change_callback = nil
|
||||
end
|
||||
|
||||
if not grid then
|
||||
return
|
||||
end
|
||||
|
||||
self._grid_on_change = grid.on_change_items
|
||||
self._grid_on_change_callback = self._grid_on_change:subscribe(function()
|
||||
self:set_size(grid:get_size())
|
||||
end)
|
||||
self:set_size(grid:get_size())
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function Scroll:_on_scroll_drag(dx, dy)
|
||||
local t = self.target_position
|
||||
local b = self.available_pos
|
||||
local eb = self.available_pos_extra
|
||||
@ -102,7 +395,7 @@ local function on_scroll_drag(self, dx, dy)
|
||||
end
|
||||
|
||||
|
||||
local function check_soft_zone(self)
|
||||
function Scroll:_check_soft_zone()
|
||||
local target = self.target_position
|
||||
local border = self.available_pos
|
||||
local speed = self.style.BACK_SPEED
|
||||
@ -127,7 +420,7 @@ end
|
||||
|
||||
|
||||
--- Cancel animation on other animation or input touch
|
||||
local function cancel_animate(self)
|
||||
function Scroll:_cancel_animate()
|
||||
if self.is_animate then
|
||||
self.target_position = gui.get_position(self.content_node)
|
||||
self.position.x = self.target_position.x
|
||||
@ -138,8 +431,7 @@ local function cancel_animate(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function set_scroll_position(self, position)
|
||||
function Scroll:_set_scroll_position(position)
|
||||
local available_extra = self.available_pos_extra
|
||||
position.x = helper.clamp(position.x, available_extra.x, available_extra.z)
|
||||
position.y = helper.clamp(position.y, available_extra.w, available_extra.y)
|
||||
@ -158,7 +450,7 @@ end
|
||||
-- if no inert, scroll to next point by scroll direction
|
||||
-- if inert, find next point by scroll director
|
||||
-- @local
|
||||
local function check_points(self)
|
||||
function Scroll:_check_points()
|
||||
if not self.points then
|
||||
return
|
||||
end
|
||||
@ -210,7 +502,7 @@ local function check_points(self)
|
||||
end
|
||||
|
||||
|
||||
local function check_threshold(self)
|
||||
function Scroll:_check_threshold()
|
||||
local is_stopped = false
|
||||
|
||||
if self.inertion.x ~= 0 and math.abs(self.inertion.x) < self.style.INERT_THRESHOLD then
|
||||
@ -223,12 +515,12 @@ local function check_threshold(self)
|
||||
end
|
||||
|
||||
if is_stopped or not self._is_inert then
|
||||
check_points(self)
|
||||
self:_check_points()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function update_free_scroll(self, dt)
|
||||
function Scroll:_update_free_scroll(dt)
|
||||
local target = self.target_position
|
||||
|
||||
if self._is_inert and (self.inertion.x ~= 0 or self.inertion.y ~= 0) then
|
||||
@ -236,31 +528,31 @@ local function update_free_scroll(self, dt)
|
||||
target.x = self.position.x + self.inertion.x * self.style.INERT_SPEED * dt
|
||||
target.y = self.position.y + self.inertion.y * self.style.INERT_SPEED * dt
|
||||
|
||||
check_threshold(self)
|
||||
self:_check_threshold()
|
||||
end
|
||||
|
||||
-- Inertion friction
|
||||
self.inertion = self.inertion * self.style.FRICT
|
||||
|
||||
check_soft_zone(self)
|
||||
self:_check_soft_zone()
|
||||
if self.position.x ~= target.x or self.position.y ~= target.y then
|
||||
set_scroll_position(self, target)
|
||||
self:_set_scroll_position(target)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function update_hand_scroll(self, dt)
|
||||
function Scroll:_update_hand_scroll(dt)
|
||||
local dx = self.target_position.x - self.position.x
|
||||
local dy = self.target_position.y - self.position.y
|
||||
|
||||
self.inertion.x = (self.inertion.x + dx) * self.style.FRICT_HOLD
|
||||
self.inertion.y = (self.inertion.y + dy) * self.style.FRICT_HOLD
|
||||
|
||||
set_scroll_position(self, self.target_position)
|
||||
self:_set_scroll_position(self.target_position)
|
||||
end
|
||||
|
||||
|
||||
local function on_touch_start(self)
|
||||
function Scroll:_on_touch_start()
|
||||
self.inertion.x = 0
|
||||
self.inertion.y = 0
|
||||
self.target_position.x = self.position.x
|
||||
@ -268,12 +560,12 @@ local function on_touch_start(self)
|
||||
end
|
||||
|
||||
|
||||
local function on_touch_end(self)
|
||||
check_threshold(self)
|
||||
function Scroll:_on_touch_end()
|
||||
self:_check_threshold()
|
||||
end
|
||||
|
||||
|
||||
local function update_size(self)
|
||||
function Scroll:_update_size()
|
||||
local view_border = helper.get_border(self.view_node)
|
||||
local view_size = vmath.mul_per_elem(gui.get_size(self.view_node), gui.get_scale(self.view_node))
|
||||
|
||||
@ -283,8 +575,8 @@ local function update_size(self)
|
||||
self.available_pos = get_border_vector(view_border - content_border)
|
||||
self.available_size = get_size_vector(self.available_pos)
|
||||
|
||||
self.drag.can_x = self.available_size.x > 0
|
||||
self.drag.can_y = self.available_size.y > 0
|
||||
self.drag.can_x = self.available_size.x > 0 and self._is_horizontal_scroll
|
||||
self.drag.can_y = self.available_size.y > 0 and self._is_vertical_scroll
|
||||
|
||||
-- Extra content size calculation
|
||||
-- We add extra size only if scroll is available
|
||||
@ -314,232 +606,4 @@ local function update_size(self)
|
||||
end
|
||||
|
||||
|
||||
--- Component style params.
|
||||
-- You can override this component styles params in druid styles table
|
||||
-- or create your own style
|
||||
-- @table Style
|
||||
-- @tfield[opt=0] number FRICT Multiplier for free inertion
|
||||
-- @tfield[opt=0] number FRICT_HOLD Multiplier for inertion, while touching
|
||||
-- @tfield[opt=3] number INERT_THRESHOLD Scroll speed to stop inertion
|
||||
-- @tfield[opt=30] number INERT_SPEED Multiplier for inertion speed
|
||||
-- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode
|
||||
-- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed
|
||||
-- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function
|
||||
-- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect)
|
||||
-- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled
|
||||
function M.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0
|
||||
self.style.ANIM_SPEED = style.ANIM_SPEED or 0.2
|
||||
self.style.BACK_SPEED = style.BACK_SPEED or 0.35
|
||||
|
||||
self.style.FRICT = style.FRICT or 0
|
||||
self.style.FRICT_HOLD = style.FRICT_HOLD or 0
|
||||
|
||||
self.style.INERT_THRESHOLD = style.INERT_THRESHOLD or 3
|
||||
self.style.INERT_SPEED = style.INERT_SPEED or 30
|
||||
self.style.POINTS_DEADZONE = style.POINTS_DEADZONE or 20
|
||||
self.style.SMALL_CONTENT_SCROLL = style.SMALL_CONTENT_SCROLL or false
|
||||
|
||||
self._is_inert = not (self.style.FRICT == 0 or
|
||||
self.style.FRICT_HOLD == 0 or
|
||||
self.style.INERT_SPEED == 0)
|
||||
end
|
||||
|
||||
|
||||
--- Scroll constructor.
|
||||
-- @function scroll:init
|
||||
-- @tparam node view_node GUI view scroll node
|
||||
-- @tparam node content_node GUI content scroll node
|
||||
function M.init(self, view_node, content_node)
|
||||
self.druid = self:get_druid()
|
||||
|
||||
self.view_node = self:get_node(view_node)
|
||||
self.content_node = self:get_node(content_node)
|
||||
|
||||
self.position = gui.get_position(self.content_node)
|
||||
self.target_position = vmath.vector3(self.position)
|
||||
self.inertion = vmath.vector3(0)
|
||||
|
||||
self.drag = self.druid:new_drag(view_node, on_scroll_drag)
|
||||
self.drag.on_touch_start:subscribe(on_touch_start)
|
||||
self.drag.on_touch_end:subscribe(on_touch_end)
|
||||
|
||||
self.on_scroll = Event()
|
||||
self.on_scroll_to = Event()
|
||||
self.on_point_scroll = Event()
|
||||
|
||||
self.selected = nil
|
||||
self.is_animate = false
|
||||
|
||||
update_size(self)
|
||||
end
|
||||
|
||||
|
||||
function M.update(self, dt)
|
||||
if self.drag.is_drag then
|
||||
update_hand_scroll(self, dt)
|
||||
else
|
||||
update_free_scroll(self, dt)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Start scroll to target point.
|
||||
-- @function scroll:scroll_to
|
||||
-- @tparam point vector3 Target point
|
||||
-- @tparam[opt] bool is_instant Instant scroll flag
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0), true)
|
||||
function M.scroll_to(self, point, is_instant)
|
||||
local b = self.available_pos
|
||||
local target = vmath.vector3(-point.x, -point.y, 0)
|
||||
target.x = helper.clamp(target.x, b.x, b.z)
|
||||
target.y = helper.clamp(target.y, b.y, b.w)
|
||||
|
||||
cancel_animate(self)
|
||||
|
||||
self.is_animate = not is_instant
|
||||
|
||||
if is_instant then
|
||||
self.target_position = target
|
||||
set_scroll_position(self, target)
|
||||
else
|
||||
gui.animate(self.content_node, gui.PROP_POSITION, target, gui.EASING_OUTSINE, self.style.ANIM_SPEED, 0, function()
|
||||
self.is_animate = false
|
||||
self.target_position = target
|
||||
set_scroll_position(self, target)
|
||||
end)
|
||||
end
|
||||
|
||||
self.on_scroll_to:trigger(self:get_context(), target, is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Scroll to item in scroll by point index.
|
||||
-- @function scroll:scroll_to_index
|
||||
-- @tparam number index Point index
|
||||
-- @tparam[opt] bool skip_cb If true, skip the point callback
|
||||
function M.scroll_to_index(self, index, skip_cb)
|
||||
if not self.points then
|
||||
return
|
||||
end
|
||||
|
||||
index = helper.clamp(index, 1, #self.points)
|
||||
|
||||
if self.selected ~= index then
|
||||
self.selected = index
|
||||
|
||||
if not skip_cb then
|
||||
self.on_point_scroll:trigger(self:get_context(), index, self.points[index])
|
||||
end
|
||||
end
|
||||
|
||||
self:scroll_to(self.points[index])
|
||||
end
|
||||
|
||||
|
||||
--- Start scroll to target scroll percent
|
||||
-- @function scroll:scroll_to_percent
|
||||
-- @tparam point vector3 target percent
|
||||
-- @tparam[opt] bool is_instant instant scroll flag
|
||||
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
||||
function M.scroll_to_percent(self, percent, is_instant)
|
||||
local border = self.available_pos
|
||||
|
||||
local pos = vmath.vector3(
|
||||
-helper.lerp(border.x, border.z, 1 - percent.x),
|
||||
-helper.lerp(border.w, border.y, 1 - percent.y),
|
||||
0
|
||||
)
|
||||
|
||||
M.scroll_to(self, pos, is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Return current scroll progress status.
|
||||
-- Values will be in [0..1] interval
|
||||
-- @function scroll:get_percent
|
||||
-- @treturn vector3 New vector with scroll progress values
|
||||
function M.get_percent(self)
|
||||
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
|
||||
local y_perc = inverse_lerp(self.available_pos.w, self.available_pos.y, self.position.y)
|
||||
|
||||
return vmath.vector3(x_perc, y_perc, 0)
|
||||
end
|
||||
|
||||
|
||||
--- Set scroll content size.
|
||||
-- It will change content gui node size
|
||||
-- @function scroll:set_size
|
||||
-- @tparam vector3 size The new size for content node
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function M.set_size(self, size)
|
||||
gui.set_size(self.content_node, size)
|
||||
update_size(self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Enable or disable scroll inert.
|
||||
-- If disabled, scroll through points (if exist)
|
||||
-- If no points, just simple drag without inertion
|
||||
-- @function scroll:set_inert
|
||||
-- @tparam bool state Inert scroll state
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function M.set_inert(self, state)
|
||||
self._is_inert = state
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return if scroll have inertion.
|
||||
-- @function scroll:is_inert
|
||||
-- @treturn bool If scroll have inertion
|
||||
function M.is_inert(self)
|
||||
return self._is_inert
|
||||
end
|
||||
|
||||
|
||||
--- Set extra size for scroll stretching.
|
||||
-- Set 0 to disable stretching effect
|
||||
-- @function scroll:set_extra_stretch_size
|
||||
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function M.set_extra_stretch_size(self, stretch_size)
|
||||
self.style.EXTRA_STRETCH_SIZE = stretch_size or 0
|
||||
update_size(self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return vector of scroll size with width and height.
|
||||
-- @function scroll:get_scroll_size
|
||||
-- @treturn vector3 Available scroll size
|
||||
function M.get_scroll_size(self)
|
||||
return self.available_size
|
||||
end
|
||||
|
||||
|
||||
--- Set points of interest.
|
||||
-- Scroll will always centered on closer points
|
||||
-- @function scroll:set_points
|
||||
-- @tparam table points Array of vector3 points
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function M.set_points(self, points)
|
||||
self.points = points
|
||||
|
||||
table.sort(self.points, function(a, b)
|
||||
return a.x > b.x or a.y < b.y
|
||||
end)
|
||||
|
||||
check_threshold(self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Scroll
|
||||
|
323
druid/base/static_grid.lua
Normal file
323
druid/base/static_grid.lua
Normal file
@ -0,0 +1,323 @@
|
||||
--- Component to handle placing components by row and columns.
|
||||
-- Grid can anchor your elements, get content size and other
|
||||
-- @module druid.static_grid
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_add_item On item add callback
|
||||
-- @tfield druid_event on_remove_item On item remove callback
|
||||
-- @tfield druid_event on_change_items On item add or remove callback
|
||||
-- @tfield druid_event on_clear On grid clear callback
|
||||
-- @tfield druid_event on_update_positions On update item positions callback
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield node parent Parent gui node
|
||||
-- @tfield node[] nodes List of all grid nodes
|
||||
-- @tfield number first_index The first index of node in grid
|
||||
-- @tfield number last_index The last index of node in grid
|
||||
-- @tfield vector3 anchor Item anchor
|
||||
-- @tfield vector3 node_size Item size
|
||||
-- @tfield vector4 border The size of item content
|
||||
|
||||
local const = require("druid.const")
|
||||
local Event = require("druid.event")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local StaticGrid = component.create("static_grid", { const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function static_grid:init
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
function StaticGrid:init(parent, element, in_row)
|
||||
self.parent = self:get_node(parent)
|
||||
self.nodes = {}
|
||||
|
||||
self.pivot = helper.get_pivot_offset(gui.get_pivot(self.parent))
|
||||
self.anchor = vmath.vector3(0.5 + self.pivot.x, 0.5 - self.pivot.y, 0)
|
||||
|
||||
self.in_row = in_row or 1
|
||||
|
||||
self._prefab = self:get_node(element)
|
||||
self.node_size = gui.get_size(self._prefab)
|
||||
self.node_pivot = const.PIVOTS[gui.get_pivot(self._prefab)]
|
||||
|
||||
self.border = vmath.vector4(0) -- Current grid content size
|
||||
|
||||
self.on_add_item = Event()
|
||||
self.on_remove_item = Event()
|
||||
self.on_change_items = Event()
|
||||
self.on_clear = Event()
|
||||
self.on_update_positions = Event()
|
||||
|
||||
self._set_position_function = gui.set_position
|
||||
end
|
||||
|
||||
|
||||
local _temp_pos = vmath.vector3(0)
|
||||
--- Return pos for grid node index
|
||||
-- @function static_grid:get_pos
|
||||
-- @tparam number index The grid element index
|
||||
-- @treturn vector3 Node position
|
||||
function StaticGrid:get_pos(index)
|
||||
local row = math.ceil(index / self.in_row) - 1
|
||||
local col = (index - row * self.in_row) - 1
|
||||
|
||||
_temp_pos.x = col * self.node_size.x
|
||||
_temp_pos.y = -row * self.node_size.y
|
||||
_temp_pos.z = 0
|
||||
|
||||
return _temp_pos
|
||||
end
|
||||
|
||||
|
||||
--- Return index for grid pos
|
||||
-- @function static_grid:get_index
|
||||
-- @tparam vector3 pos The node position in the grid
|
||||
-- @treturn number The node index
|
||||
function StaticGrid:get_index(pos)
|
||||
local col = pos.x / self.node_size.x + 1
|
||||
local row = -pos.y / self.node_size.y
|
||||
|
||||
col = helper.round(col)
|
||||
row = helper.round(row)
|
||||
|
||||
local index = col + (row * self.in_row)
|
||||
return math.ceil(index)
|
||||
end
|
||||
|
||||
|
||||
--- Return grid index by node
|
||||
-- @function static_grid:get_index_by_node
|
||||
-- @tparam node node The gui node in the grid
|
||||
-- @treturn number The node index
|
||||
function StaticGrid:get_index_by_node(node)
|
||||
for index, grid_node in pairs(self.nodes) do
|
||||
if node == grid_node then
|
||||
return index
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
function StaticGrid:on_layout_change()
|
||||
self:_update(true)
|
||||
end
|
||||
|
||||
|
||||
--- Set grid anchor. Default anchor is equal to anchor of grid parent node
|
||||
-- @function static_grid:set_anchor
|
||||
-- @tparam vector3 anchor Anchor
|
||||
function StaticGrid:set_anchor(anchor)
|
||||
self.anchor = anchor
|
||||
self:_update()
|
||||
end
|
||||
|
||||
|
||||
--- Add new item to the grid
|
||||
-- @function static_grid:add
|
||||
-- @tparam node item Gui node
|
||||
-- @tparam[opt] number index The item position. By default add as last item
|
||||
function StaticGrid:add(item, index)
|
||||
index = index or ((self.last_index or 0) + 1)
|
||||
|
||||
if self.nodes[index] then
|
||||
-- Move nodes to right
|
||||
for i = self.last_index, index, -1 do
|
||||
self.nodes[i + 1] = self.nodes[i]
|
||||
end
|
||||
end
|
||||
|
||||
self.nodes[index] = item
|
||||
|
||||
gui.set_parent(item, self.parent)
|
||||
|
||||
-- Add new item instantly in new pos. Break update function for correct positioning
|
||||
self:_update_indexes()
|
||||
self:_update_borders()
|
||||
|
||||
gui.set_position(item, self:get_pos(index) + self:_get_zero_offset())
|
||||
|
||||
self:_update_pos()
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), item, index)
|
||||
self.on_change_items:trigger(self:get_context(), index)
|
||||
end
|
||||
|
||||
|
||||
--- Remove the item from the grid. Note that gui node will be not deleted
|
||||
-- @function static_grid:remove
|
||||
-- @tparam number index The grid node index to remove
|
||||
-- @tparam bool is_shift_nodes If true, will shift nodes left after index
|
||||
function StaticGrid:remove(index, is_shift_nodes)
|
||||
assert(self.nodes[index], "No grid item at given index " .. index)
|
||||
|
||||
self.nodes[index] = nil
|
||||
|
||||
if is_shift_nodes then
|
||||
for i = index, self.last_index do
|
||||
self.nodes[i] = self.nodes[i + 1]
|
||||
end
|
||||
end
|
||||
|
||||
self:_update()
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), index)
|
||||
self.on_change_items:trigger(self:get_context(), index)
|
||||
end
|
||||
|
||||
|
||||
--- Return grid content size
|
||||
-- @function static_grid:get_size
|
||||
-- @treturn vector3 The grid content size
|
||||
function StaticGrid:get_size()
|
||||
return vmath.vector3(
|
||||
self.border.z - self.border.x,
|
||||
self.border.y - self.border.w,
|
||||
0)
|
||||
end
|
||||
|
||||
|
||||
--- Return array of all node positions
|
||||
-- @function static_grid:get_all_pos
|
||||
-- @treturn vector3[] All grid node positions
|
||||
function StaticGrid:get_all_pos()
|
||||
local result = {}
|
||||
for i, node in pairs(self.nodes) do
|
||||
table.insert(result, gui.get_position(node))
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--- Change set position function for grid nodes. It will call on
|
||||
-- update poses on grid elements. Default: gui.set_position
|
||||
-- @function static_grid:set_position_function
|
||||
-- @tparam function callback Function on node set position
|
||||
-- @treturn druid.static_grid Current grid instance
|
||||
function StaticGrid:set_position_function(callback)
|
||||
self._set_position_function = callback or gui.set_position
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Clear grid nodes array. GUI nodes will be not deleted!
|
||||
-- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
|
||||
-- @function static_grid:clear
|
||||
-- @treturn druid.static_grid Current grid instance
|
||||
function StaticGrid:clear()
|
||||
self.border.x = 0
|
||||
self.border.y = 0
|
||||
self.border.w = 0
|
||||
self.border.z = 0
|
||||
|
||||
self.nodes = {}
|
||||
self:_update()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return elements offset for correct posing nodes. Correct posing at
|
||||
-- parent pivot node (0:0) with adjusting of node sizes and anchoring
|
||||
-- @function static_grid:_get_zero_offset
|
||||
-- @treturn vector3 The offset vector
|
||||
-- @local
|
||||
function StaticGrid:_get_zero_offset()
|
||||
-- zero offset: center pos - border size * anchor
|
||||
return vmath.vector3(
|
||||
-((self.border.x + self.border.z)/2 + (self.border.z - self.border.x) * self.pivot.x),
|
||||
-((self.border.y + self.border.w)/2 + (self.border.y - self.border.w) * self.pivot.y),
|
||||
0
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
--- Update grid inner state
|
||||
-- @function static_grid:_update
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid:_update(is_instant)
|
||||
self:_update_indexes()
|
||||
self:_update_borders()
|
||||
self:_update_pos(is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Update first and last indexes of grid nodes
|
||||
-- @function static_grid:_update_indexes
|
||||
-- @local
|
||||
function StaticGrid:_update_indexes()
|
||||
self.first_index = nil
|
||||
self.last_index = nil
|
||||
for index in pairs(self.nodes) do
|
||||
self.first_index = self.first_index or index
|
||||
self.last_index = self.last_index or index
|
||||
|
||||
self.first_index = math.min(self.first_index, index)
|
||||
self.last_index = math.max(self.last_index, index)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Update grid content borders, recalculate min and max values
|
||||
-- @function static_grid:_update_borders
|
||||
-- @local
|
||||
function StaticGrid:_update_borders()
|
||||
if not self.first_index then
|
||||
self.border = vmath.vector4(0)
|
||||
return
|
||||
end
|
||||
|
||||
self.border = vmath.vector4(math.huge, -math.huge, -math.huge, math.huge)
|
||||
|
||||
local size = self.node_size
|
||||
local pivot = self.node_pivot
|
||||
for index, node in pairs(self.nodes) do
|
||||
local pos = self:get_pos(index)
|
||||
|
||||
local left = pos.x - size.x/2 - (size.x * pivot.x)
|
||||
local right = pos.x + size.x/2 - (size.x * pivot.x)
|
||||
local top = pos.y + size.y/2 - (size.y * pivot.y)
|
||||
local bottom = pos.y - size.y/2 - (size.y * pivot.y)
|
||||
|
||||
self.border.x = math.min(self.border.x, left)
|
||||
self.border.y = math.max(self.border.y, top)
|
||||
self.border.z = math.max(self.border.z, right)
|
||||
self.border.w = math.min(self.border.w, bottom)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Update grid nodes position
|
||||
-- @function static_grid:_update_indexes
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid:_update_pos(is_instant)
|
||||
local zero_offset = self:_get_zero_offset()
|
||||
|
||||
for i, node in pairs(self.nodes) do
|
||||
local pos = self:get_pos(i)
|
||||
pos.x = pos.x + zero_offset.x
|
||||
pos.y = pos.y + zero_offset.y
|
||||
|
||||
if is_instant then
|
||||
gui.set_position(node, pos)
|
||||
else
|
||||
self._set_position_function(node, pos)
|
||||
end
|
||||
end
|
||||
|
||||
self.on_update_positions:trigger(self:get_context())
|
||||
end
|
||||
|
||||
|
||||
return StaticGrid
|
@ -17,7 +17,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("swipe", { const.ON_INPUT })
|
||||
local Swipe = component.create("swipe", { const.ON_INPUT })
|
||||
|
||||
|
||||
local function start_swipe(self, action)
|
||||
@ -69,7 +69,7 @@ end
|
||||
-- @tfield[opt=0.4] number SWIPE_TIME Maximum time for swipe trigger
|
||||
-- @tfield[opt=50] number SWIPE_THRESHOLD Minimum distance for swipe trigger
|
||||
-- @tfield[opt=false] bool SWIPE_TRIGGER_ON_MOVE If true, trigger on swipe moving, not only release action
|
||||
function M.on_style_change(self, style)
|
||||
function Swipe:on_style_change(style)
|
||||
self.style = {}
|
||||
self.style.SWIPE_TIME = style.SWIPE_TIME or 0.4
|
||||
self.style.SWIPE_THRESHOLD = style.SWIPE_THRESHOLD or 50
|
||||
@ -81,7 +81,7 @@ end
|
||||
-- @function swipe:init
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
|
||||
function M.init(self, node, on_swipe_callback)
|
||||
function Swipe:init(node, on_swipe_callback)
|
||||
self._trigger_on_move = self.style.SWIPE_TRIGGER_ON_MOVE
|
||||
self.node = self:get_node(node)
|
||||
|
||||
@ -93,7 +93,7 @@ function M.init(self, node, on_swipe_callback)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Swipe:on_input(action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH then
|
||||
return false
|
||||
end
|
||||
@ -126,7 +126,7 @@ function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input_interrupt(self)
|
||||
function Swipe:on_input_interrupt()
|
||||
reset_swipe(self)
|
||||
end
|
||||
|
||||
@ -135,9 +135,9 @@ end
|
||||
-- restrict events outside stencil node
|
||||
-- @function swipe:set_click_zone
|
||||
-- @tparam node zone Gui node
|
||||
function M.set_click_zone(self, zone)
|
||||
function Swipe:set_click_zone(zone)
|
||||
self.click_zone = self:get_node(zone)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Swipe
|
||||
|
@ -24,7 +24,7 @@ local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("text")
|
||||
local Text = component.create("text", { const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function update_text_size(self)
|
||||
@ -81,7 +81,7 @@ end
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam[opt] bool no_adjust If true, text will be not auto-adjust size
|
||||
function M.init(self, node, value, no_adjust)
|
||||
function Text:init(node, value, no_adjust)
|
||||
self.node = self:get_node(node)
|
||||
self.pos = gui.get_position(self.node)
|
||||
|
||||
@ -107,10 +107,15 @@ function M.init(self, node, value, no_adjust)
|
||||
end
|
||||
|
||||
|
||||
function Text:on_layout_change()
|
||||
self:set_to(self.last_value)
|
||||
end
|
||||
|
||||
|
||||
--- Calculate text width with font with respect to trailing space
|
||||
-- @function text:get_text_width
|
||||
-- @tparam[opt] string text
|
||||
function M.get_text_width(self, text)
|
||||
function Text:get_text_width(text)
|
||||
text = text or self.last_value
|
||||
local font = gui.get_font(self.node)
|
||||
local scale = gui.get_scale(self.node)
|
||||
@ -131,7 +136,7 @@ end
|
||||
--- Set text to text field
|
||||
-- @function text:set_to
|
||||
-- @tparam string set_to Text for node
|
||||
function M.set_to(self, set_to)
|
||||
function Text:set_to(set_to)
|
||||
self.last_value = set_to
|
||||
gui.set_text(self.node, set_to)
|
||||
|
||||
@ -146,7 +151,7 @@ end
|
||||
--- Set color
|
||||
-- @function text:set_color
|
||||
-- @tparam vector4 color Color for node
|
||||
function M.set_color(self, color)
|
||||
function Text:set_color(color)
|
||||
self.color = color
|
||||
gui.set_color(self.node, color)
|
||||
end
|
||||
@ -155,7 +160,7 @@ end
|
||||
--- Set alpha
|
||||
-- @function text:set_alpha
|
||||
-- @tparam number alpha Alpha for node
|
||||
function M.set_alpha(self, alpha)
|
||||
function Text:set_alpha(alpha)
|
||||
self.color.w = alpha
|
||||
gui.set_color(self.node, self.color)
|
||||
end
|
||||
@ -164,7 +169,7 @@ end
|
||||
--- Set scale
|
||||
-- @function text:set_scale
|
||||
-- @tparam vector3 scale Scale for node
|
||||
function M.set_scale(self, scale)
|
||||
function Text:set_scale(scale)
|
||||
self.last_scale = scale
|
||||
gui.set_scale(self.node, scale)
|
||||
end
|
||||
@ -174,7 +179,7 @@ end
|
||||
-- his text area
|
||||
-- @function text:set_pivot
|
||||
-- @tparam gui.pivot pivot Gui pivot constant
|
||||
function M.set_pivot(self, pivot)
|
||||
function Text:set_pivot(pivot)
|
||||
local prev_pivot = gui.get_pivot(self.node)
|
||||
local prev_offset = const.PIVOTS[prev_pivot]
|
||||
|
||||
@ -197,9 +202,9 @@ end
|
||||
--- Return true, if text with line break
|
||||
-- @function text:is_multiline
|
||||
-- @treturn bool Is text node with line break
|
||||
function M.is_multiline(self)
|
||||
function Text:is_multiline()
|
||||
return gui.get_line_break(self.node)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Text
|
||||
|
@ -14,7 +14,7 @@ local Component = class("druid.component")
|
||||
-- their style changing and store all style params
|
||||
-- @function component:set_style
|
||||
-- @tparam table style Druid style module
|
||||
function Component.set_style(self, druid_style)
|
||||
function Component:set_style(druid_style)
|
||||
self._meta.style = druid_style or const.EMPTY_TABLE
|
||||
local component_style = self._meta.style[self._component.name] or const.EMPTY_TABLE
|
||||
|
||||
@ -24,34 +24,18 @@ function Component.set_style(self, druid_style)
|
||||
end
|
||||
|
||||
|
||||
--- Get current component template name
|
||||
-- @function component:get_template
|
||||
-- @treturn string Component template name
|
||||
function Component.get_template(self)
|
||||
return self._meta.template
|
||||
end
|
||||
|
||||
|
||||
--- Set current component template name
|
||||
-- @function component:set_template
|
||||
-- @tparam string template Component template name
|
||||
function Component.set_template(self, template)
|
||||
function Component:set_template(template)
|
||||
self._meta.template = template
|
||||
end
|
||||
|
||||
|
||||
--- Get current component nodes
|
||||
-- @function component:get_nodes
|
||||
-- @treturn table Component nodes table
|
||||
function Component.get_nodes(self)
|
||||
return self._meta.nodes
|
||||
end
|
||||
|
||||
|
||||
--- Set current component nodes
|
||||
-- @function component:set_nodes
|
||||
-- @tparam table nodes Component nodes table
|
||||
function Component.set_nodes(self, nodes)
|
||||
function Component:set_nodes(nodes)
|
||||
self._meta.nodes = nodes
|
||||
end
|
||||
|
||||
@ -59,37 +43,21 @@ end
|
||||
--- Get current component context
|
||||
-- @function component:get_context
|
||||
-- @treturn table Component context
|
||||
function Component.get_context(self, context)
|
||||
function Component:get_context(context)
|
||||
return self._meta.context
|
||||
end
|
||||
|
||||
|
||||
--- Set current component context
|
||||
-- @function component:set_context
|
||||
-- @tparam table context Druid context. Usually it is self of script
|
||||
function Component.set_context(self, context)
|
||||
self._meta.context = context
|
||||
end
|
||||
|
||||
|
||||
--- Get current component interests
|
||||
-- @function component:get_interests
|
||||
-- @treturn table List of component interests
|
||||
function Component.get_interests(self)
|
||||
return self._component.interest
|
||||
end
|
||||
|
||||
|
||||
--- Increase input priority in current input stack
|
||||
-- @function component:increase_input_priority
|
||||
function Component.increase_input_priority(self)
|
||||
function Component:increase_input_priority()
|
||||
self._meta.increased_input_priority = true
|
||||
end
|
||||
|
||||
|
||||
--- Reset input priority in current input stack
|
||||
-- @function component:reset_input_priority
|
||||
function Component.reset_input_priority(self)
|
||||
function Component:reset_input_priority()
|
||||
self._meta.increased_input_priority = false
|
||||
end
|
||||
|
||||
@ -101,9 +69,9 @@ end
|
||||
-- @function component:get_node
|
||||
-- @tparam string|node node_or_name Node name or node itself
|
||||
-- @treturn node Gui node
|
||||
function Component.get_node(self, node_or_name)
|
||||
local template_name = self:get_template() or const.EMPTY_STRING
|
||||
local nodes = self:get_nodes()
|
||||
function Component:get_node(node_or_name)
|
||||
local template_name = self:__get_template() or const.EMPTY_STRING
|
||||
local nodes = self:__get_nodes()
|
||||
|
||||
if template_name ~= const.EMPTY_STRING then
|
||||
template_name = template_name .. "/"
|
||||
@ -128,47 +96,76 @@ end
|
||||
-- Use it to create component inside of other components.
|
||||
-- @function component:get_druid
|
||||
-- @treturn Druid Druid instance with component context
|
||||
function Component.get_druid(self)
|
||||
function Component:get_druid()
|
||||
local context = { _context = self }
|
||||
return setmetatable(context, { __index = self._meta.druid })
|
||||
end
|
||||
|
||||
|
||||
--- Return true, if current component is child of another component
|
||||
-- @function component:is_child_of
|
||||
-- @treturn bool True, if current component is child of another
|
||||
function Component.is_child_of(self, component)
|
||||
return self:get_context() == component
|
||||
end
|
||||
|
||||
|
||||
--- Return component name
|
||||
-- @function component:get_name
|
||||
-- @treturn string The component name
|
||||
function Component.get_name(self)
|
||||
function Component:get_name()
|
||||
return self._component.name
|
||||
end
|
||||
|
||||
|
||||
--- Set component input state. By default it enabled
|
||||
-- You can disable any input of component by this function
|
||||
-- @function component:set_input_enabled
|
||||
-- @tparam bool state The component input state
|
||||
-- @treturn Component Component itself
|
||||
function Component:set_input_enabled(state)
|
||||
self._meta.input_enabled = state
|
||||
|
||||
for index = 1, #self._meta.children do
|
||||
self._meta.children[index]:set_input_enabled(state)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Return the parent for current component
|
||||
-- @function component:get_parent_component
|
||||
-- @treturn Component|nil The druid component instance or nil
|
||||
function Component:get_parent_component()
|
||||
local context = self:get_context()
|
||||
|
||||
if context.isInstanceOf and context:isInstanceOf(Component) then
|
||||
return context
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Setup component context and his style table
|
||||
-- @function component:setup_component
|
||||
-- @tparam druid_instance table The parent druid instance
|
||||
-- @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, druid_instance, context, style)
|
||||
-- @treturn component Component itself
|
||||
function Component:setup_component(druid_instance, context, style)
|
||||
self._meta = {
|
||||
template = nil,
|
||||
context = nil,
|
||||
nodes = nil,
|
||||
style = nil,
|
||||
druid = druid_instance,
|
||||
increased_input_priority = false
|
||||
increased_input_priority = false,
|
||||
input_enabled = true,
|
||||
children = {}
|
||||
}
|
||||
|
||||
self:set_context(context)
|
||||
self:__set_context(context)
|
||||
self:set_style(style)
|
||||
|
||||
local parent = self:get_parent_component()
|
||||
if parent then
|
||||
parent:__add_children(self)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -179,7 +176,7 @@ end
|
||||
-- @tparam string name Component name
|
||||
-- @tparam[opt={}] table interest List of component's interest
|
||||
-- @local
|
||||
function Component.initialize(self, name, interest)
|
||||
function Component:initialize(name, interest)
|
||||
interest = interest or {}
|
||||
|
||||
self._component = {
|
||||
@ -189,6 +186,63 @@ function Component.initialize(self, name, interest)
|
||||
end
|
||||
|
||||
|
||||
function Component:__tostring()
|
||||
return self._component.name
|
||||
end
|
||||
|
||||
|
||||
--- Set current component context
|
||||
-- @function component:__set_context
|
||||
-- @tparam table context Druid context. Usually it is self of script
|
||||
function Component:__set_context(context)
|
||||
self._meta.context = context
|
||||
end
|
||||
|
||||
|
||||
--- Get current component interests
|
||||
-- @function component:__get_interests
|
||||
-- @treturn table List of component interests
|
||||
function Component:__get_interests()
|
||||
return self._component.interest
|
||||
end
|
||||
|
||||
|
||||
--- Get current component template name
|
||||
-- @function component:__get_template
|
||||
-- @treturn string Component template name
|
||||
function Component:__get_template()
|
||||
return self._meta.template
|
||||
end
|
||||
|
||||
|
||||
--- Get current component nodes
|
||||
-- @function component:__get_nodes
|
||||
-- @treturn table Component nodes table
|
||||
function Component:__get_nodes()
|
||||
return self._meta.nodes
|
||||
end
|
||||
|
||||
|
||||
--- Add child to component children list
|
||||
-- @function component:__add_children
|
||||
-- @tparam component children The druid component instance
|
||||
function Component:__add_children(children)
|
||||
table.insert(self._meta.children, children)
|
||||
end
|
||||
|
||||
|
||||
--- Remove child from component children list
|
||||
-- @function component:__remove_children
|
||||
-- @tparam component children The druid component instance
|
||||
function Component:__remove_children(children)
|
||||
for i = #self._meta.children, 1, -1 do
|
||||
if self._meta.children[i] == children then
|
||||
table.remove(self._meta.children, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Create new component. It will inheritance from basic
|
||||
-- druid component.
|
||||
-- @function Component.create
|
||||
|
@ -33,7 +33,7 @@ M.ON_MESSAGE = hash("on_message")
|
||||
M.ON_INPUT_HIGH = hash("on_input_high")
|
||||
M.ON_FOCUS_LOST = hash("on_focus_lost")
|
||||
M.ON_FOCUS_GAINED = hash("on_focus_gained")
|
||||
M.ON_LAYOUT_CHANGE = hash("on_layout_change")
|
||||
M.ON_LAYOUT_CHANGE = hash("layout_changed")
|
||||
M.ON_LANGUAGE_CHANGE = hash("on_language_change")
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ M.PIVOTS = {
|
||||
}
|
||||
|
||||
|
||||
-- Value is method name of component
|
||||
M.SPECIFIC_UI_MESSAGES = {
|
||||
[M.ON_FOCUS_LOST] = "on_focus_lost",
|
||||
[M.ON_FOCUS_GAINED] = "on_focus_gained",
|
||||
@ -101,6 +102,11 @@ M.SWIPE = {
|
||||
}
|
||||
|
||||
|
||||
M.ERRORS = {
|
||||
GRID_DYNAMIC_ANCHOR = "The pivot of dynamic grid node should be West, East, South or North"
|
||||
}
|
||||
|
||||
|
||||
M.EMPTY_FUNCTION = function() end
|
||||
M.EMPTY_STRING = ""
|
||||
M.SPACE_STRING = " "
|
||||
|
@ -4,13 +4,13 @@
|
||||
local class = require("druid.system.middleclass")
|
||||
|
||||
-- @class DruidEvent
|
||||
local M = class("druid.event")
|
||||
local Event = 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)
|
||||
function Event:initialize(initial_callback)
|
||||
self._callbacks = {}
|
||||
|
||||
if initial_callback then
|
||||
@ -22,18 +22,20 @@ end
|
||||
--- Subscribe callback on event
|
||||
-- @function event:subscribe
|
||||
-- @tparam function callback Callback itself
|
||||
function M.subscribe(self, callback)
|
||||
function Event:subscribe(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)
|
||||
|
||||
return callback
|
||||
end
|
||||
|
||||
|
||||
--- Unsubscribe callback on event
|
||||
-- @function event:unsubscribe
|
||||
-- @tparam function callback Callback itself
|
||||
function M.unsubscribe(self, callback)
|
||||
function Event:unsubscribe(callback)
|
||||
for i = 1, #self._callbacks do
|
||||
if self._callbacks[i] == callback then
|
||||
table.remove(self._callbacks, i)
|
||||
@ -46,14 +48,14 @@ end
|
||||
--- Return true, if event have at lease one handler
|
||||
-- @function event:is_exist
|
||||
-- @treturn bool True if event have handlers
|
||||
function M.is_exist(self)
|
||||
function Event:is_exist()
|
||||
return #self._callbacks > 0
|
||||
end
|
||||
|
||||
|
||||
--- Clear the all event handlers
|
||||
-- @function event:clear
|
||||
function M.clear(self)
|
||||
function Event:clear()
|
||||
self._callbacks = {}
|
||||
end
|
||||
|
||||
@ -61,11 +63,11 @@ end
|
||||
--- Trigger the event and call all subscribed callbacks
|
||||
-- @function event:trigger
|
||||
-- @param ... All event params
|
||||
function M.trigger(self, ...)
|
||||
function Event:trigger(...)
|
||||
for i = 1, #self._callbacks do
|
||||
self._callbacks[i](...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Event
|
||||
|
@ -11,14 +11,15 @@
|
||||
-- @tfield[opt=node] node click_node Button trigger node
|
||||
-- @tfield druid.button button Button component from click_node
|
||||
|
||||
local const = require("druid.const")
|
||||
local Event = require("druid.event")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("checkbox")
|
||||
local Checkbox = component.create("checkbox", { const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function on_click(self)
|
||||
M.set_state(self, not self.state)
|
||||
self:set_state(not self.state)
|
||||
end
|
||||
|
||||
|
||||
@ -27,7 +28,7 @@ end
|
||||
-- or create your own style
|
||||
-- @table Style
|
||||
-- @tfield function on_change_state (self, node, state)
|
||||
function M.on_style_change(self, style)
|
||||
function Checkbox:on_style_change(style)
|
||||
self.style = {}
|
||||
|
||||
self.style.on_change_state = style.on_change_state or function(_, node, state)
|
||||
@ -41,27 +42,28 @@ end
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node click node Trigger node, by default equals to node
|
||||
function M.init(self, node, callback, click_node)
|
||||
function Checkbox:init(node, callback, click_node)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
self.click_node = self:get_node(click_node)
|
||||
|
||||
self.button = self.druid:new_button(self.click_node or self.node, on_click)
|
||||
M.set_state(self, false, true)
|
||||
self:set_state(false, true)
|
||||
|
||||
self.on_change_state = Event(callback)
|
||||
end
|
||||
|
||||
|
||||
function Checkbox:on_layout_change()
|
||||
self:set_state(self.state, true)
|
||||
end
|
||||
|
||||
|
||||
--- Set checkbox state
|
||||
-- @function checkbox:set_state
|
||||
-- @tparam bool state Checkbox state
|
||||
-- @tparam bool is_silent Don't trigger on_change_state if true
|
||||
function M.set_state(self, state, is_silent)
|
||||
if self.state == state then
|
||||
return
|
||||
end
|
||||
|
||||
function Checkbox:set_state(state, is_silent)
|
||||
self.state = state
|
||||
self.style.on_change_state(self, self.node, state)
|
||||
|
||||
@ -74,9 +76,9 @@ end
|
||||
--- Return checkbox state
|
||||
-- @function checkbox:get_state
|
||||
-- @treturn bool Checkbox state
|
||||
function M.get_state(self)
|
||||
function Checkbox:get_state()
|
||||
return self.state
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Checkbox
|
@ -12,7 +12,7 @@
|
||||
local Event = require("druid.event")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("checkbox_group")
|
||||
local CheckboxGroup = component.create("checkbox_group")
|
||||
|
||||
|
||||
--- Component init function
|
||||
@ -20,7 +20,7 @@ local M = component.create("checkbox_group")
|
||||
-- @tparam node[] node Array of gui node
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node[] click node Array of trigger nodes, by default equals to nodes
|
||||
function M.init(self, nodes, callback, click_nodes)
|
||||
function CheckboxGroup:init(nodes, callback, click_nodes)
|
||||
self.druid = self:get_druid()
|
||||
self.checkboxes = {}
|
||||
|
||||
@ -40,7 +40,7 @@ end
|
||||
--- Set checkbox group state
|
||||
-- @function checkbox_group:set_state
|
||||
-- @tparam bool[] indexes Array of checkbox state
|
||||
function M.set_state(self, indexes)
|
||||
function CheckboxGroup:set_state(indexes)
|
||||
for i = 1, #indexes do
|
||||
if self.checkboxes[i] then
|
||||
self.checkboxes[i]:set_state(indexes[i], true)
|
||||
@ -52,7 +52,7 @@ end
|
||||
--- Return checkbox group state
|
||||
-- @function checkbox_group:get_state
|
||||
-- @treturn bool[] Array if checkboxes state
|
||||
function M.get_state(self)
|
||||
function CheckboxGroup:get_state()
|
||||
local result = {}
|
||||
|
||||
for i = 1, #self.checkboxes do
|
||||
@ -63,4 +63,4 @@ function M.get_state(self)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return CheckboxGroup
|
@ -1,64 +1,67 @@
|
||||
--- Druid component template
|
||||
-- @module druid.component
|
||||
-- @local
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("my_component_name", { const.ON_UPDATE })
|
||||
local Component = component.create("my_component_name", { const.ON_UPDATE })
|
||||
|
||||
|
||||
-- Component constructor
|
||||
function M.init(self, ...)
|
||||
function Component:init(...)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: const.ON_UPDATE
|
||||
function M.update(self, dt)
|
||||
function Component:update(dt)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH
|
||||
function M.on_input(self, action_id, action)
|
||||
function Component:on_input(action_id, action)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- Call on component creation and on component:set_style() function
|
||||
function M.on_style_change(self, style)
|
||||
function Component:on_style_change(style)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: const.ON_MESSAGE
|
||||
function M.on_message(self, message_id, message, sender)
|
||||
function Component:on_message(message_id, message, sender)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
||||
function M.on_language_change(self)
|
||||
function Component:on_language_change()
|
||||
end
|
||||
|
||||
|
||||
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||
function M.on_layout_change(self)
|
||||
function Component:on_layout_change()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if input was capturing before this component
|
||||
-- Example: scroll is start scrolling, so you need unhover button
|
||||
function M.on_input_interrupt(self)
|
||||
function Component:on_input_interrupt()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
|
||||
function M.on_focus_lost(self)
|
||||
function Component:on_focus_lost()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
|
||||
function M.on_focus_gained(self)
|
||||
function Component:on_focus_gained()
|
||||
end
|
||||
|
||||
|
||||
-- Call on component remove or on druid:final
|
||||
function M.on_remove(self)
|
||||
function Component:on_remove()
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Component
|
387
druid/extended/dynamic_grid.lua
Normal file
387
druid/extended/dynamic_grid.lua
Normal file
@ -0,0 +1,387 @@
|
||||
--- Component to handle placing components in row
|
||||
-- @module druid.dynamic_grid
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_add_item On item add callback
|
||||
-- @tfield druid_event on_remove_item On item remove callback
|
||||
-- @tfield druid_event on_change_items On item add or remove callback
|
||||
-- @tfield druid_event on_clear On grid clear callback
|
||||
-- @tfield druid_event on_update_positions On update item positions callback
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield node parent Parent gui node
|
||||
-- @tfield node[] nodes List of all grid nodes
|
||||
-- @tfield number first_index The first index of node in grid
|
||||
-- @tfield number last_index The last index of node in grid
|
||||
-- @tfield vector3 node_size Item size
|
||||
-- @tfield vector4 border The size of item content
|
||||
|
||||
local const = require("druid.const")
|
||||
local Event = require("druid.event")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local DynamicGrid = component.create("dynamic_grid", { const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local SIDE_VECTORS = {
|
||||
LEFT = vmath.vector3(-1, 0, 0),
|
||||
RIGHT = vmath.vector3(1, 0, 0),
|
||||
TOP = vmath.vector3(0, -1, 0),
|
||||
BOT = vmath.vector3(0, 1, 0),
|
||||
}
|
||||
|
||||
local AVAILABLE_PIVOTS = {
|
||||
gui.PIVOT_N,
|
||||
gui.PIVOT_S,
|
||||
gui.PIVOT_W,
|
||||
gui.PIVOT_E,
|
||||
}
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function dynamic_grid:init
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
function DynamicGrid:init(parent)
|
||||
self.parent = self:get_node(parent)
|
||||
|
||||
local parent_pivot = gui.get_pivot(self.parent)
|
||||
self.pivot = helper.get_pivot_offset(parent_pivot)
|
||||
|
||||
assert(helper.contains(AVAILABLE_PIVOTS, parent_pivot), const.ERRORS.GRID_DYNAMIC_ANCHOR)
|
||||
self.side = ((parent_pivot == gui.PIVOT_W or parent_pivot == gui.PIVOT_E)
|
||||
and const.SIDE.X or const.SIDE.Y)
|
||||
|
||||
self.nodes = {}
|
||||
self.border = vmath.vector4(0) -- Current grid content size
|
||||
|
||||
self.on_add_item = Event()
|
||||
self.on_remove_item = Event()
|
||||
self.on_change_items = Event()
|
||||
self.on_clear = Event()
|
||||
self.on_update_positions = Event()
|
||||
|
||||
self._set_position_function = gui.set_position
|
||||
end
|
||||
|
||||
|
||||
function DynamicGrid:on_layout_change()
|
||||
self:_update(true)
|
||||
end
|
||||
|
||||
|
||||
--- Return pos for grid node index
|
||||
-- @function dynamic_grid:get_pos
|
||||
-- @tparam number index The grid element index
|
||||
-- @tparam node node The node to be placed
|
||||
-- @treturn vector3 Node position
|
||||
function DynamicGrid:get_pos(index, node, origin_index)
|
||||
local origin_node = self.nodes[origin_index]
|
||||
|
||||
-- If anchor node is not exist, check around nodes
|
||||
if not origin_node then
|
||||
if self.nodes[index + 1] then
|
||||
origin_index = index + 1
|
||||
end
|
||||
if self.nodes[index - 1] then
|
||||
origin_index = index - 1
|
||||
end
|
||||
origin_node = self.nodes[origin_index]
|
||||
end
|
||||
|
||||
if not origin_node then
|
||||
assert(not self.first_index, "Dynamic Grid can't have gaps between nodes. Error on grid:add")
|
||||
|
||||
-- If not origin node, so it should be first element in the grid
|
||||
local size = self:_get_node_size(node)
|
||||
local pivot = const.PIVOTS[gui.get_pivot(node)]
|
||||
return vmath.vector3(
|
||||
size.x * pivot.x - size.x * self.pivot.x,
|
||||
size.y * pivot.y - size.y * self.pivot.y,
|
||||
0)
|
||||
end
|
||||
|
||||
if origin_node then
|
||||
-- Other nodes spawn from other side of the origin node
|
||||
local is_forward = origin_index < index
|
||||
local delta = is_forward and 1 or -1
|
||||
return self:_get_next_node_pos(index - delta, node, self:_get_side_vector(self.side, is_forward))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Add new node to the grid
|
||||
-- @function dynamic_grid:add
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam[opt] number index The node position. By default add as last node
|
||||
-- @tparam[opt=false] bool is_shift_left If true, shift all nodes to the left, otherwise shift nodes to the right
|
||||
function DynamicGrid:add(node, index, is_shift_left)
|
||||
local delta = is_shift_left and -1 or 1
|
||||
|
||||
-- By default add node at end
|
||||
index = index or ((self.last_index or 0) + 1)
|
||||
|
||||
-- If node exist at index place, shifting them
|
||||
local is_shift = self.nodes[index]
|
||||
if is_shift then
|
||||
-- We need to iterate from index to start or end grid, depends of shift side
|
||||
local start_index = is_shift_left and self.first_index or self.last_index
|
||||
for i = start_index, index, -delta do
|
||||
self.nodes[i + delta] = self.nodes[i]
|
||||
end
|
||||
end
|
||||
|
||||
self:_add_node(node, index, index - delta)
|
||||
|
||||
-- After shifting we should recalc node poses
|
||||
if is_shift then
|
||||
-- We need to iterate from placed node to start or end grid, depends of shift side
|
||||
local target_index = is_shift_left and self.first_index or self.last_index
|
||||
for i = index + delta, target_index + delta, delta do
|
||||
local move_node = self.nodes[i]
|
||||
move_node.pos = self:get_pos(i, move_node.node, i - delta)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Sync grid data
|
||||
self:_update()
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), node, index)
|
||||
self.on_change_items:trigger(self:get_context(), index)
|
||||
end
|
||||
|
||||
|
||||
--- Remove the item from the grid. Note that gui node will be not deleted
|
||||
-- @function dynamic_grid:remove
|
||||
-- @tparam number index The grid node index to remove
|
||||
-- @tparam[opt=false] bool is_shift_left If true, shift all nodes to the left, otherwise shift nodes to the right
|
||||
function DynamicGrid:remove(index, is_shift_left)
|
||||
local delta = is_shift_left and -1 or 1
|
||||
|
||||
assert(self.nodes[index], "No grid item at given index " .. index)
|
||||
|
||||
-- Just set nil for delete node data
|
||||
self.nodes[index] = nil
|
||||
|
||||
-- After delete node, we should shift nodes and recalc their poses, depends from is_shift_left
|
||||
local target_index = is_shift_left and self.first_index or self.last_index
|
||||
for i = index, target_index, delta do
|
||||
self.nodes[i] = self.nodes[i + delta]
|
||||
if self.nodes[i] then
|
||||
self.nodes[i].pos = self:get_pos(i, self.nodes[i].node, i - delta)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sync grid data
|
||||
self:_update()
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), index)
|
||||
self.on_change_items:trigger(self:get_context(), index)
|
||||
end
|
||||
|
||||
|
||||
--- Return grid content size
|
||||
-- @function dynamic_grid:get_size
|
||||
-- @treturn vector3 The grid content size
|
||||
function DynamicGrid:get_size(border)
|
||||
border = border or self.border
|
||||
return vmath.vector3(
|
||||
border.z - border.x,
|
||||
border.y - border.w,
|
||||
0)
|
||||
end
|
||||
|
||||
|
||||
--- Return grid index by node
|
||||
-- @function dynamic_grid:get_index_by_node
|
||||
-- @tparam node node The gui node in the grid
|
||||
-- @treturn number The node index
|
||||
function DynamicGrid:get_index_by_node(node)
|
||||
for index, node_info in pairs(self.nodes) do
|
||||
if node == node_info.node then
|
||||
return index
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Return array of all node positions
|
||||
-- @function dynamic_grid:get_all_pos
|
||||
-- @treturn vector3[] All grid node positions
|
||||
function DynamicGrid:get_all_pos()
|
||||
local result = {}
|
||||
for i, node in pairs(self.nodes) do
|
||||
table.insert(result, gui.get_position(node))
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--- Change set position function for grid nodes. It will call on
|
||||
-- update poses on grid elements. Default: gui.set_position
|
||||
-- @function dynamic_grid:set_position_function
|
||||
-- @tparam function callback Function on node set position
|
||||
-- @treturn druid.dynamic_grid Current grid instance
|
||||
function DynamicGrid:set_position_function(callback)
|
||||
self._set_position_function = callback or gui.set_position
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Clear grid nodes array. GUI nodes will be not deleted!
|
||||
-- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
|
||||
-- @function dynamic_grid:clear
|
||||
-- @treturn druid.dynamic_grid Current grid instance
|
||||
function DynamicGrid:clear()
|
||||
self.nodes = {}
|
||||
self:_update()
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function DynamicGrid:_add_node(node, index, origin_index)
|
||||
self.nodes[index] = {
|
||||
node = node,
|
||||
pos = self:get_pos(index, node, origin_index),
|
||||
size = self:_get_node_size(node),
|
||||
pivot = const.PIVOTS[gui.get_pivot(node)]
|
||||
}
|
||||
|
||||
-- Add new item instantly in new pos
|
||||
gui.set_parent(node, self.parent)
|
||||
gui.set_position(node, self.nodes[index].pos + self:_get_zero_offset())
|
||||
end
|
||||
|
||||
|
||||
--- Update grid inner state
|
||||
-- @function dynamic_grid:_update
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function DynamicGrid:_update(is_instant)
|
||||
self:_update_indexes()
|
||||
self:_update_borders()
|
||||
self:_update_pos(is_instant)
|
||||
end
|
||||
|
||||
|
||||
--- Update first and last indexes of grid nodes
|
||||
-- @function dynamic_grid:_update_indexes
|
||||
-- @local
|
||||
function DynamicGrid:_update_indexes()
|
||||
self.first_index = nil
|
||||
self.last_index = nil
|
||||
for index in pairs(self.nodes) do
|
||||
self.first_index = self.first_index or index
|
||||
self.last_index = self.last_index or index
|
||||
|
||||
self.first_index = math.min(self.first_index, index)
|
||||
self.last_index = math.max(self.last_index, index)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Update grid content borders, recalculate min and max values
|
||||
-- @function dynamic_grid:_update_borders
|
||||
-- @local
|
||||
function DynamicGrid:_update_borders()
|
||||
if not self.first_index then
|
||||
self.border = vmath.vector4(0)
|
||||
return
|
||||
end
|
||||
|
||||
self.border = vmath.vector4(math.huge, -math.huge, -math.huge, math.huge)
|
||||
|
||||
for index, node in pairs(self.nodes) do
|
||||
local pos = node.pos
|
||||
local size = node.size
|
||||
local pivot = node.pivot
|
||||
|
||||
local left = pos.x - size.x/2 - (size.x * pivot.x)
|
||||
local right = pos.x + size.x/2 - (size.x * pivot.x)
|
||||
local top = pos.y + size.y/2 - (size.y * pivot.y)
|
||||
local bottom = pos.y - size.y/2 - (size.y * pivot.y)
|
||||
|
||||
self.border.x = math.min(self.border.x, left)
|
||||
self.border.y = math.max(self.border.y, top)
|
||||
self.border.z = math.max(self.border.z, right)
|
||||
self.border.w = math.min(self.border.w, bottom)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Update grid nodes position
|
||||
-- @function dynamic_grid:_update_indexes
|
||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function DynamicGrid:_update_pos(is_instant)
|
||||
local offset = self:_get_zero_offset()
|
||||
|
||||
for index, node in pairs(self.nodes) do
|
||||
if is_instant then
|
||||
gui.set_position(node.node, node.pos + offset)
|
||||
else
|
||||
self._set_position_function(node.node, node.pos + offset)
|
||||
end
|
||||
end
|
||||
|
||||
self.on_update_positions:trigger(self:get_context())
|
||||
end
|
||||
|
||||
|
||||
function DynamicGrid:_get_next_node_pos(origin_node_index, new_node, place_side)
|
||||
local node = self.nodes[origin_node_index]
|
||||
|
||||
local new_node_size = self:_get_node_size(new_node)
|
||||
local new_pivot = const.PIVOTS[gui.get_pivot(new_node)]
|
||||
|
||||
local dist_x = (node.size.x/2 + new_node_size.x/2) * place_side.x
|
||||
local dist_y = (node.size.y/2 + new_node_size.y/2) * place_side.y
|
||||
local node_center_x = node.pos.x - node.size.x * node.pivot.x
|
||||
local node_center_y = node.pos.y - node.size.y * node.pivot.y
|
||||
|
||||
return vmath.vector3(
|
||||
node_center_x + dist_x + new_node_size.x * new_pivot.x,
|
||||
node_center_y - dist_y + new_node_size.y * new_pivot.y,
|
||||
0
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
function DynamicGrid:_get_node_size(node)
|
||||
return vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node))
|
||||
end
|
||||
|
||||
|
||||
--- Return elements offset for correct posing nodes. Correct posing at
|
||||
-- parent pivot node (0:0) with adjusting of node sizes and anchoring
|
||||
-- @function dynamic_grid:_get_zero_offset
|
||||
-- @treturn vector3 The offset vector
|
||||
-- @local
|
||||
function DynamicGrid:_get_zero_offset()
|
||||
-- zero offset: center pos - border size * anchor
|
||||
return vmath.vector3(
|
||||
-((self.border.x + self.border.z)/2 + (self.border.z - self.border.x) * self.pivot.x),
|
||||
-((self.border.y + self.border.w)/2 + (self.border.y - self.border.w) * self.pivot.y),
|
||||
0)
|
||||
end
|
||||
|
||||
|
||||
--- Return side vector to correct node shifting
|
||||
function DynamicGrid:_get_side_vector(side, is_forward)
|
||||
if side == const.SIDE.X then
|
||||
return is_forward and SIDE_VECTORS.RIGHT or SIDE_VECTORS.LEFT
|
||||
end
|
||||
|
||||
if side == const.SIDE.Y then
|
||||
return is_forward and SIDE_VECTORS.BOT or SIDE_VECTORS.TOP
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return DynamicGrid
|
@ -27,7 +27,7 @@ local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
local utf8 = require("druid.system.utf8")
|
||||
|
||||
local M = component.create("input", { const.ON_INPUT, const.ON_FOCUS_LOST })
|
||||
local Input = component.create("input", { const.ON_INPUT, const.ON_FOCUS_LOST })
|
||||
|
||||
|
||||
--- Mask text by replacing every character with a mask character
|
||||
@ -97,7 +97,7 @@ end
|
||||
-- @tfield function on_unselect (self, button_node) Callback on input field unselecting
|
||||
-- @tfield function on_input_wrong (self, button_node) Callback on wrong user input
|
||||
-- @tfield table button_style Custom button style for input node
|
||||
function M.on_style_change(self, style)
|
||||
function Input:on_style_change(style)
|
||||
self.style = {}
|
||||
|
||||
self.style.IS_LONGTAP_ERASE = style.IS_LONGTAP_ERASE or false
|
||||
@ -115,7 +115,7 @@ function M.on_style_change(self, style)
|
||||
end
|
||||
|
||||
|
||||
function M.init(self, click_node, text_node, keyboard_type)
|
||||
function Input:init(click_node, text_node, keyboard_type)
|
||||
self.druid = self:get_druid(self)
|
||||
self.text = self.druid:new_text(text_node)
|
||||
|
||||
@ -149,7 +149,7 @@ function M.init(self, click_node, text_node, keyboard_type)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Input:on_input(action_id, action)
|
||||
if self.selected then
|
||||
local input_text = nil
|
||||
if action_id == const.ACTION_TEXT then
|
||||
@ -213,12 +213,12 @@ function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
|
||||
function M.on_focus_lost(self)
|
||||
function Input:on_focus_lost()
|
||||
unselect(self)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input_interrupt(self)
|
||||
function Input:on_input_interrupt()
|
||||
-- unselect(self)
|
||||
end
|
||||
|
||||
@ -226,7 +226,7 @@ end
|
||||
--- Set text for input field
|
||||
-- @function input:set_text
|
||||
-- @tparam string input_text The string to apply for input field
|
||||
function M.set_text(self, input_text)
|
||||
function Input:set_text(input_text)
|
||||
-- Case when update with marked text
|
||||
if input_text then
|
||||
self.value = input_text
|
||||
@ -273,7 +273,7 @@ end
|
||||
--- Return current input field text
|
||||
-- @function input:get_text
|
||||
-- @treturn string The current input field text
|
||||
function M.get_text(self)
|
||||
function Input:get_text()
|
||||
return self.value .. self.marked_value
|
||||
end
|
||||
|
||||
@ -283,7 +283,7 @@ end
|
||||
-- @function input:set_max_length
|
||||
-- @tparam number max_length Maximum length for input text field
|
||||
-- @treturn druid.input Current input instance
|
||||
function M.set_max_length(self, max_length)
|
||||
function Input:set_max_length(max_length)
|
||||
self.max_length = max_length
|
||||
return self
|
||||
end
|
||||
@ -295,7 +295,7 @@ end
|
||||
-- @function input:set_allowerd_characters
|
||||
-- @tparam string characters Regulax exp. for validate user input
|
||||
-- @treturn druid.input Current input instance
|
||||
function M.set_allowed_characters(self, characters)
|
||||
function Input:set_allowed_characters(characters)
|
||||
self.allowed_characters = characters
|
||||
return self
|
||||
end
|
||||
@ -303,10 +303,10 @@ end
|
||||
|
||||
--- Reset current input selection and return previous value
|
||||
-- @function input:reset_changes
|
||||
function M.reset_changes(self)
|
||||
function Input:reset_changes()
|
||||
self:set_text(self.previous_value)
|
||||
unselect(self)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Input
|
@ -15,7 +15,7 @@ local const = require("druid.const")
|
||||
local settings = require("druid.system.settings")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("lang_text", { const.ON_LANGUAGE_CHANGE })
|
||||
local LangText = component.create("lang_text", { const.ON_LANGUAGE_CHANGE })
|
||||
|
||||
|
||||
--- Component init function
|
||||
@ -23,7 +23,7 @@ local M = component.create("lang_text", { const.ON_LANGUAGE_CHANGE })
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id
|
||||
-- @tparam bool no_adjust If true, will not correct text size
|
||||
function M.init(self, node, locale_id, no_adjust)
|
||||
function LangText:init(node, locale_id, no_adjust)
|
||||
self.druid = self:get_druid()
|
||||
self.text = self.druid:new_text(node, locale_id, no_adjust)
|
||||
self.last_locale_args = {}
|
||||
@ -36,9 +36,9 @@ function M.init(self, node, locale_id, no_adjust)
|
||||
end
|
||||
|
||||
|
||||
function M.on_language_change(self)
|
||||
function LangText:on_language_change()
|
||||
if self.last_locale then
|
||||
M.translate(self, self.last_locale, unpack(self.last_locale_args))
|
||||
self:translate(self.last_locale, unpack(self.last_locale_args))
|
||||
end
|
||||
end
|
||||
|
||||
@ -46,7 +46,7 @@ end
|
||||
--- Setup raw text to lang_text component
|
||||
-- @function lang_text:set_to
|
||||
-- @tparam string text Text for text node
|
||||
function M.set_to(self, text)
|
||||
function LangText:set_to(text)
|
||||
self.last_locale = false
|
||||
self.text:set_to(text)
|
||||
self.on_change:trigger()
|
||||
@ -56,11 +56,11 @@ end
|
||||
--- Translate the text by locale_id
|
||||
-- @function lang_text:translate
|
||||
-- @tparam string locale_id Locale id
|
||||
function M.translate(self, locale_id, ...)
|
||||
function LangText:translate(locale_id, ...)
|
||||
self.last_locale_args = {...}
|
||||
self.last_locale = locale_id or self.last_locale
|
||||
self.text:set_to(settings.get_text(self.last_locale, ...))
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return LangText
|
@ -20,7 +20,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("progress", { const.ON_UPDATE })
|
||||
local Progress = component.create("progress", { const.ON_UPDATE, const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function check_steps(self, from, to, exactly)
|
||||
@ -71,7 +71,7 @@ end
|
||||
-- @table Style
|
||||
-- @tfield[opt=5] number SPEED Progress bas fill rate. More -> faster
|
||||
-- @tfield[opt=0.005] number MIN_DELTA Minimum step to fill progress bar
|
||||
function M.on_style_change(self, style)
|
||||
function Progress:on_style_change(style)
|
||||
self.style = {}
|
||||
self.style.SPEED = style.SPEED or 5
|
||||
self.style.MIN_DELTA = style.MIN_DELTA or 0.005
|
||||
@ -83,7 +83,7 @@ end
|
||||
-- @tparam string|node node Progress bar fill node or node name
|
||||
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||
-- @tparam[opt=1] number init_value Initial value of progress bar
|
||||
function M.init(self, node, key, init_value)
|
||||
function Progress:init(node, key, init_value)
|
||||
assert(key == const.SIDE.X or const.SIDE.Y, "Progress bar key should be 'x' or 'y'")
|
||||
|
||||
self.prop = hash("scale."..key)
|
||||
@ -106,7 +106,12 @@ function M.init(self, node, key, init_value)
|
||||
end
|
||||
|
||||
|
||||
function M.update(self, dt)
|
||||
function Progress:on_layout_change()
|
||||
self:set_to(self.last_value)
|
||||
end
|
||||
|
||||
|
||||
function Progress:update(dt)
|
||||
if self.target then
|
||||
local prev_value = self.last_value
|
||||
local step = math.abs(self.last_value - self.target) * (self.style.SPEED*dt)
|
||||
@ -128,14 +133,14 @@ end
|
||||
|
||||
--- Fill a progress bar and stop progress animation
|
||||
-- @function progress:fill
|
||||
function M.fill(self)
|
||||
function Progress:fill()
|
||||
set_bar_to(self, 1, true)
|
||||
end
|
||||
|
||||
|
||||
--- Empty a progress bar
|
||||
-- @function progress:empty
|
||||
function M.empty(self)
|
||||
function Progress:empty()
|
||||
set_bar_to(self, 0, true)
|
||||
end
|
||||
|
||||
@ -143,14 +148,14 @@ end
|
||||
--- Instant fill progress bar to value
|
||||
-- @function progress:set_to
|
||||
-- @tparam number to Progress bar value, from 0 to 1
|
||||
function M.set_to(self, to)
|
||||
function Progress:set_to(to)
|
||||
set_bar_to(self, to)
|
||||
end
|
||||
|
||||
|
||||
--- Return current progress bar value
|
||||
-- @function progress:get
|
||||
function M.get(self)
|
||||
function Progress:get()
|
||||
return self.last_value
|
||||
end
|
||||
|
||||
@ -160,7 +165,7 @@ end
|
||||
-- @tparam number[] steps Array of progress bar values
|
||||
-- @tparam function callback Callback on intersect step value
|
||||
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
|
||||
function M.set_steps(self, steps, callback)
|
||||
function Progress:set_steps(steps, callback)
|
||||
self.steps = steps
|
||||
self.step_callback = callback
|
||||
end
|
||||
@ -170,7 +175,7 @@ end
|
||||
-- @function progress:to
|
||||
-- @tparam number to value between 0..1
|
||||
-- @tparam[opt] function callback Callback on animation ends
|
||||
function M.to(self, to, callback)
|
||||
function Progress:to(to, callback)
|
||||
to = helper.clamp(to, 0, 1)
|
||||
-- cause of float error
|
||||
local value = helper.round(to, 5)
|
||||
@ -185,4 +190,4 @@ function M.to(self, to, callback)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Progress
|
@ -12,7 +12,7 @@
|
||||
local Event = require("druid.event")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("radio_group")
|
||||
local RadioGroup = component.create("radio_group")
|
||||
|
||||
|
||||
local function on_checkbox_click(self, index)
|
||||
@ -29,7 +29,7 @@ end
|
||||
-- @tparam node[] node Array of gui node
|
||||
-- @tparam function callback Radio callback
|
||||
-- @tparam[opt=node] node[] click node Array of trigger nodes, by default equals to nodes
|
||||
function M.init(self, nodes, callback, click_nodes)
|
||||
function RadioGroup:init(nodes, callback, click_nodes)
|
||||
self.druid = self:get_druid()
|
||||
self.checkboxes = {}
|
||||
|
||||
@ -49,7 +49,7 @@ end
|
||||
--- Set radio group state
|
||||
-- @function radio_group:set_state
|
||||
-- @tparam number index Index in radio group
|
||||
function M.set_state(self, index)
|
||||
function RadioGroup:set_state(index)
|
||||
on_checkbox_click(self, index)
|
||||
end
|
||||
|
||||
@ -57,7 +57,7 @@ end
|
||||
--- Return radio group state
|
||||
-- @function radio_group:get_state
|
||||
-- @treturn number Index in radio group
|
||||
function M.get_state(self)
|
||||
function RadioGroup:get_state()
|
||||
local result = -1
|
||||
|
||||
for i = 1, #self.checkboxes do
|
||||
@ -71,4 +71,4 @@ function M.get_state(self)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return RadioGroup
|
@ -22,7 +22,7 @@ local helper = require("druid.helper")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("slider", { const.ON_INPUT_HIGH })
|
||||
local Slider = component.create("slider", { const.ON_INPUT_HIGH, const.ON_LAYOUT_CHANGE })
|
||||
|
||||
|
||||
local function on_change_value(self)
|
||||
@ -41,7 +41,7 @@ end
|
||||
-- @tparam node node Gui pin node
|
||||
-- @tparam vector3 end_pos The end position of slider
|
||||
-- @tparam[opt] function callback On slider change callback
|
||||
function M.init(self, node, end_pos, callback)
|
||||
function Slider:init(node, end_pos, callback)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
self.start_pos = gui.get_position(self.node)
|
||||
@ -59,7 +59,12 @@ function M.init(self, node, end_pos, callback)
|
||||
end
|
||||
|
||||
|
||||
function M.on_input(self, action_id, action)
|
||||
function Slider:on_layout_change()
|
||||
self:set(self.value, true)
|
||||
end
|
||||
|
||||
|
||||
function Slider:on_input(action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH then
|
||||
return false
|
||||
end
|
||||
@ -128,7 +133,7 @@ end
|
||||
-- @function slider:set
|
||||
-- @tparam number value Value from 0 to 1
|
||||
-- @tparam[opt] bool is_silent Don't trigger event if true
|
||||
function M.set(self, value, is_silent)
|
||||
function Slider:set(value, is_silent)
|
||||
value = helper.clamp(value, 0, 1)
|
||||
set_position(self, value)
|
||||
self.value = value
|
||||
@ -143,9 +148,9 @@ end
|
||||
-- @function slider:set_steps
|
||||
-- @tparam number[] steps Array of steps
|
||||
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
|
||||
function M.set_steps(self, steps)
|
||||
function Slider:set_steps(steps)
|
||||
self.steps = steps
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Slider
|
@ -22,7 +22,7 @@ local formats = require("druid.helper.formats")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local M = component.create("timer", { const.ON_UPDATE })
|
||||
local Timer = component.create("timer", { const.ON_UPDATE })
|
||||
|
||||
|
||||
--- Component init function
|
||||
@ -31,7 +31,7 @@ local M = component.create("timer", { const.ON_UPDATE })
|
||||
-- @tparam number seconds_from Start timer value in seconds
|
||||
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
||||
-- @tparam[opt] function callback Function on timer end
|
||||
function M.init(self, node, seconds_from, seconds_to, callback)
|
||||
function Timer:init(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)
|
||||
@ -52,7 +52,7 @@ function M.init(self, node, seconds_from, seconds_to, callback)
|
||||
end
|
||||
|
||||
|
||||
function M.update(self, dt)
|
||||
function Timer:update(dt)
|
||||
if not self.is_on then
|
||||
return
|
||||
end
|
||||
@ -63,7 +63,7 @@ function M.update(self, dt)
|
||||
if self.temp > dist then
|
||||
self.temp = self.temp - dist
|
||||
self.value = helper.step(self.value, self.target, 1)
|
||||
M.set_to(self, self.value)
|
||||
self:set_to(self.value)
|
||||
|
||||
self.on_tick:trigger(self:get_context(), self.value)
|
||||
|
||||
@ -77,7 +77,7 @@ end
|
||||
--- Set text to text field
|
||||
-- @function timer:set_to
|
||||
-- @tparam number set_to Value in seconds
|
||||
function M.set_to(self, set_to)
|
||||
function Timer:set_to(set_to)
|
||||
self.last_value = set_to
|
||||
gui.set_text(self.node, formats.second_string_min(set_to))
|
||||
end
|
||||
@ -86,7 +86,7 @@ end
|
||||
--- Called when update
|
||||
-- @function timer:set_state
|
||||
-- @tparam bool is_on Timer enable state
|
||||
function M.set_state(self, is_on)
|
||||
function Timer:set_state(is_on)
|
||||
self.is_on = is_on
|
||||
|
||||
self.on_set_enabled:trigger(self:get_context(), is_on)
|
||||
@ -97,14 +97,14 @@ end
|
||||
-- @function timer:set_interval
|
||||
-- @tparam number from Start time in seconds
|
||||
-- @tparam number to Target time in seconds
|
||||
function M.set_interval(self, from, to)
|
||||
function Timer:set_interval(from, to)
|
||||
self.from = from
|
||||
self.value = from
|
||||
self.temp = 0
|
||||
self.target = to
|
||||
M.set_state(self, true)
|
||||
M.set_to(self, from)
|
||||
self:set_state(true)
|
||||
self:set_to(from)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return Timer
|
@ -131,6 +131,16 @@ function M.lerp(a, b, t)
|
||||
end
|
||||
|
||||
|
||||
function M.contains(t, value)
|
||||
for i = 1, #t do
|
||||
if t[i] == value then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
--- Check if node is enabled in gui hierarchy.
|
||||
-- Return false, if node or any his parent is disabled
|
||||
-- @function helper.is_enabled
|
||||
@ -188,4 +198,28 @@ function M.get_border(node)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
--- Show deprecated message. Once time per message
|
||||
-- @function helper.deprecated
|
||||
-- @tparam string message The deprecated message
|
||||
local _deprecated_messages = {}
|
||||
function M.deprecated(message)
|
||||
if _deprecated_messages[message] then
|
||||
return
|
||||
end
|
||||
|
||||
print("[Druid]: " .. message)
|
||||
_deprecated_messages[message] = true
|
||||
end
|
||||
|
||||
|
||||
-- Show message to require extended component
|
||||
function M.extended_component(component_name)
|
||||
print(string.format("[Druid]: The component %s is extended component. You have to register it via druid.register to use it", component_name))
|
||||
print("[Druid]: Use next code:")
|
||||
print(string.format('local %s = require("druid.extended.%s")', component_name, component_name))
|
||||
print(string.format('druid.register("%s", %s)', component_name, component_name))
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@ -1,5 +1,12 @@
|
||||
--- Druid main class. Create instance of this
|
||||
-- to start creating components
|
||||
--- Instance of Druid. Make one instance per gui_script with next code:
|
||||
--
|
||||
-- local druid = require("druid.druid")
|
||||
-- function init(self)
|
||||
-- self.druid = druid.new(self)
|
||||
-- local button = self.druid:new_button(...)
|
||||
-- end
|
||||
--
|
||||
-- Learn Druid instance function here
|
||||
-- @module druid_instance
|
||||
-- @see druid.button
|
||||
-- @see druid.blocker
|
||||
@ -9,7 +16,8 @@
|
||||
-- @see druid.lang_text
|
||||
-- @see druid.timer
|
||||
-- @see druid.progress
|
||||
-- @see druid.grid
|
||||
-- @see druid.static_grid
|
||||
-- @see druid.dynamic_grid
|
||||
-- @see druid.scroll
|
||||
-- @see druid.slider
|
||||
-- @see druid.checkbox
|
||||
@ -19,28 +27,30 @@
|
||||
-- @see druid.drag
|
||||
|
||||
local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local druid_input = require("druid.helper.druid_input")
|
||||
local settings = require("druid.system.settings")
|
||||
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 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")
|
||||
local scroll = require("druid.base.scroll")
|
||||
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 swipe = require("druid.base.swipe")
|
||||
local blocker = require("druid.base.blocker")
|
||||
local button = require("druid.base.button")
|
||||
local drag = require("druid.base.drag")
|
||||
-- local infinity_scroll = require("druid.base.infinity_scroll")
|
||||
local hover = require("druid.base.hover")
|
||||
local scroll = require("druid.base.scroll")
|
||||
local static_grid = require("druid.base.static_grid")
|
||||
local swipe = require("druid.base.swipe")
|
||||
local text = require("druid.base.text")
|
||||
|
||||
local checkbox = require("druid.extended.checkbox")
|
||||
local checkbox_group = require("druid.extended.checkbox_group")
|
||||
local dynamic_grid = require("druid.extended.dynamic_grid")
|
||||
local input = require("druid.extended.input")
|
||||
local lang_text = require("druid.extended.lang_text")
|
||||
local progress = require("druid.extended.progress")
|
||||
local radio_group = require("druid.extended.radio_group")
|
||||
local slider = require("druid.extended.slider")
|
||||
local timer = require("druid.extended.timer")
|
||||
|
||||
-- @classmod Druid
|
||||
local Druid = class("druid.druid_instance")
|
||||
@ -77,7 +87,7 @@ local function create(self, instance_class)
|
||||
|
||||
table.insert(self.components[const.ALL], instance)
|
||||
|
||||
local register_to = instance:get_interests()
|
||||
local register_to = instance:__get_interests()
|
||||
for i = 1, #register_to do
|
||||
local interest = register_to[i]
|
||||
table.insert(self.components[interest], instance)
|
||||
@ -99,7 +109,8 @@ local function process_input(action_id, action, components, is_input_consumed)
|
||||
for i = #components, 1, -1 do
|
||||
local component = components[i]
|
||||
-- Process increased input priority first
|
||||
if component._meta.increased_input_priority then
|
||||
local meta = component._meta
|
||||
if meta.input_enabled and meta.increased_input_priority then
|
||||
if not is_input_consumed then
|
||||
is_input_consumed = component:on_input(action_id, action)
|
||||
else
|
||||
@ -112,7 +123,9 @@ local function process_input(action_id, action, components, is_input_consumed)
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
local component = components[i]
|
||||
if not component._meta.increased_input_priority then
|
||||
-- Process usual input priority next
|
||||
local meta = component._meta
|
||||
if meta.input_enabled and not meta.increased_input_priority then
|
||||
if not is_input_consumed then
|
||||
is_input_consumed = component:on_input(action_id, action)
|
||||
else
|
||||
@ -131,7 +144,7 @@ end
|
||||
-- @function druid:initialize
|
||||
-- @tparam context table Druid context. Usually it is self of script
|
||||
-- @tparam style table Druid style module
|
||||
function Druid.initialize(self, context, style)
|
||||
function Druid:initialize(context, style)
|
||||
self._context = context
|
||||
self._style = style or settings.default_style
|
||||
self._deleted = false
|
||||
@ -150,7 +163,7 @@ end
|
||||
-- @function druid:create
|
||||
-- @tparam Component component Component module
|
||||
-- @tparam args ... Other component params to pass it to component:init function
|
||||
function Druid.create(self, component, ...)
|
||||
function Druid:create(component, ...)
|
||||
local instance = create(self, component)
|
||||
|
||||
if instance.init then
|
||||
@ -164,7 +177,7 @@ end
|
||||
--- Call on final function on gui_script. It will call on_remove
|
||||
-- on all druid components
|
||||
-- @function druid:final
|
||||
function Druid.final(self)
|
||||
function Druid:final()
|
||||
local components = self.components[const.ALL]
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
@ -183,22 +196,24 @@ end
|
||||
-- Component `on_remove` function will be invoked, if exist.
|
||||
-- @function druid:remove
|
||||
-- @tparam Component component Component instance
|
||||
function Druid.remove(self, component)
|
||||
function Druid:remove(component)
|
||||
if self._is_input_processing then
|
||||
table.insert(self._late_remove, component)
|
||||
return
|
||||
end
|
||||
|
||||
local all_components = self.components[const.ALL]
|
||||
|
||||
-- Recursive remove all children of component
|
||||
for i = #all_components, 1, -1 do
|
||||
local inst = all_components[i]
|
||||
if inst:is_child_of(component) then
|
||||
self:remove(inst)
|
||||
local children = component._meta.children
|
||||
for i = 1, #children do
|
||||
self:remove(children[i])
|
||||
local parent = children[i]:get_parent_component()
|
||||
if parent then
|
||||
parent:__remove_children(children[i])
|
||||
end
|
||||
end
|
||||
component._meta.children = {}
|
||||
|
||||
local all_components = self.components[const.ALL]
|
||||
for i = #all_components, 1, -1 do
|
||||
if all_components[i] == component then
|
||||
if component.on_remove then
|
||||
@ -208,7 +223,7 @@ function Druid.remove(self, component)
|
||||
end
|
||||
end
|
||||
|
||||
local interests = component:get_interests()
|
||||
local interests = component:__get_interests()
|
||||
for i = 1, #interests do
|
||||
local interest = interests[i]
|
||||
local components = self.components[interest]
|
||||
@ -224,7 +239,7 @@ end
|
||||
--- Druid update function
|
||||
-- @function druid:update
|
||||
-- @tparam number dt Delta time
|
||||
function Druid.update(self, dt)
|
||||
function Druid:update(dt)
|
||||
local components = self.components[const.ON_UPDATE]
|
||||
for i = 1, #components do
|
||||
components[i]:update(dt)
|
||||
@ -236,7 +251,7 @@ end
|
||||
-- @function druid:on_input
|
||||
-- @tparam hash action_id Action_id from on_input
|
||||
-- @tparam table action Action from on_input
|
||||
function Druid.on_input(self, action_id, action)
|
||||
function Druid:on_input(action_id, action)
|
||||
self._is_input_processing = true
|
||||
|
||||
local is_input_consumed = false
|
||||
@ -265,7 +280,7 @@ end
|
||||
-- @tparam hash message_id Message_id from on_message
|
||||
-- @tparam table message Message from on_message
|
||||
-- @tparam hash sender Sender from on_message
|
||||
function Druid.on_message(self, message_id, message, sender)
|
||||
function Druid:on_message(message_id, message, sender)
|
||||
local specific_ui_message = const.SPECIFIC_UI_MESSAGES[message_id]
|
||||
|
||||
if specific_ui_message then
|
||||
@ -288,7 +303,7 @@ end
|
||||
--- Druid on focus lost interest function.
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @function druid:on_focus_lost
|
||||
function Druid.on_focus_lost(self)
|
||||
function Druid:on_focus_lost()
|
||||
local components = self.components[const.ON_FOCUS_LOST]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_lost()
|
||||
@ -299,7 +314,7 @@ end
|
||||
--- Druid on focus gained interest function.
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @function druid:on_focus_gained
|
||||
function Druid.on_focus_gained(self)
|
||||
function Druid:on_focus_gained()
|
||||
local components = self.components[const.ON_FOCUS_GAINED]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_gained()
|
||||
@ -310,7 +325,7 @@ end
|
||||
--- Druid on layout change function.
|
||||
-- Called on update gui layout
|
||||
-- @function druid:on_layout_change
|
||||
function Druid.on_layout_change(self)
|
||||
function Druid:on_layout_change()
|
||||
local components = self.components[const.ON_LAYOUT_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_layout_change()
|
||||
@ -322,7 +337,7 @@ end
|
||||
-- This one called by global gruid.on_language_change, but can be
|
||||
-- call manualy to update all translations
|
||||
-- @function druid.on_language_change
|
||||
function Druid.on_language_change(self)
|
||||
function Druid:on_language_change()
|
||||
local components = self.components[const.ON_LANGUAGE_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_language_change()
|
||||
@ -334,7 +349,7 @@ end
|
||||
-- @function druid:new_button
|
||||
-- @tparam args ... button init args
|
||||
-- @treturn Component button component
|
||||
function Druid.new_button(self, ...)
|
||||
function Druid:new_button(...)
|
||||
return Druid.create(self, button, ...)
|
||||
end
|
||||
|
||||
@ -343,7 +358,7 @@ end
|
||||
-- @function druid:new_blocker
|
||||
-- @tparam args ... blocker init args
|
||||
-- @treturn Component blocker component
|
||||
function Druid.new_blocker(self, ...)
|
||||
function Druid:new_blocker(...)
|
||||
return Druid.create(self, blocker, ...)
|
||||
end
|
||||
|
||||
@ -352,7 +367,7 @@ end
|
||||
-- @function druid:new_back_handler
|
||||
-- @tparam args ... back_handler init args
|
||||
-- @treturn Component back_handler component
|
||||
function Druid.new_back_handler(self, ...)
|
||||
function Druid:new_back_handler(...)
|
||||
return Druid.create(self, back_handler, ...)
|
||||
end
|
||||
|
||||
@ -361,7 +376,7 @@ end
|
||||
-- @function druid:new_hover
|
||||
-- @tparam args ... hover init args
|
||||
-- @treturn Component hover component
|
||||
function Druid.new_hover(self, ...)
|
||||
function Druid:new_hover(...)
|
||||
return Druid.create(self, hover, ...)
|
||||
end
|
||||
|
||||
@ -370,44 +385,28 @@ end
|
||||
-- @function druid:new_text
|
||||
-- @tparam args ... text init args
|
||||
-- @treturn Component text component
|
||||
function Druid.new_text(self, ...)
|
||||
function Druid:new_text(...)
|
||||
return Druid.create(self, text, ...)
|
||||
end
|
||||
|
||||
|
||||
--- 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
|
||||
|
||||
|
||||
--- Create timer basic component
|
||||
-- @function druid:new_timer
|
||||
-- @tparam args ... timer init args
|
||||
-- @treturn Component timer component
|
||||
function Druid.new_timer(self, ...)
|
||||
return Druid.create(self, timer, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create progress basic component
|
||||
-- @function druid:new_progress
|
||||
-- @tparam args ... progress init args
|
||||
-- @treturn Component progress component
|
||||
function Druid.new_progress(self, ...)
|
||||
return Druid.create(self, progress, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create grid basic component
|
||||
-- Deprecated
|
||||
-- @function druid:new_grid
|
||||
-- @tparam args ... grid init args
|
||||
-- @treturn Component grid component
|
||||
function Druid.new_grid(self, ...)
|
||||
return Druid.create(self, grid, ...)
|
||||
function Druid:new_grid(...)
|
||||
helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead")
|
||||
return Druid.create(self, static_grid, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create static grid basic component
|
||||
-- @function druid:new_static_grid
|
||||
-- @tparam args ... grid init args
|
||||
-- @treturn Component grid component
|
||||
function Druid:new_static_grid(...)
|
||||
return Druid.create(self, static_grid, ...)
|
||||
end
|
||||
|
||||
|
||||
@ -415,61 +414,16 @@ end
|
||||
-- @function druid:new_scroll
|
||||
-- @tparam args ... scroll init args
|
||||
-- @treturn Component scroll component
|
||||
function Druid.new_scroll(self, ...)
|
||||
function Druid:new_scroll(...)
|
||||
return Druid.create(self, scroll, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create slider basic component
|
||||
-- @function druid:new_slider
|
||||
-- @tparam args ... slider init args
|
||||
-- @treturn Component slider component
|
||||
function Druid.new_slider(self, ...)
|
||||
return Druid.create(self, slider, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox basic component
|
||||
-- @function druid:new_checkbox
|
||||
-- @tparam args ... checkbox init args
|
||||
-- @treturn Component checkbox component
|
||||
function Druid.new_checkbox(self, ...)
|
||||
return Druid.create(self, checkbox, ...)
|
||||
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
|
||||
-- @treturn Component checkbox_group component
|
||||
function Druid.new_checkbox_group(self, ...)
|
||||
return Druid.create(self, checkbox_group, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create radio_group basic component
|
||||
-- @function druid:new_radio_group
|
||||
-- @tparam args ... radio_group init args
|
||||
-- @treturn Component radio_group component
|
||||
function Druid.new_radio_group(self, ...)
|
||||
return Druid.create(self, radio_group, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create swipe basic component
|
||||
-- @function druid:new_swipe
|
||||
-- @tparam args ... swipe init args
|
||||
-- @treturn Component swipe component
|
||||
function Druid.new_swipe(self, ...)
|
||||
function Druid:new_swipe(...)
|
||||
return Druid.create(self, swipe, ...)
|
||||
end
|
||||
|
||||
@ -478,9 +432,99 @@ end
|
||||
-- @function druid:new_drag
|
||||
-- @tparam args ... drag init args
|
||||
-- @treturn Componetn drag component
|
||||
function Druid.new_drag(self, ...)
|
||||
function Druid:new_drag(...)
|
||||
return Druid.create(self, drag, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create dynamic grid component
|
||||
-- @function druid:new_dynamic_grid
|
||||
-- @tparam args ... grid init args
|
||||
-- @treturn Component grid component
|
||||
function Druid:new_dynamic_grid(...)
|
||||
-- return helper.extended_component("dynamic_grid")
|
||||
return Druid.create(self, dynamic_grid, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create lang_text component
|
||||
-- @function druid:new_lang_text
|
||||
-- @tparam args ... lang_text init args
|
||||
-- @treturn Component lang_text component
|
||||
function Druid:new_lang_text(...)
|
||||
-- return helper.extended_component("lang_text")
|
||||
return Druid.create(self, lang_text, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create slider component
|
||||
-- @function druid:new_slider
|
||||
-- @tparam args ... slider init args
|
||||
-- @treturn Component slider component
|
||||
function Druid:new_slider(...)
|
||||
-- return helper.extended_component("slider")
|
||||
return Druid.create(self, slider, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox component
|
||||
-- @function druid:new_checkbox
|
||||
-- @tparam args ... checkbox init args
|
||||
-- @treturn Component checkbox component
|
||||
function Druid:new_checkbox(...)
|
||||
-- return helper.extended_component("checkbox")
|
||||
return Druid.create(self, checkbox, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create input component
|
||||
-- @function druid:new_input
|
||||
-- @tparam args ... input init args
|
||||
-- @treturn Component input component
|
||||
function Druid:new_input(...)
|
||||
-- return helper.extended_component("input")
|
||||
return Druid.create(self, input, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox_group component
|
||||
-- @function druid:new_checkbox_group
|
||||
-- @tparam args ... checkbox_group init args
|
||||
-- @treturn Component checkbox_group component
|
||||
function Druid:new_checkbox_group(...)
|
||||
-- return helper.extended_component("checkbox_group")
|
||||
return Druid.create(self, checkbox_group, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create radio_group component
|
||||
-- @function druid:new_radio_group
|
||||
-- @tparam args ... radio_group init args
|
||||
-- @treturn Component radio_group component
|
||||
function Druid:new_radio_group(...)
|
||||
-- return helper.extended_component("radio_group")
|
||||
return Druid.create(self, radio_group, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create timer component
|
||||
-- @function druid:new_timer
|
||||
-- @tparam args ... timer init args
|
||||
-- @treturn Component timer component
|
||||
function Druid:new_timer(...)
|
||||
-- return helper.extended_component("timer")
|
||||
return Druid.create(self, timer, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create progress component
|
||||
-- @function druid:new_progress
|
||||
-- @tparam args ... progress init args
|
||||
-- @treturn Component progress component
|
||||
function Druid:new_progress(...)
|
||||
-- return helper.extended_component("progress")
|
||||
return Druid.create(self, progress, ...)
|
||||
end
|
||||
|
||||
|
||||
return Druid
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,49 @@
|
||||
local M = {}
|
||||
|
||||
|
||||
local function add_node(self)
|
||||
local function simple_animate(node, pos)
|
||||
gui.animate(node, "position", pos, gui.EASING_OUTSINE, 0.2)
|
||||
end
|
||||
|
||||
|
||||
local function remove_node(self, button, is_shift)
|
||||
gui.delete_node(button.node)
|
||||
|
||||
self.druid:remove(button)
|
||||
local index = self.grid_static_grid:get_index_by_node(button.node)
|
||||
self.grid_static_grid:remove(index, is_shift)
|
||||
for i = 1, #self.grid_node_buttons do
|
||||
if self.grid_node_buttons[i] == button then
|
||||
table.remove(self.grid_node_buttons, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_node(self, index)
|
||||
local prefab = gui.get_node("grid_nodes_prefab")
|
||||
local cloned = gui.clone_tree(prefab)
|
||||
gui.set_enabled(cloned["grid_nodes_prefab"], true)
|
||||
local index = #self.grid_nodes + 1
|
||||
gui.set_text(cloned["grid_nodes_text"], index)
|
||||
|
||||
local button = self.druid:new_button(cloned["grid_nodes_prefab"], function()
|
||||
print(index)
|
||||
local button = self.druid:new_button(cloned["grid_nodes_prefab"], function(_, params, button)
|
||||
remove_node(self, button, true)
|
||||
end)
|
||||
button.on_long_click:subscribe(function()
|
||||
remove_node(self, button)
|
||||
end)
|
||||
button:set_click_zone(self.grid_static_scroll.view_node)
|
||||
|
||||
table.insert(self.grid_node_buttons, button)
|
||||
|
||||
self.grid_nodes:add(cloned["grid_nodes_prefab"])
|
||||
self.grid_static_grid:add(cloned["grid_nodes_prefab"], index)
|
||||
end
|
||||
|
||||
|
||||
local function clear_nodes(self)
|
||||
local nodes = self.grid_nodes.nodes
|
||||
for i = 1, #nodes do
|
||||
gui.delete_node(nodes[i])
|
||||
local nodes = self.grid_static_grid.nodes
|
||||
for i, node in pairs(nodes) do
|
||||
gui.delete_node(node)
|
||||
end
|
||||
|
||||
for i = 1, #self.grid_node_buttons do
|
||||
@ -28,29 +51,125 @@ local function clear_nodes(self)
|
||||
end
|
||||
self.grid_node_buttons = {}
|
||||
|
||||
self.grid_nodes:clear()
|
||||
self.grid_static_grid:clear()
|
||||
end
|
||||
|
||||
|
||||
local function remove_node(self)
|
||||
-- Remove is not implemented yet
|
||||
end
|
||||
|
||||
|
||||
function M.setup_page(self)
|
||||
self.grid_nodes = self.druid:new_grid("grid_nodes", "grid_nodes_prefab", 5)
|
||||
local function init_static_grid(self)
|
||||
self.grid_node_buttons = {}
|
||||
gui.set_enabled(gui.get_node("grid_nodes_prefab"), false)
|
||||
|
||||
for i = 1, 15 do
|
||||
add_node(self)
|
||||
add_node(self, i)
|
||||
end
|
||||
|
||||
self.druid:new_button("button_add/button", add_node)
|
||||
self.druid:new_button("button_clear/button", clear_nodes)
|
||||
self.druid:new_button("button_add/button", function()
|
||||
add_node(self)
|
||||
end)
|
||||
self.druid:new_button("button_clear/button", function()
|
||||
clear_nodes(self)
|
||||
end)
|
||||
end
|
||||
|
||||
local remove_button = self.druid:new_button("button_remove/button", remove_node)
|
||||
gui.set_enabled(remove_button.node, false)
|
||||
|
||||
local function remove_dynamic_node(self, button, is_shift_left)
|
||||
gui.delete_node(button.node)
|
||||
|
||||
self.druid:remove(button)
|
||||
local index = self.grid_dynamic_grid:get_index_by_node(button.node)
|
||||
self.grid_dynamic_grid:remove(index, is_shift_left)
|
||||
for i = 1, #self.dynamic_node_buttons do
|
||||
if self.dynamic_node_buttons[i] == button then
|
||||
table.remove(self.dynamic_node_buttons, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_node_dynamic(self, index, is_shift_left)
|
||||
local node = gui.clone(self.prefab_dynamic)
|
||||
gui.set_enabled(node, true)
|
||||
gui.set_size(node, vmath.vector3(250, math.random(60, 150), 0))
|
||||
self.grid_dynamic_grid:add(node, index, is_shift_left)
|
||||
|
||||
local button = self.druid:new_button(node, function(_, params, button)
|
||||
remove_dynamic_node(self, button)
|
||||
end)
|
||||
button.on_long_click:subscribe(function()
|
||||
remove_dynamic_node(self, button, true)
|
||||
end)
|
||||
button:set_click_zone(self.grid_dynamic_scroll.view_node)
|
||||
table.insert(self.dynamic_node_buttons, button)
|
||||
end
|
||||
|
||||
|
||||
local function add_node_dynamic_hor(self, index)
|
||||
local node = gui.clone(self.prefab_hor_dynamic)
|
||||
gui.set_enabled(node, true)
|
||||
gui.set_size(node, vmath.vector3(80 + math.random(0, 80), 80, 0))
|
||||
self.grid_dynamic_hor_grid:add(node, index)
|
||||
end
|
||||
|
||||
|
||||
local function init_dynamic_grid(self)
|
||||
-- Vertical horizontal grid
|
||||
self.dynamic_node_buttons = {}
|
||||
|
||||
self.prefab_dynamic = gui.get_node("grid_dynamic_prefab")
|
||||
gui.set_enabled(self.prefab_dynamic, false)
|
||||
|
||||
for i = 1, 10 do
|
||||
add_node_dynamic(self, i)
|
||||
end
|
||||
self.druid:new_button("button_add_start_dynamic/button", function()
|
||||
local start_index = (self.grid_dynamic_grid.first_index or 2) - 1
|
||||
add_node_dynamic(self, start_index)
|
||||
end)
|
||||
self.druid:new_button("button_add_end_dynamic/button", function()
|
||||
add_node_dynamic(self)
|
||||
end)
|
||||
|
||||
-- Horizontal dynamic grid
|
||||
self.prefab_hor_dynamic = gui.get_node("grid_dynamic_hor_prefab")
|
||||
gui.set_enabled(self.prefab_hor_dynamic, false)
|
||||
|
||||
for i = 1, 10 do
|
||||
add_node_dynamic_hor(self, i)
|
||||
end
|
||||
|
||||
self.druid:new_button("button_add_start_dynamic_hor/button", function()
|
||||
add_node_dynamic_hor(self, 1)
|
||||
end)
|
||||
self.druid:new_button("button_add_end_dynamic_hor/button", function()
|
||||
add_node_dynamic_hor(self)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M.setup_page(self)
|
||||
self.grid_page_scroll = self.druid:new_scroll("grid_page", "grid_page_content")
|
||||
|
||||
self.grid_static_grid = self.druid:new_static_grid("grid_nodes", "grid_nodes_prefab", 5)
|
||||
:set_position_function(simple_animate)
|
||||
self.grid_static_scroll = self.druid:new_scroll("grid_nodes_view", "grid_nodes")
|
||||
:set_horizontal_scroll(false)
|
||||
:bind_grid(self.grid_static_grid)
|
||||
|
||||
self.grid_dynamic_grid = self.druid:new_dynamic_grid("grid_dynamic_nodes")
|
||||
:set_position_function(simple_animate)
|
||||
self.grid_dynamic_scroll = self.druid:new_scroll("grid_dynamic_view", "grid_dynamic_nodes")
|
||||
:set_horizontal_scroll(false)
|
||||
:bind_grid(self.grid_dynamic_grid)
|
||||
|
||||
self.grid_dynamic_hor_grid = self.druid:new_dynamic_grid("grid_dynamic_hor_nodes")
|
||||
:set_position_function(simple_animate)
|
||||
self.grid_dynamic_hor_scroll = self.druid:new_scroll("grid_dynamic_hor_view", "grid_dynamic_hor_nodes")
|
||||
:set_vertical_scroll(false)
|
||||
:bind_grid(self.grid_dynamic_hor_grid)
|
||||
|
||||
init_static_grid(self)
|
||||
init_dynamic_grid(self)
|
||||
end
|
||||
|
||||
|
||||
|
@ -50,22 +50,6 @@ local function setup_progress(self)
|
||||
end
|
||||
|
||||
|
||||
local function setup_grid(self)
|
||||
local grid = self.druid:new_grid("grid", "button_template/button", 3)
|
||||
|
||||
for i = 1, 12 do
|
||||
local nodes = gui.clone_tree(gui.get_node("button_template/button"))
|
||||
|
||||
local root = nodes["button_template/button"]
|
||||
self.druid:new_button(root, function(context, param)
|
||||
grid:set_offset(vmath.vector3(param))
|
||||
end, i)
|
||||
self.druid:new_text(nodes["button_template/text"], "Grid"..i)
|
||||
grid:add(root)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function setup_slider(self)
|
||||
local slider = self.druid:new_slider("slider_pin", vmath.vector3(95, 0, 0), function(_, value)
|
||||
gui.set_text(gui.get_node("text_progress_slider"), math.ceil(value * 100) .. "%")
|
||||
@ -96,11 +80,6 @@ local function setup_timer(self)
|
||||
end
|
||||
|
||||
|
||||
local function setup_scroll(self)
|
||||
self.druid:new_scroll("main_page", "scroll_content")
|
||||
end
|
||||
|
||||
|
||||
local function setup_back_handler(self)
|
||||
self.druid:new_back_handler(empty_callback, "back button")
|
||||
end
|
||||
@ -117,10 +96,8 @@ function M.setup_page(self)
|
||||
|
||||
setup_button(self)
|
||||
setup_progress(self)
|
||||
setup_grid(self)
|
||||
setup_timer(self)
|
||||
setup_checkbox(self)
|
||||
setup_scroll(self)
|
||||
setup_slider(self)
|
||||
setup_back_handler(self)
|
||||
setup_input(self)
|
||||
|
@ -5,7 +5,7 @@ local function init_scroll_with_grid(self)
|
||||
local prefab = gui.get_node("grid_prefab")
|
||||
|
||||
local grid_scroll = self.druid:new_scroll("scroll_with_grid_size", "grid_content")
|
||||
local grid = self.druid:new_grid("grid_content", "grid_prefab", 20)
|
||||
local grid = self.druid:new_static_grid("grid_content", "grid_prefab", 20)
|
||||
|
||||
for i = 1, 40 do
|
||||
local clone_prefab = gui.clone_tree(prefab)
|
||||
|
@ -10,7 +10,7 @@ height = 900
|
||||
|
||||
[project]
|
||||
title = druid
|
||||
version = 0.4.3
|
||||
version = 0.5.0
|
||||
|
||||
[library]
|
||||
include_dirs = druid
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
use_latest_bob=true
|
||||
use_latest_bob=false
|
||||
|
Loading…
x
Reference in New Issue
Block a user