66 Commits
0.7.0 ... 0.9.0

Author SHA1 Message Date
Maxim Tuprikov
b5a77391a4 Merge pull request #180 from Insality/develop
Release 0.9.0
2022-03-12 12:07:50 +02:00
Insality
8054ad84f9 Update version to 0.9.0 update live example 2022-03-12 12:03:39 +02:00
Insality
d0f3d6641a Add reproducable ldoc generation 2022-03-12 11:58:00 +02:00
Insality
9c2b442c50 Update md docs of custom components 2022-03-12 11:54:45 +02:00
Insality
102d8ca579 Update druid editor scripts to run from dependency 2022-03-12 10:50:25 +02:00
Insality
e1ce982043 Revert "Move editor scripts to druid folder"
This reverts commit 007e715009.
2022-03-12 09:04:25 +02:00
Insality
58a877f8a7 Update docs 2022-03-12 09:03:45 +02:00
Insality
18eb52b92b Update changelogs 2022-03-11 20:43:20 +02:00
Insality
c5c335d17c Optimize component and event creation, add cache for interests, optimize scroll 2022-03-11 20:37:18 +02:00
Insality
cc35fe208c Force disable dynamic node poses of static grid in data_list 2022-03-11 19:41:05 +02:00
Insality
db1e7ec502 Add reinit data_list example, add debug mode for druid/components. Refactor scroll is_in_view. Use late remove while scroll update 2022-03-11 19:20:33 +02:00
Insality
4166fbe089 Now can pass node (not string) even if component nodes is defined 2022-03-11 14:33:36 +02:00
Insality
d44e196b96 Move Emmylua annotations to Druid folder 2022-03-11 14:26:31 +02:00
Insality
1cfec9df15 Update changelog 2022-03-11 14:24:35 +02:00
Insality
ea5b3dcea3 Solve #178 Update get_text_width -> get_text_size 2022-03-11 10:08:41 +02:00
Insality
007e715009 Move editor scripts to druid folder 2022-03-11 10:02:04 +02:00
Insality
b1b44b412e Update changelogs 2022-03-11 10:00:16 +02:00
Insality
02601c142d Add checkboxes example 2022-03-11 01:06:13 +02:00
Insality
fbe5db7875 Add general swipe and drag examples 2022-03-11 00:21:50 +02:00
Insality
760946765c Update generate component script 2022-03-10 21:45:23 +02:00
Maxim Tuprikov
6bb5ee59a8 Merge pull request #177 from Insality/custom_components
Update with custom components issues scope
2022-03-10 20:32:13 +02:00
Insality
70d4f0f1f8 Rename component template for autogenerate 2022-03-10 20:23:55 +02:00
Insality
8256fc9d92 Update defold version to 1.3.0 2022-03-10 20:21:27 +02:00
Insality
7465212cf0 Don't process layouting node inside templates 2022-03-10 20:00:33 +02:00
Insality
505ff9a540 Solve #159 Add auto layouting for generate custom Druid component 2022-03-10 19:50:16 +02:00
Insality
b84b6c461d Solve #119 Add script for create custom component 2022-03-09 21:17:24 +02:00
Insality
7b8dfb1ef0 Solve #114 Add default component templates for fast usage 2022-03-09 19:13:00 +02:00
Insality
57b9770419 Solve #44 Add slider drag not only by pin, but can additional add input zone 2022-03-09 18:54:58 +02:00
Insality
a8fcb9a25c Add cache last_scene and last scroll position to druid example. Fix scroll_to_percent by y (again) 2022-03-09 18:36:19 +02:00
Insality
fc2d93c34f Update README md 2022-03-09 18:19:36 +02:00
Insality
669b525c15 Add self:get_node assert, add no_auto_template flag, fix idents 2022-03-09 18:14:40 +02:00
Insality
a3e5ff1116 Resolve #171 #158 Don't need to pass full template name, correct work with inner clone_tree and inner templates 2022-03-09 18:06:41 +02:00
Insality
a4e8e9fb3a Add pin knob custom component 2022-03-09 00:34:04 +02:00
Insality
6e2fe4de83 Add protected field to annotations 2022-03-08 22:06:39 +02:00
Insality
2e9ab69001 Add rich input component and example 2022-03-08 21:31:44 +02:00
Insality
81c8e4aa00 Update workspace, update templates 2022-03-08 20:41:55 +02:00
Insality
dc76d3b3d4 Update docs, update custom component templates 2022-03-08 20:32:10 +02:00
Insality
f801bb6862 Update doc links, update emmylua generator 2022-03-08 20:21:39 +02:00
Insality
a846adf97b Update docs 2022-03-08 18:38:17 +02:00
Insality
a87a576ded Update #168 Remove unused global on_layout_change 2022-03-01 02:09:28 +02:00
Insality
129a102cc8 Solve #165 Add set_in_row function for StaticGrid 2022-02-28 22:18:07 +02:00
Insality
bd0c5545ae Solve #168 Added button to open the source code of current example 2022-02-28 22:02:13 +02:00
Maxim Tuprikov
2a0998d236 Merge pull request #170 from Insality/develop
Merge 0.8.1 to master
2022-02-28 21:41:41 +02:00
Insality
ac72c172fe Update version to 0.8.1 2022-02-28 21:37:49 +02:00
Insality
2d78bcb5e9 Solve #169 Fix on_layout_change 2022-02-28 21:37:23 +02:00
Maxim Tuprikov
10fad9c871 Merge pull request #167 from Insality/develop
Release 0.8.0
2022-02-12 17:22:52 +02:00
Insality
3b329f9c25 Update docs, annotations and style for checkbox 2022-02-12 17:17:36 +02:00
Insality
4e0fd264b1 Prepare for release 0.8.0 2022-02-12 17:02:27 +02:00
Insality
a75dd5a6f9 Merge branch 'master' into develop 2022-02-12 16:20:48 +02:00
Maxim Tuprikov
c12bfe63a5 Merge pull request #166 from SalavatR/patch-1 2022-02-02 16:19:18 +02:00
SalavatR
21830d9886 Update input.lua
function set_allowed_characters(NAME_PATTERN) isn't working with Cyrillic symbols  in range "[А-я]", string.match includes chars №, ₽ and may be more
2022-02-02 19:51:15 +06:00
Insality
3ac2986171 #162 Add static grid last row alignment 2022-01-27 22:29:13 +02:00
Insality
97e7631d22 #155 Add margin to total width in centrate_nodes 2022-01-27 19:35:29 +02:00
Insality
f534baf2ee #163 Default locale id from text node for lang_text component 2022-01-27 18:31:33 +02:00
Insality
54f80aeccd #160 Remove component interests, now setup it with function declaring 2022-01-27 01:48:05 +02:00
Insality
7a5faa2b85 #164 Fix scroll_to_percent wrong Y position 2022-01-27 01:15:12 +02:00
Insality
b7d2891fed #153 Add Druid acquire input to late_init step 2022-01-27 01:13:23 +02:00
Insality
ef455a71eb #00 Add more self chaining to Lang text component 2022-01-27 01:12:49 +02:00
Insality
30f48f1d27 #00 Add text arg to on_input_unselect event 2022-01-27 01:11:34 +02:00
Insality
b42d16d999 #152 Add instans set_state for Checkbox component 2022-01-27 01:09:24 +02:00
Insality
8d0f9e5070 #154 Change text adjust const to strings 2022-01-27 01:06:35 +02:00
Insality
43adb5f52d #147 Remove ... from lang_text to fixed arguments, add lang_text:format additional functions 2021-11-20 11:14:04 +02:00
Insality
d0c91c9cb5 #151 Fix text adjust by height 2021-11-20 11:12:34 +02:00
Insality
098df24265 #150 Fix scroll to percentage on Y position 2021-11-20 11:11:52 +02:00
Insality
154d9fc166 #148 remove scroll inertion after scroll animate or set_to 2021-11-20 11:11:24 +02:00
Insality
dbb883b1b8 #149 Call button style functions after actual callback 2021-11-20 11:10:29 +02:00
145 changed files with 18356 additions and 6222 deletions

2
.gitignore vendored
View File

@@ -9,3 +9,5 @@ Thumbs.db
.cproject
builtins
dist
deployer_version_settings.txt
.deployer_cache

View File

@@ -57,13 +57,25 @@ input_scroll_down = scroll_down
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 don't need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_:
If you don't need this behaviour, you can disable it by setting `druid.no_auto_input` field in _game.project_:
```
[druid]
no_auto_input = 1
```
### Template name check [optional]
By default, **Druid** will auto check the parent component template name to build the full template name for component.
If for some reason you want to pass the full template name by yourself, you can disable it by setting `druid.no_auto_template` field in _game.project_:
```
[druid]
no_auto_template = 1
```
### Stencil check [optional]
When creating input components inside stencil nodes, you probably will use `component:set_click_zone()` to restrict clicks outside this stencil zone.
@@ -73,6 +85,7 @@ Druid can do it automatically on _late_init_ component step. To enable this feat
stencil_check = 1
```
### Code [optional]
Adjust **Druid** settings, if needed:
@@ -120,7 +133,7 @@ druid.on_window_callback(event)
- **[Swipe](docs_md/01-components.md#swipe)** - System Druid component, handle swipe gestures on node
- **[Drag](docs_md/01-components.md#drag)** - System Druid component, handle drag input on node
- **[Drag](docs_md/01-components.md#drag)** - System Druid component, handle drag input on node
**Druid** also provides the following *extended* components:
@@ -245,11 +258,9 @@ It is recommended to fully integrate all **Druid** lifecycles functions.
## Examples
See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
See the [**example folder**](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles
Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app
Try the [**HTML5 version**](https://insality.github.io/druid/druid/) of the **Druid** example app
## Documentation
@@ -259,17 +270,11 @@ To better understand **Druid**, read the following documentation:
- [Create custom components](docs_md/02-creating_custom_components.md)
- [See FAQ article](docs_md/FAQ.md)
- [Druid styles](docs_md/03-styles.md)
- [Druid asset store](docs_md/04-druid_assets.md)
You can fund the full **Druid** documentation here:
https://insality.github.io/druid/
## Games powered by Druid
_You published your game and you using Druid? Note me!_
## License
- Developed and supported by [Insality](https://github.com/Insality)

View File

@@ -4,13 +4,15 @@ description='Documentation for Druid Library'
file={"./druid",
exclude = {
"./druid/styles/",
"./druid/system/middleclass.lua"
"./druid/system/middleclass.lua",
"./druid/templates/",
"./druid/annotations.lua",
}
}
package='druid'
sort=false
sort=true
dir='./docs'
style='!fixed'
topics={}
use_markdown_titles=true
no_space_before_args=true
no_space_before_args=true

7
deployer_build_stats.csv Normal file
View File

@@ -0,0 +1,7 @@
date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_count
2022-02-28T19:06:43Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,68,armv7-android,debug,true,521
2022-02-28T19:14:56Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,51,armv7-android,debug,true,521
2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-03-12T10:01:30Z,d0f3d6641a08b0d6b719b13017aa85907d1667e5,0.8.564,2200,44,js-web,release,true,564
1 date sha version build_size build_time platform mode is_cache_using commits_count
2 2022-02-28T19:06:43Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 68 armv7-android debug true 521
3 2022-02-28T19:14:56Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 51 armv7-android debug true 521
4 2022-02-28T19:16:23Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
5 2022-02-28T19:19:46Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
6 2022-02-28T19:22:51Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
7 2022-03-12T10:01:30Z d0f3d6641a08b0d6b719b13017aa85907d1667e5 0.8.564 2200 44 js-web release true 564

View File

@@ -1 +1 @@
{"content":[{"name":"game.projectc","size":3748,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":13488,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":948341,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13875,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
{"content":[{"name":"game.projectc","size":3808,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":17168,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":417873,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":17838,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,12 +1,13 @@
[project]
title = druid
version = 0.7.499
version = 0.8.564
write_log = 0
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = 1ae77e727fd29b01a514e73820b3e02213aeb7db
build_time = 2021-10-23T14:38:03Z
commit_sha = d0f3d6641a08b0d6b719b13017aa85907d1667e5
build_date = 2022-03-12T10:01:30Z
title_as_file_name = druid
[display]
width = 600
@@ -16,8 +17,8 @@ samples = 0
fullscreen = 0
update_frequency = 0
vsync = 1
display_profiles = /builtins/render/default.display_profilesc
dynamic_orientation = 0
display_profiles = /example/custom.display_profilesc
dynamic_orientation = 1
display_device_info = 0
[render]
@@ -43,6 +44,7 @@ contact_impulse_limit = 0
ray_cast_limit_2d = 64
ray_cast_limit_3d = 128
trigger_overlap_capacity = 16
velocity_threshold = 1
[bootstrap]
main_collection = /example/example.collectionc
@@ -85,9 +87,6 @@ use_accelerometer = 0
max_count = 128
subpixels = 1
[spine]
max_count = 128
[model]
max_count = 128
@@ -121,7 +120,7 @@ default_language = en
localizations = en
[android]
version_code = 499
version_code = 564
minimum_sdk_version = 16
target_sdk_version = 30
package = com.insality.druid
@@ -156,6 +155,7 @@ splash_image = /media/druid_logo.png
[particle_fx]
max_count = 64
max_emitter_count = 64
max_particle_count = 1024
[iap]
@@ -193,6 +193,7 @@ run_while_iconified = 0
[druid]
no_auto_input = 0
stencil_check = 0
no_auto_template = 0
input_text = text
input_touch = touch
input_marked_text = marked_text

Binary file not shown.

View File

@@ -113,9 +113,9 @@ var EngineLoader = {
asmjs_from: 0,
asmjs_to: 50,
// load .wasm and set Module.instantiateWasm to use the loaded .wasm file
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
stream_wasm: true,
loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
@@ -133,6 +133,31 @@ var EngineLoader = {
});
},
streamAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetch(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
successCallback(output.instance);
}).catch(function(e) {
console.log('wasm streaming instantiation failed! ' + e);
throw e;
});
return {}; // Compiling asynchronously, no exports.
}
callback();
},
// instantiate the .wasm file either by streaming it or first loading and then instantiate it
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.streamAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
else {
EngineLoader.loadAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
},
// load and start engine script (asm.js or wasm.js)
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
FileLoader.load(src, "text", estimatedSize,
@@ -457,35 +482,6 @@ var Progress = {
}
};
/* ********************************************************************* */
/* Default input override */
/* ********************************************************************* */
var CanvasInput = {
arrowKeysHandler : function(e) {
switch(e.keyCode) {
case 37: case 38: case 39: case 40: // Arrow keys
case 32: e.preventDefault(); e.stopPropagation(); // Space
default: break; // do not block other keys
}
},
onFocusIn : function(e) {
window.addEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},
onFocusOut: function(e) {
window.removeEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},
addToCanvas : function(canvas) {
canvas.addEventListener("focus", CanvasInput.onFocusIn, false);
canvas.addEventListener("blur", CanvasInput.onFocusOut, false);
canvas.focus();
CanvasInput.onFocusIn();
}
};
/* ********************************************************************* */
/* Module is Emscripten namespace */
/* ********************************************************************* */
@@ -578,30 +574,6 @@ var Module = {
return webgl_support;
},
handleVisibilityChange: function () {
GLFW.onFocusChanged(document[Module.hiddenProperty] ? 0 : 1);
},
getHiddenProperty: function () {
if ('hidden' in document) return 'hidden';
var prefixes = ['webkit','moz','ms','o'];
for (var i = 0; i < prefixes.length; i++) {
if ((prefixes[i] + 'Hidden') in document)
return prefixes[i] + 'Hidden';
}
return null;
},
setupVisibilityChangeListener: function() {
Module.hiddenProperty = Module.getHiddenProperty();
if( Module.hiddenProperty ) {
var eventName = Module.hiddenProperty.replace(/[H|h]idden/,'') + 'visibilitychange';
document.addEventListener(eventName, Module.handleVisibilityChange, false);
} else {
console.log("No document.hidden property found. The focus events won't be enabled.")
}
},
setupCanvas: function(appCanvasId) {
appCanvasId = (typeof appCanvasId === 'undefined') ? 'canvas' : appCanvasId;
Module.canvas = document.getElementById(appCanvasId);
@@ -672,10 +644,7 @@ var Module = {
Module.fullScreenContainer = fullScreenContainer || Module.canvas;
if (Module.hasWebGLSupport()) {
// Override game keys
CanvasInput.addToCanvas(Module.canvas);
Module.setupVisibilityChangeListener();
Module.canvas.focus();
// Add context menu hide-handler if requested
if (params["disable_context_menu"])

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

View File

@@ -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.7.499</title>
<title>druid 0.8.564</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

View File

@@ -41,6 +41,8 @@
<li><a href="modules/Swipe.html">Swipe</a></li>
<li><a href="modules/Text.html">Text</a></li>
<li><a href="modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="modules/PinKnob.html">PinKnob</a></li>
<li><a href="modules/RichInput.html">RichInput</a></li>
<li><a href="modules/druid.html">druid</a></li>
<li><a href="modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="modules/Checkbox.html">Checkbox</a></li>
@@ -53,7 +55,7 @@
<li><a href="modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="modules/Slider.html">Slider</a></li>
<li><a href="modules/Timer.html">Timer</a></li>
<li><a href="modules/druid.helper.html">druid.helper</a></li>
<li><a href="modules/Helper.html">Helper</a></li>
<li><a href="modules/DruidInstance.html">DruidInstance</a></li>
</ul>
@@ -106,13 +108,21 @@
<td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td>
<td class="summary">Basic class for all Druid components.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/PinKnob.html">PinKnob</a></td>
<td class="summary">Druid pin knob custom component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td>
<td class="summary">Druid Rich Input custom component.</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/DruidEvent.html">DruidEvent</a></td>
<td class="summary">Lua event small library</td>
<td class="summary">Druid lua event library</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td>
@@ -156,8 +166,8 @@
<td class="summary">Component to handle GUI timers.</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>
<td class="name" nowrap><a href="modules/Helper.html">Helper</a></td>
<td class="summary">Druid helper module for gui layouts</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
@@ -168,8 +178,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><strong>BackHandler</strong></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -116,7 +118,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">callback</span></span>
@@ -146,14 +148,14 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li>
<li><span class="parameter">action_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
on_input action id
</li>
<li><span class="parameter">action</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
on_input action
</li>
</ul>
@@ -177,8 +179,8 @@
<ul>
<li><span class="parameter">on_back</span>
<span class="types"><span class="type">druid_event</span></span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -213,8 +215,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><strong>BaseComponent</strong></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><strong>BaseComponent</strong></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -78,70 +80,83 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td>
<td class="summary">Set current component style table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
<td class="summary">Set current component template name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes</td>
<td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td>
<td class="summary">Return all children components, recursive (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_context">get_context(self)</a></td>
<td class="summary">Get current component context</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
<td class="summary">Get current component context (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_druid">get_druid(self)</a></td>
<td class="summary">Return druid with context of calling component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
<td class="summary">Return component name</td>
<td class="summary">Return druid with context of calling component (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_input_priority">get_input_priority(self)</a></td>
<td class="summary">Return component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value)</a></td>
<td class="summary">Set component input priority</td>
<td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
<td class="summary">Return component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_component">get_parent_component(self)</a></td>
<td class="summary">Return the parent for current component (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_name">get_parent_name(self)</a></td>
<td class="summary">Return parent component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_template">get_template(self)</a></td>
<td class="summary">Get current component template name (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td>
<td class="summary">Return component uid (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#log_message">log_message(self, message, context)</a></td>
<td class="summary">Print log information if debug mode is enabled (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_input_priority">reset_input_priority(self)</a></td>
<td class="summary">Reset component input priority to default value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td>
<td class="summary">Return component uid.</td>
<td class="name" nowrap><a href="#set_debug">set_debug(self, is_debug)</a></td>
<td class="summary">Set debug logs for component enabled or disabled</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(self, 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(self)</a></td>
<td class="summary">Return the parent for current component</td>
<td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value)</a></td>
<td class="summary">Set component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#setup_component">setup_component(self, druid_instance, context, style)</a></td>
<td class="summary">Setup component context and his style table</td>
<td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td>
<td class="summary">Return all children components, recursive</td>
<td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td>
<td class="summary">Set current component style table (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
<td class="summary">Set current component template name (protected)
It will check parent template name to build full template name</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#ALL">ALL</a></td>
<td class="name" nowrap><a href="#ON_INPUT">ON_INPUT</a></td>
<td class="summary">Component Interests</td>
</tr>
</table>
@@ -154,77 +169,27 @@
<dl class="function">
<dt>
<a name = "set_style"></a>
<strong>set_style(self, druid_style)</strong>
<a name = "get_childrens"></a>
<strong>get_childrens(self)</strong>
</dt>
<dd>
Set current component style table.
Invoke `on_style_change` on component, if exist. BaseComponent should handle
their style changing and store all style params
Return all children components, recursive (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">druid_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Druid style module
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
</dd>
<dt>
<a name = "set_template"></a>
<strong>set_template(self, template)</strong>
</dt>
<dd>
Set current component template name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
BaseComponent template name
</li>
</ul>
</dd>
<dt>
<a name = "set_nodes"></a>
<strong>set_nodes(self, nodes)</strong>
</dt>
<dd>
Set current component nodes
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
BaseComponent nodes table
</li>
</ul>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array of childrens if the Druid component instance
</ol>
@@ -235,68 +200,34 @@
<strong>get_context(self)</strong>
</dt>
<dd>
Get current component context
Get current component context (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<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>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent context
</ol>
</dd>
<dt>
<a name = "get_node"></a>
<strong>get_node(self, node_or_name)</strong>
</dt>
<dd>
Get node for component by name.
If component has nodes, node_or_name should be string
It auto pick node by template name or from nodes by clone_tree
if they was setup via component:set_nodes, component:set_template
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">node_or_name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <span class="type">node</span></span>
Node name or node itself
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span></span>
Gui node
</ol>
</dd>
<dt>
<a name = "get_druid"></a>
<strong>get_druid(self)</strong>
</dt>
<dd>
Return druid with context of calling component.
Return druid with context of calling component (protected).
Use it to create component inside of other components.
@@ -304,7 +235,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
@@ -318,33 +249,6 @@
</dd>
<dt>
<a name = "get_name"></a>
<strong>get_name(self)</strong>
</dt>
<dd>
Return component name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
</ul>
<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>
The component name
</ol>
</dd>
<dt>
<a name = "get_input_priority"></a>
@@ -358,7 +262,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
@@ -374,22 +278,162 @@
</dd>
<dt>
<a name = "set_input_priority"></a>
<strong>set_input_priority(self, value)</strong>
<a name = "get_name"></a>
<strong>get_name(self)</strong>
</dt>
<dd>
Set component input priority
Return component name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The new input priority value
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The component name
</ol>
</dd>
<dt>
<a name = "get_node"></a>
<strong>get_node(self, node_or_name)</strong>
</dt>
<dd>
Get node for component by name.
If component has nodes, node_or_name should be string
It auto pick node by template name or from nodes by clone_tree
if they was setup via component:set_nodes, component:set_template.
If node is not found, the exception will fired
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">node_or_name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
Node name or node itself
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span></span>
Gui node
</ol>
</dd>
<dt>
<a name = "get_parent_component"></a>
<strong>get_parent_component(self)</strong>
</dt>
<dd>
Return the parent for current component (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span> or <span class="type">nil</span></span>
The druid component instance or nil
</ol>
</dd>
<dt>
<a name = "get_parent_name"></a>
<strong>get_parent_name(self)</strong>
</dt>
<dd>
Return parent component name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
The parent component name if exist or bil
</ol>
</dd>
<dt>
<a name = "get_template"></a>
<strong>get_template(self)</strong>
</dt>
<dd>
Get current component template name (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Component full template name
</ol>
</dd>
<dt>
<a name = "get_uid"></a>
<strong>get_uid(self)</strong>
</dt>
<dd>
Return component uid (protected).
UID generated in component creation order
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
@@ -397,12 +441,41 @@
<ol>
<span class="types"><span class="type">number</span></span>
The component input priority
The component uid
</ol>
</dd>
<dt>
<a name = "log_message"></a>
<strong>log_message(self, message, context)</strong>
</dt>
<dd>
Print log information if debug mode is enabled (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "reset_input_priority"></a>
@@ -416,7 +489,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
@@ -432,27 +505,25 @@
</dd>
<dt>
<a name = "get_uid"></a>
<strong>get_uid(self)</strong>
<a name = "set_debug"></a>
<strong>set_debug(self, is_debug)</strong>
</dt>
<dd>
Return component uid. UID generated in component creation order
Set debug logs for component enabled or disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">is_debug</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component uid
</ol>
@@ -471,7 +542,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
@@ -491,26 +562,30 @@
</dd>
<dt>
<a name = "get_parent_component"></a>
<strong>get_parent_component(self)</strong>
<a name = "set_input_priority"></a>
<strong>set_input_priority(self, value)</strong>
</dt>
<dd>
Return the parent for current component
Set component input priority
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The new input priority value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.base_component</span> or <span class="type">nil</span></span>
The druid component instance or nil
<span class="types"><span class="type">number</span></span>
The component input priority
</ol>
@@ -518,65 +593,89 @@
</dd>
<dt>
<a name = "setup_component"></a>
<strong>setup_component(self, druid_instance, context, style)</strong>
<a name = "set_nodes"></a>
<strong>set_nodes(self, nodes)</strong>
</dt>
<dd>
Setup component context and his style table
Set current component nodes (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent nodes table
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
</dd>
<dt>
<a name = "set_style"></a>
<strong>set_style(self, druid_style)</strong>
</dt>
<dd>
Set current component style table (protected).
Invoke `on_style_change` on component, if exist. BaseComponent should handle
their style changing and store all style params
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">druid_instance</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The parent druid instance
</li>
<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>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<li><span class="parameter">druid_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">component</span></span>
BaseComponent itself
</ol>
</dd>
<dt>
<a name = "get_childrens"></a>
<strong>get_childrens(self)</strong>
<a name = "set_template"></a>
<strong>set_template(self, template)</strong>
</dt>
<dd>
Return all children components, recursive
Set current component template name (protected)
It will check parent template name to build full template name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
BaseComponent template name
</li>
</ul>
<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>
Array of childrens if the Druid component instance
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
@@ -588,8 +687,8 @@
<dl class="function">
<dt>
<a name = "ALL"></a>
<strong>ALL</strong>
<a name = "ON_INPUT"></a>
<strong>ON_INPUT</strong>
</dt>
<dd>
Component Interests
@@ -607,8 +706,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>Blocker</strong></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -81,13 +83,13 @@
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return blocked enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
@@ -116,7 +118,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Blocker.html#node">node</a></span>
@@ -128,31 +130,6 @@
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
@@ -166,7 +143,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
</ul>
@@ -180,6 +157,31 @@
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
@@ -211,8 +213,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><strong>Button</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -78,33 +80,33 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, params[, anim_node]])</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get key-code to trigger this button</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled button component state</td>
<td class="name" nowrap><a href="#init">init(self, node, callback[, params[, anim_node]])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return button enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_check_function">set_check_function(self[, check_function[, failure_callback]])</a></td>
<td class="summary">Set function for additional check for button click availability</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict button click area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled button component state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(self, key)</a></td>
<td class="summary">Set key-code to trigger this button</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get key-code to trigger this button</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_check_function">set_check_function([check_function[, failure_callback]])</a></td>
<td class="summary">Set function for additional check for button click availability</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
@@ -115,17 +117,33 @@
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#anim_node">anim_node</a></td>
<td class="summary">Animation node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hash">hash</a></td>
<td class="summary">The hash of trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary">Druid hover logic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click">on_click</a></td>
<td class="summary">On release button callback(self, params, button_instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary">On repeated action button callback(self, params, button_instance, click_amount)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">On long tap button callback(self, params, button_instance, time)</td>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary">On click outside of button(self, params, button_instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
@@ -136,44 +154,28 @@
<td class="summary">On button hold before long_click callback(self, params, button_instance, time)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary">On click outside of button(self, params, button_instance)</td>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">On long tap button callback(self, params, button_instance, time)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hash">hash</a></td>
<td class="summary">The hash of trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#anim_node">anim_node</a></td>
<td class="summary">Animation node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial scale of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Initial pos of anim_node</td>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary">On repeated action button callback(self, params, button_instance, click_amount)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Params to click callbacks</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary">Druid hover logic component</td>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial scale of anim_node</td>
</tr>
</table>
@@ -184,166 +186,6 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, params[, anim_node]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Button callback
</li>
<li><span class="parameter">params</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Button callback params
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Button anim node (node, if not provided)
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled button component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return button enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled
</ol>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_key_trigger"></a>
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key-code to trigger this button
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "get_key_trigger"></a>
<strong>get_key_trigger(self)</strong>
@@ -370,10 +212,76 @@
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, params[, anim_node]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Button callback
</li>
<li><span class="parameter">params</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Button callback params
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Button anim node (node, if not provided)
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return button enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled
</ol>
</dd>
<dt>
<a name = "set_check_function"></a>
<strong>set_check_function([check_function[, failure_callback]])</strong>
<strong>set_check_function(self[, check_function[, failure_callback]])</strong>
</dt>
<dd>
Set function for additional check for button click availability
@@ -381,6 +289,10 @@
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">check_function</span>
<span class="types"><span class="type">function</span></span>
Should return true or false. If true - button can be pressed.
@@ -403,6 +315,100 @@
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled button component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_key_trigger"></a>
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key-code to trigger this button
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
@@ -467,137 +473,39 @@
<dl class="function">
<dt>
<a name = "on_click"></a>
<strong>on_click</strong>
<a name = "anim_node"></a>
<strong>anim_node</strong>
</dt>
<dd>
On release button callback(self, params, button_instance)
Animation node
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_repeated_click"></a>
<strong>on_repeated_click</strong>
</dt>
<dd>
On repeated action button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_repeated_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_long_click"></a>
<strong>on_long_click</strong>
</dt>
<dd>
On long tap button callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_double_click"></a>
<strong>on_double_click</strong>
</dt>
<dd>
On double tap button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_double_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_hold_callback"></a>
<strong>on_hold_callback</strong>
</dt>
<dd>
On button hold before long_click callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_click_outside"></a>
<strong>on_click_outside</strong>
</dt>
<dd>
On click outside of button(self, params, button_instance)
<ul>
<li><span class="parameter">on_click_outside</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Trigger node
<ul>
<li><span class="parameter">node</span>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "click_zone"></a>
<strong>click_zone</strong>
</dt>
<dd>
Restriction zone
<ul>
<li><span class="parameter">click_zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>optional</em>)
</li>
</ul>
@@ -627,18 +535,17 @@
</dd>
<dt>
<a name = "anim_node"></a>
<strong>anim_node</strong>
<a name = "hover"></a>
<strong>hover</strong>
</dt>
<dd>
Animation node
Druid hover logic component
<ul>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>default</em> node)
<li><span class="parameter">hover</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
@@ -648,15 +555,175 @@
</dd>
<dt>
<a name = "start_scale"></a>
<strong>start_scale</strong>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Initial scale of anim_node
Trigger node
<ul>
<li><span class="parameter">start_scale</span>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_click"></a>
<strong>on_click</strong>
</dt>
<dd>
On release button callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_click_outside"></a>
<strong>on_click_outside</strong>
</dt>
<dd>
On click outside of button(self, params, button_instance)
<ul>
<li><span class="parameter">on_click_outside</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_double_click"></a>
<strong>on_double_click</strong>
</dt>
<dd>
On double tap button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_double_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_hold_callback"></a>
<strong>on_hold_callback</strong>
</dt>
<dd>
On button hold before long_click callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_long_click"></a>
<strong>on_long_click</strong>
</dt>
<dd>
On long tap button callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_repeated_click"></a>
<strong>on_repeated_click</strong>
</dt>
<dd>
On repeated action button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_repeated_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Params to click callbacks
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Initial pos of anim_node
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
@@ -688,15 +755,15 @@
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
<a name = "start_scale"></a>
<strong>start_scale</strong>
</dt>
<dd>
Initial pos of anim_node
Initial scale of anim_node
<ul>
<li><span class="parameter">pos</span>
<li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span>
</li>
@@ -706,67 +773,6 @@
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Params to click callbacks
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "hover"></a>
<strong>hover</strong>
</dt>
<dd>
Druid hover logic component
<ul>
<li><span class="parameter">hover</span>
<span class="types"><span class="type">druid.hover</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "click_zone"></a>
<strong>click_zone</strong>
</dt>
<dd>
Restriction zone
<ul>
<li><span class="parameter">click_zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>optional</em>)
</li>
</ul>
</dd>
</dl>
@@ -774,8 +780,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><strong>Checkbox</strong></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -78,17 +80,17 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node])</a></td>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent)</a></td>
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent, is_instant)</a></td>
<td class="summary">Set checkbox state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox state</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
@@ -100,20 +102,20 @@
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td>
<td class="summary">On change state callback(self, state)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Visual node</td>
<td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">Button component from click_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_node">click_node</a></td>
<td class="summary">Button trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">Button component from click_node</td>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Visual node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td>
<td class="summary">On change state callback(self, state)</td>
</tr>
</table>
@@ -124,9 +126,36 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, click_node=node])</strong>
<strong>init(self, node, callback[, click_node=node[, initial_state=false]])</strong>
</dt>
<dd>
Component init function
@@ -136,7 +165,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
@@ -151,6 +180,11 @@
Trigger node, by default equals to node
(<em>default</em> node)
</li>
<li><span class="parameter">initial_state</span>
<span class="types"><span class="type">boolean</span></span>
The initial state of checkbox, default - false
(<em>default</em> false)
</li>
</ul>
@@ -160,7 +194,7 @@
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, state, is_silent)</strong>
<strong>set_state(self, state, is_silent, is_instant)</strong>
</dt>
<dd>
Set checkbox state
@@ -170,7 +204,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
@@ -180,35 +214,12 @@
<span class="types"><span class="type">bool</span></span>
Don't trigger on_change_state if true
</li>
</ul>
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">bool</span></span>
If instant checkbox change
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</ol>
@@ -246,37 +257,17 @@
<dl class="function">
<dt>
<a name = "on_change_state"></a>
<strong>on_change_state</strong>
<a name = "button"></a>
<strong>button</strong>
</dt>
<dd>
On change state callback(self, state)
Button component from click_node
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Visual node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
<li><span class="parameter">button</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
@@ -307,16 +298,16 @@
</dd>
<dt>
<a name = "button"></a>
<strong>button</strong>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Button component from click_node
Visual node
<ul>
<li><span class="parameter">button</span>
<span class="types"><span class="type">Button</span></span>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
</li>
</ul>
@@ -325,6 +316,26 @@
</dd>
<dt>
<a name = "on_change_state"></a>
<strong>on_change_state</strong>
</dt>
<dd>
On change state callback(self, state)
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
@@ -332,8 +343,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><strong>CheckboxGroup</strong></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -76,29 +78,29 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, indexes)</a></td>
<td class="name" nowrap><a href="#set_state">set_state(self, indexes, is_instant)</a></td>
<td class="summary">Set checkbox group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox group state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_checkbox_click">on_checkbox_click</a></td>
<td class="summary">On any checkbox click callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_checkbox_click">on_checkbox_click</a></td>
<td class="summary">On any checkbox click callback(self, index)</td>
</tr>
</table>
<br/>
@@ -108,6 +110,33 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
@@ -120,7 +149,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
@@ -144,7 +173,7 @@
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, indexes)</strong>
<strong>set_state(self, indexes, is_instant)</strong>
</dt>
<dd>
Set checkbox group state
@@ -154,41 +183,18 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
<li><span class="parameter">indexes</span>
<span class="types"><span class="type">bool[]</span></span>
Array of checkbox state
</li>
</ul>
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If instant state change
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
@@ -198,26 +204,6 @@
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_checkbox_click"></a>
<strong>on_checkbox_click</strong>
</dt>
<dd>
On any checkbox click callback(self, index)
<ul>
<li><span class="parameter">on_checkbox_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "checkboxes"></a>
<strong>checkboxes</strong>
@@ -228,8 +214,28 @@
<ul>
<li><span class="parameter">checkboxes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_checkbox_click"></a>
<strong>on_checkbox_click</strong>
</dt>
<dd>
On any checkbox click callback(self, index)
<ul>
<li><span class="parameter">on_checkbox_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -244,8 +250,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><strong>DataList</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -77,18 +79,6 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, scroll, grid, create_function)</a></td>
<td class="summary">Data list constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove">on_remove(self)</a></td>
<td class="summary">Druid System on_remove function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_data">set_data(self, data)</a></td>
<td class="summary">Set new data set for DataList component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the DataList and refresh visuals</td>
@@ -98,6 +88,10 @@
<td class="summary">Return first index from data.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_index">get_index(self, data)</a></td>
<td class="summary">Return index for data value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_last_index">get_last_index(self)</a></td>
<td class="summary">Return last index from data</td>
</tr>
@@ -106,39 +100,47 @@
<td class="summary">Return amount of data</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_index">get_index(self, data)</a></td>
<td class="summary">Return index for data value</td>
<td class="name" nowrap><a href="#init">init(self, scroll, grid, create_function)</a></td>
<td class="summary">Data list constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove">on_remove(self)</a></td>
<td class="summary">Druid System on_remove function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td>
<td class="summary">Instant scroll to element with passed index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_data">set_data(self, data)</a></td>
<td class="summary">Set new data set for DataList component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#scroll">scroll</a></td>
<td class="summary">The Druid scroll component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#grid">grid</a></td>
<td class="summary">The Druid Grid component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#top_index">top_index</a></td>
<td class="summary">The current visual top data index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#last_index">last_index</a></td>
<td class="summary">The current visual last data index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_scroll_progress_change">on_scroll_progress_change</a></td>
<td class="summary">Event triggered when scroll progress is changed; event(self, progress_value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll">scroll</a></td>
<td class="summary">The Druid scroll component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll_progress">scroll_progress</a></td>
<td class="summary">The current progress of scroll posititon</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_scroll_progress_change">on_scroll_progress_change</a></td>
<td class="summary">Event triggered when scroll progress is changed; event(self, progress_value)</td>
<td class="name" nowrap><a href="#top_index">top_index</a></td>
<td class="summary">The current visual top data index</td>
</tr>
</table>
@@ -149,6 +151,115 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the DataList and refresh visuals
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_first_index"></a>
<strong>get_first_index(self)</strong>
</dt>
<dd>
Return first index from data. It not always equals to 1
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, data)</strong>
</dt>
<dd>
Return index for data value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_last_index"></a>
<strong>get_last_index(self)</strong>
</dt>
<dd>
Return last index from data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_length"></a>
<strong>get_length(self)</strong>
</dt>
<dd>
Return amount of data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, scroll, grid, create_function)</strong>
@@ -161,15 +272,15 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">druid.scroll</span></span>
The Scroll instance for Data List component
<span class="types"><span class="type">Scroll</span></span>
The <a href="../modules/Scroll.html#">Scroll</a> instance for Data List component
</li>
<li><span class="parameter">grid</span>
<span class="types"><span class="type">druid.grid</span></span>
The Grid instance for Data List component
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component
</li>
<li><span class="parameter">create_function</span>
<span class="types"><span class="type">function</span></span>
@@ -194,6 +305,31 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_to_index"></a>
<strong>scroll_to_index(self, index)</strong>
</dt>
<dd>
Instant scroll to element with passed index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -215,10 +351,10 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The new data array
</li>
</ul>
@@ -233,165 +369,11 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the DataList and refresh visuals
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_first_index"></a>
<strong>get_first_index(self)</strong>
</dt>
<dd>
Return first index from data. It not always equals to 1
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_last_index"></a>
<strong>get_last_index(self)</strong>
</dt>
<dd>
Return last index from data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_length"></a>
<strong>get_length(self)</strong>
</dt>
<dd>
Return amount of data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, data)</strong>
</dt>
<dd>
Return index for data value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_to_index"></a>
<strong>scroll_to_index(self, index)</strong>
</dt>
<dd>
Instant scroll to element with passed index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "scroll"></a>
<strong>scroll</strong>
</dt>
<dd>
The Druid scroll component
<ul>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">druid.scroll</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "grid"></a>
<strong>grid</strong>
@@ -402,28 +384,8 @@
<ul>
<li><span class="parameter">grid</span>
<span class="types"><span class="type">druid.static_grid</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "top_index"></a>
<strong>top_index</strong>
</dt>
<dd>
The current visual top data index
<ul>
<li><span class="parameter">top_index</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>, <a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
@@ -451,6 +413,46 @@
</dd>
<dt>
<a name = "on_scroll_progress_change"></a>
<strong>on_scroll_progress_change</strong>
</dt>
<dd>
Event triggered when scroll progress is changed; event(self, progress_value)
<ul>
<li><span class="parameter">on_scroll_progress_change</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll"></a>
<strong>scroll</strong>
</dt>
<dd>
The Druid scroll component
<ul>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">Scroll</span></span>
<a href="../modules/Scroll.html#">Scroll</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_progress"></a>
@@ -473,16 +475,16 @@
</dd>
<dt>
<a name = "on_scroll_progress_change"></a>
<strong>on_scroll_progress_change</strong>
<a name = "top_index"></a>
<strong>top_index</strong>
</dt>
<dd>
Event triggered when scroll progress is changed; event(self, progress_value)
The current visual top data index
<ul>
<li><span class="parameter">on_scroll_progress_change</span>
<span class="types"><span class="type">druid_event</span></span>
<li><span class="parameter">top_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -498,8 +500,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -99,16 +101,20 @@
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_touch_start">on_touch_start</a></td>
<td class="summary">Event on touch start callback(self)</td>
<td class="name" nowrap><a href="#can_x">can_x</a></td>
<td class="summary">Is drag component process vertical dragging.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_touch_end">on_touch_end</a></td>
<td class="summary">Event on touch end callback(self)</td>
<td class="name" nowrap><a href="#can_y">can_y</a></td>
<td class="summary">Is drag component process horizontal.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_drag_start">on_drag_start</a></td>
<td class="summary">Event on drag start callback(self)</td>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Is component now dragging</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_touch">is_touch</a></td>
<td class="summary">Is component now touching</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_drag">on_drag</a></td>
@@ -119,20 +125,20 @@
<td class="summary">Event on drag end callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_touch">is_touch</a></td>
<td class="summary">Is component now touching</td>
<td class="name" nowrap><a href="#on_drag_start">on_drag_start</a></td>
<td class="summary">Event on drag start callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Is component now dragging</td>
<td class="name" nowrap><a href="#on_touch_end">on_touch_end</a></td>
<td class="summary">Event on touch end callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#can_x">can_x</a></td>
<td class="summary">Is drag component process vertical dragging.</td>
<td class="name" nowrap><a href="#on_touch_start">on_touch_start</a></td>
<td class="summary">Event on touch start callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#can_y">can_y</a></td>
<td class="summary">Is drag component process horizontal.</td>
<td class="name" nowrap><a href="#touch_start_pos">touch_start_pos</a></td>
<td class="summary">Touch start position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#x">x</a></td>
@@ -142,10 +148,6 @@
<td class="name" nowrap><a href="#y">y</a></td>
<td class="summary">Current touch y position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#touch_start_pos">touch_start_pos</a></td>
<td class="summary">Touch start position</td>
</tr>
</table>
<br/>
@@ -167,7 +169,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
@@ -197,7 +199,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
@@ -243,16 +245,16 @@
<dl class="function">
<dt>
<a name = "on_touch_start"></a>
<strong>on_touch_start</strong>
<a name = "can_x"></a>
<strong>can_x</strong>
</dt>
<dd>
Event on touch start callback(self)
Is drag component process vertical dragging. Default - true
<ul>
<li><span class="parameter">on_touch_start</span>
<span class="types"><span class="type">druid_event</span></span>
<li><span class="parameter">can_x</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
@@ -263,95 +265,15 @@
</dd>
<dt>
<a name = "on_touch_end"></a>
<strong>on_touch_end</strong>
<a name = "can_y"></a>
<strong>can_y</strong>
</dt>
<dd>
Event on touch end callback(self)
Is drag component process horizontal. Default - true
<ul>
<li><span class="parameter">on_touch_end</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_start"></a>
<strong>on_drag_start</strong>
</dt>
<dd>
Event on drag start callback(self)
<ul>
<li><span class="parameter">on_drag_start</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag"></a>
<strong>on_drag</strong>
</dt>
<dd>
on drag progress callback(self, dx, dy)
<ul>
<li><span class="parameter">on_drag</span>
<span class="types"><span class="type">druid_event</span></span>
Event
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_end"></a>
<strong>on_drag_end</strong>
</dt>
<dd>
Event on drag end callback(self)
<ul>
<li><span class="parameter">on_drag_end</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_touch"></a>
<strong>is_touch</strong>
</dt>
<dd>
Is component now touching
<ul>
<li><span class="parameter">is_touch</span>
<li><span class="parameter">can_y</span>
<span class="types"><span class="type">bool</span></span>
</li>
@@ -383,15 +305,15 @@
</dd>
<dt>
<a name = "can_x"></a>
<strong>can_x</strong>
<a name = "is_touch"></a>
<strong>is_touch</strong>
</dt>
<dd>
Is drag component process vertical dragging. Default - true
Is component now touching
<ul>
<li><span class="parameter">can_x</span>
<li><span class="parameter">is_touch</span>
<span class="types"><span class="type">bool</span></span>
</li>
@@ -403,16 +325,116 @@
</dd>
<dt>
<a name = "can_y"></a>
<strong>can_y</strong>
<a name = "on_drag"></a>
<strong>on_drag</strong>
</dt>
<dd>
Is drag component process horizontal. Default - true
on drag progress callback(self, dx, dy)
<ul>
<li><span class="parameter">can_y</span>
<span class="types"><span class="type">bool</span></span>
<li><span class="parameter">on_drag</span>
<span class="types"><span class="type">DruidEvent</span></span>
Event <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_end"></a>
<strong>on_drag_end</strong>
</dt>
<dd>
Event on drag end callback(self)
<ul>
<li><span class="parameter">on_drag_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_start"></a>
<strong>on_drag_start</strong>
</dt>
<dd>
Event on drag start callback(self)
<ul>
<li><span class="parameter">on_drag_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_end"></a>
<strong>on_touch_end</strong>
</dt>
<dd>
Event on touch end callback(self)
<ul>
<li><span class="parameter">on_touch_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_start"></a>
<strong>on_touch_start</strong>
</dt>
<dd>
Event on touch start callback(self)
<ul>
<li><span class="parameter">on_touch_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "touch_start_pos"></a>
<strong>touch_start_pos</strong>
</dt>
<dd>
Touch start position
<ul>
<li><span class="parameter">touch_start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
@@ -461,26 +483,6 @@
</dd>
<dt>
<a name = "touch_start_pos"></a>
<strong>touch_start_pos</strong>
</dt>
<dd>
Touch start position
<ul>
<li><span class="parameter">touch_start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
</dl>
@@ -488,8 +490,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -39,29 +39,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -69,36 +71,36 @@
<div id="content">
<h1>Module <code>DruidEvent</code></h1>
<p>Lua event small library</p>
<p>Druid lua event library</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the all event handlers</td>
</tr>
<tr>
<td class="name" nowrap><a href="#initialize">initialize(self, initial_callback)</a></td>
<td class="summary">Event constructur</td>
</tr>
<tr>
<td class="name" nowrap><a href="#subscribe">subscribe(self, callback, context)</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback, context)</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_exist">is_exist(self)</a></td>
<td class="summary">Return true, if event have at lease one handler</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the all event handlers</td>
<td class="name" nowrap><a href="#subscribe">subscribe(self, callback, context)</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#trigger">trigger(self, ...)</a></td>
<td class="summary">Trigger the event and call all subscribed callbacks</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback, context)</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
</table>
<br/>
@@ -108,6 +110,27 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the all event handlers
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "initialize"></a>
<strong>initialize(self, initial_callback)</strong>
@@ -120,7 +143,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">initial_callback</span>
<span class="types"><span class="type">function</span></span>
@@ -132,64 +155,6 @@
</dd>
<dt>
<a name = "subscribe"></a>
<strong>subscribe(self, callback, context)</strong>
</dt>
<dd>
Subscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<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>
Additional context as first param to callback call
</li>
</ul>
</dd>
<dt>
<a name = "unsubscribe"></a>
<strong>unsubscribe(self, callback, context)</strong>
</dt>
<dd>
Unsubscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<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>
Additional context as first param to callback call
</li>
</ul>
</dd>
<dt>
<a name = "is_exist"></a>
@@ -203,7 +168,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -219,18 +184,26 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
<a name = "subscribe"></a>
<strong>subscribe(self, callback, context)</strong>
</dt>
<dd>
Clear the all event handlers
Subscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li>
</ul>
@@ -251,7 +224,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">any</span></span>
@@ -263,6 +236,35 @@
</dd>
<dt>
<a name = "unsubscribe"></a>
<strong>unsubscribe(self, callback, context)</strong>
</dt>
<dd>
Unsubscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li>
</ul>
</dd>
</dl>
@@ -270,8 +272,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

File diff suppressed because it is too large Load Diff

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><strong>DynamicGrid</strong></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -77,28 +79,20 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#_get_side_vector">_get_side_vector(self, side, is_forward)</a></td>
<td class="summary">Return side vector to correct node shifting</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index, node[, origin_index])</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add">add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]]])</a></td>
<td class="name" nowrap><a href="#add">add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</a></td>
<td class="summary">Add new node to the grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]])</a></td>
<td class="summary">Remove the item from the grid.</td>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear grid nodes array.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_size">get_size(self, border)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_offset">get_offset(self)</a></td>
<td class="summary">Return DynamicGrid offset, where DynamicGrid content starts.</td>
<td class="name" nowrap><a href="#get_all_pos">get_all_pos(self)</a></td>
<td class="summary">Return array of all node positions</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td>
@@ -109,51 +103,35 @@
<td class="summary">Return grid index by node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_all_pos">get_all_pos(self)</a></td>
<td class="summary">Return array of all node positions</td>
<td class="name" nowrap><a href="#get_offset">get_offset(self)</a></td>
<td class="summary">Return DynamicGrid offset, where DynamicGrid content starts.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index, node[, origin_index])</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_size">get_size(self, border)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_position_function">set_position_function(self, callback)</a></td>
<td class="summary">Change set position function for grid nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear grid nodes array.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#_get_side_vector">_get_side_vector(self, side, is_forward)</a></td>
<td class="summary">Return side vector to correct node shifting</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td>
<td class="summary">On item add callback(self, node, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add or remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#nodes">nodes</a></td>
<td class="summary">List of all grid elements.</td>
<td class="name" nowrap><a href="#border">border</a></td>
<td class="summary">The size of item content</td>
</tr>
<tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td>
@@ -168,8 +146,32 @@
<td class="summary">Item size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#border">border</a></td>
<td class="summary">The size of item content</td>
<td class="name" nowrap><a href="#nodes">nodes</a></td>
<td class="summary">List of all grid elements.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td>
<td class="summary">On item add callback(self, node, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add or remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr>
</table>
@@ -181,22 +183,63 @@
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, parent)</strong>
<a name = "_get_side_vector"></a>
<strong>_get_side_vector(self, side, is_forward)</strong>
</dt>
<dd>
Component init function
Return side vector to correct node shifting
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">side</span>
</li>
<li><span class="parameter">is_forward</span>
</li>
</ul>
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</strong>
</dt>
<dd>
Add new node to the grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">parent</span>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed
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">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
@@ -204,6 +247,146 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</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>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</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 = "get_all_pos"></a>
<strong>get_all_pos(self)</strong>
</dt>
<dd>
Return array of all node positions
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(self, node)</strong>
</dt>
<dd>
Return grid index by node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<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_offset"></a>
<strong>get_offset(self)</strong>
</dt>
<dd>
Return DynamicGrid offset, where DynamicGrid content starts.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a> The DynamicGrid instance
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The DynamicGrid offset
</ol>
</dd>
<dt>
<a name = "get_pos"></a>
@@ -217,7 +400,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
@@ -244,87 +427,6 @@
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]]])</strong>
</dt>
<dd>
Add new node to the grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<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">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instance</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
</dd>
<dt>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instance=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">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<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">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instance</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Node</span></span>
The deleted gui node from grid
</ol>
</dd>
<dt>
<a name = "get_size"></a>
@@ -338,7 +440,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector3</span></span>
@@ -358,111 +460,65 @@
</dd>
<dt>
<a name = "get_offset"></a>
<strong>get_offset(self)</strong>
<a name = "init"></a>
<strong>init(self, parent)</strong>
</dt>
<dd>
Return DynamicGrid offset, where DynamicGrid content starts.
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
The DynamicGrid instance
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The DynamicGrid offset
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(self, node)</strong>
</dt>
<dd>
Return grid index by node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">node</span>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
The gui node in the grid
The gui node parent, where items will be placed
</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(self)</strong>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
</dt>
<dd>
Return array of all node positions
Remove the item from the grid. Note that gui node will be not deleted
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<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">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
<span class="types"><span class="type">node</span></span>
The deleted gui node from grid
</ol>
@@ -482,7 +538,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
@@ -500,196 +556,22 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</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>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</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 = "_get_side_vector"></a>
<strong>_get_side_vector(self, side, is_forward)</strong>
</dt>
<dd>
Return side vector to correct node shifting
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">side</span>
</li>
<li><span class="parameter">is_forward</span>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_add_item"></a>
<strong>on_add_item</strong>
<a name = "border"></a>
<strong>border</strong>
</dt>
<dd>
On item add callback(self, node, index)
The size of item content
<ul>
<li><span class="parameter">on_add_item</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add or remove callback(self, index)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "nodes"></a>
<strong>nodes</strong>
</dt>
<dd>
List of all grid elements. Contains from node, pos, size, pivot
<ul>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector4</span></span>
</li>
</ul>
@@ -760,16 +642,136 @@
</dd>
<dt>
<a name = "border"></a>
<strong>border</strong>
<a name = "nodes"></a>
<strong>nodes</strong>
</dt>
<dd>
The size of item content
List of all grid elements. Contains from node, pos, size, pivot
<ul>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector4</span></span>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_add_item"></a>
<strong>on_add_item</strong>
</dt>
<dd>
On item add callback(self, node, index)
<ul>
<li><span class="parameter">on_add_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add or remove callback(self, index)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
@@ -785,8 +787,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

427
docs/modules/Helper.html Normal file
View File

@@ -0,0 +1,427 @@
<!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>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><strong>Helper</strong></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Helper</code></h1>
<p>Druid helper module for gui layouts</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#helper.centrate_icon_with_text">helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0[, ...]])</a></td>
<td class="summary">Center several nodes nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_text_with_icon">helper.centrate_text_with_icon([text_node][, icon_node], margin)</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.deprecated">helper.deprecated(message)</a></td>
<td class="summary">Show deprecated message.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_border">helper.get_border(node, offset)</a></td>
<td class="summary">Distance from node position to his borders</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_closest_stencil_node">helper.get_closest_stencil_node(node)</a></td>
<td class="summary">Return closest non inverted clipping parent node for node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_pivot_offset">helper.get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given gui pivot</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_enabled">helper.is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in gui hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_mobile">helper.is_mobile()</a></td>
<td class="summary">Check if device is mobile (Android or iOS)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_web">helper.is_web()</a></td>
<td class="summary">Check if device is HTML5</td>
</tr>
<tr>
<td class="name" nowrap><a href="#table_to_string">table_to_string(t)</a></td>
<td class="summary">Transform table to oneline string</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "helper.centrate_icon_with_text"></a>
<strong>helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
icon_node will be first (at left side)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
</ul>
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0[, ...]])</strong>
</dt>
<dd>
Center several nodes nodes.
Nodes will be center around 0 x position
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">Node</span></span>
Any count of gui Node
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "helper.centrate_text_with_icon"></a>
<strong>helper.centrate_text_with_icon([text_node][, icon_node], margin)</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
text_node will be first (at left side)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
</li>
</ul>
</dd>
<dt>
<a name = "helper.deprecated"></a>
<strong>helper.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.1/manual.html#5.4">string</a></span>
The deprecated message
</li>
</ul>
</dd>
<dt>
<a name = "helper.get_border"></a>
<strong>helper.get_border(node, offset)</strong>
</dt>
<dd>
Distance from node position to his borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node to check
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vector3</span></span>
The offset to add to result
</li>
</ul>
<h3>Returns:</h3>
<ol>
vector4 Vector with distance to node border: (left, top, right, down)
</ol>
</dd>
<dt>
<a name = "helper.get_closest_stencil_node"></a>
<strong>helper.get_closest_stencil_node(node)</strong>
</dt>
<dd>
Return closest non inverted clipping parent node for node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span> or <span class="type">nil</span></span>
The clipping node
</ol>
</dd>
<dt>
<a name = "helper.get_pivot_offset"></a>
<strong>helper.get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given gui pivot
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
The node pivot
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Vector offset with [-1..1] values
</ol>
</dd>
<dt>
<a name = "helper.is_enabled"></a>
<strong>helper.is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in gui hierarchy.
Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is enabled in hierarchy
</ol>
</dd>
<dt>
<a name = "helper.is_mobile"></a>
<strong>helper.is_mobile()</strong>
</dt>
<dd>
Check if device is mobile (Android or iOS)
</dd>
<dt>
<a name = "helper.is_web"></a>
<strong>helper.is_web()</strong>
</dt>
<dd>
Check if device is HTML5
</dd>
<dt>
<a name = "table_to_string"></a>
<strong>table_to_string(t)</strong>
</dt>
<dd>
Transform table to oneline string
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><strong>Hover</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><strong>Hover</strong></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -81,12 +83,8 @@
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_hover">set_hover(self, state)</a></td>
<td class="summary">Set hover state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_mouse_hover">set_mouse_hover(self, state)</a></td>
<td class="summary">Set mouse hover state</td>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return current hover enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
@@ -97,8 +95,12 @@
<td class="summary">Set enable state of hover component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return current hover enabled state</td>
<td class="name" nowrap><a href="#set_hover">set_hover(self, state)</a></td>
<td class="summary">Set hover state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_mouse_hover">set_mouse_hover(self, state)</a></td>
<td class="summary">Set mouse hover state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
@@ -132,7 +134,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
@@ -150,50 +152,27 @@
</dd>
<dt>
<a name = "set_hover"></a>
<strong>set_hover(self, state)</strong>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Set hover state
Return current hover enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover state
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
</dd>
<dt>
<a name = "set_mouse_hover"></a>
<strong>set_mouse_hover(self, state)</strong>
</dt>
<dd>
Set mouse hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The mouse hover state
</li>
</ul>
<span class="types"><span class="type">bool</span></span>
The hover enabled state
</ol>
@@ -212,7 +191,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><span class="type">node</span></span>
@@ -239,7 +218,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
@@ -253,27 +232,50 @@
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
<a name = "set_hover"></a>
<strong>set_hover(self, state)</strong>
</dt>
<dd>
Return current hover enabled state
Set hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The hover enabled state
</ol>
</dd>
<dt>
<a name = "set_mouse_hover"></a>
<strong>set_mouse_hover(self, state)</strong>
</dt>
<dd>
Set mouse hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The mouse hover state
</li>
</ul>
@@ -293,8 +295,8 @@
<ul>
<li><span class="parameter">on_hover</span>
<span class="types"><span class="type">druid_event</span></span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -313,8 +315,8 @@
<ul>
<li><span class="parameter">on_mouse_hover</span>
<span class="types"><span class="type">druid_event</span></span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -329,8 +331,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><strong>Input</strong></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -83,32 +85,36 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#set_text">set_text(self, input_text)</a></td>
<td class="summary">Set text for input field</td>
<td class="name" nowrap><a href="#get_text">get_text(self)</a></td>
<td class="summary">Return current input field text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, click_node, text_node[, keyboard_type])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_changes">reset_changes(self)</a></td>
<td class="summary">Reset current input selection and return previous value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#select">select(self)</a></td>
<td class="summary">Select input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unselect">unselect(self)</a></td>
<td class="summary">Remove selection from input.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_text">get_text(self)</a></td>
<td class="summary">Return current input field text</td>
<td class="name" nowrap><a href="#set_allowed_characters">set_allowed_characters(self, characters)</a></td>
<td class="summary">Set allowed charaters for input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_length">set_max_length(self, max_length)</a></td>
<td class="summary">Set maximum length for input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_allowed_characters">set_allowed_characters(self, characters)</a></td>
<td class="summary">Set allowed charaters for input field.</td>
<td class="name" nowrap><a href="#set_text">set_text(self, input_text)</a></td>
<td class="summary">Set text for input field</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_changes">reset_changes(self)</a></td>
<td class="summary">Reset current input selection and return previous value</td>
<td class="name" nowrap><a href="#unselect">unselect(self)</a></td>
<td class="summary">Remove selection from input.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
@@ -121,16 +127,28 @@
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_input_select">on_input_select</a></td>
<td class="summary">On input field select callback(self, button_node)</td>
<td class="name" nowrap><a href="#allowerd_characters">allowerd_characters</a></td>
<td class="summary">Pattern matching for user input</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td>
<td class="summary">On input field unselect callback(self, button_node)</td>
<td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">Button component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
<td class="name" nowrap><a href="#is_empty">is_empty</a></td>
<td class="summary">Is current input is empty now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_selected">is_selected</a></td>
<td class="summary">Is current input selected now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#keyboard_type">keyboard_type</a></td>
<td class="summary">Gui keyboard type for input field</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_length">max_length</a></td>
<td class="summary">Max length for input text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_empty">on_input_empty</a></td>
@@ -141,6 +159,18 @@
<td class="summary">On input field text change to max length string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_select">on_input_select</a></td>
<td class="summary">On input field select callback(self, button_node)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td>
<td class="summary">On input field unselect callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_wrong">on_input_wrong</a></td>
<td class="summary">On trying user input with not allowed character callback(self, params, button_instance)</td>
</tr>
@@ -148,30 +178,6 @@
<td class="name" nowrap><a href="#text">text</a></td>
<td class="summary">Text component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">Button component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_selected">is_selected</a></td>
<td class="summary">Is current input selected now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_empty">is_empty</a></td>
<td class="summary">Is current input is empty now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_length">max_length</a></td>
<td class="summary">Max length for input text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#allowerd_characters">allowerd_characters</a></td>
<td class="summary">Pattern matching for user input</td>
</tr>
<tr>
<td class="name" nowrap><a href="#keyboard_type">keyboard_type</a></td>
<td class="summary">Gui keyboard type for input field</td>
</tr>
</table>
<br/>
@@ -182,22 +188,79 @@
<dl class="function">
<dt>
<a name = "set_text"></a>
<strong>set_text(self, input_text)</strong>
<a name = "get_text"></a>
<strong>get_text(self)</strong>
</dt>
<dd>
Set text for input field
Return current input field text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">input_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
The string to apply for input field
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The current input field text
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, click_node, text_node[, keyboard_type])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">click_node</span>
<span class="types"><span class="type">node</span></span>
Button node to enabled input component
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">node</span> or <span class="type">Text</span></span>
Text node what will be changed on user input. You can pass text component instead of text node name <a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></span>
Gui keyboard type for input field
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "reset_changes"></a>
<strong>reset_changes(self)</strong>
</dt>
<dd>
Reset current input selection and return previous value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
@@ -218,7 +281,97 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "set_allowed_characters"></a>
<strong>set_allowed_characters(self, characters)</strong>
</dt>
<dd>
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Regulax exp. for validate user input
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_max_length"></a>
<strong>set_max_length(self, max_length)</strong>
</dt>
<dd>
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
Maximum length for input text field
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_text"></a>
<strong>set_text(self, input_text)</strong>
</dt>
<dd>
Set text for input field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">input_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The string to apply for input field
</li>
</ul>
@@ -239,120 +392,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_text"></a>
<strong>get_text(self)</strong>
</dt>
<dd>
Return current input field text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
</ul>
<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>
The current input field text
</ol>
</dd>
<dt>
<a name = "set_max_length"></a>
<strong>set_max_length(self, max_length)</strong>
</dt>
<dd>
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
Maximum length for input text field
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_allowed_characters"></a>
<strong>set_allowed_characters(self, characters)</strong>
</dt>
<dd>
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
<li><span class="parameter">characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Regulax exp. for validate user input
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "reset_changes"></a>
<strong>reset_changes(self)</strong>
</dt>
<dd>
Reset current input selection and return previous value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
@@ -383,7 +423,7 @@
(<em>default</em> false)
</li>
<li><span class="parameter">MASK_DEFAULT_CHAR</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Default character mask for password input
(<em>default</em> *)
</li>
@@ -405,7 +445,7 @@
(self, button_node) Callback on wrong user input
</li>
<li><span class="parameter">button_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Custom button style for input node
</li>
</ul>
@@ -420,137 +460,18 @@
<dl class="function">
<dt>
<a name = "on_input_select"></a>
<strong>on_input_select</strong>
<a name = "allowerd_characters"></a>
<strong>allowerd_characters</strong>
</dt>
<dd>
On input field select callback(self, button_node)
Pattern matching for user input
<ul>
<li><span class="parameter">on_input_select</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_unselect"></a>
<strong>on_input_unselect</strong>
</dt>
<dd>
On input field unselect callback(self, button_node)
<ul>
<li><span class="parameter">on_input_unselect</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_text"></a>
<strong>on_input_text</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">on_input_text</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_empty"></a>
<strong>on_input_empty</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">on_input_empty</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_full"></a>
<strong>on_input_full</strong>
</dt>
<dd>
On input field text change to max length string callback(self, input_text)
<ul>
<li><span class="parameter">on_input_full</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_wrong"></a>
<strong>on_input_wrong</strong>
</dt>
<dd>
On trying user input with not allowed character callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
Text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">druid.text</span></span>
<li><span class="parameter">allowerd_characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
(<em>optional</em>)
</li>
</ul>
@@ -569,7 +490,27 @@
<ul>
<li><span class="parameter">button</span>
<span class="types"><span class="type">druid.button</span></span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
</dd>
<dt>
<a name = "is_empty"></a>
<strong>is_empty</strong>
</dt>
<dd>
Is current input is empty now
<ul>
<li><span class="parameter">is_empty</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
@@ -600,16 +541,16 @@
</dd>
<dt>
<a name = "is_empty"></a>
<strong>is_empty</strong>
<a name = "keyboard_type"></a>
<strong>keyboard_type</strong>
</dt>
<dd>
Is current input is empty now
Gui keyboard type for input field
<ul>
<li><span class="parameter">is_empty</span>
<span class="types"><span class="type">bool</span></span>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -641,18 +582,17 @@
</dd>
<dt>
<a name = "allowerd_characters"></a>
<strong>allowerd_characters</strong>
<a name = "on_input_empty"></a>
<strong>on_input_empty</strong>
</dt>
<dd>
Pattern matching for user input
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">allowerd_characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
(<em>optional</em>)
<li><span class="parameter">on_input_empty</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -662,17 +602,117 @@
</dd>
<dt>
<a name = "keyboard_type"></a>
<strong>keyboard_type</strong>
<a name = "on_input_full"></a>
<strong>on_input_full</strong>
</dt>
<dd>
Gui keyboard type for input field
On input field text change to max length string callback(self, input_text)
<ul>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></span>
<li><span class="parameter">on_input_full</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_select"></a>
<strong>on_input_select</strong>
</dt>
<dd>
On input field select callback(self, button_node)
<ul>
<li><span class="parameter">on_input_select</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_text"></a>
<strong>on_input_text</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">on_input_text</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_unselect"></a>
<strong>on_input_unselect</strong>
</dt>
<dd>
On input field unselect callback(self, input_text)
<ul>
<li><span class="parameter">on_input_unselect</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_wrong"></a>
<strong>on_input_wrong</strong>
</dt>
<dd>
On trying user input with not allowed character callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
Text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
@@ -687,8 +727,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -77,6 +79,10 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#format">format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</a></td>
<td class="summary">Format string with new text params on localized text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id, no_adjust)</a></td>
<td class="summary">Component init function</td>
@@ -86,7 +92,7 @@
<td class="summary">Setup raw text to lang_text component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#translate">translate(self, locale_id)</a></td>
<td class="name" nowrap><a href="#translate">translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])</a></td>
<td class="summary">Translate the text by locale_id</td>
</tr>
</table>
@@ -109,6 +115,68 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "format"></a>
<strong>format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</strong>
</dt>
<dd>
Format string with new text params on localized text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, locale_id, no_adjust)</strong>
@@ -121,15 +189,15 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The text node
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Default locale id, optional
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Default locale id or text from node as default
</li>
<li><span class="parameter">no_adjust</span>
<span class="types"><span class="type">bool</span></span>
@@ -154,14 +222,20 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Text for text node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
@@ -169,7 +243,7 @@
</dd>
<dt>
<a name = "translate"></a>
<strong>translate(self, locale_id)</strong>
<strong>translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])</strong>
</dt>
<dd>
Translate the text by locale_id
@@ -179,14 +253,55 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale id
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
@@ -206,8 +321,8 @@
<ul>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">druid_event</span></span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -227,7 +342,7 @@
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
@@ -242,8 +357,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

297
docs/modules/PinKnob.html Normal file
View File

@@ -0,0 +1,297 @@
<!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="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><strong>PinKnob</strong></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>PinKnob</code></h1>
<p>Druid pin knob custom component.</p>
<p>
It's simple rotating input element</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, callback, template, nodes)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_angle">set_angle(self, cur_value, min, max)</a></td>
<td class="summary">Set current and min/max angles for component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_friction">set_friction(self[, value=1])</a></td>
<td class="summary">Set current and min/max angles for component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#druid">druid</a></td>
<td class="summary">The component druid instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Is currently under user control</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">The pin node</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(self, callback, template, nodes)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback(self, value) on value changed
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The template string name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Nodes table from gui.clone_tree
</li>
</ul>
</dd>
<dt>
<a name = "set_angle"></a>
<strong>set_angle(self, cur_value, min, max)</strong>
</dt>
<dd>
Set current and min/max angles for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">cur_value</span>
<span class="types"><span class="type">number</span></span>
The new value for pin knob
</li>
<li><span class="parameter">min</span>
<span class="types"><span class="type">number</span></span>
The minimum value for pin knob
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">number</span></span>
The maximum value for pin knob
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</ol>
</dd>
<dt>
<a name = "set_friction"></a>
<strong>set_friction(self[, value=1])</strong>
</dt>
<dd>
Set current and min/max angles for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The spin speed multiplier
(<em>default</em> 1)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "druid"></a>
<strong>druid</strong>
</dt>
<dd>
The component druid instance
<ul>
<li><span class="parameter">druid</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
</ul>
</dd>
<dt>
<a name = "is_drag"></a>
<strong>is_drag</strong>
</dt>
<dd>
Is currently under user control
<ul>
<li><span class="parameter">is_drag</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
The pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/PinKnob.html#node">node</a></span>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><strong>Progress</strong></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -79,30 +81,30 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#empty">empty(self)</a></td>
<td class="summary">Empty a progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#fill">fill(self)</a></td>
<td class="summary">Fill a progress bar and stop progress animation</td>
</tr>
<tr>
<td class="name" nowrap><a href="#empty">empty(self)</a></td>
<td class="summary">Empty a progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, to)</a></td>
<td class="summary">Instant fill progress bar to value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get">get(self)</a></td>
<td class="summary">Return current progress bar value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps, callback)</a></td>
<td class="summary">Set points on progress bar to fire the callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, to)</a></td>
<td class="summary">Instant fill progress bar to value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to">to(self, to[, callback])</a></td>
<td class="summary">Start animation of a progress bar</td>
</tr>
@@ -117,16 +119,20 @@
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">On progress bar change callback(self, new_value)</td>
<td class="name" nowrap><a href="#key">key</a></td>
<td class="summary">The progress bar direction</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
<td class="summary">Maximum size of progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Progress bar fill node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#key">key</a></td>
<td class="summary">The progress bar direction</td>
<td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">On progress bar change callback(self, new_value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scale">scale</a></td>
@@ -137,10 +143,6 @@
<td class="summary">Current progress bar size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
<td class="summary">Maximum size of progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#slice">slice</a></td>
<td class="summary">Progress bar slice9 settings</td>
</tr>
@@ -154,31 +156,18 @@
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, node, key[, init_value=1])</strong>
<a name = "empty"></a>
<strong>empty(self)</strong>
</dt>
<dd>
Component init function
Empty a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span>
Progress bar fill node or node name
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Progress bar direction: const.SIDE.X or const.SIDE.Y
</li>
<li><span class="parameter">init_value</span>
<span class="types"><span class="type">number</span></span>
Initial value of progress bar
(<em>default</em> 1)
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
@@ -199,53 +188,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "empty"></a>
<strong>empty(self)</strong>
</dt>
<dd>
Empty a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, to)</strong>
</dt>
<dd>
Instant fill progress bar to value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
@@ -266,7 +209,41 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, key[, init_value=1])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span>
Progress bar fill node or node name
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Progress bar direction: const.SIDE.X or const.SIDE.Y
</li>
<li><span class="parameter">init_value</span>
<span class="types"><span class="type">number</span></span>
Initial value of progress bar
(<em>default</em> 1)
</li>
</ul>
@@ -287,7 +264,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span>
@@ -307,6 +284,31 @@
<pre class="example">progress:set_steps({<span class="number">0</span>, <span class="number">0.3</span>, <span class="number">0.6</span>, <span class="number">1</span>}, <span class="keyword">function</span>(self, step) <span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, to)</strong>
</dt>
<dd>
Instant fill progress bar to value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
</li>
</ul>
</dd>
<dt>
<a name = "to"></a>
@@ -320,7 +322,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
@@ -376,16 +378,36 @@
<dl class="function">
<dt>
<a name = "on_change"></a>
<strong>on_change</strong>
<a name = "key"></a>
<strong>key</strong>
</dt>
<dd>
On progress bar change callback(self, new_value)
The progress bar direction
<ul>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">druid_event</span></span>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "max_size"></a>
<strong>max_size</strong>
</dt>
<dd>
Maximum size of progress bar
<ul>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -416,17 +438,17 @@
</dd>
<dt>
<a name = "key"></a>
<strong>key</strong>
<a name = "on_change"></a>
<strong>on_change</strong>
</dt>
<dd>
The progress bar direction
On progress bar change callback(self, new_value)
<ul>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -474,26 +496,6 @@
</dd>
<dt>
<a name = "max_size"></a>
<strong>max_size</strong>
</dt>
<dd>
Maximum size of progress bar
<ul>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "slice"></a>
@@ -521,8 +523,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -76,29 +78,29 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return radio group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, index)</a></td>
<td class="name" nowrap><a href="#set_state">set_state(self, index, is_instant)</a></td>
<td class="summary">Set radio group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return radio group state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_radio_click">on_radio_click</a></td>
<td class="summary">On any checkbox click</td>
</tr>
<tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_radio_click">on_radio_click</a></td>
<td class="summary">On any checkbox click</td>
</tr>
</table>
<br/>
@@ -108,6 +110,33 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
@@ -120,7 +149,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
@@ -144,7 +173,7 @@
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, index)</strong>
<strong>set_state(self, index, is_instant)</strong>
</dt>
<dd>
Set radio group state
@@ -154,41 +183,18 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index in radio group
</li>
</ul>
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If is instant state change
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
@@ -198,26 +204,6 @@
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_radio_click"></a>
<strong>on_radio_click</strong>
</dt>
<dd>
On any checkbox click
<ul>
<li><span class="parameter">on_radio_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "checkboxes"></a>
<strong>checkboxes</strong>
@@ -237,6 +223,26 @@
</dd>
<dt>
<a name = "on_radio_click"></a>
<strong>on_radio_click</strong>
</dt>
<dd>
On any checkbox click
<ul>
<li><span class="parameter">on_radio_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
@@ -244,8 +250,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

267
docs/modules/RichInput.html Normal file
View File

@@ -0,0 +1,267 @@
<!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="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><strong>RichInput</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RichInput</code></h1>
<p>Druid Rich Input custom component.</p>
<p>
It's wrapper on Input component with cursor and placeholder text</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, template, nodes)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_placeholder">set_placeholder(self, placeholder_text)</a></td>
<td class="summary">Set placeholder text</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#cursor">cursor</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid">druid</a></td>
<td class="summary">The component druid instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="#input">input</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#placeholder">placeholder</a></td>
<td class="summary">On input field text change to max length string callback(self, input_text)</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(self, template, nodes)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichInput</span></span>
<a href="../modules/RichInput.html#">RichInput</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The template string name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Nodes table from gui.clone_tree
</li>
</ul>
</dd>
<dt>
<a name = "set_placeholder"></a>
<strong>set_placeholder(self, placeholder_text)</strong>
</dt>
<dd>
Set placeholder text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichInput</span></span>
<a href="../modules/RichInput.html#">RichInput</a>
</li>
<li><span class="parameter">placeholder_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The placeholder text
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "cursor"></a>
<strong>cursor</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">cursor</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "druid"></a>
<strong>druid</strong>
</dt>
<dd>
The component druid instance
<ul>
<li><span class="parameter">druid</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
</ul>
</dd>
<dt>
<a name = "input"></a>
<strong>input</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">input</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "placeholder"></a>
<strong>placeholder</strong>
</dt>
<dd>
On input field text change to max length string callback(self, input_text)
<ul>
<li><span class="parameter">placeholder</span>
<span class="types"><span class="type">druid.text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><strong>Slider</strong></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -85,6 +87,10 @@
<td class="summary">Set value for slider</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_input_node">set_input_node(self, input_node)</a></td>
<td class="summary">Set input zone for slider.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps)</a></td>
<td class="summary">Set slider steps.</td>
</tr>
@@ -92,38 +98,38 @@
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_change_value">on_change_value</a></td>
<td class="summary">On change value callback(self, value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Slider pin node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Start pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target_pos">target_pos</a></td>
<td class="summary">Targer pin node position</td>
<td class="name" nowrap><a href="#dist">dist</a></td>
<td class="summary">Length between start and end position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#end_pos">end_pos</a></td>
<td class="summary">End pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#dist">dist</a></td>
<td class="summary">Length between start and end position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Current drag state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Slider pin node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_value">on_change_value</a></td>
<td class="summary">On change value callback(self, value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Start pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target_pos">target_pos</a></td>
<td class="summary">Targer pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#value">value</a></td>
<td class="summary">Current slider value</td>
</tr>
@@ -148,7 +154,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
@@ -182,7 +188,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
@@ -199,6 +205,40 @@
</dd>
<dt>
<a name = "set_input_node"></a>
<strong>set_input_node(self, input_node)</strong>
</dt>
<dd>
Set input zone for slider.
User can touch any place of node, pin instantly will
move at this position and node drag will start.
This function require the Defold version 1.3.0+
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">input_node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
</dd>
<dt>
<a name = "set_steps"></a>
@@ -213,7 +253,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span>
@@ -221,6 +261,12 @@
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
@@ -235,96 +281,16 @@
<dl class="function">
<dt>
<a name = "on_change_value"></a>
<strong>on_change_value</strong>
<a name = "dist"></a>
<strong>dist</strong>
</dt>
<dd>
On change value callback(self, value)
Length between start and end position
<ul>
<li><span class="parameter">on_change_value</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Slider pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Start pin node position
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current pin node position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target_pos"></a>
<strong>target_pos</strong>
</dt>
<dd>
Targer pin node position
<ul>
<li><span class="parameter">target_pos</span>
<span class="types"><span class="type">vector3</span></span>
<li><span class="parameter">dist</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -353,26 +319,6 @@
</dd>
<dt>
<a name = "dist"></a>
<strong>dist</strong>
</dt>
<dd>
Length between start and end position
<ul>
<li><span class="parameter">dist</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_drag"></a>
@@ -393,6 +339,106 @@
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Slider pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_value"></a>
<strong>on_change_value</strong>
</dt>
<dd>
On change value callback(self, value)
<ul>
<li><span class="parameter">on_change_value</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current pin node position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Start pin node position
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target_pos"></a>
<strong>target_pos</strong>
</dt>
<dd>
Targer pin node position
<ul>
<li><span class="parameter">target_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "value"></a>
@@ -420,8 +466,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

File diff suppressed because it is too large Load Diff

View File

@@ -41,29 +41,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -97,17 +99,17 @@
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Swipe node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Swipe node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_swipe">on_swipe</a></td>
<td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time</td>
<td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time)</td>
</tr>
</table>
@@ -130,7 +132,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span>
<a href="../modules/Swipe.html#">Swipe</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
@@ -160,7 +162,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span>
<a href="../modules/Swipe.html#">Swipe</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
@@ -215,26 +217,6 @@
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Swipe node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "click_zone"></a>
<strong>click_zone</strong>
@@ -255,19 +237,39 @@
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Swipe node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_swipe"></a>
<strong>on_swipe</strong>
</dt>
<dd>
Trigger on swipe event(self, swipe_side, dist, delta_time
Trigger on swipe event(self, swipe_side, dist, delta_time)
<ul>
<li><span class="parameter">on_swipe</span>
<span class="types"><span class="type">druid_event</span></span>
)
<span class="types"><span class="type">DruidEvent</span></span>
) <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -282,8 +284,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

File diff suppressed because it is too large Load Diff

View File

@@ -40,29 +40,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><strong>Timer</strong></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@@ -83,39 +85,39 @@
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td>
<td class="summary">Set text to text field</td>
<td class="name" nowrap><a href="#set_interval">set_interval(self, from, to)</a></td>
<td class="summary">Set time interval</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, is_on)</a></td>
<td class="summary">Called when update</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_interval">set_interval(self, from, to)</a></td>
<td class="summary">Set time interval</td>
<td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td>
<td class="summary">Set text to text field</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_tick">on_tick</a></td>
<td class="summary">On timer tick.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_set_enabled">on_set_enabled</a></td>
<td class="summary">On timer change enabled state callback(self, is_enabled)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_timer_end">on_timer_end</a></td>
<td class="summary">On timer end callback</td>
<td class="name" nowrap><a href="#from">from</a></td>
<td class="summary">Initial timer value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#from">from</a></td>
<td class="summary">Initial timer value</td>
<td class="name" nowrap><a href="#on_set_enabled">on_set_enabled</a></td>
<td class="summary">On timer change enabled state callback(self, is_enabled)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_tick">on_tick</a></td>
<td class="summary">On timer tick.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_timer_end">on_timer_end</a></td>
<td class="summary">On timer end callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target">target</a></td>
@@ -146,7 +148,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Timer.html#node">node</a></span>
@@ -174,22 +176,26 @@
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, set_to)</strong>
<a name = "set_interval"></a>
<strong>set_interval(self, from, to)</strong>
</dt>
<dd>
Set text to text field
Set time interval
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li>
<li><span class="parameter">set_to</span>
<li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span>
Value in seconds
Start time in seconds
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Target time in seconds
</li>
</ul>
@@ -210,7 +216,7 @@
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li>
<li><span class="parameter">is_on</span>
<span class="types"><span class="type">bool</span></span>
@@ -224,26 +230,22 @@
</dd>
<dt>
<a name = "set_interval"></a>
<strong>set_interval(self, from, to)</strong>
<a name = "set_to"></a>
<strong>set_to(self, set_to)</strong>
</dt>
<dd>
Set time interval
Set text to text field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li>
<li><span class="parameter">from</span>
<li><span class="parameter">set_to</span>
<span class="types"><span class="type">number</span></span>
Start time in seconds
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Target time in seconds
Value in seconds
</li>
</ul>
@@ -257,16 +259,16 @@
<dl class="function">
<dt>
<a name = "on_tick"></a>
<strong>on_tick</strong>
<a name = "from"></a>
<strong>from</strong>
</dt>
<dd>
On timer tick. Fire every second callback(self, value)
Initial timer value
<ul>
<li><span class="parameter">on_tick</span>
<span class="types"><span class="type">druid_event</span></span>
<li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
@@ -275,46 +277,6 @@
</dd>
<dt>
<a name = "on_set_enabled"></a>
<strong>on_set_enabled</strong>
</dt>
<dd>
On timer change enabled state callback(self, is_enabled)
<ul>
<li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_timer_end"></a>
<strong>on_timer_end</strong>
</dt>
<dd>
On timer end callback
<ul>
<li><span class="parameter">on_timer_end</span>
<span class="types"><span class="type">druid_event</span></span>
(self, Timer)
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
@@ -337,17 +299,57 @@
</dd>
<dt>
<a name = "from"></a>
<strong>from</strong>
<a name = "on_set_enabled"></a>
<strong>on_set_enabled</strong>
</dt>
<dd>
Initial timer value
On timer change enabled state callback(self, is_enabled)
<ul>
<li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span>
<li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_tick"></a>
<strong>on_tick</strong>
</dt>
<dd>
On timer tick. Fire every second callback(self, value)
<ul>
<li><span class="parameter">on_tick</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_timer_end"></a>
<strong>on_timer_end</strong>
</dt>
<dd>
On timer end callback
<ul>
<li><span class="parameter">on_timer_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
(self, Timer) <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
@@ -402,8 +404,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -370,7 +370,7 @@
<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>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The deprecated message
</li>
</ul>
@@ -387,7 +387,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 2021-10-23 17:45:31 </i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -39,29 +39,31 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>druid</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><strong>druid</strong></li>
</ul>
</div>
@@ -86,39 +88,35 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Register external druid component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new">new(context[, style])</a></td>
<td class="summary">Create Druid instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_default_style">set_default_style(style)</a></td>
<td class="summary">Set new default style.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_function">set_text_function(callback)</a></td>
<td class="summary">Set text function
Druid locale component will call this function
to get translated text.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_sound_function">set_sound_function(callback)</a></td>
<td class="summary">Set sound function.</td>
<td class="name" nowrap><a href="#on_language_change">on_language_change()</a></td>
<td class="summary">Callback on global language change event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_window_callback">on_window_callback(event)</a></td>
<td class="summary">Callback on global window event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_layout_change">on_layout_change()</a></td>
<td class="summary">Callback on global layout change event.</td>
<td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Register external druid component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_language_change">on_language_change()</a></td>
<td class="summary">Callback on global language change event.</td>
<td class="name" nowrap><a href="#set_default_style">set_default_style(style)</a></td>
<td class="summary">Set new default style.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_sound_function">set_sound_function(callback)</a></td>
<td class="summary">Set sound function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_function">set_text_function(callback)</a></td>
<td class="summary">Set text function
Druid locale component will call this function
to get translated text.</td>
</tr>
</table>
@@ -129,33 +127,6 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
</dt>
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
module name
</li>
<li><span class="parameter">module</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
lua table with component
</li>
</ul>
</dd>
<dt>
<a name = "new"></a>
<strong>new(context[, style])</strong>
@@ -167,11 +138,11 @@
<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>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid context. Usually it is self of script
</li>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
(<em>optional</em>)
</li>
@@ -187,6 +158,70 @@
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
</dd>
<dt>
<a name = "on_window_callback"></a>
<strong>on_window_callback(event)</strong>
</dt>
<dd>
Callback on global window event.
Used to trigger on_focus_lost and on_focus_gain
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">event</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Event param from window listener
</li>
</ul>
</dd>
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
</dt>
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
module name
</li>
<li><span class="parameter">module</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
lua table with component
</li>
</ul>
</dd>
<dt>
<a name = "set_default_style"></a>
@@ -199,7 +234,7 @@
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
</li>
</ul>
@@ -208,30 +243,6 @@
</dd>
<dt>
<a name = "set_text_function"></a>
<strong>set_text_function(callback)</strong>
</dt>
<dd>
Set text function
Druid locale component will call this function
to get translated text. After set_text_funtion
all existing locale component will be updated
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Get localized text function
</li>
</ul>
</dd>
<dt>
<a name = "set_sound_function"></a>
@@ -257,19 +268,21 @@
</dd>
<dt>
<a name = "on_window_callback"></a>
<strong>on_window_callback(event)</strong>
<a name = "set_text_function"></a>
<strong>set_text_function(callback)</strong>
</dt>
<dd>
Callback on global window event.
Used to trigger on_focus_lost and on_focus_gain
Set text function
Druid locale component will call this function
to get translated text. After set_text_funtion
all existing locale component will be updated
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">event</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Event param from window listener
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Get localized text function
</li>
</ul>
@@ -277,35 +290,6 @@
</dd>
<dt>
<a name = "on_layout_change"></a>
<strong>on_layout_change()</strong>
</dt>
<dd>
Callback on global layout change event.
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
</dd>
</dl>
@@ -313,8 +297,8 @@
</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 2021-10-23 17:45:31 </i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@@ -2,77 +2,133 @@
## Overview
Druid allows you to create your custom components from druid basic components or other custom components.
Druid allows you to create your custom components which contains your custom logic, other Druid basic components or other custom components.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name}
I wanna make a point that Druid is not only set of defined components to place buttons, scroll, etc. But mostly it's a way how to handle all your GUI elements in general. Custom components is most powerful way to separate logic and make higher abstraction in your code.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via `self:{method_name}`
## Custom components
Basic custom component template looks like this:
### Basic component template
Basic custom component template looks like this. It's good start to create your own component! (you can copy it from `/druid/templates/component.template.lua`)
```lua
local component = require("druid.component")
local M = component.create("my_component")
---@class component_name : druid.base_component
local Component = component.create("component_name")
-- Component constructor
function M.init(self, ...)
local SCHEME = {
ROOT = "root",
BUTTON = "button",
}
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.root = self:get_node(SCHEME.ROOT)
self.druid = self:get_druid()
self.button = self.druid:new_button(SCHEME.BUTTON, function() end)
end
-- Call only if exist interest: component.ON_UPDATE
function M.update(self, dt)
-- [OPTIONAL] Call on component remove or on druid:final
function Component:on_remove() end
return Component
```
### Full component template
Full custom component template looks like this (you can copy it from `/druid/templates/component_full.template.lua`:
```lua
local component = require("druid.component")
---@class component_name : druid.base_component
local Component = component.create("component_name")
-- Scheme of component gui nodes
local SCHEME = {
ROOT = "root",
BUTTON = "button",
}
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(template, nodes)
-- If your component is gui template, pass the template name and set it
self:set_template(template)
-- If your component is cloned my gui.clone_tree, pass nodes to component and set it
self:set_nodes(nodes)
-- self:get_node will auto process component template and nodes
self.root = self:get_node(SCHEME.ROOT)
-- Use inner druid instance to create components inside this component
self.druid = self:get_druid()
end
-- Call only if exist interest: component.ON_INPUT
function M.on_input(self, action_id, action)
end
-- [OPTIONAL] Call every update step
function Component:update(dt) end
-- Call on component creation and on component:set_style() function
function M.on_style_change(self, style)
end
-- [OPTIONAL] Call default on_input from gui script
function Component:on_input(action_id, action) return false end
-- Call only if exist interest: component.ON_MESSAGE
function M.on_message(self, message_id, message, sender)
end
-- [OPTIONAL] Call on component creation and on component:set_style() function
function Component:on_style_change(style) end
-- Call only if component with ON_LANGUAGE_CHANGE interest
function M.on_language_change(self)
end
-- [OPTIONAL] Call default on_message from gui script
function Component:on_message(message_id, message, sender) end
-- Call only if component with ON_MESSAGE_INPUT interest
function M.on_message_input(self, node_id, message)
end
-- [OPTIONAL] Call if druid has triggered on_language_change
function Component:on_language_change() end
-- Call only if component with ON_LAYOUT_CHANGE interest
function M.on_layout_change(self)
end
-- [OPTIONAL] Call if game layout has changed and need to restore values in component
function Component:on_layout_change() end
-- Call, if input was capturing before this component
-- [OPTIONAL] Call, if input was capturing before this component
-- Example: scroll is start scrolling, so you need unhover button
function M.on_input_interrupt(self)
end
function Component:on_input_interrupt() end
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
function M.on_focus_lost(self)
end
-- [OPTIONAL] Call, if game lost focus
function Component:on_focus_lost() end
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
function M.on_focus_gained(self)
end
-- [OPTIONAL] Call, if game gained focus
function Component:on_focus_gained() end
-- Call only if exist interest: component.ON_LATE_INIT
function M.on_late_init(self)
end
-- [OPTIONAL] Call on component remove or on druid:final
function Component:on_remove() end
-- Call on component remove or on druid:final
function M.on_remove(self)
end
return M
return Component
```
Add your custom component to druid via `druid.register`
### Spawn custom component
After the creating your custom component, you now able to create it.
For example we made the component `my_component`. Now we able create it like this:
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
function init(self)
self.druid = druid.new(self)
self.druid:new(my_component, "template_name", nodes)
end
```
The template name - is the name of GUI template file if you use it in your custom component.
The nodes - is table from `gui.clone_tree(node)`. If you spawn multiply nodes for component, pass it to component constructor.
Inside component you have to set template and nodes via
`self:set_template(template)` and `self:set_nodes(nodes)`
### Register custom component
You can register your custom component for use it without require component module in every file. Registering components is comfortable for very basic components in your game.
Add your custom component to druid via `druid.register
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
@@ -84,8 +140,6 @@ end
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`.
Or you can create component without registering with `druid:create(my_component_module)`
As component registered, you can create your component with next code:
```lua
local druid = require("druid.druid")
@@ -93,38 +147,45 @@ local my_component = require("my.amazing.component")
function init(self)
self.druid = druid.new(self)
local my_component = self.druid:new_my_component(...)
-- or --
local my_component = self.druid:create(my_component, ...)
self.my_component = self.druid:new_my_component(template, nodes)
end
```
### Interest
Interest - is a way to indicate what events your component will respond to.
There is next interests in druid:
- **ON_MESSAGE** - component will receive messages from on_message
- **ON_UPDATE** - component will be updated from update
## Create Druid Component editor script
- **ON_INPUT_HIGH** - component will receive input from on_input, before other components with ON_INPUT
The Druid has editor script to help you with creating lua file for your GUI scene.
The commands is available on *.gui scenes in menu `Edit -> Create Druid Component`
- **ON_INPUT** - component will receive input from on_input, after other components with ON_INPUT_HIGH
The script will check current GUI scene and generate lua file with all Druid component stubs. The output file will be named as current GUI scene and placed nearby. The *.lua file should be not exists, the script will not override any file. If you want to re-generate file, delete previous one first.
- **ON_LANGUAGE_CHANGE** - will call _on_language_change_ function on language change trigger
The script required `python3` with `deftree` installed. If `deftree` is not installed the instructions will be prompt in console.
- **ON_MESSAGE_INPUT** - will call _on_message_input_ function on Druid _const.ON_MESSAGE_INPUT_ message
- **ON_LAYOUT_CHANGE** will call _on_layout_change_ function on layout change trigger
### Auto layout components
- **ON_FOCUS_LOST** will call _on_focust_lost_ function in on focus lost event. You need to pass window_callback to global `druid:on_window_callback`
The generator script also check current GUI scene for Druid components to make stubs for them. The script will check the node names and if it starts with special keyword it will make component stubs in generated lua file. It will generate component declaring, callback functions stubs and annotations.
Start your node names with one of next keyword to say parser make component stubs for your. For example for nodes `button` and `button_exit` will be generated two Druid Button components with callback stubs.
Available keywords:
- `button` - add [Druid Button](docs_md/01-components.md#button) and generate callback stub
- `text` - add [Druid Text](docs_md/01-components.md#text)
- `lang_text` - add Druid [Druid Lang Text](docs_md/01-components.md#lang-text)
- `grid` or `static_grid` - add Druid [Druid Static Grid](docs_md/01-components.md#static-grid). You should to setup Grid prefab for this component after file generation
- `dynamic_grid` - add Druid [Druid Dynamic Grid](docs_md/01-components.md#dynamic-grid)
- `scroll_view` - add [Druid Scroll](docs_md/01-components.md#scroll). It will add `scroll_content` node with the same postfix too. Check that is will correct node
- `blocker` - add [Druid Blocker](docs_md/01-components.md#blocker)
- `slider` - add [Druid Slider](docs_md/01-components.md#slider). You should to adjust end position of Slider after file generation
- `progress` - add [Druid Progress](docs_md/01-components.md#progress)
- `timer` - add [Druid Timer](docs_md/01-components.md#timer)
- **ON_FOCUS_GAINED** will call _on_focust_gained_ function in on focus gained event. You need to pass window_callback to global `druid:on_window_callback`
- **ON_LATE_INIT** will call _on_late_init_ function once after component init on update step.
## Best practice on custom components
On each component recommended describe component scheme in next way:
To get this structure, Druid has editor script to help you with it. Select your GUI nodes in editor outline, right click and press "Print GUI Scheme". And copy the result from the output console.
```lua
-- Component module
@@ -139,25 +200,21 @@ local SCHEME = {
}
function M.init(self, template_name, node_table)
-- If component use template, setup it:
self:set_template(template_name)
-- If component was cloned with gui.clone_tree, pass his nodes
self:set_nodes(node_table)
-- helper can get node from gui/template/table
local root = self:get_node(SCHEME.ROOT)
-- This component can spawn another druid components:
local druid = self:get_druid()
-- Button self on callback is self of _this_ component
local button = druid:new_button(...)
end
```
## Power of using templates
You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.
You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.
For example you have component `player_panel` and two GUI templates: `player_panel` and `enemy_panel` with different layout. But the same component script can be used for both of them.

View File

@@ -37,7 +37,7 @@ local my_style = require("my.amazing.style")
local function init(self)
self.druid = druid.new(self)
self.button = self.druid:new_button(self, "node")
self.button = self.druid:new_button("node", function() end)
-- Setup custom style for specific component
self.button:set_style(my_style)
end
@@ -50,10 +50,10 @@ The most components have their styles. You can explore it on [Druid API](https:/
To create you style, create lua module, what return <_component_name_, _component_style_> table
Example: [default druid style](https://github.com/Insality/druid/blob/develop/druid/styles/default/style.lua)
Example: [default druid style](styles/default/style.lua)
Override all fields you want and set your style with one of next ways:
- Set your style as global via `druid.set_default_style`
- Set style for concrete druid instance via `druid = druid.new(self, style)`
- Set style for concrete instance via `component:set_style(style)`
- Set style for concrete instance via `component:set_style(style)`

View File

@@ -1,8 +0,0 @@
# Druid assets
## Overview
I've created [druid-assets repository](https://github.com/Insality/druid-assets) to make a _marketplace_ with custom styles and components.
Any of Druid users can push their own components and styles to share it with the other users
Also, this marketplace is great example to how you can create your custom components

View File

@@ -1,6 +0,0 @@
# Examples
## Overview
See the [example folder](https://github.com/Insality/druid/tree/develop/example/kenney) for examples of how to use Druid
Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app

View File

@@ -22,7 +22,7 @@
### 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).
**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)
@@ -39,7 +39,7 @@ Some examples of custom components you can find [here](https://github.com/Insali
**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.
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
@@ -53,8 +53,8 @@ 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:
**A:** Since the dependencies can't be processed by external editors, for use generated EmmyLua annotations you should copy the _druid/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")

View File

@@ -66,7 +66,7 @@
- _Content node_ - dynamic node, moving by _Scroll_ component
- Scroll will be disabled only if content size equals to view size (by width or height separatly)
- You can adjust start scroll size via _.gui_ scene. Just setup correct node size
- Different anchoring is supported (for easier layouting)
- Different anchoring is supported (for easier layout)
- Function _scroll_to_ now accept position relative to _content node_. It's more easier for handling. _Example:_ if you have children node of _content_node_, you can pass this node position to scroll to this.
- **Resolve #52**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_)
- **Fix #50**: If style.SOFT_ZONE_SIZE equals to [0..1], scroll can be disappeared
@@ -184,7 +184,7 @@ Have a good day.
- Lang text now can be initialized without default locale id
- Input component: rename field _selected_ to _is_selected_ (according to the docs)
- **#92** Setup repo for CI and unit tests. (Yea, successful build and tests badges!)
- **#86** Fix a lot of event triggers on scroll inertia moving
- **#86** Fix a lot of event triggers on scroll inertia moving
- **#101** Fix scroll to other node instead of swipe direction with scroll's points of interest (without inert settings)
- **#103** Add `helper.centate_nodes` function. It can horizontal align several Box and Text nodes
- **#105** Add `Input:select` and `Input:unselect` function.
@@ -269,4 +269,125 @@ Good luck!
- **#144** [Scroll] Fix some glitches with scroll Points of Interest. Remove false detection of scroll stopped.
- **#142** [Scroll] Add Scroll style param `WHEEL_SCROLL_BY_INERTION` (default - false). If true - mouse wheel will add inertion to scroll, if false - set position directly per mouse wheel event.
- This fix caused because Mac trackpad seems have additional mouse wheel events for simulate inertion. If you uncomfortable with this, you can disable `WHEEL_SCROLL_BY_INERTION` for more controllable scroll by mouse wheel.
- **#132** Add example with grid add/remove with animations
- **#132** Add example with grid add/remove with animations
### Druid 0.8.0
Hello!
In this Druid update no any huge special features. Mostly the bug fixes and reworking the component's interest points. If you used interests in your custom components, you should remove it from `component.create` and all should works as before.
Also added last row allignment in Static Grid component with "dynamic content poses" style enabled. You can look how it is work here: https://insality.github.io/druid/druid/?example=grid_static_grid_dynamic_pos
You can say thanks to me via stars on GitHub! :wink:
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Have a nice day!
**Changelog 0.8.0**
---
- **#160** __[BREAKING]__ Remove component interests list
- The component interests now setup via function declaration inside your components. The functions are still the same.
- Now `component.create` function have next signature: _create(component_name, input_priority)_
- Your should remove interests list from your custom components if exists
- From `component.create("custom", { component.ON_INPUT, component.ON_LATE_INIT }, const.PRIORITY_INPUT_HIGH)` to
`component.create("custom", const.PRIORITY_INPUT_HIGH)`
- **#166** [Input] Fix issue with Cyrillic symbols in range "[А-я]"
- **#162** [Static Grid] Add last row alignment with dynamic content poses enabled
- Add style param: _static_grid.IS_ALIGN_LAST_ROW_, true by default. Works only if _static_grid.IS_DYNAMIC_NODE_POSES_ enabled. See the "Static grid with dynamic poses" example.
- **#163** [Lang Text] Set default locale_id value from text node
- **#147** [Lang Text] Remove `...` from lang_text to fixed arguments, add _format_ function to change only string format arguments
- There are some issues with `...`. Now Lang Text will support up to 7 _string.format_ arguments
- [Lang Text] Add more self chaining to Lang text component (_set_to_, _translate_ and _format_ functions)
- **#151** [Text] Fix text adjust by height
- It still have not perfect fitting, but it's good enough!
- **#164 #150** [Scroll] Fix `scroll:scroll_to_percent` by Y position
- **#148** [Scroll] Remove scroll inertion after scroll `animate` or `set_to` functions
- [Input] Add current text argument to _on_input_unselect_ event
- **#152** [Checkbox] Add _is_instant_ argument to `set_state` function
- Add _initial_state_ argument to Checkbox component constructor
- Update Checkbox style, add _is_instant_ param
- **#149** [Button] Call button style functions after actual callback
- **#153** System: Mode Druid acquire input to late_init step
- Required to solve issues, when go input acquire can be later, when gui input acquire (on init step)
- **#154** System: Change text adjust const to strings
- **#155** Fix: Add margin to total width calculation in `helper.centrate_nodes`
### Druid 0.9.0
_Custom components update_
Hello!
Here is the long awaited update! Finally I implemented some ideas how to make easier creating custom components. There is a bunch of improvements you can be interested in.
I wanna make a point that Druid is not only set of defined components to place buttons, scroll, etc. But mostly it's a way how to handle all your GUI elements in general. Custom components is most powerful way to separate logic and make higher abstraction in your code.
Usually - custom components is set of GUI template and lua code for this template. I've added editor script, that can make a lua component file from your GUI scene (all boilerplate and usage code, also some component that can be defined right in GUI scene).
Auto layout from GUI script should be a powerful tool too! Also it's brings some code structure and style across all your files. Auto layout works from node names. If its starts or equal to some string, it will add code to generated lua file. For example, if you have in your scene node with name "button_start", it will create the Druid button, stub function and annotations to this. Sounds good!
For more information see [Create custom components](docs_md/02-creating_custom_components.md) documentations.
Also this update have some breaking changes: you should no more pass full tempalte name in inner components and the second one is renaming `text:get_text_width` to `text:get_text_size`.
The Defold 1.3.0 solves the old my issue with slider component. Now you can define input zone (not only the slider pin node) to interact with slider. It's because of inroduction `gui.screen_to_local` and `gui.set_screen_position` in default GUI api. If you using previuos Defold releases, this piece of logic will be ignored.
The Druid Assets repository will be closed and I move some components right in Druid repository. You can now use custom components in your game if your need. Right now it's Rich Input (input field with cursor and placegolder) and Pin Knob (Rotating node for set value). And slowly working on adding new examples and improvements of existing ones.
You can say thanks to me via stars on GitHub! :wink:
Also you can help with testing new functions and leave feedback.
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Take care of yourself
**Changelog 0.9.0**
---
- **#119** Add **Create Druid Component** editor script *(python3 with deftree required)*
- The headliner of current update. This editor scripts allows you to create Custom component lua script from you *.gui* scene file. It will create component file with the same name as GUI scene and place it nearby. Inside this generated file you will find the instructions how to start usage this (require and create code).
- This code contains GUI scheme, basic component boilerplace and generated code for components, used in this GUI scene (see #159)
- See [Create custom components](docs_md/02-creating_custom_components.md) for more info
- **#159** Add auto layout custom components by node naming
- The **Create Druid Component** script will check the node names to create Druid components stubs inside generated code
- The generator will check the node name, if it's starts from special prefix, it will create component code for you
- Currently support the next components: `button`, `text`, `lang_text`, `grid`, `static_grid`, `dynamic_grid`, `scroll_view`, `blocker`, `slider`, `progress` and `timer`
- **#158** **[BREAKING]** Auto `get_node` inside inner components with template/nodes
- Before this update, if your component with template using another component with template, you had to pass full template name (`current_template .. "/" .. inner_component_template`). From this update you should pass only the `inner_component_template` name. It's will auto check the parent component template name to build full template path
- If you don't want migrate code for this, this option can be disabled via `druid.no_auto_template` in your _game.project_ file. By default it's enabled now
- **#171** Add `component:get_template()` function to **Druid** Base Component
- Now it's able to get full component template name. This function has "protected" scope, so you should use it only inside your component code.
- **#173** Fix GUI nodes usage inside inner templates
- Now you can pass the node name instead of node itself to Druid components inside your Custom Components. Before this update Druid didn't check the nodes in parent component (usually for basic components such as button, text inside your components)
- So you can use now `self.druid:new_button(SCHEME.BUTTON)` instead of `self.druid:new_button(self:get_node(SCHEME.BUTTON))` inside your custom components
- **#174** Add assert to nil node on `self:get_node()`
- It's required for easier debuging components, when GUI node path is wrong and your got the nil. The error with node path will appear in console.
- **#169** [System] Fix on_layout_change event
- It was broken, now the on_layout_change event is working as expected
- **#165** [StaticGrid] Add `static_grid:set_in_row(amount)` function
- **#44** [Slider] Click zone on all slider node, not only pin node
- Finally! Added the `slider:set_input_node(node)` function. Now slider can be interacted not only with slider pin node, but with any zone you will define.
- It will work only from Defold 1.3.0. If you use earlier version, nothing is happened. It using new `gui.screen_to_local` and `gui.set_screen_position` functions.
- **#178** **[BREAKING][Text]** Rename `text:get_text_width` to `text:get_text_size`. Now it return two numbers: width and height
- **#114** Add default component templates
- Added templates for fast prototyping. Use GUI templates to place buttons, checkbox, input and sliders on your GUI scene. You still have to create component with `druid:new` functions inside gui_script.
- **#168** Add button to open code of current example
- Inside every example added button to open code of this example on GitHub
- **#140** Better documentation for custom components
- **#172** Update documentation with links to components
- The docs in (https://insality.github.io/druid/) now have cross links for every custom type
- **#175** Remove Druid Assets repository, move to Druid library
- Added folder `druid/custom`. It will have the complex custom components. Usually you should to use default GUI template or create your own with similar GUI scheme. Currently add `RichInput` and `PinKnob` components from druid-assets repository.
- Usually to use custom component you have to require lua file first and create it's via `druid:new(Component, template_name, [nodes]). See component docs to see constructor params.
- This components will be included in build only if used
- **#176** Keep last scene and scroll position in Druid example
- Probably, it's useful for faster debug, but anyway. The example now keep the last scene and scroll position.
- Add new examples: Checkboxes, Swipe, Grid, Rich input, Pin knob
- Now editor scripts are available in Druid as dependency
- Move emmylua annotations inside Druid dependency folder. You can copy it from Defold Editor outline
- Optimize different stuff(Scroll, Druid Event, Druid instance and Base component)
- Force Data List component to `IS_DYNAMIC_NODE_POSES = false` style

30
druid.code-workspace Normal file
View File

@@ -0,0 +1,30 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.exclude": {
"**/.git": true, // this is a default value
"**/.DS_Store": true, // this is a default value
"**/node_modules": true, // this excludes all folders
// named "node_modules" from
// the explore tree
// alternative version
"node_modules": true, // this excludes the folder
// only from the root of
// your workspace
".internal": true,
"bundle": true,
"input": true,
"media": true,
"build": true,
".github": true,
".deployer_cache": true,
"dist": true
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle back key (android, backspace)
-- @module BackHandler
@@ -6,7 +6,7 @@
-- @alias druid.back_handler
--- On back handler callback(self, params)
-- @tfield druid_event on_back
-- @tfield DruidEvent on_back @{DruidEvent}
--- Params to back callback
-- @tfield any params
@@ -17,11 +17,11 @@ local Event = require("druid.event")
local const = require("druid.const")
local component = require("druid.component")
local BackHandler = component.create("back_handler", { component.ON_INPUT })
local BackHandler = component.create("back_handler")
--- Component init function
-- @tparam BackHandler self
-- @tparam BackHandler self @{BackHandler}
-- @tparam callback callback On back button
-- @tparam[opt] any params Callback argument
function BackHandler.init(self, callback, params)
@@ -31,7 +31,7 @@ end
--- Input handler for component
-- @tparam BackHandler self
-- @tparam BackHandler self @{BackHandler}
-- @tparam string action_id on_input action id
-- @tparam table action on_input action
function BackHandler.on_input(self, action_id, action)

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to block input on specify zone by node
-- @module Blocker
@@ -13,11 +13,11 @@
local const = require("druid.const")
local component = require("druid.component")
local Blocker = component.create("blocker", { component.ON_INPUT })
local Blocker = component.create("blocker")
--- Component init function
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @tparam node node Gui node
function Blocker.init(self, node)
self.node = self:get_node(node)
@@ -44,7 +44,7 @@ end
--- Set enabled blocker component state
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @tparam bool state Enabled state
function Blocker.set_enabled(self, state)
gui.set_enabled(self.node, state)
@@ -52,7 +52,7 @@ end
--- Return blocked enabled state
-- @tparam Blocker self
-- @tparam Blocker self @{Blocker}
-- @treturn bool True, if blocker is enabled
function Blocker.is_enabled(self)
return gui.is_enabled(self.node)

46
druid/base/button.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle basic GUI button
-- @module Button
@@ -6,22 +6,22 @@
-- @alias druid.button
--- On release button callback(self, params, button_instance)
-- @tfield druid_event on_click
-- @tfield DruidEvent on_click @{DruidEvent}
--- On repeated action button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_repeated_click
-- @tfield DruidEvent on_repeated_click @{DruidEvent}
---On long tap button callback(self, params, button_instance, time)
-- @tfield druid_event on_long_click
-- @tfield DruidEvent on_long_click @{DruidEvent}
---On double tap button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_double_click
-- @tfield DruidEvent on_double_click @{DruidEvent}
---On button hold before long_click callback(self, params, button_instance, time)
-- @tfield druid_event on_hold_callback
-- @tfield DruidEvent on_hold_callback @{DruidEvent}
---On click outside of button(self, params, button_instance)
-- @tfield druid_event on_click_outside
-- @tfield DruidEvent on_click_outside @{DruidEvent}
---Trigger node
-- @tfield node node
@@ -45,7 +45,7 @@
-- @tfield any params
---Druid hover logic component
-- @tfield druid.hover hover
-- @tfield Hover hover @{Hover}
---Restriction zone
-- @tfield[opt] node click_zone
@@ -57,11 +57,7 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Button = component.create("button", {
component.ON_INPUT,
component.ON_MESSAGE_INPUT,
component.ON_LATE_INIT
})
local Button = component.create("button")
local function is_input_match(self, action_id)
@@ -88,10 +84,9 @@ end
local function on_button_click(self)
self.style.on_click(self, self.anim_node)
self.click_in_row = 1
self.on_click:trigger(self:get_context(), self.params, self)
self.style.on_click(self, self.anim_node)
end
@@ -101,28 +96,24 @@ local function on_button_repeated_click(self)
self.is_repeated_started = true
end
self.style.on_click(self, self.anim_node)
self.click_in_row = self.click_in_row + 1
self.on_repeated_click:trigger(self:get_context(), self.params, self, self.click_in_row)
self.style.on_click(self, self.anim_node)
end
local function on_button_long_click(self)
self.style.on_click(self, self.anim_node)
self.click_in_row = 1
local time = socket.gettime() - self.last_pressed_time
self.on_long_click:trigger(self:get_context(), self.params, self, time)
self.style.on_click(self, self.anim_node)
end
local function on_button_double_click(self)
self.style.on_click(self, self.anim_node)
self.click_in_row = self.click_in_row + 1
self.on_double_click:trigger(self:get_context(), self.params, self, self.click_in_row)
self.style.on_click(self, self.anim_node)
end
@@ -202,7 +193,7 @@ end
--- Component init function
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam node node Gui node
-- @tparam function callback Button callback
-- @tparam[opt] table params Button callback params
@@ -348,7 +339,7 @@ end
--- Set enabled button component state
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam bool state Enabled state
-- @treturn Button Current button instance
function Button.set_enabled(self, state)
@@ -361,7 +352,7 @@ end
--- Return button enabled state
-- @tparam Button self
-- @tparam Button self @{Button}
-- @treturn bool True, if button is enabled
function Button.is_enabled(self)
return not self.disabled
@@ -370,7 +361,7 @@ end
--- Strict button click area. Useful for
-- no click events outside stencil node
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam node zone Gui node
-- @treturn Button Current button instance
function Button.set_click_zone(self, zone)
@@ -382,7 +373,7 @@ end
--- Set key-code to trigger this button
-- @tparam Button self
-- @tparam Button self @{Button}
-- @tparam hash key The action_id of the key
-- @treturn Button Current button instance
function Button.set_key_trigger(self, key)
@@ -401,6 +392,7 @@ end
--- Set function for additional check for button click availability
-- @tparam Button self
-- @tparam[opt] function check_function Should return true or false. If true - button can be pressed.
-- @tparam[opt] function failure_callback Function what will be called on button click, if check function return false
-- @treturn Button Current button instance

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle drag action on node.
-- Drag have correct handling for multitouch and swap
@@ -9,19 +9,19 @@
-- @alias druid.drag
--- Event on touch start callback(self)
-- @tfield druid_event on_touch_start
-- @tfield DruidEvent on_touch_start @{DruidEvent}
--- Event on touch end callback(self)
-- @tfield druid_event on_touch_end
-- @tfield DruidEvent on_touch_end @{DruidEvent}
--- Event on drag start callback(self)
-- @tfield druid_event on_drag_start
-- @tfield DruidEvent on_drag_start @{DruidEvent}
--- on drag progress callback(self, dx, dy)
-- @tfield druid_event on_drag Event
-- @tfield DruidEvent on_drag Event @{DruidEvent}
--- Event on drag end callback(self)
-- @tfield druid_event on_drag_end
-- @tfield DruidEvent on_drag_end @{DruidEvent}
--- Is component now touching
-- @tfield bool is_touch
@@ -51,7 +51,7 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Drag = component.create("drag", { component.ON_INPUT, component.ON_LATE_INIT }, const.PRIORITY_INPUT_HIGH)
local Drag = component.create("drag", const.PRIORITY_INPUT_HIGH)
local function start_touch(self, touch)
@@ -162,7 +162,7 @@ end
--- Drag component constructor
-- @tparam Drag self
-- @tparam Drag self @{Drag}
-- @tparam node node GUI node to detect dragging
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
function Drag.init(self, node, on_drag_callback)
@@ -277,7 +277,7 @@ end
--- Strict drag click area. Useful for
-- restrict events outside stencil node
-- @tparam Drag self
-- @tparam Drag self @{Drag}
-- @tparam node node Gui node
function Drag.set_click_zone(self, node)
self.click_zone = self:get_node(node)

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle hover node interaction
-- @module Hover
@@ -6,10 +6,10 @@
-- @alias druid.hover
--- On hover callback(self, state)
-- @tfield druid_event on_hover
-- @tfield DruidEvent on_hover @{DruidEvent}
--- On mouse hover callback(self, state)
-- @tfield druid_event on_mouse_hover
-- @tfield DruidEvent on_mouse_hover @{DruidEvent}
---
@@ -18,11 +18,11 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Hover = component.create("hover", { component.ON_INPUT, component.ON_LATE_INIT })
local Hover = component.create("hover")
--- Component init function
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam node node Gui node
-- @tparam function on_hover_callback Hover callback
function Hover.init(self, node, on_hover_callback)
@@ -90,7 +90,7 @@ end
--- Set hover state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The hover state
function Hover.set_hover(self, state)
if self._is_hovered ~= state then
@@ -100,7 +100,7 @@ function Hover.set_hover(self, state)
end
--- Set mouse hover state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The mouse hover state
function Hover.set_mouse_hover(self, state)
if self._is_mouse_hovered ~= state then
@@ -112,7 +112,7 @@ end
--- Strict hover click area. Useful for
-- no click events outside stencil node
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam node zone Gui node
function Hover.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)
@@ -122,7 +122,7 @@ end
--- Set enable state of hover component.
-- If hover is not enabled, it will not generate
-- any hover events
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @tparam bool state The hover enabled state
function Hover.set_enabled(self, state)
self._is_enabled = state
@@ -139,7 +139,7 @@ end
--- Return current hover enabled state
-- @tparam Hover self
-- @tparam Hover self @{Hover}
-- @treturn bool The hover enabled state
function Hover.is_enabled(self)
return self._is_enabled

122
druid/base/scroll.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle scroll content.
-- Scroll consist from two nodes: scroll parent and scroll input
@@ -13,13 +13,13 @@
--- On scroll move callback(self, position)
-- @tfield druid_event on_scroll
-- @tfield DruidEvent on_scroll @{DruidEvent}
--- On scroll_to function callback(self, target, is_instant)
-- @tfield druid_event on_scroll_to
-- @tfield DruidEvent on_scroll_to @{DruidEvent}
--- On scroll_to_index function callback(self, index, point)
-- @tfield druid_event on_point_scroll
-- @tfield DruidEvent on_point_scroll @{DruidEvent}
--- Scroll view node
-- @tfield node view_node
@@ -46,7 +46,7 @@
-- @tfield vector3 available_size
--- Drag Druid component
-- @tfield Drag drag
-- @tfield Drag drag @{Drag}
--- Current index of points of interests
-- @tfield[opt] number selected
@@ -61,12 +61,7 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Scroll = component.create("scroll", {
component.ON_INPUT,
component.ON_UPDATE,
component.ON_LAYOUT_CHANGE,
component.ON_LATE_INIT
})
local Scroll = component.create("scroll")
local function inverse_lerp(min, max, current)
@@ -138,13 +133,14 @@ end
--- Scroll constructor
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam node view_node GUI view scroll node
-- @tparam node content_node GUI content scroll node
function Scroll.init(self, view_node, content_node)
self.druid = self:get_druid()
self.view_node = self:get_node(view_node)
self.view_border = helper.get_border(self.view_node)
self.content_node = self:get_node(content_node)
self.view_size = vmath.mul_per_elem(gui.get_size(self.view_node), gui.get_scale(self.view_node))
@@ -173,7 +169,6 @@ function Scroll.init(self, view_node, content_node)
self._is_vertical_scroll = true
self._grid_on_change = nil
self._grid_on_change_callback = nil
self._outside_offset_vector = vmath.vector3(0)
self:_update_size()
end
@@ -195,8 +190,6 @@ end
function Scroll.update(self, dt)
self:_update_params()
if self.drag.is_drag then
self:_update_hand_scroll(dt)
else
@@ -216,7 +209,7 @@ end
--- Start scroll to target point.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 point Target point
-- @tparam[opt] bool is_instant Instant scroll flag
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
@@ -250,7 +243,7 @@ end
--- Scroll to item in scroll by point index.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam number index Point index
-- @tparam[opt] bool skip_cb If true, skip the point callback
function Scroll.scroll_to_index(self, index, skip_cb)
@@ -273,7 +266,7 @@ end
--- Start scroll to target scroll percent
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 percent target percent
-- @tparam[opt] bool is_instant instant scroll flag
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
@@ -282,7 +275,7 @@ function Scroll.scroll_to_percent(self, percent, is_instant)
local pos = vmath.vector3(
-helper.lerp(border.x, border.z, 1 - percent.x),
-helper.lerp(border.w, border.y, 1 - percent.y),
-helper.lerp(border.y, border.w, 1 - percent.y),
0
)
@@ -292,7 +285,7 @@ end
--- Return current scroll progress status.
-- Values will be in [0..1] interval
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn vector3 New vector with scroll progress values
function Scroll.get_percent(self)
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
@@ -304,7 +297,7 @@ end
--- Set scroll content size.
-- It will change content gui node size
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam vector3 size The new size for content node
-- @tparam vector3 offset Offset value to set, where content is starts
-- @treturn druid.scroll Current scroll instance
@@ -322,7 +315,7 @@ end
--- Enable or disable scroll inert.
-- If disabled, scroll through points (if exist)
-- If no points, just simple drag without inertion
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state Inert scroll state
-- @treturn druid.scroll Current scroll instance
function Scroll.set_inert(self, state)
@@ -333,7 +326,7 @@ end
--- Return if scroll have inertion.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn bool If scroll have inertion
function Scroll.is_inert(self)
return self._is_inert
@@ -342,7 +335,7 @@ end
--- Set extra size for scroll stretching.
-- Set 0 to disable stretching effect
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @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(self, stretch_size)
@@ -354,7 +347,7 @@ end
--- Return vector of scroll size with width and height.
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @treturn vector3 Available scroll size
function Scroll.get_scroll_size(self)
return self.available_size
@@ -363,7 +356,7 @@ end
--- Set points of interest.
-- Scroll will always centered on closer points
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam table points Array of vector3 points
-- @treturn druid.scroll Current scroll instance
function Scroll.set_points(self, points)
@@ -380,7 +373,7 @@ end
--- Lock or unlock horizontal scroll
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if horizontal scroll is enabled
-- @treturn druid.scroll Current scroll instance
function Scroll.set_horizontal_scroll(self, state)
@@ -391,7 +384,7 @@ end
--- Lock or unlock vertical scroll
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if vertical scroll is enabled
-- @treturn druid.scroll Current scroll instance
function Scroll.set_vertical_scroll(self, state)
@@ -403,20 +396,38 @@ end
--- Check node if it visible now on scroll.
-- Extra border is not affected. Return true for elements in extra scroll zone
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam node node The node to check
-- @treturn boolean True if node in visible scroll area
function Scroll.is_node_in_view(self, node)
local node_border = helper.get_border(node, gui.get_position(node))
local view_border = helper.get_border(self.view_node, -(self.position - self._outside_offset_vector))
local node_offset_for_view = gui.get_position(node)
local parent = gui.get_parent(node)
local is_parent_of_view = false
while parent do
if parent ~= self.view_node then
local parent_pos = gui.get_position(parent)
node_offset_for_view.x = node_offset_for_view.x + parent_pos.x
node_offset_for_view.y = node_offset_for_view.y + parent_pos.y
parent = gui.get_parent(parent)
else
is_parent_of_view = true
parent = nil
end
end
if not is_parent_of_view then
error("The node to check is_node_in_view should be child if scroll view")
return false
end
local node_border = helper.get_border(node, node_offset_for_view)
-- Check is vertical outside (Left or Right):
if node_border.z < view_border.x or node_border.x > view_border.z then
if node_border.z < self.view_border.x or node_border.x > self.view_border.z then
return false
end
-- Check is horizontal outside (Up or Down):
if node_border.w > view_border.y or node_border.y < view_border.w then
if node_border.w > self.view_border.y or node_border.y < self.view_border.w then
return false
end
@@ -426,7 +437,7 @@ end
--- Bind the grid component (Static or Dynamic) to recalculate
-- scroll size on grid changes
-- @tparam Scroll self
-- @tparam Scroll self @{Scroll}
-- @tparam StaticGrid|DynamicGrid grid Druid grid component
-- @treturn druid.scroll Current scroll instance
function Scroll.bind_grid(self, grid)
@@ -443,7 +454,10 @@ function Scroll.bind_grid(self, grid)
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(), grid:get_offset())
local size = grid:get_size()
local offset = grid:get_offset()
self:set_size(size, offset)
self:log_message("Change size from grid", { size = size, offset = offset })
end)
self:set_size(grid:get_size(), grid:get_offset())
@@ -529,8 +543,11 @@ function Scroll._check_soft_zone(self)
end
--- Cancel animation on other animation or input touch
-- Cancel animation on other animation or input touch
function Scroll._cancel_animate(self)
self.inertion.x = 0
self.inertion.y = 0
if self.is_animate then
self.target_position = gui.get_position(self.content_node)
self.position.x = self.target_position.x
@@ -549,7 +566,6 @@ function Scroll._set_scroll_position(self, position)
if self.position.x ~= position.x or self.position.y ~= position.y then
self.position.x = position.x
self.position.y = position.y
self:_update_params()
gui.set_position(self.content_node, position)
self.on_scroll:trigger(self:get_context(), self.position)
@@ -677,12 +693,10 @@ end
function Scroll._update_size(self)
local view_border = helper.get_border(self.view_node)
local content_border = helper.get_border(self.content_node)
local content_size = vmath.mul_per_elem(gui.get_size(self.content_node), gui.get_scale(self.content_node))
self.available_pos = get_border_vector(view_border - content_border, self._offset)
self.available_pos = get_border_vector(self.view_border - content_border, self._offset)
self.available_size = get_size_vector(self.available_pos)
self.drag.can_x = self.available_size.x > 0 and self._is_horizontal_scroll
@@ -711,7 +725,7 @@ function Scroll._update_size(self)
self.drag.can_y = content_size.y > self.view_size.y
end
self.available_pos_extra = get_border_vector(view_border - content_border_extra, self._offset)
self.available_pos_extra = get_border_vector(self.view_border - content_border_extra, self._offset)
self.available_size_extra = get_size_vector(self.available_pos_extra)
self:_set_scroll_position(self.position)
@@ -720,32 +734,6 @@ function Scroll._update_size(self)
end
function Scroll._update_params(self)
local t = self.target_position
local b = self.available_pos
self._outside_offset_vector.x = 0
self._outside_offset_vector.y = 0
-- Right border (minimum x)
if t.x < b.x then
self._outside_offset_vector.x = t.x - b.x
end
-- Left border (maximum x)
if t.x > b.z then
self._outside_offset_vector.x = t.x - b.z
end
-- Top border (minimum y)
if t.y < b.y then
self._outside_offset_vector.y = t.y - b.y
end
-- Bot border (maximum y)
if t.y > b.w then
self._outside_offset_vector.y = t.y - b.w
end
end
function Scroll._process_scroll_wheel(self, action_id, action)
if not self._is_mouse_hover or self.style.WHEEL_SCROLL_SPEED == 0 then
return false

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle placing components by row and columns.
-- Grid can anchor your elements, get content size and other
@@ -7,19 +7,19 @@
-- @alias druid.static_grid
--- On item add callback(self, node, index)
-- @tfield druid_event on_add_item
-- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index)
-- @tfield druid_event on_remove_item
-- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add or remove callback(self, index)
-- @tfield druid_event on_change_items
--- On item add, remove or change in_row callback(self, index|nil)
-- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self)
-- @tfield druid_event on_clear
-- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self)
-- @tfield druid_event on_update_positions
-- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node
-- @tfield node parent
@@ -49,7 +49,7 @@ local Event = require("druid.event")
local helper = require("druid.helper")
local component = require("druid.component")
local StaticGrid = component.create("static_grid", { component.ON_LAYOUT_CHANGE })
local StaticGrid = component.create("static_grid")
local function _extend_border(border, pos, size, pivot)
@@ -70,14 +70,16 @@ end
-- or create your own style
-- @table style
-- @tfield[opt=false] bool IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets
-- @tfield[opt=false] bool IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets
function StaticGrid.on_style_change(self, style)
self.style = {}
self.style.IS_DYNAMIC_NODE_POSES = style.IS_DYNAMIC_NODE_POSES or false
self.style.IS_ALIGN_LAST_ROW = style.IS_ALIGN_LAST_ROW or false
end
--- Component init function
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @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
@@ -115,14 +117,16 @@ end
local _temp_pos = vmath.vector3(0)
--- Return pos for grid node index
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid element index
-- @treturn vector3 Node position
function StaticGrid.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._zero_offset.x
local zero_offset_x = self:_get_zero_offset_x(row)
_temp_pos.x = col * self.node_size.x + zero_offset_x
_temp_pos.y = -row * self.node_size.y + self._zero_offset.y
_temp_pos.z = 0
@@ -131,7 +135,7 @@ end
--- Return index for grid pos
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 pos The node position in the grid
-- @treturn number The node index
function StaticGrid.get_index(self, pos)
@@ -147,7 +151,7 @@ end
--- Return grid index by node
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node node The gui node in the grid
-- @treturn number The node index
function StaticGrid.get_index_by_node(self, node)
@@ -167,7 +171,7 @@ end
--- Set grid anchor. Default anchor is equal to anchor of grid parent node
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 anchor Anchor
function StaticGrid.set_anchor(self, anchor)
self.anchor = anchor
@@ -176,11 +180,11 @@ end
--- Add new item to the grid
-- @tparam StaticGrid self
-- @tparam node item Gui node
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node item Gui node
-- @tparam[opt] number index The item position. By default add as last item
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
function StaticGrid.add(self, item, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT
index = index or ((self.last_index or 0) + 1)
@@ -215,10 +219,10 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid node index to remove
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
-- @treturn Node The deleted gui node from grid
function StaticGrid.remove(self, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT
@@ -248,7 +252,7 @@ end
--- Return grid content size
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content size
function StaticGrid.get_size(self)
return vmath.vector3(
@@ -258,7 +262,6 @@ function StaticGrid.get_size(self)
end
function StaticGrid.get_size_for(self, count)
if not count or count == 0 then
return vmath.vector3(0)
@@ -282,7 +285,7 @@ end
--- Return grid content borders
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content borders
function StaticGrid.get_borders(self)
return self.border
@@ -290,7 +293,7 @@ end
--- Return array of all node positions
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3[] All grid node positions
function StaticGrid.get_all_pos(self)
local result = {}
@@ -304,7 +307,7 @@ end
--- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam function callback Function on node set position
-- @treturn druid.static_grid Current grid instance
function StaticGrid.set_position_function(self, callback)
@@ -316,7 +319,7 @@ 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
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @treturn druid.static_grid Current grid instance
function StaticGrid.clear(self)
self.border.x = 0
@@ -334,7 +337,7 @@ end
--- Return StaticGrid offset, where StaticGrid content starts.
-- @tparam StaticGrid self The StaticGrid instance
-- @tparam StaticGrid self @{StaticGrid} The StaticGrid instance
-- @treturn vector3 The StaticGrid offset
function StaticGrid:get_offset()
local borders = self:get_borders()
@@ -349,8 +352,22 @@ function StaticGrid:get_offset()
end
--- Set new in_row elements for grid
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number in_row The new in_row value
-- @treturn druid.static_grid Current grid instance
function StaticGrid.set_in_row(self, in_row)
self.in_row = in_row
self._grid_horizonal_offset = self.node_size.x * (self.in_row - 1) * self.anchor.x
self:_update(true)
self.on_change_items:trigger(self:get_context())
return self
end
--- Update grid inner state
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function StaticGrid._update(self, is_instant)
@@ -361,7 +378,7 @@ end
--- Update first and last indexes of grid nodes
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @local
function StaticGrid._update_indexes(self)
self.first_index = nil
@@ -377,7 +394,7 @@ end
--- Update grid content borders, recalculate min and max values
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @local
function StaticGrid._update_borders(self)
if not self.first_index then
@@ -396,7 +413,7 @@ end
--- Update grid nodes position
-- @tparam StaticGrid self
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function StaticGrid._update_pos(self, is_instant)
@@ -420,7 +437,6 @@ 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()
@@ -437,4 +453,25 @@ function StaticGrid:_get_zero_offset()
end
--- Return offset x for last row in grid. Used to align this row accorting to grid's anchor
-- @treturn number The offset x value
-- @local
function StaticGrid:_get_zero_offset_x(row_index)
if not self.style.IS_DYNAMIC_NODE_POSES or not self.style.IS_ALIGN_LAST_ROW then
return self._zero_offset.x
end
local offset_x = self._zero_offset.x
local last_row = math.ceil(self.last_index / self.in_row) - 1
if last_row > 0 and last_row == row_index then
local elements_in_row = (self.last_index - (last_row * self.in_row)) - 1
local offset = elements_in_row * self.node_size.x * self.anchor.x
offset_x = self.node_size.x * self.node_pivot.x - self.node_size.x * self.pivot.x - offset
end
return offset_x
end
return StaticGrid

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle swipe gestures on node.
-- Swipe will be triggered, if swipe was started and
@@ -13,8 +13,8 @@
--- Restriction zone
-- @tparam[opt] node click_zone
--- Trigger on swipe event(self, swipe_side, dist, delta_time
-- @tfield druid_event on_swipe)
--- Trigger on swipe event(self, swipe_side, dist, delta_time)
-- @tfield DruidEvent on_swipe) @{DruidEvent}
---
@@ -23,7 +23,7 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Swipe = component.create("swipe", { component.ON_INPUT, component.ON_LATE_INIT })
local Swipe = component.create("swipe")
local function start_swipe(self, action)
@@ -84,7 +84,7 @@ end
--- Component init function
-- @tparam Swipe self
-- @tparam Swipe self @{Swipe}
-- @tparam node node Gui node
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
function Swipe.init(self, node, on_swipe_callback)
@@ -139,6 +139,8 @@ function Swipe.on_input(self, action_id, action)
if action.released then
reset_swipe(self, action)
end
return true
end
@@ -149,7 +151,7 @@ end
--- Strict swipe click area. Useful for
-- restrict events outside stencil node
-- @tparam Swipe self
-- @tparam Swipe self @{Swipe}
-- @tparam node zone Gui node
function Swipe.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)

49
druid/base/text.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle all GUI texts.
-- Druid text can adjust itself for text node size
@@ -8,13 +8,13 @@
-- @alias druid.text
--- On set text callback(self, text)
-- @tfield druid_event on_set_text
-- @tfield DruidEvent on_set_text @{DruidEvent}
--- On adjust text size callback(self, new_scale)
-- @tfield druid_event on_update_text_scale
-- @tfield DruidEvent on_update_text_scale @{DruidEvent}
--- On change pivot callback(self, pivot)
-- @tfield druid_event on_set_pivot
-- @tfield DruidEvent on_set_pivot @{DruidEvent}
--- Text node
-- @tfield node node
@@ -50,7 +50,7 @@ local const = require("druid.const")
local utf8 = require("druid.system.utf8")
local component = require("druid.component")
local Text = component.create("text", { component.ON_LAYOUT_CHANGE, component.ON_MESSAGE_INPUT })
local Text = component.create("text")
local function update_text_size(self)
@@ -86,6 +86,7 @@ local function update_text_area_size(self)
local max_text_area_square = max_width * max_height
local cur_text_area_square = metrics.height * metrics.width * self.start_scale.x
scale_modifier = self.start_scale.x * math.sqrt(max_text_area_square / cur_text_area_square)
scale_modifier = math.min(scale_modifier, self.start_scale.x)
end
if self._minimal_scale then
@@ -104,7 +105,7 @@ end
local function update_text_with_trim(self, trim_postfix)
local max_width = self.text_area.x
local text_width = self:get_text_width()
local text_width = self:get_text_size()
if text_width > max_width then
local text_length = utf8.len(self.last_value)
@@ -112,7 +113,7 @@ local function update_text_with_trim(self, trim_postfix)
while text_width > max_width do
text_length = text_length - 1
new_text = utf8.sub(self.last_value, 1, text_length)
text_width = self:get_text_width(new_text .. trim_postfix)
text_width = self:get_text_size(new_text .. trim_postfix)
end
gui.set_text(self.node, new_text .. trim_postfix)
@@ -121,7 +122,7 @@ end
local function update_text_with_anchor_shift(self)
if self:get_text_width() >= self.text_area.x then
if self:get_text_size() >= self.text_area.x then
self:set_pivot(const.REVERSE_PIVOTS[self.start_pivot])
else
self:set_pivot(self.start_pivot)
@@ -184,7 +185,7 @@ end
--- Component init function
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam node node Gui text node
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
-- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
@@ -233,28 +234,32 @@ end
--- Calculate text width with font with respect to trailing space
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam[opt] string text
function Text.get_text_width(self, text)
-- @treturn number Width
-- @treturn number Height
function Text.get_text_size(self, text)
text = text or self.last_value
local font = gui.get_font(self.node)
local scale = gui.get_scale(self.node)
local result = gui.get_text_metrics(font, text, 0, false, 0, 0).width
local linebreak = gui.get_line_break(self.node)
local metrics = gui.get_text_metrics(font, text, 0, linebreak, 0, 0)
local width = metrics.width
for i = #text, 1, -1 do
local c = string.sub(text, i, i)
if c ~= ' ' then
break
end
result = result + get_space_width(self, font)
width = width + get_space_width(self, font)
end
return result * scale.x
return width * scale.x, metrics.height * scale.y
end
--- Set text to text field
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam string set_to Text for node
-- @treturn Text Current text instance
function Text.set_to(self, set_to)
@@ -272,7 +277,7 @@ end
--- Set color
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam vector4 color Color for node
-- @treturn Text Current text instance
function Text.set_color(self, color)
@@ -284,7 +289,7 @@ end
--- Set alpha
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam number alpha Alpha for node
-- @treturn Text Current text instance
function Text.set_alpha(self, alpha)
@@ -296,7 +301,7 @@ end
--- Set scale
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam vector3 scale Scale for node
-- @treturn Text Current text instance
function Text.set_scale(self, scale)
@@ -308,7 +313,7 @@ end
--- Set text pivot. Text will re-anchor inside text area
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam gui.pivot pivot Gui pivot constant
-- @treturn Text Current text instance
function Text.set_pivot(self, pivot)
@@ -334,7 +339,7 @@ end
--- Return true, if text with line break
-- @tparam Text self
-- @tparam Text self @{Text}
-- @treturn bool Is text node with line break
function Text.is_multiline(self)
return gui.get_line_break(self.node)
@@ -342,7 +347,7 @@ end
--- Set text adjust, refresh the current text visuals, if needed
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance
@@ -356,7 +361,7 @@ end
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
-- @tparam Text self
-- @tparam Text self @{Text}
-- @tparam number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance
function Text.set_minimal_scale(self, minimal_scale)

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Basic class for all Druid components.
-- To create you component, use `component.create`
@@ -12,9 +12,11 @@ local helper = require("druid.helper")
local BaseComponent = class("druid.component")
local INTERESTS = {} -- Cache interests by component class in runtime
local IS_AUTO_TEMPLATE = not (sys.get_config("druid.no_auto_template") == "1")
--- Component Interests
BaseComponent.ALL = const.ALL
BaseComponent.ON_INPUT = const.ON_INPUT
BaseComponent.ON_UPDATE = const.ON_UPDATE
BaseComponent.ON_MESSAGE = const.ON_MESSAGE
@@ -27,7 +29,6 @@ BaseComponent.ON_LANGUAGE_CHANGE = const.ON_LANGUAGE_CHANGE
BaseComponent.ALL_INTERESTS = {
BaseComponent.ALL,
BaseComponent.ON_INPUT,
BaseComponent.ON_UPDATE,
BaseComponent.ON_MESSAGE,
@@ -40,18 +41,13 @@ BaseComponent.ALL_INTERESTS = {
}
-- Value is method name of component
-- Mapping from on_message method to specific method name
BaseComponent.SPECIFIC_UI_MESSAGES = {
[BaseComponent.ON_FOCUS_LOST] = "on_focus_lost",
[BaseComponent.ON_FOCUS_GAINED] = "on_focus_gained",
[BaseComponent.ON_LAYOUT_CHANGE] = "on_layout_change",
[BaseComponent.ON_MESSAGE_INPUT] = "on_message_input",
[BaseComponent.ON_LANGUAGE_CHANGE] = "on_language_change",
}
BaseComponent.UI_INPUT = {
[BaseComponent.ON_INPUT] = true
[hash("layout_changed")] = BaseComponent.ON_LAYOUT_CHANGE, -- The message_id from Defold
[hash(BaseComponent.ON_FOCUS_LOST)] = BaseComponent.ON_FOCUS_LOST,
[hash(BaseComponent.ON_FOCUS_GAINED)] = BaseComponent.ON_FOCUS_GAINED,
[hash(BaseComponent.ON_MESSAGE_INPUT)] = BaseComponent.ON_MESSAGE_INPUT,
[hash(BaseComponent.ON_LANGUAGE_CHANGE)] = BaseComponent.ON_LANGUAGE_CHANGE,
}
@@ -62,10 +58,10 @@ function BaseComponent.static.get_uid()
end
--- Set current component style table.
--- Set current component style table (protected).
-- Invoke `on_style_change` on component, if exist. BaseComponent should handle
-- their style changing and store all style params
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam table druid_style Druid style module
function BaseComponent.set_style(self, druid_style)
self._meta.style = druid_style or const.EMPTY_TABLE
@@ -77,24 +73,60 @@ function BaseComponent.set_style(self, druid_style)
end
--- Set current component template name
-- @tparam BaseComponent self
--- Set current component template name (protected)
-- It will check parent template name to build full template name
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string template BaseComponent template name
-- @treturn BaseComponent @{BaseComponent}
function BaseComponent.set_template(self, template)
template = template or const.EMPTY_STRING
local parent = self:get_parent_component()
if parent and IS_AUTO_TEMPLATE then
local parent_template = parent:get_template()
if #parent_template > 0 then
if #template > 0 then
template = "/" .. template
end
template = parent_template .. template
end
end
self._meta.template = template
return self
end
--- Set current component nodes
-- @tparam BaseComponent self
--- Get current component template name (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn string Component full template name
function BaseComponent.get_template(self)
return self._meta.template
end
--- Set current component nodes (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam table nodes BaseComponent nodes table
-- @treturn BaseComponent @{BaseComponent}
function BaseComponent.set_nodes(self, nodes)
self._meta.nodes = nodes
-- When we use gui.clone_tree in inner template (template inside other template)
-- this nodes have no id. We have table: hash(correct_id) : hash("")
-- It's wrong and we use this hack to fix this
if nodes then
for id, node in pairs(nodes) do
gui.set_id(node, id)
end
end
return self
end
--- Get current component context
-- @tparam BaseComponent self
--- Get current component context (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn table BaseComponent context
function BaseComponent.get_context(self)
return self._meta.context
@@ -102,47 +134,52 @@ end
--- Increase input priority in current input stack
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @local
function BaseComponent.increase_input_priority(self)
helper.deprecated("The component:increase_input_priority is deprecated. Please use component:set_input_priority(druid_const.PRIORITY_INPUT_MAX) instead")
end
--- Get node for component by name.
-- If component has nodes, node_or_name should be string
-- It auto pick node by template name or from nodes by clone_tree
-- if they was setup via component:set_nodes, component:set_template
-- @tparam BaseComponent self
-- if they was setup via component:set_nodes, component:set_template.
-- If node is not found, the exception will fired
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string|node node_or_name Node name or node itself
-- @treturn node Gui node
function BaseComponent.get_node(self, node_or_name)
local template_name = self:__get_template() or const.EMPTY_STRING
local template_name = self:get_template()
local nodes = self:__get_nodes()
if template_name ~= const.EMPTY_STRING then
if #template_name > 0 then
template_name = template_name .. "/"
end
local node_type = type(node_or_name)
if nodes then
assert(node_type == const.STRING, "You should pass node name instead of node")
return nodes[template_name .. node_or_name]
else
if node_type == const.STRING then
return gui.get_node(template_name .. node_or_name)
local node
if type(node_or_name) == const.STRING then
if nodes then
node = nodes[template_name .. node_or_name]
else
-- Assume it's already node from gui.get_node
return node_or_name
node = gui.get_node(template_name .. node_or_name)
end
else
-- Assume it's already node from gui.get_node
node = node_or_name
end
if not node then
assert(node, "No component with name: " .. template_name .. node_or_name)
end
return node
end
--- Return druid with context of calling component.
--- Return druid with context of calling component (protected).
-- Use it to create component inside of other components.
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn Druid Druid instance with component context
function BaseComponent.get_druid(self)
local context = { _context = self }
@@ -151,15 +188,24 @@ end
--- Return component name
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn string The component name
function BaseComponent.get_name(self)
return self._component.name
return self._component.name .. self:get_uid()
end
--- Return parent component name
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn string|nil The parent component name if exist or bil
function BaseComponent.get_parent_name(self)
local parent = self:get_parent_component()
return parent and parent:get_name()
end
--- Return component input priority
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component input priority
function BaseComponent.get_input_priority(self)
return self._component.input_priority
@@ -167,7 +213,7 @@ end
--- Set component input priority
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam number value The new input priority value
-- @treturn number The component input priority
function BaseComponent.set_input_priority(self, value)
@@ -188,7 +234,7 @@ end
--- Reset component input priority to default value
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component input priority
function BaseComponent.reset_input_priority(self)
self:set_input_priority(self._component.default_input_priority)
@@ -196,8 +242,9 @@ function BaseComponent.reset_input_priority(self)
end
--- Return component uid. UID generated in component creation order
-- @tparam BaseComponent self
--- Return component uid (protected).
--- UID generated in component creation order
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component uid
function BaseComponent.get_uid(self)
return self._component._uid
@@ -206,9 +253,9 @@ end
--- Set component input state. By default it enabled
-- You can disable any input of component by this function
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam bool state The component input state
-- @treturn BaseComponent BaseComponent itself
-- @treturn BaseComponent BaseComponent itself
function BaseComponent.set_input_enabled(self, state)
self._meta.input_enabled = state
@@ -220,43 +267,40 @@ function BaseComponent.set_input_enabled(self, state)
end
--- Return the parent for current component
-- @tparam BaseComponent self
-- @treturn druid.base_component|nil The druid component instance or nil
--- Return the parent for current component (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn BaseComponent|nil The druid component instance or nil
function BaseComponent.get_parent_component(self)
local context = self:get_context()
if context.isInstanceOf and context:isInstanceOf(BaseComponent) then
return context
end
return nil
return self._meta.parent
end
--- Setup component context and his style table
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam table druid_instance The parent druid instance
-- @tparam table context Druid context. Usually it is self of script
-- @tparam table style Druid style module
-- @tparam table instance_class The component instance class
-- @treturn component BaseComponent itself
function BaseComponent.setup_component(self, druid_instance, context, style)
-- @local
function BaseComponent.setup_component(self, druid_instance, context, style, instance_class)
self._meta = {
template = nil,
context = nil,
template = "",
context = context,
nodes = nil,
style = nil,
druid = druid_instance,
input_enabled = true,
children = {}
children = {},
parent = type(context) ~= "userdata" and context,
instance_class = instance_class
}
self:__set_context(context)
self:set_style(style)
self:set_template("")
local parent = self:get_parent_component()
if parent then
parent:__add_children(self)
if self._meta.parent then
self._meta.parent:__add_children(self)
end
return self
@@ -265,27 +309,44 @@ end
--- Basic constructor of component. It will call automaticaly
-- by `BaseComponent.static.create`
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string name BaseComponent name
-- @tparam[opt={}] table interest List of component's interest
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
-- @local
function BaseComponent.initialize(self, name, interest, input_priority)
interest = interest or {}
function BaseComponent.initialize(self, name, input_priority)
self._component = {
name = name,
interest = interest,
input_priority = input_priority or const.PRIORITY_INPUT,
default_input_priority = input_priority or const.PRIORITY_INPUT,
is_debug = false,
_is_input_priority_changed = true, -- Default true for sort once time after GUI init
_uid = BaseComponent.get_uid()
}
end
--- Print log information if debug mode is enabled (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string message
-- @tparam table context
function BaseComponent.log_message(self, message, context)
if not self._component.is_debug then
return
end
print("[" .. self:get_name() .. "]:", message, helper.table_to_string(context))
end
--- Set debug logs for component enabled or disabled
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam bool is_debug
function BaseComponent.set_debug(self, is_debug)
self._component.is_debug = is_debug
end
--- Return true, if input priority was changed
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @local
function BaseComponent._is_input_priority_changed(self)
return self._component._is_input_priority_changed
@@ -293,7 +354,7 @@ end
--- Reset is_input_priority_changed field
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @local
function BaseComponent._reset_input_priority_changed(self)
self._component._is_input_priority_changed = false
@@ -305,44 +366,45 @@ function BaseComponent.__tostring(self)
end
--- Set current component context
-- @tparam BaseComponent self
-- @tparam table context Druid context. Usually it is self of script
-- @local
function BaseComponent.__set_context(self, context)
self._meta.context = context
end
--- Get current component interests
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn table List of component interests
-- @local
function BaseComponent.__get_interests(self)
return self._component.interest
end
local instance_class = self._meta.instance_class
if INTERESTS[instance_class] then
return INTERESTS[instance_class]
end
local interests = {}
for index = 1, #BaseComponent.ALL_INTERESTS do
local interest = BaseComponent.ALL_INTERESTS[index]
if self[interest] and type(self[interest]) == "function" then
table.insert(interests, interest)
end
end
--- Get current component template name
-- @tparam BaseComponent self
-- @treturn string BaseComponent template name
-- @local
function BaseComponent.__get_template(self)
return self._meta.template
INTERESTS[instance_class] = interests
return INTERESTS[instance_class]
end
--- Get current component nodes
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn table BaseComponent nodes table
-- @local
function BaseComponent.__get_nodes(self)
return self._meta.nodes
local nodes = self._meta.nodes
local parent = self:get_parent_component()
if parent then
nodes = nodes or parent:__get_nodes()
end
return nodes
end
--- Add child to component children list
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam component children The druid component instance
-- @local
function BaseComponent.__add_children(self, children)
@@ -351,7 +413,7 @@ end
--- Remove child from component children list
-- @tparam BaseComponent self
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam component children The druid component instance
-- @local
function BaseComponent.__remove_children(self, children)
@@ -363,8 +425,8 @@ function BaseComponent.__remove_children(self, children)
end
--- Return all children components, recursive
-- @tparam BaseComponent self
--- Return all children components, recursive (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn table Array of childrens if the Druid component instance
function BaseComponent.get_childrens(self)
local childrens = {}
@@ -386,15 +448,14 @@ end
--- Create new component. It will inheritance from basic
-- druid component.
-- @tparam string name BaseComponent name
-- @tparam[opt={}] table interest List of component's interest
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
-- @local
function BaseComponent.static.create(name, interest, input_priority)
function BaseComponent.static.create(name, input_priority)
-- Yea, inheritance here
local new_class = class(name, BaseComponent)
new_class.initialize = function(self)
BaseComponent.initialize(self, name, interest, input_priority)
BaseComponent.initialize(self, name, input_priority)
end
return new_class

33
druid/const.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid constants
-- @local
@@ -32,16 +32,15 @@ M.ZERO = "0"
--- Component Interests
M.ALL = "all"
M.ON_INPUT = hash("on_input")
M.ON_UPDATE = hash("on_update")
M.ON_MESSAGE = hash("on_message")
M.ON_LATE_INIT = hash("on_late_init")
M.ON_FOCUS_LOST = hash("on_focus_lost")
M.ON_FOCUS_GAINED = hash("on_focus_gained")
M.ON_LAYOUT_CHANGE = hash("layout_changed")
M.ON_MESSAGE_INPUT = hash("on_message_input")
M.ON_LANGUAGE_CHANGE = hash("on_language_change")
M.ON_INPUT = "on_input"
M.ON_UPDATE = "update"
M.ON_MESSAGE = "on_message"
M.ON_LATE_INIT = "on_late_init"
M.ON_FOCUS_LOST = "on_focus_lost"
M.ON_FOCUS_GAINED = "on_focus_gained"
M.ON_LAYOUT_CHANGE = "on_layout_change"
M.ON_MESSAGE_INPUT = "on_message_input"
M.ON_LANGUAGE_CHANGE = "on_language_change"
M.PRIORITY_INPUT = 10
@@ -108,12 +107,12 @@ M.SHIFT = {
M.TEXT_ADJUST = {
DOWNSCALE = 0,
TRIM = 1,
NO_ADJUST = 2,
DOWNSCALE_LIMITED = 3,
SCROLL = 4,
SCALE_THEN_SCROLL = 5,
DOWNSCALE = "downscale",
TRIM = "trim",
NO_ADJUST = "no_adjust",
DOWNSCALE_LIMITED = "downscale_limited",
SCROLL = "scroll",
SCALE_THEN_SCROLL = "scale_then_scroll",
}

View File

@@ -0,0 +1,182 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 2.0
y: 2.0
z: 1.0
w: 1.0
}
size {
x: 36.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_move"
id: "pin"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 13.5
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.2
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 17.0
y: 17.0
z: 0.0
w: 1.0
}
color {
x: 0.101960786
y: 0.101960786
z: 0.101960786
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/tick"
id: "notch"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "pin"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,123 @@
-- Copyright (c) 2022 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid pin knob custom component.
-- It's simple rotating input element
-- @module PinKnob
-- @within BaseComponent
-- @alias druid.pin_knob
--- The component druid instance
-- @tfield DruidInstance druid @{DruidInstance}
--- Is currently under user control
-- @tfield bool is_drag
--- The pin node
-- @tfield node node
---
local const = require("druid.const")
local component = require("druid.component")
local PinKnob = component.create("druid.pin_knob", { const.ON_INPUT })
local SCHEME = {
ROOT = "root",
PIN = "pin",
}
local function update_visual(self)
local rotation = vmath.vector3(0, 0, self.angle)
gui.set_rotation(self.node, rotation)
end
local function set_angle(self, value)
local prev_value = self.angle
self.angle = value
self.angle = math.min(self.angle, self.angle_max)
self.angle = math.max(self.angle, self.angle_min)
update_visual(self)
if prev_value ~= self.angle and self.callback then
local output_value = self.angle
if output_value ~= 0 then
output_value = -output_value
end
self.callback(self:get_context(), output_value)
end
end
--- Component init function
-- @tparam PinKnob self @{PinKnob}
-- @tparam function callback Callback(self, value) on value changed
-- @tparam string template The template string name
-- @tparam table nodes Nodes table from gui.clone_tree
function PinKnob.init(self, callback, template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
self.node = self:get_node(SCHEME.PIN)
self.is_drag = false
self.callback = callback
self:set_angle(0, -100, 100)
self._friction = 0.75
end
--- Set current and min/max angles for component
-- @tparam PinKnob self @{PinKnob}
-- @tparam number cur_value The new value for pin knob
-- @tparam number min The minimum value for pin knob
-- @tparam number max The maximum value for pin knob
-- @treturn PinKnob @{PinKnob}
function PinKnob.set_angle(self, cur_value, min, max)
self.angle_min = min or self.angle_min
self.angle_max = max or self.angle_max
set_angle(self, cur_value)
return self
end
--- Set current and min/max angles for component
-- @tparam PinKnob self @{PinKnob}
-- @tparam[opt=1] number value The spin speed multiplier
-- @treturn PinKnob @{PinKnob}
function PinKnob.set_friction(self, value)
self._friction = value or 1
return self
end
function PinKnob.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return false
end
if gui.pick_node(self.node, action.x, action.y) then
if action.pressed then
self.pos = gui.get_position(self.node)
self.is_drag = true
end
end
if self.is_drag and not action.pressed then
set_angle(self, self.angle - action.dx * self._friction - action.dy * self._friction)
end
if action.released then
self.is_drag = false
end
return self.is_drag
end
return PinKnob

View File

@@ -0,0 +1,371 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 190.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/progress_back"
id: "button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.5
y: 0.5
z: 1.0
w: 1.0
}
size {
x: 300.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Placeholder"
font: "game"
id: "placeholder_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.4
y: 0.4
z: 0.4
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.6
y: 0.6
z: 1.0
w: 1.0
}
size {
x: 300.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "User input"
font: "game"
id: "input_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 67.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.6
y: 0.6
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "cursor_node"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 2.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 20.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "|"
font: "game"
id: "cursor_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "cursor_node"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,95 @@
-- Copyright (c) 2022 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid Rich Input custom component.
-- It's wrapper on Input component with cursor and placeholder text
-- @module RichInput
-- @within Input
-- @alias druid.rich_input
--- The component druid instance
-- @tfield DruidInstance druid @{DruidInstance}
--- On input field text change callback(self, input_text)
-- @tfield Input input @{Input}
--- On input field text change to empty string callback(self, input_text)
-- @tfield node cursor
--- On input field text change to max length string callback(self, input_text)
-- @tfield druid.text placeholder @{Text}
---
local component = require("druid.component")
local RichInput = component.create("druid.rich_input")
local SCHEME = {
ROOT = "root",
BUTTON = "button",
PLACEHOLDER = "placeholder_text",
INPUT = "input_text",
CURSOR = "cursor_node",
}
local function animate_cursor(self)
gui.cancel_animation(self.cursor, gui.PROP_COLOR)
gui.set_color(self.cursor, vmath.vector4(1))
gui.animate(self.cursor, gui.PROP_COLOR, vmath.vector4(1,1,1,0), gui.EASING_INSINE, 0.8, 0, nil, gui.PLAYBACK_LOOP_PINGPONG)
end
local function update_text(self, text)
local text_width = self.input.total_width
animate_cursor(self)
gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0))
gui.set_scale(self.cursor, self.input.text.scale)
end
local function on_select(self)
gui.set_enabled(self.cursor, true)
gui.set_enabled(self.placeholder.node, false)
animate_cursor(self)
end
local function on_unselect(self)
gui.set_enabled(self.cursor, false)
gui.set_enabled(self.placeholder.node, true and #self.input:get_text() == 0)
end
--- Component init function
-- @tparam RichInput self @{RichInput}
-- @tparam string template The template string name
-- @tparam table nodes Nodes table from gui.clone_tree
function RichInput.init(self, template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
self.input = self.druid:new_input(self:get_node(SCHEME.BUTTON), self:get_node(SCHEME.INPUT))
self.cursor = self:get_node(SCHEME.CURSOR)
self.input:set_text("")
self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER))
self.input.on_input_text:subscribe(update_text)
self.input.on_input_select:subscribe(on_select)
self.input.on_input_unselect:subscribe(on_unselect)
on_unselect(self)
update_text(self, "")
end
--- Set placeholder text
-- @tparam RichInput self @{RichInput}
-- @tparam string placeholder_text The placeholder text
function RichInput.set_placeholder(self, placeholder_text)
self.placeholder:set_to(placeholder_text)
return self
end
return RichInput

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid UI Library.
-- Powerful Defold component based UI library. Use standart
@@ -120,17 +120,6 @@ function M.on_window_callback(event)
end
--- Callback on global layout change event.
-- @function druid.on_layout_change
function M.on_layout_change()
local instances = get_druid_instances()
for i = 1, #instances do
msg.post(instances[i].url, base_component.ON_LAYOUT_CHANGE)
end
end
--- Callback on global language change event.
-- Use to update all lang texts
-- @function druid.on_language_change

View File

@@ -0,0 +1,32 @@
--- For component interest functions
--- see https://github.com/Insality/druid/blob/develop/docs_md/02-creating_custom_components.md
--- Require this component in you gui file:
--- local {COMPONENT_NAME} = require("{COMPONENT_PATH}")
--- And create this component via:
--- self.{COMPONENT_TYPE} = self.druid:new({COMPONENT_NAME}, template, nodes)
local component = require("druid.component")
---@class {COMPONENT_TYPE}: druid.base_component{COMPONENT_ANNOTATIONS}
---@field druid druid_instance
local {COMPONENT_NAME} = component.create("{COMPONENT_TYPE}")
local SCHEME = {
{SCHEME_LIST}
}
---@param template string
---@param nodes table<hash, node>
function {COMPONENT_NAME}:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid(){COMPONENT_DEFINE}
end
function {COMPONENT_NAME}:on_remove()
end
{COMPONENT_FUNCTIONS}
return {COMPONENT_NAME}

View File

@@ -0,0 +1,139 @@
# @license MIT, Insality 2021
# @source https://github.com/Insality/druid
import os
import sys
import deftree
current_filepath = os.path.abspath(os.path.dirname(__file__))
TEMPLATE_PATH = current_filepath + "/component.lua_template"
component_annotations = ""
component_functions = ""
component_define = ""
def to_camel_case(snake_str):
components = snake_str.split('_')
return ''.join(x.title() for x in components[0:])
def get_id(node_name):
return node_name.upper().replace("/", "_")
def process_component(node_name, component_name):
global component_annotations
global component_functions
global component_define
if node_name == "root":
component_annotations += "\n---@field root node"
component_define += "\n\tself.root = self:get_node(SCHEME.ROOT)"
if node_name.startswith("button"):
component_annotations += "\n---@field {0} druid.button".format(node_name)
component_functions += "\nfunction {1}:_on_{0}()\n\tprint(\"Click on {0}\")\nend\n\n".format(node_name, component_name)
component_define += "\n\tself.{0} = self.druid:new_button(SCHEME.{1}, self._on_{0})".format(node_name, get_id(node_name))
if node_name.startswith("text"):
component_annotations += "\n---@field {0} druid.text".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_text(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("lang_text"):
component_annotations += "\n---@field {0} druid.text".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_lang_text(SCHEME.{1}, \"lang_id\")".format(node_name, get_id(node_name))
if node_name.startswith("grid") or node_name.startswith("static_grid"):
component_annotations += "\n---@field {0} druid.static_grid".format(node_name)
component_define += "\n--TODO: Replace prefab_name with grid element prefab"
component_define += "\n\tself.{0} = self.druid:new_static_grid(SCHEME.{1}, \"prefab_name\", 1)".format(node_name, get_id(node_name))
if node_name.startswith("dynamic_grid"):
component_annotations += "\n---@field {0} druid.dynamic_grid".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_dynamic_grid(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("scroll_view"):
field_name = node_name.replace("_view", "")
content_name = node_name.replace("_view", "_content")
component_annotations += "\n---@field {0} druid.scroll".format(field_name)
component_define += "\n\tself.{0} = self.druid:new_scroll(SCHEME.{1}, SCHEME.{2})".format(field_name, get_id(node_name), get_id(content_name))
if node_name.startswith("blocker"):
component_annotations += "\n---@field {0} druid.blocker".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_blocker(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("slider"):
component_annotations += "\n---@field {0} druid.slider".format(node_name)
component_define += "\n--TODO: Replace slider end position. It should be only vertical or horizontal"
component_define += "\n\tself.{0} = self.druid:new_slider(SCHEME.{1}, vmath.vector3(100, 0, 0), self._on_{0}_change)".format(node_name, get_id(node_name))
component_functions += "\nfunction {1}:_on_{0}_change(value)\n\tprint(\"Slider change:\", value)\nend\n\n".format(node_name, component_name)
if node_name.startswith("progress"):
component_annotations += "\n---@field {0} druid.progress".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_progress(SCHEME.{1}, \"x\")".format(node_name, get_id(node_name))
if node_name.startswith("timer"):
component_annotations += "\n---@field {0} druid.timer".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_timer(SCHEME.{1}, 59, 0, self._on_{0}_end)".format(node_name, get_id(node_name))
component_functions += "\nfunction {1}:_on_{0}_end()\n\tprint(\"Timer {0} trigger\")\nend\n\n".format(node_name, component_name)
def main():
global component_annotations
global component_functions
global component_define
filename = sys.argv[1]
print("Create Druid component from gui file", filename)
tree = deftree.parse(filename)
root = tree.get_root()
output_directory = os.path.dirname(filename)
output_filename = os.path.splitext(os.path.basename(filename))[0]
output_full_path = os.path.join(output_directory, output_filename + ".lua")
is_already_exists = os.path.exists(output_full_path)
if is_already_exists:
print("Error: The file is already exists")
print("File:", output_full_path)
return
component_require_path = os.path.join(output_directory, output_filename).replace("/", ".").replace("..", "")
component_name = to_camel_case(output_filename)
component_type = output_filename
scheme_list = []
# Gather nodes from GUI scene
for node in root.iter_elements("nodes"):
node_name = node.get_attribute("id").value
scheme_list.append("\t" + get_id(node_name) + " = \"" + node_name + "\"")
is_template = node.get_attribute("template")
is_in_template = "/" in node_name
if not is_template and not is_in_template:
process_component(node_name, component_name)
if len(component_define) > 2:
component_define = "\n" + component_define
template_file = open(TEMPLATE_PATH, "r")
filedata = template_file.read()
template_file.close()
filedata = filedata.replace("{COMPONENT_NAME}", component_name)
filedata = filedata.replace("{COMPONENT_TYPE}", component_type)
filedata = filedata.replace("{COMPONENT_PATH}", component_require_path)
filedata = filedata.replace("{COMPONENT_DEFINE}", component_define)
filedata = filedata.replace("{COMPONENT_FUNCTIONS}", component_functions)
filedata = filedata.replace("{COMPONENT_ANNOTATIONS}", component_annotations)
filedata = filedata.replace("{SCHEME_LIST}", ",\n".join(scheme_list))
output_file = open(output_full_path, "w")
output_file.write(filedata)
output_file.close()
print("Success: The file is created")
print("File:", output_full_path)
main()

View File

@@ -0,0 +1,127 @@
--- @license MIT, Insality 2021
--- @source https://github.com/Insality/druid
local M = {}
local function ends_with(str, ending)
return ending == "" or str:sub(-#ending) == ending
end
local function save_file_from_dependency(dependency_file_path, output_file_path)
local content = editor.get(dependency_file_path, "text")
local file, err = io.open(output_file_path, "w")
if err then
print("Error:", err)
return false
end
file:write(content)
file:close()
print("Write file at", output_file_path)
return true
end
function M.get_commands()
return {
{
label = "Print gui scheme",
locations = { "Outline" },
query = {
selection = {type = "outline", cardinality = "many"}
},
active = function(opts)
return true
end,
run = function(opts)
print("local SCHEME = {")
for i = 1, #opts.selection do
local file = opts.selection[i]
if editor.can_get(file, "id") then
local id = editor.get(file, "id")
print("\t" .. string.upper(id) .. " = \"" .. id .. "\",")
end
end
print("}")
print("")
end
},
{
label = "Assign layers",
locations = {"Edit"},
query = {
selection = {type = "resource", cardinality = "one"}
},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".gui")
end,
run = function(opts)
local file = opts.selection
print("Run script for", editor.get(file, "path"))
save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh")
save_file_from_dependency('/druid/editor_scripts/setup_layers.py', "./build/setup_layers.py")
return {
{
action = "shell",
command = {
"bash",
"./build/run_python_script_on_gui.sh",
"./build/setup_layers.py",
"." .. editor.get(file, "path")
}
}
}
end
},
{
label = "Create Druid Component",
locations = {"Edit"},
query = {
selection = {type = "resource", cardinality = "one"}
},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".gui")
end,
run = function(opts)
local file = opts.selection
print("Run script for", editor.get(file, "path"))
save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh")
save_file_from_dependency('/druid/editor_scripts/create_druid_component.py', "./build/create_druid_component.py")
save_file_from_dependency('/druid/editor_scripts/component.lua_template', "./build/component.lua_template")
return {
{
action = "shell",
command = {
"bash",
"./build/run_python_script_on_gui.sh",
"./build/create_druid_component.py",
"." .. editor.get(file, "path")
}
}
}
end
}
}
end
return M

View File

@@ -0,0 +1,15 @@
#!/bin/bash
# @license MIT, Insality 2022
# @source https://github.com/Insality/druid
echo "Run bash for $1"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
is_defree_installed=$(pip3 list --disable-pip-version-check | grep -E "deftree")
if [ -z "$is_defree_installed" ]; then
echo "The python deftree is not installed. Please install it via"
echo "pip3 install deftree"
exit 0
fi
python3 $1 $2

View File

@@ -1,8 +1,8 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Lua event small library
--- Druid lua event library
-- @module DruidEvent
-- @alias druid_event
-- @alias druid.event
local class = require("druid.system.middleclass")
@@ -10,10 +10,10 @@ local DruidEvent = class("druid.event")
--- Event constructur
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
-- @tparam function initial_callback Subscribe the callback on new event, if callback exist
function DruidEvent.initialize(self, initial_callback)
self._callbacks = {}
self._callbacks = nil -- initialize later
if initial_callback then
self:subscribe(initial_callback)
@@ -22,13 +22,14 @@ end
--- Subscribe callback on event
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
-- @tparam function callback Callback itself
-- @tparam table context Additional context as first param to callback call
function DruidEvent.subscribe(self, callback, context)
assert(type(self) == "table", "You should subscribe to event with : syntax")
assert(type(callback) == "function", "Callback should be function")
self._callbacks = self._callbacks or {}
table.insert(self._callbacks, {
callback = callback,
context = context
@@ -39,10 +40,14 @@ end
--- Unsubscribe callback on event
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
-- @tparam function callback Callback itself
-- @tparam table context Additional context as first param to callback call
function DruidEvent.unsubscribe(self, callback, context)
if not self._callbacks then
return
end
for index, callback_info in ipairs(self._callbacks) do
if callback_info.callback == callback and callback_info.context == context then
table.remove(self._callbacks, index)
@@ -53,24 +58,31 @@ end
--- Return true, if event have at lease one handler
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
-- @treturn bool True if event have handlers
function DruidEvent.is_exist(self)
if not self._callbacks then
return false
end
return #self._callbacks > 0
end
--- Clear the all event handlers
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
function DruidEvent.clear(self)
self._callbacks = {}
self._callbacks = nil
end
--- Trigger the event and call all subscribed callbacks
-- @tparam DruidEvent self
-- @tparam DruidEvent self @{DruidEvent}
-- @tparam any ... All event params
function DruidEvent.trigger(self, ...)
if not self._callbacks then
return false
end
for index, callback_info in ipairs(self._callbacks) do
if callback_info.context then
callback_info.callback(callback_info.context, ...)

28
druid/extended/checkbox.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid checkbox component
-- @module Checkbox
@@ -6,7 +6,7 @@
-- @alias druid.checkbox
--- On change state callback(self, state)
-- @tfield druid_event on_change_state
-- @tfield DruidEvent on_change_state @{DruidEvent}
--- Visual node
-- @tfield node node
@@ -15,14 +15,14 @@
-- @tfield[opt=node] node click_node
--- Button component from click_node
-- @tfield Button button
-- @tfield Button button @{Button}
---
local Event = require("druid.event")
local component = require("druid.component")
local Checkbox = component.create("checkbox", { component.ON_LAYOUT_CHANGE })
local Checkbox = component.create("checkbox")
local function on_click(self)
@@ -45,17 +45,18 @@ end
--- Component init function
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @tparam node node Gui node
-- @tparam function callback Checkbox callback
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
function Checkbox.init(self, node, callback, click_node)
-- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false
function Checkbox.init(self, node, callback, click_node, initial_state)
self.druid = self:get_druid()
self.node = self:get_node(node)
self.click_node = self:get_node(click_node)
self.click_node = self:get_node(click_node or node)
self.button = self.druid:new_button(self.click_node or self.node, on_click)
self:set_state(false, true)
self:set_state(initial_state, true, true)
self.on_change_state = Event(callback)
end
@@ -67,21 +68,24 @@ end
--- Set checkbox state
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @tparam bool state Checkbox state
-- @tparam bool is_silent Don't trigger on_change_state if true
function Checkbox.set_state(self, state, is_silent)
-- @tparam bool is_instant If instant checkbox change
function Checkbox.set_state(self, state, is_silent, is_instant)
self.state = state
self.style.on_change_state(self, self.node, state)
self.style.on_change_state(self, self.node, state, is_instant)
if not is_silent then
self.on_change_state:trigger(self:get_context(), state)
end
return self
end
--- Return checkbox state
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @treturn bool Checkbox state
function Checkbox.get_state(self)
return self.state

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Checkbox group module
-- @module CheckboxGroup
@@ -6,10 +6,10 @@
-- @alias druid.checkbox_group
--- On any checkbox click callback(self, index)
-- @tfield druid_event on_checkbox_click
-- @tfield DruidEvent on_checkbox_click @{DruidEvent}
--- Array of checkbox components
-- @tfield table checkboxes
-- @tfield table checkboxes @{Checkbox}
---
@@ -20,7 +20,7 @@ local CheckboxGroup = component.create("checkbox_group")
--- Component init function
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam node[] nodes Array of gui node
-- @tparam function callback Checkbox callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@@ -42,19 +42,20 @@ end
--- Set checkbox group state
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam bool[] indexes Array of checkbox state
function CheckboxGroup.set_state(self, indexes)
-- @tparam boolean is_instant If instant state change
function CheckboxGroup.set_state(self, indexes, is_instant)
for i = 1, #indexes do
if self.checkboxes[i] then
self.checkboxes[i]:set_state(indexes[i], true)
self.checkboxes[i]:set_state(indexes[i], true, is_instant)
end
end
end
--- Return checkbox group state
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @treturn bool[] Array if checkboxes state
function CheckboxGroup.get_state(self)
local result = {}

View File

@@ -1,68 +0,0 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid component template
-- @module druid.component
-- @local
local component = require("druid.component")
local Component = component.create("my_component_name", { component.ON_UPDATE })
-- Component constructor
function Component:init(...)
end
-- Call only if exist interest: component.ON_UPDATE
function Component:update(dt)
end
-- Call only if exist interest: component.ON_INPUT
function Component:on_input(action_id, action)
return false
end
-- Call on component creation and on component:set_style() function
function Component:on_style_change(style)
end
-- Call only if exist interest: component.ON_MESSAGE
function Component:on_message(message_id, message, sender)
end
-- Call only if component with ON_LANGUAGE_CHANGE interest
function Component:on_language_change()
end
-- Call only if component with ON_LAYOUT_CHANGE interest
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 Component:on_input_interrupt()
end
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
function Component:on_focus_lost()
end
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
function Component:on_focus_gained()
end
-- Call on component remove or on druid:final
function Component:on_remove()
end
return Component

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to manage data for huge dataset in scroll.
-- It requires Druid Scroll and Druid Grid (Static or Dynamic) components
@@ -8,10 +8,10 @@
--- The Druid scroll component
-- @tfield druid.scroll scroll
-- @tfield Scroll scroll @{Scroll}
--- The Druid Grid component
-- @tfield druid.static_grid grid
-- @tfield StaticGrid|DynamicGrid grid @{StaticGrid}, @{DynamicGrid}
--- The current visual top data index
-- @tfield number top_index
@@ -23,7 +23,7 @@
-- @tfield number scroll_progress
--- Event triggered when scroll progress is changed; event(self, progress_value)
-- @tfield druid_event on_scroll_progress_change
-- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}
---
@@ -36,14 +36,17 @@ local DataList = component.create("data_list")
--- Data list constructor
-- @tparam DataList self
-- @tparam druid.scroll scroll The Scroll instance for Data List component
-- @tparam druid.grid grid The Grid instance for Data List component
-- @tparam DataList self @{DataList}
-- @tparam Scroll scroll The @{Scroll} instance for Data List component
-- @tparam StaticGrid|DynamicGrid grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
function DataList.init(self, scroll, grid, create_function)
self.druid = self:get_druid()
self.scroll = scroll
self.grid = grid
if self.grid.style then
self.grid.style.IS_DYNAMIC_NODE_POSES = false
end
self.scroll:bind_grid(grid)
-- Current visual elements indexes
@@ -61,18 +64,20 @@ function DataList.init(self, scroll, grid, create_function)
self.scroll.on_scroll:subscribe(self._check_elements, self)
self.on_scroll_progress_change = Event()
self:set_data()
end
--- Druid System on_remove function
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.on_remove(self)
self.scroll.on_scroll:unsubscribe(self._check_elements, self)
end
--- Set new data set for DataList component
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data The new data array
-- @treturn druid.data_list Current DataList instance
function DataList.set_data(self, data)
@@ -85,7 +90,7 @@ end
--- Add element to DataList. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data
-- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.*
@@ -109,22 +114,26 @@ function DataList.add(self, data, index, shift_policy)
self._data[index] = data
self:_update_data_info()
self:_check_elements()
self:log_message("Add element", { index = index })
end
--- Remove element from DataList. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.*
-- @local
function DataList.remove(self, index, shift_policy)
table.remove(self._data, index)
self:_refresh()
self:log_message("Remove element", { index = index })
end
--- Remove element from DataList by data value. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam tabe data
-- @tparam number shift_policy The constant from const.SHIFT.*
-- @local
@@ -138,7 +147,7 @@ end
--- Clear the DataList and refresh visuals
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.clear(self)
self._data = {}
self:_refresh()
@@ -146,28 +155,28 @@ end
--- Return first index from data. It not always equals to 1
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_first_index(self)
return self._data_first_index
end
--- Return last index from data
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_last_index(self)
return self._data_last_index
end
--- Return amount of data
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_length(self)
return self._data_length
end
--- Return index for data value
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data
function DataList.get_index(self, data)
for index, value in pairs(self._data) do
@@ -181,7 +190,7 @@ end
--- Instant scroll to element with passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
function DataList.scroll_to_index(self, index)
local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
@@ -195,7 +204,7 @@ end
--- Add element at passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @local
function DataList._add_at(self, index)
@@ -209,11 +218,13 @@ function DataList._add_at(self, index)
node = node,
component = instance
}
self:log_message("Add element at", { index = index })
end
--- Remove element from passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @local
function DataList._remove_at(self, index)
@@ -226,11 +237,13 @@ function DataList._remove_at(self, index)
self.druid:remove(self._data_visual[index].component)
end
self._data_visual[index] = nil
self:log_message("Remove element at", { index = index })
end
--- Fully refresh all DataList elements
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._refresh(self)
for index, _ in pairs(self._data_visual) do
@@ -241,7 +254,7 @@ end
--- Check elements which should be created
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._check_elements(self)
for index, data in pairs(self._data_visual) do
@@ -270,6 +283,8 @@ function DataList._check_elements(self)
progress = 0
end
self:log_message("Check elements", { top_index = self.top_index, last_index = self.last_index, progress = progress })
if self.scroll_progress ~= progress then
self.scroll_progress = progress
self.on_scroll_progress_change:trigger(self:get_context(), progress)
@@ -279,7 +294,7 @@ end
--- Check elements which should be created.
-- Start from index with step until element is outside of scroll view
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @tparam number step
-- @local
@@ -312,9 +327,8 @@ function DataList._check_elements_from(self, index, step)
end
--- Update actual data params
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._update_data_info(self)
self._data_first_index = false

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle placing components in row
-- @module DynamicGrid
@@ -6,19 +6,19 @@
-- @alias druid.dynamic_grid
--- On item add callback(self, node, index)
-- @tfield druid_event on_add_item
-- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index)
-- @tfield druid_event on_remove_item
-- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add or remove callback(self, index)
-- @tfield druid_event on_change_items
-- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self)
-- @tfield druid_event on_clear
-- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self)
-- @tfield druid_event on_update_positions
-- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node
-- @tfield node parent
@@ -45,7 +45,7 @@ local Event = require("druid.event")
local helper = require("druid.helper")
local component = require("druid.component")
local DynamicGrid = component.create("dynamic_grid", { component.ON_LAYOUT_CHANGE })
local DynamicGrid = component.create("dynamic_grid")
local SIDE_VECTORS = {
@@ -64,7 +64,7 @@ local AVAILABLE_PIVOTS = {
--- Component init function
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node parent The gui node parent, where items will be placed
function DynamicGrid.init(self, parent)
self.parent = self:get_node(parent)
@@ -95,7 +95,7 @@ end
--- Return pos for grid node index
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid element index
-- @tparam node node The node to be placed
-- @tparam[opt] number origin_index Index of nearby node
@@ -136,11 +136,11 @@ end
--- Add new node to the grid
-- @tparam DynamicGrid self
-- @tparam node node Gui node
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node Gui node
-- @tparam[opt] number index The node position. By default add as last node
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
function DynamicGrid.add(self, node, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT
local delta = shift_policy -- -1 or 1 or 0
@@ -179,11 +179,11 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid node index to remove
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly
-- @treturn Node The deleted gui node from grid
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
-- @treturn node The deleted gui node from grid
function DynamicGrid.remove(self, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT
local delta = shift_policy -- -1 or 1 or 0
@@ -216,7 +216,7 @@ end
--- Return grid content size
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam vector3 border
-- @treturn vector3 The grid content size
function DynamicGrid.get_size(self, border)
@@ -229,7 +229,7 @@ end
--- Return DynamicGrid offset, where DynamicGrid content starts.
-- @tparam DynamicGrid self The DynamicGrid instance
-- @tparam DynamicGrid self @{DynamicGrid} The DynamicGrid instance
-- @treturn vector3 The DynamicGrid offset
function DynamicGrid.get_offset(self)
local size = self:get_size()
@@ -244,7 +244,7 @@ end
--- Return grid content borders
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3 The grid content borders
function DynamicGrid.get_borders(self)
return self.border
@@ -252,7 +252,7 @@ end
--- Return grid index by node
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node The gui node in the grid
-- @treturn number The node index
function DynamicGrid.get_index_by_node(self, node)
@@ -267,7 +267,7 @@ end
--- Return array of all node positions
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3[] All grid node positions
function DynamicGrid.get_all_pos(self)
local result = {}
@@ -281,7 +281,7 @@ end
--- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam function callback Function on node set position
-- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.set_position_function(self, callback)
@@ -292,7 +292,7 @@ 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
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.clear(self)
self.nodes = {}
@@ -319,7 +319,7 @@ end
--- Update grid inner state
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function DynamicGrid._update(self, is_instant)
@@ -330,7 +330,7 @@ end
--- Update first and last indexes of grid nodes
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @local
function DynamicGrid._update_indexes(self)
self.first_index = nil
@@ -346,7 +346,7 @@ end
--- Update grid content borders, recalculate min and max values
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @local
function DynamicGrid._update_borders(self)
if not self.first_index then
@@ -375,7 +375,7 @@ end
--- Update grid nodes position
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function DynamicGrid._update_pos(self, is_instant)
@@ -410,7 +410,6 @@ function DynamicGrid._get_next_node_pos(self, origin_node_index, new_node, place
end
function DynamicGrid._get_node_size(self, node)
return vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node))
end

50
druid/extended/input.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid input text component.
-- Carry on user text input
@@ -8,28 +8,28 @@
-- @alias druid.input
--- On input field select callback(self, button_node)
-- @tfield druid_event on_input_select
-- @tfield DruidEvent on_input_select @{DruidEvent}
--- On input field unselect callback(self, button_node)
-- @tfield druid_event on_input_unselect
--- On input field unselect callback(self, input_text)
-- @tfield DruidEvent on_input_unselect @{DruidEvent}
--- On input field text change callback(self, input_text)
-- @tfield druid_event on_input_text
-- @tfield DruidEvent on_input_text @{DruidEvent}
--- On input field text change to empty string callback(self, input_text)
-- @tfield druid_event on_input_empty
-- @tfield DruidEvent on_input_empty @{DruidEvent}
--- On input field text change to max length string callback(self, input_text)
-- @tfield druid_event on_input_full
-- @tfield DruidEvent on_input_full @{DruidEvent}
--- On trying user input with not allowed character callback(self, params, button_instance)
-- @tfield druid_event on_input_wrong
-- @tfield DruidEvent on_input_wrong @{DruidEvent}
--- Text component
-- @tfield druid.text text
-- @tfield Text text @{Text}
--- Button component
-- @tfield druid.button button
-- @tfield Button button @{Button}
--- Is current input selected now
-- @tfield bool is_selected
@@ -53,7 +53,7 @@ local const = require("druid.const")
local component = require("druid.component")
local utf8 = require("druid.system.utf8")
local Input = component.create("input", { component.ON_INPUT, component.ON_FOCUS_LOST })
local Input = component.create("input")
--- Mask text by replacing every character with a mask character
@@ -110,8 +110,10 @@ function Input.on_style_change(self, style)
end
--- Component init function
-- @tparam Input self @{Input}
-- @tparam node click_node Button node to enabled input component
-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name
-- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text}
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
function Input.init(self, click_node, text_node, keyboard_type)
self.druid = self:get_druid(self)
@@ -166,8 +168,8 @@ function Input.on_input(self, action_id, action)
end)
-- ignore arrow keys
if not string.match(hex, "EF9C8[0-3]") then
if not self.allowed_characters or action.text:match(self.allowed_characters) then
if not utf8.match(hex, "EF9C8[0-3]") then
if not self.allowed_characters or utf8.match(action.text, self.allowed_characters) then
input_text = self.value .. action.text
if self.max_length then
input_text = utf8.sub(input_text, 1, self.max_length)
@@ -227,7 +229,7 @@ end
--- Set text for input field
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam string input_text The string to apply for input field
function Input.set_text(self, input_text)
-- Case when update with marked text
@@ -258,8 +260,8 @@ function Input.set_text(self, input_text)
self.text:set_to(final_text)
-- measure it
self.text_width = self.text:get_text_width(value)
self.marked_text_width = self.text:get_text_width(marked_value)
self.text_width = self.text:get_text_size(value)
self.marked_text_width = self.text:get_text_size(marked_value)
self.total_width = self.text_width + self.marked_text_width
self.on_input_text:trigger(self:get_context(), final_text)
@@ -274,7 +276,7 @@ end
--- Select input field. It will show the keyboard and trigger on_select events
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.select(self)
gui.reset_keyboard()
self.marked_value = ""
@@ -297,7 +299,7 @@ end
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.unselect(self)
gui.reset_keyboard()
self.marked_value = ""
@@ -307,7 +309,7 @@ function Input.unselect(self)
self.is_selected = false
gui.hide_keyboard()
self.on_input_unselect:trigger(self:get_context())
self.on_input_unselect:trigger(self:get_context(), self:get_text())
self.style.on_unselect(self, self.button.node)
end
@@ -315,7 +317,7 @@ end
--- Return current input field text
-- @tparam Input self
-- @tparam Input self @{Input}
-- @treturn string The current input field text
function Input.get_text(self)
return self.value .. self.marked_value
@@ -324,7 +326,7 @@ end
--- Set maximum length for input field.
-- Pass nil to make input field unliminted (by default)
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam number max_length Maximum length for input text field
-- @treturn druid.input Current input instance
function Input.set_max_length(self, max_length)
@@ -336,7 +338,7 @@ end
--- Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam string characters Regulax exp. for validate user input
-- @treturn druid.input Current input instance
function Input.set_allowed_characters(self, characters)
@@ -346,7 +348,7 @@ end
--- Reset current input selection and return previous value
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.reset_changes(self)
self:set_text(self.previous_value)
self:unselect()

57
druid/extended/lang_text.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle all GUI texts
-- Good working with localization system
@@ -7,10 +7,10 @@
-- @alias druid.lang_text
--- On change text callback
-- @tfield druid_event on_change
-- @tfield DruidEvent on_change @{DruidEvent}
--- The text component
-- @tfield Text text
-- @tfield Text text @{Text}
---
@@ -18,24 +18,23 @@ local Event = require("druid.event")
local settings = require("druid.system.settings")
local component = require("druid.component")
local LangText = component.create("lang_text", { component.ON_LANGUAGE_CHANGE })
local LangText = component.create("lang_text")
--- Component init function
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam node node The text node
-- @tparam string locale_id Default locale id, optional
-- @tparam string locale_id Default locale id or text from node as default
-- @tparam bool no_adjust If true, will not correct text size
function LangText.init(self, node, locale_id, no_adjust)
self.druid = self:get_druid()
self.text = self.druid:new_text(node, locale_id, no_adjust)
self.node = self.text.node
self.last_locale_args = {}
self.on_change = Event()
if locale_id then
self:translate(locale_id)
end
self:translate(locale_id or gui.get_text(self.node))
return self
end
@@ -49,23 +48,53 @@ end
--- Setup raw text to lang_text component
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam string text Text for text node
-- @treturn LangText Current instance
function LangText.set_to(self, text)
self.last_locale = false
self.text:set_to(text)
self.on_change:trigger()
return self
end
--- Translate the text by locale_id
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam string locale_id Locale id
function LangText.translate(self, locale_id, ...)
self.last_locale_args = {...}
-- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
-- @tparam[opt] string c Optional param to string.format
-- @tparam[opt] string d Optional param to string.format
-- @tparam[opt] string e Optional param to string.format
-- @tparam[opt] string f Optional param to string.format
-- @tparam[opt] string g Optional param to string.format
-- @treturn LangText Current instance
function LangText.translate(self, locale_id, a, b, c, d, e, f, g)
self.last_locale_args = { a, b, c, d, e, f, g }
self.last_locale = locale_id or self.last_locale
self.text:set_to(settings.get_text(self.last_locale, ...) or "")
self.text:set_to(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
return self
end
--- Format string with new text params on localized text
-- @tparam LangText self @{LangText}
-- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
-- @tparam[opt] string c Optional param to string.format
-- @tparam[opt] string d Optional param to string.format
-- @tparam[opt] string e Optional param to string.format
-- @tparam[opt] string f Optional param to string.format
-- @tparam[opt] string g Optional param to string.format
-- @treturn LangText Current instance
function LangText.format(self, a, b, c, d, e, f, g)
self.last_locale_args = { a, b, c, d, e, f, g }
self.text:set_to(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
return self
end
return LangText

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Basic progress bar component.
-- For correct progress bar init it should be in max size from gui
@@ -7,7 +7,7 @@
-- @alias druid.progress
--- On progress bar change callback(self, new_value)
-- @tfield druid_event on_change
-- @tfield DruidEvent on_change @{DruidEvent}
--- Progress bar fill node
-- @tfield node node
@@ -34,7 +34,7 @@ local const = require("druid.const")
local helper = require("druid.helper")
local component = require("druid.component")
local Progress = component.create("progress", { component.ON_UPDATE, component.ON_LAYOUT_CHANGE })
local Progress = component.create("progress")
local function check_steps(self, from, to, exactly)
@@ -93,7 +93,7 @@ end
--- Component init function
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @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
@@ -146,21 +146,21 @@ end
--- Fill a progress bar and stop progress animation
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.fill(self)
set_bar_to(self, 1, true)
end
--- Empty a progress bar
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.empty(self)
set_bar_to(self, 0, true)
end
--- Instant fill progress bar to value
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam number to Progress bar value, from 0 to 1
function Progress.set_to(self, to)
set_bar_to(self, to)
@@ -168,14 +168,14 @@ end
--- Return current progress bar value
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.get(self)
return self.last_value
end
--- Set points on progress bar to fire the callback
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @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)
@@ -186,7 +186,7 @@ end
--- Start animation of a progress bar
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam number to value between 0..1
-- @tparam[opt] function callback Callback on animation ends
function Progress.to(self, to, callback)

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Radio group module
-- @module RadioGroup
@@ -6,7 +6,7 @@
-- @alias druid.radio_group
--- On any checkbox click
-- @tfield druid_event on_radio_click
-- @tfield DruidEvent on_radio_click @{DruidEvent}
--- Array of checkbox components
-- @tfield Checkbox[] checkboxes
@@ -19,9 +19,9 @@ local component = require("druid.component")
local RadioGroup = component.create("radio_group")
local function on_checkbox_click(self, index)
local function on_checkbox_click(self, index, is_instant)
for i = 1, #self.checkboxes do
self.checkboxes[i]:set_state(i == index, true)
self.checkboxes[i]:set_state(i == index, true, is_instant)
end
self.on_radio_click:trigger(self:get_context(), index)
@@ -29,7 +29,7 @@ end
--- Component init function
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @tparam node[] nodes Array of gui node
-- @tparam function callback Radio callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@@ -51,15 +51,16 @@ end
--- Set radio group state
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @tparam number index Index in radio group
function RadioGroup.set_state(self, index)
on_checkbox_click(self, index)
-- @tparam boolean is_instant If is instant state change
function RadioGroup.set_state(self, index, is_instant)
on_checkbox_click(self, index, is_instant)
end
--- Return radio group state
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @treturn number Index in radio group
function RadioGroup.get_state(self)
local result = -1

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid slider component
-- @module Slider
@@ -6,7 +6,7 @@
-- @alias druid.slider
--- On change value callback(self, value)
-- @tfield druid_event on_change_value
-- @tfield DruidEvent on_change_value @{DruidEvent}
--- Slider pin node
-- @tfield node node
@@ -40,7 +40,7 @@ local helper = require("druid.helper")
local const = require("druid.const")
local component = require("druid.component")
local Slider = component.create("slider", { component.ON_INPUT, component.ON_LAYOUT_CHANGE }, const.PRIORITY_INPUT_HIGH)
local Slider = component.create("slider", const.PRIORITY_INPUT_HIGH)
local function on_change_value(self)
@@ -55,7 +55,7 @@ end
--- Component init function
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam node node Gui pin node
-- @tparam vector3 end_pos The end position of slider
-- @tparam[opt] function callback On slider change callback
@@ -78,7 +78,7 @@ end
function Slider.on_layout_change(self)
self:set(self.value, true)
self:set(self.value)
end
@@ -94,6 +94,17 @@ function Slider.on_input(self, action_id, action)
end
end
if not self.is_drag and self._input_node and gui.pick_node(self._input_node, action.x, action.y) then
if action.pressed and gui.screen_to_local then
self.pos = gui.screen_to_local(self.node, vmath.vector3(action.screen_x, action.screen_y, 0))
self.pos.x = helper.clamp(self.pos.x, self.start_pos.x, self.end_pos.x)
self.pos.y = helper.clamp(self.pos.y, self.start_pos.y, self.end_pos.y)
gui.set_position(self.node, self.pos)
self.is_drag = true
end
end
if self.is_drag and not action.pressed then
-- move
self.pos.x = self.pos.x + action.dx
@@ -148,7 +159,7 @@ end
--- Set value for slider
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam number value Value from 0 to 1
-- @tparam[opt] bool is_silent Don't trigger event if true
function Slider.set(self, value, is_silent)
@@ -163,11 +174,26 @@ end
--- Set slider steps. Pin node will
-- apply closest step position
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam number[] steps Array of steps
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
-- @treturn Slider @{Slider}
function Slider.set_steps(self, steps)
self.steps = steps
return self
end
--- Set input zone for slider.
-- User can touch any place of node, pin instantly will
-- move at this position and node drag will start.
-- This function require the Defold version 1.3.0+
-- @tparam Slider self @{Slider}
-- @tparam Node input_node
-- @treturn Slider @{Slider}
function Slider.set_input_node(self, input_node)
self._input_node = self:get_node(input_node)
return self
end

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle GUI timers.
-- Timer updating by game delta time. If game is not focused -
@@ -8,13 +8,13 @@
-- @alias druid.timer
--- On timer tick. Fire every second callback(self, value)
-- @tfield druid_event on_tick
-- @tfield DruidEvent on_tick @{DruidEvent}
--- On timer change enabled state callback(self, is_enabled)
-- @tfield druid_event on_set_enabled
-- @tfield DruidEvent on_set_enabled @{DruidEvent}
--- On timer end callback
-- @tfield druid_event on_timer_end(self, Timer)
-- @tfield DruidEvent on_timer_end(self, Timer) @{DruidEvent}
--- Trigger node
-- @tfield node node
@@ -35,11 +35,11 @@ local formats = require("druid.helper.formats")
local helper = require("druid.helper")
local component = require("druid.component")
local Timer = component.create("timer", { component.ON_UPDATE })
local Timer = component.create("timer")
--- Component init function
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam node node Gui text node
-- @tparam number seconds_from Start timer value in seconds
-- @tparam[opt=0] number seconds_to End timer value in seconds
@@ -87,8 +87,14 @@ function Timer.update(self, dt)
end
end
function Timer.on_layout_change(self)
self:set_to(self.last_value)
end
--- Set text to text field
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam number set_to Value in seconds
function Timer.set_to(self, set_to)
self.last_value = set_to
@@ -97,7 +103,7 @@ end
--- Called when update
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam bool is_on Timer enable state
function Timer.set_state(self, is_on)
self.is_on = is_on
@@ -107,7 +113,7 @@ end
--- Set time interval
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam number from Start time in seconds
-- @tparam number to Target time in seconds
function Timer.set_interval(self, from, to)

View File

@@ -1,7 +1,8 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Druid helper module for gui layouts
-- @module helper
--- Druid helper module for gui layouts
-- @module Helper
-- @alias druid.helper
local const = require("druid.const")
@@ -76,6 +77,7 @@ function M.centrate_nodes(margin, ...)
node_widths[i] = get_width(node)
width = width + node_widths[i]
end
width = width + margin * (count - 1)
-- Posing all elements
local pos_x = 0
@@ -171,7 +173,6 @@ function M.is_enabled(node)
end
--- Return closest non inverted clipping parent node for node
-- @function helper.get_closest_stencil_node
-- @tparam node node Gui node
@@ -207,7 +208,7 @@ end
--- Check if device is mobile (Android or iOS)
-- @function helper..is_mobile
-- @function helper.is_mobile
function M.is_mobile()
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or
const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
@@ -221,6 +222,27 @@ function M.is_web()
end
--- Transform table to oneline string
-- @tparam table t
-- @treturn string
function M.table_to_string(t)
if not t then
return const.EMPTY_STRING
end
local result = "{"
for key, value in pairs(t) do
if #result > 1 then
result = result .. ","
end
result = result .. key .. ": " .. value
end
return result .. "}"
end
--- Distance from node position to his borders
-- @function helper.get_border
-- @tparam node node The gui node to check

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid inner module to acquire/release input
-- @module helper.input

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid module with utils on string formats
-- @local

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local M = {}

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local const = require("druid.const")
local settings = require("druid.system.settings")
@@ -61,6 +61,7 @@ M["drag"] = {
M["static_grid"] = {
IS_DYNAMIC_NODE_POSES = false, -- Always align by content size with node anchor
IS_ALIGN_LAST_ROW = true, -- Align the last row of grid
}
@@ -87,9 +88,15 @@ M["progress"] = {
M["checkbox"] = {
on_change_state = function(self, node, state)
on_change_state = function(self, node, state, is_instant)
local target = state and 1 or 0
gui.animate(node, "color.w", target, gui.EASING_OUTSINE, 0.1)
if not is_instant then
gui.animate(node, "color.w", target, gui.EASING_OUTSINE, 0.1)
else
local color = gui.get_color(node)
color.w = target
gui.set_color(node, color)
end
end
}

View File

@@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_blue"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_green"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_red"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_yellow"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,181 @@
script: ""
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 50.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 38.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/check_back_square"
id: "back"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 21.0
y: 20.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/checkmark"
id: "checkmark"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 180.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/progress_back"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 20.0
y: 10.0
z: 20.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 3.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 220.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Input"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.75
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -0,0 +1,181 @@
script: ""
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 4.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_back"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 10.0
y: 0.0
z: 10.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 240.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "input_zone"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: -100.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.7
y: 0.7
z: 1.0
w: 1.0
}
size {
x: 36.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_move"
id: "pin"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@@ -1,3 +1,3 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
return {}

View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local M = {}

152
druid/system/druid_instance.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Instance of Druid. Make one instance per gui_script with next code:
--
@@ -61,9 +61,10 @@ local data_list = require("druid.extended.data_list")
local DruidInstance = class("druid.druid_instance")
local IS_NO_AUTO_INPUT = sys.get_config("druid.no_auto_input") == "1"
local function input_init(self)
if sys.get_config("druid.no_auto_input") == "1" then
if IS_NO_AUTO_INPUT then
return
end
@@ -75,7 +76,7 @@ end
local function input_release(self)
if sys.get_config("druid.no_auto_input") == "1" then
if IS_NO_AUTO_INPUT then
return
end
@@ -87,7 +88,7 @@ end
local function sort_input_stack(self)
local input_components = self.components[base_component.ON_INPUT]
local input_components = self.components_interest[base_component.ON_INPUT]
if not input_components then
return
end
@@ -105,18 +106,14 @@ end
-- Create the component itself
local function create(self, instance_class)
local instance = instance_class()
instance:setup_component(self, self._context, self._style)
instance:setup_component(self, self._context, self._style, instance_class)
table.insert(self.components[base_component.ALL], instance)
table.insert(self.components_all, instance)
local register_to = instance:__get_interests()
for i = 1, #register_to do
local interest = register_to[i]
table.insert(self.components[interest], instance)
if base_component.UI_INPUT[interest] then
input_init(self)
end
table.insert(self.components_interest[interest], instance)
end
return instance
@@ -144,7 +141,6 @@ local function check_sort_input_stack(self, components)
end
--- Check whitelists and blacklists for input components
local function can_use_input_component(self, component)
local can_by_whitelist = true
@@ -199,20 +195,23 @@ end
-- @tparam DruidInstance self
-- @tparam table context Druid context. Usually it is self of script
-- @tparam table style Druid style module
-- @local
function DruidInstance.initialize(self, context, style)
self._context = context
self._style = style or settings.default_style
self._deleted = false
self._is_input_processing = false
self._is_late_remove_enabled = false
self._late_remove = {}
self._is_debug = false
self.url = msg.url()
self._input_blacklist = nil
self._input_whitelist = nil
self.components = {}
self.components_interest = {}
self.components_all = {}
for i = 1, #base_component.ALL_INTERESTS do
self.components[base_component.ALL_INTERESTS[i]] = {}
self.components_interest[base_component.ALL_INTERESTS[i]] = {}
end
end
@@ -248,7 +247,7 @@ end
-- on all druid components
-- @tparam DruidInstance self
function DruidInstance.final(self)
local components = self.components[base_component.ALL]
local components = self.components_all
for i = #components, 1, -1 do
if components[i].on_remove then
@@ -259,6 +258,8 @@ function DruidInstance.final(self)
self._deleted = true
input_release(self)
self:log_message("Druid final")
end
@@ -267,7 +268,7 @@ end
-- @tparam DruidInstance self
-- @tparam Component component Component instance
function DruidInstance.remove(self, component)
if self._is_input_processing then
if self._is_late_remove_enabled then
table.insert(self._late_remove, component)
return
end
@@ -283,7 +284,7 @@ function DruidInstance.remove(self, component)
end
component._meta.children = {}
local all_components = self.components[base_component.ALL]
local all_components = self.components_all
for i = #all_components, 1, -1 do
if all_components[i] == component then
if component.on_remove then
@@ -296,13 +297,15 @@ function DruidInstance.remove(self, component)
local interests = component:__get_interests()
for i = 1, #interests do
local interest = interests[i]
local components = self.components[interest]
local components = self.components_interest[interest]
for j = #components, 1, -1 do
if components[j] == component then
table.remove(components, j)
end
end
end
self:log_message("Remove", { name = component:get_name(), parent = component:get_parent_name() })
end
@@ -310,16 +313,25 @@ end
-- @tparam DruidInstance self
-- @tparam number dt Delta time
function DruidInstance.update(self, dt)
local late_init_components = self.components[base_component.ON_LATE_INIT]
local late_init_components = self.components_interest[base_component.ON_LATE_INIT]
while late_init_components[1] do
late_init_components[1]:on_late_init()
table.remove(late_init_components, 1)
end
local components = self.components[base_component.ON_UPDATE]
if not self.input_inited and #self.components_interest[base_component.ON_INPUT] > 0 then
-- Input init on late init step, to be sure it goes after user go acquire input
input_init(self)
end
self._is_late_remove_enabled = true
local components = self.components_interest[base_component.ON_UPDATE]
for i = 1, #components do
components[i]:update(dt)
end
self._is_late_remove_enabled = false
self:_clear_late_remove()
end
@@ -329,21 +341,15 @@ end
-- @tparam table action Action from on_input
-- @treturn bool The boolean value is input was consumed
function DruidInstance.on_input(self, action_id, action)
self._is_input_processing = true
self._is_late_remove_enabled = true
local components = self.components[base_component.ON_INPUT]
local components = self.components_interest[base_component.ON_INPUT]
check_sort_input_stack(self, components)
local is_input_consumed = process_input(self, action_id, action, components)
self._is_input_processing = false
if #self._late_remove > 0 then
for i = 1, #self._late_remove do
self:remove(self._late_remove[i])
end
self._late_remove = {}
end
self._is_late_remove_enabled = false
self:_clear_late_remove()
return is_input_consumed
end
@@ -356,10 +362,10 @@ end
function DruidInstance.on_message(self, message_id, message, sender)
-- TODO: refactor for more juicy code
local specific_ui_message = base_component.SPECIFIC_UI_MESSAGES[message_id]
local on_message_input_message = base_component.SPECIFIC_UI_MESSAGES[base_component.ON_MESSAGE_INPUT]
local on_message_input_message = base_component.ON_MESSAGE_INPUT
if specific_ui_message == on_message_input_message then
local components = self.components[message_id]
local components = self.components_interest[base_component.ON_MESSAGE_INPUT]
if components then
for i = 1, #components do
local component = components[i]
@@ -369,7 +375,7 @@ function DruidInstance.on_message(self, message_id, message, sender)
end
end
elseif specific_ui_message then
local components = self.components[message_id]
local components = self.components_interest[specific_ui_message]
if components then
for i = 1, #components do
local component = components[i]
@@ -377,7 +383,7 @@ function DruidInstance.on_message(self, message_id, message, sender)
end
end
else
local components = self.components[base_component.ON_MESSAGE]
local components = self.components_interest[base_component.ON_MESSAGE]
for i = 1, #components do
components[i]:on_message(message_id, message, sender)
end
@@ -388,46 +394,43 @@ end
--- Druid on focus lost interest function.
-- This one called by on_window_callback by global window listener
-- @tparam DruidInstance self
-- @local
function DruidInstance.on_focus_lost(self)
local components = self.components[base_component.ON_FOCUS_LOST]
local components = self.components_interest[base_component.ON_FOCUS_LOST]
for i = 1, #components do
components[i]:on_focus_lost()
end
self:log_message("On focus lost")
end
--- Druid on focus gained interest function.
-- This one called by on_window_callback by global window listener
-- @tparam DruidInstance self
-- @local
function DruidInstance.on_focus_gained(self)
local components = self.components[base_component.ON_FOCUS_GAINED]
local components = self.components_interest[base_component.ON_FOCUS_GAINED]
for i = 1, #components do
components[i]:on_focus_gained()
end
end
--- Druid on layout change function.
-- Called on update gui layout
-- @tparam DruidInstance self
function DruidInstance.on_layout_change(self)
local components = self.components[base_component.ON_LAYOUT_CHANGE]
for i = 1, #components do
components[i]:on_layout_change()
end
self:log_message("On focus gained")
end
--- Druid on language change.
-- This one called by global gruid.on_language_change, but can be
-- This one called by global druid.on_language_change, but can be
-- call manualy to update all translations
-- @tparam DruidInstance self
-- @function druid.on_language_change
-- @local
function DruidInstance.on_language_change(self)
local components = self.components[base_component.ON_LANGUAGE_CHANGE]
local components = self.components_interest[base_component.ON_LANGUAGE_CHANGE]
for i = 1, #components do
components[i]:on_language_change()
end
self:log_message("On language change")
end
@@ -436,7 +439,6 @@ end
-- component will be not processed on input step
-- @tparam DruidInstance self
-- @tparam[opt=nil] table|Component whitelist_components The array of component to whitelist
-- @function druid.set_whitelist
function DruidInstance.set_whitelist(self, whitelist_components)
if whitelist_components and whitelist_components.isInstanceOf then
whitelist_components = { whitelist_components }
@@ -457,9 +459,8 @@ end
--- Set blacklist components for input processing.
-- If blacklist is not empty and component contains in this list,
-- component will be not processed on input step
-- @tparam DruidInstance self
-- @tparam DruidInstance self @{DruidInstance}
-- @tparam[opt=nil] table|Component blacklist_components The array of component to blacklist
-- @function druid.set_blacklist
function DruidInstance.set_blacklist(self, blacklist_components)
if blacklist_components and blacklist_components.isInstanceOf then
blacklist_components = { blacklist_components }
@@ -477,6 +478,40 @@ function DruidInstance.set_blacklist(self, blacklist_components)
end
--- Set debug mode for current Druid instance. It's enable debug log messages
-- @tparam DruidInstance self @{DruidInstance}
-- @tparam bool is_debug
-- @treturn self @{DruidInstance}
function DruidInstance.set_debug(self, is_debug)
self._is_debug = is_debug
return self
end
--- Log message, if is_debug mode is enabled
-- @tparam DruidInstance self @{DruidInstance}
-- @tparam string message
-- @tparam[opt] table context
function DruidInstance.log_message(self, message, context)
if not self._is_debug then
return
end
print("[Druid]:", message, helper.table_to_string(context))
end
--- Remove all components on late remove step
-- @tparam DruidInstance self @{DruidInstance}
-- @local
function DruidInstance._clear_late_remove(self)
if #self._late_remove > 0 then
for i = 1, #self._late_remove do
self:remove(self._late_remove[i])
end
self._late_remove = {}
end
end
--- Create button basic component
-- @tparam DruidInstance self
-- @tparam node node Gui node
@@ -622,10 +657,11 @@ end
-- @tparam node node Gui node
-- @tparam function callback Checkbox callback
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
-- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false
-- @treturn Checkbox checkbox component
function DruidInstance.new_checkbox(self, node, callback, click_node)
function DruidInstance.new_checkbox(self, node, callback, click_node, initial_state)
-- return helper.extended_component("checkbox")
return DruidInstance.new(self, checkbox, node, callback, click_node)
return DruidInstance.new(self, checkbox, node, callback, click_node, initial_state)
end
@@ -654,9 +690,9 @@ end
--- Create data list basic component
-- @function druid:new_data_list
-- @tparam druid.scroll druid_scroll The Scroll instance for Data List component
-- @tparam druid.grid druid_grid The Grid instance for Data List component
-- @tparam DruidInstance self
-- @tparam Scroll druid_scroll The Scroll instance for Data List component
-- @tparam Grid druid_grid The Grid instance for Data List component
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
-- @treturn DataList data_list component
function DruidInstance.new_data_list(self, druid_scroll, druid_grid, create_function)

4
druid/system/settings.lua Normal file → Executable file
View File

@@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid settings file
-- @module settings
@@ -9,7 +9,7 @@ local M = {}
M.default_style = nil
function M.get_text(name, ...)
function M.get_text(name, a, b, c, d, e, f)
return "[Druid]: locales not inited"
end

Some files were not shown because too many files have changed in this diff Show More