Compare commits

...

514 Commits

Author SHA1 Message Date
Insality
616c513fbd Use tagged releases of dependencies 2025-06-19 20:28:45 +03:00
Insality
61111536a8 Release 1.1.4 2025-05-20 00:51:34 +03:00
Maksim Tuprikov
b5d2f313cc
Merge pull request #312 from polivanni/master
Reset width and leading of the reusable table TEXT_METRICS_OPTIONS by default
2025-05-20 00:50:09 +03:00
Ivan Polovyi
d0067e5496 Reset width and leading of the reusable table TEXT_METRICS_OPTIONS by default 2025-05-18 23:33:40 +03:00
Insality
58f14d0a64 Return hack to keep cloned node_ids consistent 2025-05-13 21:43:05 +03:00
Insality
6572da3b14 Release 1.1.2 2025-05-07 23:54:30 +03:00
Insality
d7c26358a0 Fix for data list element amounts issue 2025-05-07 21:43:48 +03:00
Maksim Tuprikov
f007a28ab7
Merge pull request #310 from rigo128/example_data_list_matrix_basic
Add data_list_matrix_basic example
2025-05-07 18:50:53 +03:00
Yury Grigoryev
d98c3c2ef1 Add data_list_matrix_basic example 2025-05-07 17:07:58 +03:00
Insality
c87f1331ed Release 1.1.1 2025-05-05 21:33:32 +03:00
Maksim Tuprikov
efc38672c9
Merge pull request #309 from astrochili/container-max-size
Added `max_size_x` and `max_size_y` to `container`
2025-05-05 21:31:59 +03:00
Roman Silin
df516a08c6 Added max_size_x and max_size_y to container 2025-05-05 20:48:51 +03:00
Insality
a2b273762d Add on_change_value to input property widget 2025-05-02 13:36:36 +03:00
Insality
2b68117527 Update properties API docs 2025-05-02 12:53:32 +03:00
Insality
336694cd1d Update docs 2025-04-26 12:42:30 +03:00
Insality
4f8be6ebdb Return live example files 2025-04-26 12:19:37 +03:00
Insality
fc9706774f Removed example to change case of filenames 2025-04-26 12:19:10 +03:00
Maksim Tuprikov
423a523903
Merge pull request #300 from Insality/develop
Release 1.1.0
2025-04-26 12:09:37 +03:00
Insality
6d7556b5a0 Update live example 2025-04-26 12:07:28 +03:00
Insality
9fe8763c7f Update changelog MD 2025-04-26 12:00:10 +03:00
Insality
89595b022a Merge branch 'master' into develop 2025-04-26 11:57:18 +03:00
Insality
6d0a853d41 Update 2025-04-26 11:55:57 +03:00
Insality
ec39242fb1 Update docs 2025-04-25 20:53:58 +03:00
Insality
6795934a1f Update docs, add Editor script: Create Druid GUI Script, add simple using widgets example 2025-04-25 20:37:00 +03:00
Maksim Tuprikov
db8cdc1650
Merge pull request #305 from boruok/fix-remove-link 2025-04-25 16:43:53 +03:00
Alexandr Xenofontov
52ffca53e3 fix link 2025-04-25 22:40:35 +09:00
Insality
749666a4a5 Update with container examples 2025-04-25 01:13:04 +03:00
Insality
8155d649ab Fix for drag end touch fro mobule, update contributing, update input examples to make better for mobile (move up) 2025-04-24 23:46:39 +03:00
Insality
4e71fee9ba Add Bind layout and hotkey node bind 2025-04-21 19:53:44 +03:00
Insality
c33dbd5942 Update API pages 2025-04-20 12:15:31 +03:00
Insality
6e1998b822 Update changelog 2025-04-19 22:46:47 +03:00
Insality
225fa0aa8d Try to return discarded GUI properties, oh 2025-04-19 22:30:38 +03:00
Insality
c7b11562d5 Update 2025-04-19 22:25:58 +03:00
Insality
4cb16de782 Merge branch 'master' into develop 2025-04-19 19:49:51 +03:00
Insality
8d35dc0b20 Update 2025-04-19 19:46:25 +03:00
Insality
013d61771f Update docs 2025-04-19 19:36:07 +03:00
Insality
74ddc67469 Update 2025-04-19 19:01:39 +03:00
Insality
50e59d9469 Update editor scripts 2025-04-19 18:03:50 +03:00
Insality
8d2b8c25a0 Update tests 2025-04-18 19:36:52 +03:00
Insality
b7fd33bf3b Missing texture 2025-04-18 02:32:35 +03:00
Insality
ebd604b29b Update tests 2025-04-18 02:31:28 +03:00
Insality
f42211782a Update 2025-04-18 01:24:39 +03:00
Insality
0d0581b108 Update tests 2025-04-17 19:18:40 +03:00
Insality
d1d54896fb Update Docs 2025-04-16 01:01:00 +03:00
Insality
9e2a14c6dd Update docs 2025-04-15 21:49:22 +03:00
Insality
e2c9a7d9d6 Update README 2025-04-10 01:07:12 +03:00
Maksim Tuprikov
afdcbe1dd4
Merge pull request #304 from Insality/fix_input
Fix input issues
2025-04-07 22:02:47 +03:00
Insality
326ce8bbbb Prepare v1.0.1 2025-04-07 22:01:47 +03:00
Insality
be1a3d3788 Fix input issues 2025-04-07 21:59:50 +03:00
Insality
34be76777b Update 2025-04-05 15:00:41 +03:00
Insality
0504496975 Set code links to master until release 2025-03-30 20:21:06 +03:00
Insality
ed7ab908ac Update color 2025-03-30 20:09:39 +03:00
Maksim Tuprikov
6c6e2c64ee
Merge pull request #303 from Insality/update_docs
Docs, widgets and code refactor
2025-03-30 16:16:42 +03:00
Insality
f6acbe291f Fix 2025-03-30 16:16:31 +03:00
Maksim Tuprikov
2f70905c59
Merge branch 'develop' into update_docs 2025-03-30 16:16:10 +03:00
Insality
67aba26544 Update 2025-03-30 16:02:54 +03:00
Insality
b5f2ae253d Update docs 2025-03-30 14:57:54 +03:00
Insality
ec194e8441 Add luacov 2025-03-30 14:33:45 +03:00
Insality
90c3f81373 Update 2025-03-30 14:30:47 +03:00
Insality
026ec03803 Update tests 2025-03-30 14:19:59 +03:00
Insality
fed6fec193 Okay zulu is required? 2025-03-30 13:46:08 +03:00
Insality
4138061975 Update 2025-03-30 13:44:36 +03:00
Insality
316b182106 Update 2025-03-30 13:43:25 +03:00
Insality
50079e0838 Update 2025-03-30 13:33:52 +03:00
Insality
e4a8a85c39 Next/Prev example by arrows 2025-03-30 13:16:03 +03:00
Insality
c4694b421b Update 2025-03-30 13:01:54 +03:00
Insality
d182bcef7c Fix code url in widgets examples 2025-03-29 20:07:52 +02:00
Insality
f2b930ba68 Other updated 2025-03-29 20:06:08 +02:00
Insality
45493bc9dd Basic examples done 2025-03-29 20:00:55 +02:00
Insality
e1339a2ca8 Start update examples to move control things to example itself 2025-03-29 19:53:11 +02:00
Insality
d6fb8cad09 Tiling node to component, add way to move examples properties code to example itself 2025-03-29 19:29:08 +02:00
Insality
3f22e9c542 Update 2025-03-29 14:03:03 +02:00
Insality
b053b5044b Update examples 2025-03-27 00:30:37 +02:00
Insality
7640e207a4 Update examples to widgets instead components 2025-03-27 00:19:32 +02:00
Insality
dee77ab313 Remove uncompleted stuff 2025-03-26 23:30:29 +02:00
Insality
91f2d593d2 Update 2025-03-26 22:59:27 +02:00
Insality
65234ec8d2 Update 2025-03-26 22:57:34 +02:00
Insality
e83e5a6c84 Update 2025-03-25 22:56:47 +02:00
Insality
fb9c80b284 Update 2025-03-20 09:59:45 +02:00
Insality
330dabda09 Update 2025-03-20 09:46:13 +02:00
Insality
10556ba31a Remove html api, update docs 2025-03-20 00:26:29 +02:00
Insality
f786b20951 Update docs 2025-03-18 22:58:13 +02:00
Insality
44b735adda Reimport docs 2025-03-18 22:00:51 +02:00
Insality
3c063313de Update private annotations 2025-03-18 21:41:09 +02:00
Insality
19ea7fcff9 Add private annotation 2025-03-18 21:32:11 +02:00
Insality
1bc916e187 Update docs 2025-03-18 21:23:30 +02:00
Insality
5348561d68 widget.* to druid.widget lls class 2025-03-16 17:44:08 +02:00
Insality
ad0447b649 Update 2025-03-16 02:24:47 +02:00
Insality
a2bb93a03b Update 2025-03-14 23:35:24 +02:00
Insality
b30cf9109e Test new markdown api generator 2025-03-14 20:29:05 +02:00
Insality
11aeb377c2 Update 2025-03-14 01:06:20 +02:00
Insality
1aa96d8dbc Update 2025-03-13 23:39:43 +02:00
Insality
c13a31711f Update 2025-03-10 22:40:12 +02:00
Insality
6c5210a0fa Update 2025-03-07 23:17:04 +02:00
Insality
69cf28e408 Update 2025-03-07 21:30:55 +02:00
Insality
f36986ed1f Update deployer sha 2025-03-07 21:15:18 +02:00
Insality
be03a5bd50 LLS refactor 2025-03-07 21:09:01 +02:00
Insality
3bb8705444 Update 2025-03-06 01:50:31 +02:00
Insality
ea4ff7eafc Update 2025-03-06 01:13:04 +02:00
Insality
1a138f7020 Update 2025-03-06 00:27:51 +02:00
Insality
9bb7c6e8bd Update 2025-03-05 22:17:06 +02:00
Insality
72692f5efc Update 2025-03-05 22:10:37 +02:00
Insality
46223f0bb8 Update 2025-03-05 22:06:06 +02:00
Insality
d6bec60ba9 Update 2025-03-05 21:52:18 +02:00
Insality
c3b132187a Update 2025-03-05 21:42:54 +02:00
Insality
2c2789f1f9 Update 2025-03-05 21:28:56 +02:00
Insality
94d1d64dc3 Update button docs 2025-03-05 21:19:03 +02:00
Insality
ef86b387c2 Rename type druid.base_component -> druid.component 2025-03-05 21:02:46 +02:00
Insality
3a559d7ac2 Rename type druid_instance to druid.instance 2025-03-01 15:54:14 +02:00
Insality
dd5f619345 Move bindings to druid, update widgets 2025-02-18 21:12:56 +02:00
Insality
5eaa50552a Update 2025-02-09 22:28:58 +02:00
Maksim Tuprikov
86fbe83265
Merge pull request #298 from itmurker/master
Fix Y position calculation for layouts with nodes of different height for 'horizontal_wrap' mode
2025-02-09 20:59:00 +02:00
Alexey Shnigir
6aacb28a73 Fix Y position calculation for layouts with nodes of different height 2025-02-09 17:58:26 +03:00
Insality
8407932236 Update docs, add stub for quick api reference 2025-02-09 15:12:25 +02:00
Maksim Tuprikov
197118c229
Merge pull request #292 from Insality/shaders
All changes to Develop
2025-02-09 14:43:19 +02:00
Insality
d06ebd53f9 Update 2025-02-09 14:42:25 +02:00
Insality
16d20da5ab Update 2025-02-08 00:31:35 +02:00
Insality
7a6f529c82 Update 2025-02-08 00:28:20 +02:00
Insality
96ce3eee95 Update 2025-02-08 00:11:29 +02:00
Insality
b6c0e1556a Update the panel druid profiler, remove events counter 2025-01-30 19:30:56 +02:00
Insality
0514625f9a Progress with widget examples 2025-01-30 01:44:03 +02:00
Insality
c51a00ad80 Revert "Remove HTML API from this branch"
This reverts commit 0972c53c700caf32354463a0734798891aa20635.
2025-01-29 23:35:46 +02:00
Insality
da5c6b9a54 Fix for examples 2025-01-29 23:13:09 +02:00
Insality
db0c4c8ee5 Fix components inner table typo 2025-01-11 15:32:36 +01:00
Insality
ae33b08a6b Decrease default drag dead zone to 4 pixels 2024-12-24 01:23:20 +02:00
Insality
6b8bbe1970 Refactor text setting methods and remove ldoc files 2024-12-08 13:35:41 +02:00
Insality
9a1cd795b8 Test shaders 2024-12-03 20:42:33 +02:00
Insality
917a84fc94 Update 2024-11-30 22:52:27 +02:00
Insality
e59a2b0bcb Update 2024-11-30 15:04:05 +02:00
Insality
cb36625836 Add vector3 property 2024-11-29 00:49:56 +02:00
Insality
434dce55ce Update 2024-11-27 23:34:50 +02:00
Insality
06f682e8e4 Update 2024-11-23 12:39:55 +02:00
Insality
28bd165cee Update 2024-11-22 02:22:21 +02:00
Insality
af44d0d26e Update components interests link 2024-11-21 22:38:40 +02:00
Insality
5a1668a8af Update 2024-11-21 22:00:05 +02:00
Insality
69ebb252e1 Remove no_auto_template and no_stencil_check settings 2024-11-21 00:53:06 +02:00
Insality
9c03c950ad Remove on_message_input functional 2024-11-21 00:51:35 +02:00
Insality
bc0ada7098 Remove register and update examples 2024-11-21 00:28:53 +02:00
Insality
4ef65579a6 Update 2024-11-21 00:18:43 +02:00
Insality
c0abfd350e Update examples 2024-11-21 00:01:16 +02:00
Insality
c00fb3590c Replace event with event library 2024-11-20 23:52:48 +02:00
Insality
6552ea5cac Update example assets 2024-11-20 23:43:39 +02:00
Insality
7ea8691fc5 Update 2024-11-20 23:36:04 +02:00
Insality
f2fa5320d2 Update 2024-11-20 02:44:45 +02:00
Insality
606f400719 Update widgets 2024-11-20 01:55:58 +02:00
Insality
37d7168bd6 More widgets, additional adjusts for text 2024-11-20 01:42:12 +02:00
Insality
c35dfc7066 More widgets stuff, cleaning code 2024-11-19 23:06:57 +02:00
Insality
37190684c4 Add more widgets 2024-11-19 00:48:15 +02:00
Insality
6cb2c9ca9a Widgets WIP 2024-11-18 23:28:34 +02:00
Insality
dc8f3b99bb Widgets WIP 2024-11-18 23:06:04 +02:00
Insality
299f8501e8 Widgets WIP 2024-11-18 22:50:42 +02:00
Insality
99f75dd626 Update widgets 2024-11-18 22:03:04 +02:00
Insality
3fca582197 All components now included 2024-11-18 21:51:26 +02:00
Insality
f3fad8bd92 Add test widget stubs 2024-11-18 21:48:08 +02:00
Insality
56ef92a1b5 Update annotations 2024-11-10 20:34:30 +01:00
Insality
b5ccd80215 Replace treturn 2024-11-07 18:35:06 +01:00
Insality
620facbe1f replace all tparam 2024-11-07 18:34:27 +01:00
Insality
999c6222a0 Update annotations 2024-11-07 18:32:46 +01:00
Insality
60ef641276 Update 2024-11-02 17:16:09 +01:00
Insality
0972c53c70 Remove HTML API from this branch 2024-10-30 23:46:55 +02:00
Insality
6ccf58d527 Update docs 2024-10-30 23:46:39 +02:00
Insality
72cf310d6c Update 2024-10-30 23:37:43 +02:00
Insality
00b8b192a7 Add test "new_widget" 2024-10-30 01:29:46 +02:00
Insality
91bdcb6678 Update 2024-10-30 00:34:43 +02:00
Insality
c85d66fdca Update annotations P.1 2024-10-29 20:31:45 +02:00
Insality
a46f38734e Fix for editor script luacheck 2024-10-24 09:59:40 +03:00
Insality
62384f36b3 Add generics annotations to component set_style/nodes/template 2024-10-23 00:43:03 +03:00
Insality
aff4412677 Fix example is_selected 2024-10-22 22:28:19 +03:00
Insality
7aa24dba2e Update changelog 2024-10-19 12:36:11 +03:00
Insality
eb83a69dc5 Update changelog 2024-10-19 12:00:23 +03:00
Maksim Tuprikov
d2b617a14f
Merge pull request #283 from Insality/develop
Release 1.0
2024-10-19 11:56:13 +03:00
Insality
2e6168d518 Update characters in default font 2024-10-19 11:29:42 +03:00
Insality
be1f470dbe Update annotations 2024-10-19 11:25:30 +03:00
Insality
86189d6e3e Update docs, annotations 2024-10-19 11:22:24 +03:00
Insality
13fb109ef0 Use gifs instead of mp4 2024-10-19 11:11:21 +03:00
Insality
45c81aa9a0 Add new preview videos 2024-10-19 11:01:07 +03:00
Insality
ebd7f94354 Add new examples 2024-10-19 10:59:13 +03:00
Insality
8d409b8062 Update docs 2024-10-19 10:58:51 +03:00
Insality
0a5bb248d7 Remove checkbox, checkbox group, radio group and old default templates 2024-10-19 10:58:46 +03:00
Insality
d73835a2d5 Update Druid components 2024-10-19 10:58:24 +03:00
Insality
ad339508cf Update example app 2024-10-19 10:57:55 +03:00
Insality
c787ed860e Update example build 2024-10-17 02:13:32 +03:00
Insality
2ea635fc56 Update example build 2024-10-17 02:09:19 +03:00
Maksim Tuprikov
4d29363678
Merge pull request #282 from Insality/example_rework
Example rework
2024-10-17 02:03:35 +03:00
Insality
dd41aab962 Update docs and example page 2024-10-17 02:02:07 +03:00
Insality
3579370287 Update 2024-10-17 01:48:30 +03:00
Insality
91879509a0 Update example with new brand one 2024-10-17 01:24:15 +03:00
Insality
2c762716bb Remove current Druid example 2024-10-17 01:10:21 +03:00
Maksim Tuprikov
032eb4aac5
Merge pull request #275 from Insality/update
Prepare for release 12
2024-10-17 01:07:21 +03:00
Insality
40bda1b0eb Fix deleted knob 2024-10-16 21:30:32 +03:00
Insality
3ccfe2c306 Remove pin knob component 2024-10-16 21:15:16 +03:00
Insality
c0c1870ac5 Solve #239 Remove button style 2024-10-16 20:58:55 +03:00
Insality
aa6310db91 Update 2024-10-16 20:30:55 +03:00
Insality
6e4490a3a7 Fix test.ini 2024-10-15 21:38:40 +03:00
Insality
e8dbc097d0 Update 2024-10-15 21:35:51 +03:00
Insality
ea80c874f6 Update annotations 2024-10-15 19:43:36 +03:00
Insality
5848921cba Update docs, config generations, fix linter 2024-10-15 19:34:07 +03:00
Insality
2f5336fa4f Remove annotations 2024-10-15 02:49:56 +03:00
Insality
a5e579ddaa Update button hold callback 2024-10-15 02:48:41 +03:00
Insality
067b650838 Get rid of middleclass 2024-10-15 01:59:25 +03:00
Insality
54345b924b Update timer & text 2024-10-15 01:30:28 +03:00
Insality
a0113d3356 Update druid component template 2024-10-15 00:56:19 +03:00
Insality
87f52551e2 Update rich text 2024-10-15 00:56:06 +03:00
Insality
66f4a1c8d5 WIP 2024-10-14 23:03:45 +03:00
Insality
a4fa0f0348 WIP 2024-10-14 22:24:57 +03:00
Insality
5d5fe7f374 Rich text based only on text node 2024-10-14 22:13:57 +03:00
Insality
59d3b116ac Add figma layout for druid 1.6.3 2024-10-14 11:33:05 +03:00
Insality
d11aeb6b18 Update 2024-10-14 11:32:53 +03:00
Insality
3c9f539376 Update annotations 2024-10-05 02:27:30 +03:00
Insality
4a8bb214d2 Update 2024-10-05 02:07:53 +03:00
Insality
d39f4715f3 Update annotations, fix rare errors 2024-10-05 01:40:46 +03:00
Insality
b9b74736a7 Merge remote-tracking branch 'origin/update' into update 2024-09-12 21:03:42 +03:00
Insality
ab90927d32 Update Druid logos 2024-09-12 21:03:31 +03:00
Insality
b2a88146e5 Update input and rich input 2024-09-12 20:59:50 +03:00
Insality
d533e5ee2d Fix scroll events while animating
Fix slider issue with negative distance
Add bunch of new functions to grid
More accurate progress bar scaling with 9-slice images
2024-09-10 21:46:29 +03:00
Insality
986a4695f6 Update Rich Input with selection/arrows control. Add template and nodes to self:get_druid 2024-09-07 17:15:40 +03:00
Insality
f93d0c7d40 Add hover on_mouse_hover callback in constructor
Add ON_HOVER_CURSOR and ON_MOUSE_HOVER_CURSOR in hover component in styles
2024-09-04 01:58:20 +03:00
Insality
4a095a2a24 Update README
Button key trigger will not consume input
Update scroll position while animate
Add scroll:set_view_size
Better static grid get_index function
Rework Data List (only static grid)
Update Default style
Remove a component from parent if exists on druid:remove
2024-09-03 21:48:43 +03:00
Insality
0aeb0b3fea Update event to remove middleclass, using defold-event as a base 2024-08-29 09:51:09 +03:00
Insality
ba1ab07e0d Update new component template, replace component name with M as module name 2024-08-29 09:28:54 +03:00
Insality
7e16dacbc2 Update helper to use gui.get to reduce memory footprint 2024-08-29 09:27:34 +03:00
Insality
cece44f2d1 Fix #264 Use pip or pip3 instead only pip3 2024-08-27 18:13:15 +03:00
Insality
678f542bdb Fix #273 Update appmanifest 2024-08-27 17:55:36 +03:00
Maksim Tuprikov
341d1721d1
Merge pull request #274 from mozok/develop
Fixes for annotations
2024-08-27 17:52:48 +03:00
Maksim Tuprikov
5e2a3bdb4b
Merge branch 'update' into develop 2024-08-27 17:52:36 +03:00
Insality
45718325a1 Update luacheck 2024-08-27 17:48:46 +03:00
Insality
11ae63a9f6 Update annotations 2024-08-27 17:45:09 +03:00
Insality
5f2ae1eb0d Add Defold annotations 2024-08-27 17:18:55 +03:00
Insality
7f90ae99e6 Update docs 2024-08-27 17:16:33 +03:00
Maksim Tuprikov
731e5f6627
Merge pull request #271 from JustAPotota/patch-1
Fix password input events returning masked text
2024-08-27 17:12:58 +03:00
Insality
217b90163a Merge branch 'master' into develop 2024-08-27 17:08:25 +03:00
Mozok Evgen
15a2450437 Fix LangText annotations 2024-08-24 21:35:48 +03:00
Mozok Evgen
f54347ef6c Fix Slider annotations 2024-08-24 21:27:59 +03:00
Mozok Evgen
2cef65ed40 Fix scroll annotations 2024-08-24 21:22:34 +03:00
Mozok Evgen
32aa760386 Fix "any" type annotation to lowercase 2024-08-24 21:15:55 +03:00
Mozok Evgen
c4a4221841 Fix Grid methods annotations 2024-08-24 21:12:26 +03:00
Mozok Evgen
8a3cff17ab Fix "node" type annotation to lowercase 2024-08-24 20:59:55 +03:00
Mozok Evgen
63c2e8ea93 Fix new_ annotations 2024-08-24 20:53:28 +03:00
Maksim Tuprikov
d7e1174162
Merge pull request #272 from boruok/fix-style-links
fix style docs
2024-07-16 10:28:46 +03:00
boruok
93cbb99cdf fix style docs 2024-07-16 12:10:57 +09:00
JustAPotota
80f60c6e74
Fix password input events returning masked text 2024-07-06 21:42:03 -05:00
Maksim Tuprikov
152ff189ff
Merge pull request #269 from boruok/fix-codelinks
Fix wrong code links
2024-07-01 10:01:52 +03:00
boruok
04b7323be2 fixed wrong codelinks 2024-07-01 10:57:36 +09:00
Maksim Tuprikov
1b42824912
Merge pull request #267 from astrochili/annotations-fix-3
Fix sender type for `druid_instance.on_message()`
2024-06-13 10:16:05 +01:00
Roman Silin
3bf50660b3 Fixed sender type for druid_instance.on_message() 2024-06-13 12:15:05 +03:00
Maksim Tuprikov
e2108a5f1e
Merge pull request #263 from ivolff/master
fix for DynamicGrid.get_all_pos
2024-04-23 17:49:03 +03:00
ivolff
8741e6cb74
get_all_pos fix 2024-04-23 18:25:03 +04:00
Maksim Tuprikov
0e9445b1a8
Merge pull request #260 from Fossean1/patch-2 2024-03-25 09:32:31 +02:00
Fossean1
9c37582f2b
Fix init function in 03-styles.md 2024-03-25 10:59:15 +05:00
Insality
07101355c8 Merge remote-tracking branch 'origin/develop' into develop 2024-03-21 17:47:46 +02:00
Insality
13919fdb04 Update README 2024-03-21 17:47:33 +02:00
Maksim Tuprikov
2dcbb6ad92
Merge pull request #259 from marnason/master
Fixed lang_text URL in example.gui_script
2024-02-28 20:54:28 +02:00
marnason
f47631cae9
Fixed lang_text URL in example.gui_script 2024-02-27 12:13:05 +00:00
Maksim Tuprikov
9b69b65add
Merge pull request #252 from astrochili/drag_screen_x_y
Added the screen position to the Drag component
2023-12-12 19:40:17 +02:00
Roman Silin
aa7e62e3f1 Added screen_x and screen_y to the Drag component 2023-12-12 18:43:18 +02:00
Insality
bdd9efb892 Update annotations 2023-12-05 14:55:58 +02:00
Insality
01d1445511 Update annotations, add set_repeat to hotkey component 2023-12-05 14:49:56 +02:00
Insality
97ff6154eb Update wrong links in documentation 2023-12-05 14:28:04 +02:00
Insality
2c083f6a71 Update wrong links in documentation 2023-12-05 14:27:53 +02:00
Maksim Tuprikov
5d4039da4f
Merge pull request #247 from Insality/update_annotations
Update Druid annotations
2023-10-20 11:26:19 +03:00
Insality
85e6d41f56 Update HTML5 example 2023-10-20 11:25:06 +03:00
Insality
9132dc477b Update java version for CI 2023-10-20 11:21:30 +03:00
Insality
00a7852225 Update example to 1.6.0 Defold version 2023-10-20 11:19:15 +03:00
Insality
d1d20d73ff Fix wrong link to lang_text example 2023-10-20 11:14:58 +03:00
Insality
88154b2269 Fix scrolls.gui stencil nodes 2023-10-20 11:03:30 +03:00
Insality
4a16a8bc07 Annotations update [5] 2023-10-18 10:40:08 +03:00
Insality
24bb39481d Annotations update [4] 2023-10-17 23:18:25 +03:00
Insality
c99b97f392 Annotations update [3] 2023-10-17 22:32:22 +03:00
Insality
50c9b6bad5 Annotations update [2] 2023-10-17 22:00:43 +03:00
Insality
86b92f90a7 Annotations update 2023-10-17 21:09:45 +03:00
Insality
7fc76ed8c0 Fix #245 Lang Text on_change trigger on language change 2023-09-06 14:48:46 +02:00
Insality
5ed9bdd814 Return width from helper.centrate_nodes 2023-09-02 21:25:58 +03:00
Insality
ca8c4e2425 Rich Text add on layout change 2023-08-27 13:40:49 +03:00
Insality
73ed0c8cd0 Fix #242 Text component metrics zero width issue 2023-08-25 11:07:33 +03:00
Insality
2d8d3cffbb Late scripts require in tests 2023-08-06 14:17:12 +03:00
Insality
3219b280e7 Test with late require 2023-08-06 14:12:57 +03:00
Insality
65fe2521f4 Another way to require druid in test scripts 2023-08-06 14:07:45 +03:00
Insality
b7e16e4321 Test init luacover earlier 2023-08-06 14:02:31 +03:00
Insality
d1195a47a2 Add require test file directly in deftest.add 2023-08-06 10:59:50 +03:00
Insality
300fbf1309 Update docs 2023-08-05 20:10:32 +03:00
Insality
69b3383dc4 Remove all docs 2023-08-05 20:10:11 +03:00
Maksim Tuprikov
03ffd943df
Merge pull request #233 from Insality/develop
Merge Druid 0.11 to Master
2023-08-05 19:44:01 +03:00
Insality
646cf5a4b4 Update example 2023-08-05 19:43:09 +03:00
Insality
d7dd4a86b8 Update docs 2023-08-05 19:32:47 +03:00
Insality
37fff52aa5 Fix HTML5 button 2023-08-05 19:27:51 +03:00
Insality
628723386e Update Rich text style params 2023-08-05 19:01:06 +03:00
Insality
5a0cf42e3d Update README, move emmylua section to Advanced Setup manual 2023-07-16 12:28:46 +03:00
Insality
556e1a9bae Small optimization && refactoring 2023-07-15 15:56:06 +03:00
Insality
337090e74c Update docs, little optimizations, inline style anims 2023-07-15 12:35:05 +03:00
Insality
38c117b9d8 Inline helper.is_enabled, remove unused code, documentation fixes, remove formats and druid_input files, add more tests 2023-07-15 11:53:07 +03:00
Insality
c01ee189b4 Prepare for release 0.11 2023-07-13 22:42:23 +03:00
Insality
ea18562270 Update docs 2023-07-13 22:00:52 +03:00
Insality
f910db985c Update README 2023-07-13 21:52:41 +03:00
Maksim Tuprikov
706b5d094a
Merge pull request #232 from Insality/rich_text
Rich text
2023-07-13 21:40:51 +03:00
Insality
32d184ca81 Update Docs & Example 2023-07-13 21:39:02 +03:00
Maksim Tuprikov
1cbe573763
Merge pull request #231 from Insality/docs
Update documentation
2023-07-13 21:35:20 +03:00
Insality
5ecd67d8ef Update docs 2023-07-13 21:32:04 +03:00
Insality
23ac068f51 Update docs 2023-07-11 22:23:48 +03:00
Insality
6ed48772a3 Update docs 2023-07-11 21:46:56 +03:00
Insality
bdacd4a440 Update docs 2023-07-11 21:29:12 +03:00
Insality
894b62b888 Update docs 2023-07-09 22:56:44 +03:00
Insality
eca76b12d1 Update docs 2023-07-09 21:47:14 +03:00
Insality
15cf72df27 Update docs 2023-07-09 11:11:30 +03:00
Insality
4896f38e09 Update readme and docs 2023-07-08 09:59:35 +03:00
Maksim Tuprikov
862b61281d
Merge pull request #230 from Insality/docs
Docs update
2023-07-05 23:20:58 +03:00
Insality
487851302b Update Bob version to 1.4.7 2023-07-05 23:20:17 +03:00
Insality
d0062c2a78 Update changelog 2023-07-05 23:14:27 +03:00
Insality
fb5508b083 Update docs 2023-06-10 19:18:12 +03:00
Insality
7bf479e6c0 Update Helper docs 2023-06-08 00:06:05 +03:00
Insality
65974e0b30 Update docs 2023-06-07 23:30:37 +03:00
Insality
b22808f585 Remove debug log messages, update docs 2023-06-07 01:41:47 +03:00
Insality
e14f68bc90 Move swipe to extended, update docs 2023-06-07 00:41:05 +03:00
Insality
99fc4ccc31 Start update docs 2023-06-06 23:01:46 +03:00
Insality
76ab3811fa Update rich text texts example 2023-05-31 23:51:57 +03:00
Insality
b628212c58 Update examples 2023-05-31 21:54:55 +03:00
Insality
a01eae3d89 Solve #156 Input field now show keyboard in html5 mobile 2023-05-03 01:13:16 +03:00
Insality
7b40af9a33 Solve #219 Add utf8 native library support 2023-05-03 01:05:31 +03:00
Insality
7aa2da11f6 Update docs, wrong links 2023-05-03 00:51:56 +03:00
Insality
807168d850 Solve #227 Update current URL to match with current example 2023-05-02 21:30:11 +03:00
Insality
c815b6b240 Update rich text examples 2023-05-02 21:08:37 +03:00
Insality
a1d138522e Update rich text example 2023-02-08 21:54:32 +02:00
Insality
5e92cf5ffc Rich Text example progress 2023-02-08 21:01:37 +02:00
Insality
547b10d097 Update rich text for last version 2023-02-07 19:37:05 +02:00
Insality
6ea5ed0b97 Merge branch 'develop' into rich_text 2023-02-07 19:09:38 +02:00
Maksim Tuprikov
2733c88655
Merge pull request #222 from Insality/tests
Initial tests for Druid GUI
2023-02-07 19:05:48 +02:00
Insality
96d1b8c068 Typo fix 2023-02-07 19:04:39 +02:00
Insality
cfaeff1516 Fix tests 2023-02-07 18:58:24 +02:00
Insality
bd9b4ad58f Merge branch 'develop' into tests 2023-02-07 18:45:35 +02:00
Insality
2196cc3e17 Add text_metrics args on change text scale text event 2022-12-03 17:53:57 +02:00
Insality
0368260d16 Schedule late_init if component have on_input 2022-12-03 17:43:08 +02:00
Insality
6d75d61fd5 Add lang text example 2022-12-03 16:59:04 +02:00
Insality
5accec45c3 Solve #216 Button also can be pressed via multitouch action_id (not still simultaneously but can capture the event) 2022-12-03 16:41:28 +02:00
Insality
a983d5e72a Solve #126 Update input bindings according to Defold defaults 2022-12-03 16:40:15 +02:00
Insality
8fb41ea8e9 Solve #214 Fix hover on_input return value. Add hover example. Add hover_instance to hover callback 2022-12-03 16:26:28 +02:00
Insality
d93823ae6a Solve #215 Better late init interest support 2022-12-03 16:16:55 +02:00
Insality
4f7dbf49d3 Progress #210 Add set_max_gui_upscale for layout component 2022-12-03 16:15:48 +02:00
Insality
dad54d8de3 Update #199 rename IS_CONSUME_INPUT_WHILE_SELECTED to NO_CONSUME_INPUT_WHILE_SELECTED. Change default value 2022-12-01 21:05:14 +02:00
Insality
7f5be3ffb0 Solve #217 Fix error font argument, remove deprecated gui.get_text_metrics 2022-12-01 21:02:31 +02:00
Insality
5d3625e2a8 Solve #199 Add input consume flag while input is selected. With false value it's allow to interact with other input components while input is selected (current input will be unselected if this case) 2022-11-12 12:50:19 +02:00
Insality
ec15ac053a Merge remote-tracking branch 'origin/develop' into develop 2022-11-09 20:21:42 +02:00
Insality
337a43ae08 Solve #213 remove late init for progress bar 2022-11-09 20:21:06 +02:00
Insality
fadd0c4c4b Fix progress late init 2022-11-09 17:40:45 +02:00
Insality
66abd3bd31 Update rich text with Druid component and content adjust into root size 2022-11-04 20:09:46 +02:00
Insality
fae7e4afa4 Initial commit with rich text 2022-11-04 20:09:13 +02:00
Maksim Tuprikov
5480f175bf
Merge pull request #211 from dmi7ry/patch-1
Fixed wrong link to Text API
2022-11-03 08:53:27 +01:00
Maksim Tuprikov
c766dc7ba4
Merge pull request #212 from dmi7ry/patch-2
misprint in new_text() documentation (Tet → Text)
2022-11-03 08:53:13 +01:00
Dmitry
13f0922ccc
misprint (Tet → Text) 2022-11-02 00:43:19 +07:00
Dmitry
dac1218809
Fixed wrong link to Text API 2022-11-02 00:18:59 +07:00
Insality
9b53314fa7 Fix drag node scene koefs 2022-10-20 21:44:04 +03:00
Insality
999789c1c8 Move FUNDING.yml file 2022-10-16 12:59:27 +03:00
Insality
253ea36817 Add FUNDING.yml 2022-10-16 12:58:38 +03:00
Insality
b5b07cb8d9 Update README 2022-10-16 12:51:13 +03:00
Insality
4de50591f8 Update drag/slider scene node koefs, add layout max gui upscale 2022-10-15 16:11:12 +03:00
Insality
9cd1769c37 Fix extended components in example 2022-10-09 17:20:40 +03:00
Insality
92d9e2e5e4 Remove unexists preview 2022-10-09 17:10:04 +03:00
Insality
4c130a68bb Move all extended component out of default bundle 2022-10-09 17:02:54 +03:00
Insality
561fdc7b38 Update README 2022-10-09 16:58:35 +03:00
Insality
674eefd70b Update README 2022-10-09 16:57:57 +03:00
Insality
441c6e3dc4 Update README 2022-10-09 16:55:32 +03:00
Insality
edde50ccb6 Update preview gifs 2022-10-09 16:53:55 +03:00
Insality
9d75af2eb9 Replace gui.get_text_metrics with resource.get_text_metrics 2022-10-09 16:40:23 +03:00
Insality
09ecc45921 Add preview for Druid components, change the README component section 2022-10-09 14:38:29 +03:00
Insality
9e92cf295b Add tests for drag component 2022-10-08 19:11:57 +03:00
Insality
51dc34613b Add tests for hover component 2022-10-08 16:11:45 +03:00
Insality
a87f775ac7 Merge branch 'master' into tests 2022-10-08 15:43:11 +03:00
Maksim Tuprikov
bbd41659f9
Merge pull request #208 from Insality/develop
Solve #207 fix scroll + data_list issue
2022-10-02 14:15:44 +03:00
Insality
2e9353afeb Solve #207 fix scroll + data_list issue 2022-10-02 14:15:17 +03:00
Insality
d92be1cfa7 Update button tests 2022-09-11 14:19:07 +03:00
Insality
79a711fa01 Add button basic tests 2022-09-11 13:10:05 +03:00
Insality
a6de0128bd Add initial Druid tests 2022-09-11 12:16:20 +03:00
Maksim Tuprikov
ad9ed801aa
Merge pull request #205 from Insality/develop
Merge release 0.10.0 to develop
2022-09-09 21:02:13 +03:00
Insality
cb5df2b5bc Update docs, html example 2022-09-09 21:01:33 +03:00
Insality
072507cc9e Fix progress bar example 2022-09-09 20:46:26 +03:00
Insality
32e5fdb669 Update progress bar component, add progress bar example 2022-09-09 20:45:27 +03:00
Insality
ba383261b0 Update layout component, add layout fit example 2022-09-09 20:45:08 +03:00
Insality
25a17773e7 Solve #198 move input init and late init to Druid instance init function 2022-09-06 22:09:32 +03:00
Insality
e683eed90f Solve #202 set check stencil node enabled by default 2022-09-06 21:35:43 +03:00
Insality
2c92a792f7 Fix the HTML logo stretch 2022-08-29 22:18:20 +03:00
Insality
a3f109123e Update the changelog for 0.10.0 2022-08-29 21:58:29 +03:00
Insality
2f844a31c4 Update the Druid logo 2022-08-29 21:50:58 +03:00
Insality
9e2648e998 Merge branch 'master' into develop 2022-08-29 21:50:46 +03:00
Insality
8cd954e2dc Update HTML example 2022-08-29 21:47:59 +03:00
Insality
65f5d2db01 Solve #204 fix code url from direct example url open 2022-08-29 21:47:11 +03:00
Insality
13003e4721 Merge branch 'data_list_control' 2022-08-29 21:31:25 +03:00
Maksim Tuprikov
f471013e90
Merge pull request #203 from Insality/data_list_control
Solve #200 #201 Add DataList access functions, example with custom co…
2022-08-29 21:30:49 +03:00
Insality
55cc1c713e Update docs and HTML example project 2022-08-29 21:29:57 +03:00
Insality
b2643ebd26 Solve #200 #201 Add DataList access functions, example with custom component + DataList 2022-08-29 21:27:37 +03:00
Insality
0c47828d96 Add changelog for 0.10.0 2022-07-17 19:38:19 +03:00
Insality
2f964c6ed3 Update docs 2022-07-17 19:22:36 +03:00
Insality
847bee2e6b Update docs 2022-07-17 19:19:25 +03:00
Insality
77e56e8747 Add hotkey example 2022-07-17 19:07:35 +03:00
Insality
3e5a90920e Update drag screen koef value 2022-07-17 18:41:02 +03:00
Insality
46bcbb596d Fix drag is_enabled, add to example 2022-07-17 18:27:38 +03:00
Insality
d237eaec59 Merge branch 'layout' into develop 2022-07-17 18:23:22 +03:00
Insality
45b4843887 Layout component update 2022-07-17 18:23:07 +03:00
Insality
43f75cd820 Solve #195 Add set_enabled to Drag component 2022-07-17 18:08:03 +03:00
Insality
0107c015a1 Update layout component 2022-06-15 10:37:45 +05:00
Insality
e029d1eac3 Solve #133 Add hotkey component 2022-06-15 10:35:56 +05:00
Insality
53f305734c Solve #189 Add temporary set input priority 2022-06-15 10:34:47 +05:00
Insality
c9f862ac03 Solve #188 Add drag component total_x/total_y 2022-06-15 10:34:19 +05:00
Insality
415869e2bf Update layout component 2022-06-15 10:29:27 +05:00
Insality
4d47b6e656 Solve #186 fix set in row static grid zero offset 2022-04-18 15:52:50 +03:00
Insality
13fd4babb1 Solve #187 Temporary removed default gui templates 2022-04-16 10:16:29 +03:00
Insality
decb9fd9fd Solve #73 fix scroll drag on stretch/zoom nodes 2022-04-10 15:20:57 +03:00
Insality
f7e6888c5a Revert "Solve #182 add table pool for events"
This reverts commit dff522fbaa8775ed983f6a2b83409addef7d112d.
2022-04-05 23:18:39 +03:00
Insality
70e94ec14a Fix event table pool 2022-04-05 19:20:03 +03:00
Insality
dff522fbaa Solve #182 add table pool for events 2022-04-05 18:57:40 +03:00
Insality
2779f9cf7a Start implement druid layout component 2022-04-05 18:17:39 +03:00
Insality
c263c60de8 Fix changelog type 2022-03-12 12:18:33 +02:00
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 007e715009550fc1b4bdbaa51c5be4cda6deda58.
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
Maxim Tuprikov
9459ecc6b2
Merge pull request #145 from Insality/release/0.7.0
Release/0.7.0 to master
2021-10-23 17:48:53 +03:00
Insality
c16c3e4074 Update docs 2021-10-23 17:45:46 +03:00
Insality
d2e4362f48 Update example app 2021-10-23 17:39:24 +03:00
Insality
1ae77e727f Increase version to 0.7.0 2021-10-23 17:33:14 +03:00
Insality
e6f0a86f12 Update docs 2021-10-23 17:32:52 +03:00
Insality
db0196f55e Update changelog 2021-10-23 17:32:35 +03:00
Insality
009c3999c4 #142 Add WHEEL_SCROLL_BY_INERTION Scroll style param 2021-10-23 17:10:15 +03:00
Insality
d24301cd13 #144 Add checks for is scroll available to check POI in that intertion side 2021-10-23 16:34:14 +03:00
Insality
ba312742d2 #107 Better scale text adjust by height for multiline text nodes 2021-10-23 16:18:43 +03:00
Insality
ab3f5f8e31 #104 Add is_instant flag to add/remove Static and Dynamic Grid components 2021-10-23 15:16:38 +03:00
Insality
a4a03db813 #110 Add set_check_function for Buttom component 2021-10-23 15:04:12 +03:00
Insality
273dd33843 #111 Fix game.project field compare type 2021-10-23 14:11:26 +03:00
Insality
91fb8ced52 #111 Add druid.stencil_check for auto stencil check to call set_click_zone 2021-10-23 14:08:24 +03:00
Insality
063e4f4a31 Add message input TEXT_SET, update docs/changelog 2021-10-23 13:30:50 +03:00
Insality
0179e68887 #91 Add license comments 2021-10-23 13:08:39 +03:00
Insality
1da5476837 #81 Add simple input control via messages 2021-10-22 00:56:46 +03:00
Insality
bbdf2b405d Add #143 to changelog 2021-10-21 00:40:19 +03:00
Insality
a8c2185d20 #143 Update all lang components on set_text_function 2021-10-21 00:38:23 +03:00
Insality
94197391a5 Update docs for #78 text update 2021-10-20 20:52:14 +03:00
Insality
4ef8316949 #78 Add text different adjust types 2021-10-20 20:24:31 +03:00
Insality
a501d3418b Add #125 to changelog 2021-10-17 18:28:55 +03:00
Insality
19ece205f8 #125 Now set_input_priority affects on all children of component 2021-10-17 18:28:11 +03:00
Insality
a014fca1a1 #66 Add set_whitelist and set_blacklist functions 2021-10-17 17:50:49 +03:00
Insality
a9de3771e3 #112 Add allow remap default Druid input bindings 2021-10-17 16:55:23 +03:00
Insality
087ca36d12 Add 132 to changelog 2021-10-17 16:43:59 +03:00
Insality
1219b02c10 #131 Add dynamic_poses for static grid 2021-10-17 16:36:45 +03:00
Maxim Tuprikov
b4560daa69
Merge pull request #136 from SalavatR/develop
Update scroll.lua
2021-08-07 13:03:45 +03:00
Maxim Tuprikov
ecc6e27057
Merge pull request #134 from astrochili/develop
Update README.md
2021-08-07 13:03:15 +03:00
SalavatR
732dad747c
Update scroll.lua 2021-08-04 20:44:36 +06:00
Roman Silin
b3dc9581d1
Update README.md 2021-07-18 16:48:01 +03:00
Insality
5d74531b4a Merge branch 'develop', add .gitattributes 2021-05-30 12:09:22 +03:00
Insality
8d3332204b Add git attributes for syntax highlight 2021-05-30 12:06:27 +03:00
Insality
105f672676 Merge branch 'develop': add example for grid animations 2021-05-30 11:54:20 +03:00
Insality
305c300f31 Update example 2021-05-30 11:52:56 +03:00
Insality
ffa3bafa00 Add deep linking for exampes in html 2021-05-30 11:50:37 +03:00
Insality
271fdd2b57 #132 Add example: add/remove grid with animations 2021-05-23 21:10:09 +03:00
Insality
63a6af3faa Fix typo 2021-04-08 00:29:57 +03:00
Insality
40c3609162 Update docs 2021-04-08 00:29:16 +03:00
Insality
d2fcb1aa85 Update changelogs 2021-04-06 00:34:29 +03:00
588 changed files with 57188 additions and 41454 deletions

2
.defignore Normal file
View File

@ -0,0 +1,2 @@
/dist
/.deployer_cache

18
.gitattributes vendored Normal file
View File

@ -0,0 +1,18 @@
# Defold GLSL Shaders
*.fp linguist-language=GLSL
*.vp linguist-language=GLSL
# Defold Lua Files
*.editor_script linguist-language=Lua
*.render_script linguist-language=Lua
*.script linguist-language=Lua
*.gui_script linguist-language=Lua
# Defold Files
*.atlas linguist-language=JSON5
*.collection linguist-language=JSON5
*.font linguist-language=JSON5
*.go linguist-language=JSON5
*.gui linguist-language=JSON5
*.tilemap linguist-language=JSON5
*.tilesource linguist-language=JSON5

5
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,5 @@
# These are supported funding model platforms
github: insality
ko_fi: insality
buy_me_a_coffee: insality

View File

@ -7,17 +7,22 @@ jobs:
name: Build and run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: '13'
distribution: 'zulu'
java-version: '21'
- name: Build && Run
run: |
deployer_url="https://raw.githubusercontent.com/Insality/defold-deployer/1/deployer.sh"
curl -s ${deployer_url} | bash -s lbd --headless --settings ./unit_test.txt
curl -s ${deployer_url} | bash -s lbd --headless --settings ./test/test.ini
- name: Upload test report
run: bash <(curl -s https://codecov.io/bash)
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: insality/druid

8
.gitignore vendored
View File

@ -9,3 +9,11 @@ Thumbs.db
.cproject
builtins
dist
deployer_version_settings.txt
.deployer_cache
bob*.jar
manifest.private.der
manifest.public.der
/.editor_settings
/.deployer_cache

View File

@ -1,51 +0,0 @@
std = "max"
files['.luacheckrc'].global = false
unused_args = false
max_code_line_length = 90
max_comment_line_length = false
globals = {
"sys",
"go",
"gui",
"label",
"render",
"crash",
"sprite",
"sound",
"tilemap",
"spine",
"particlefx",
"physics",
"factory",
"collectionfactory",
"iac",
"msg",
"vmath",
"url",
"http",
"image",
"json",
"zlib",
"iap",
"push",
"facebook",
"hash",
"hash_to_hex",
"pprint",
"init",
"final",
"update",
"on_input",
"on_message",
"on_reload",
"socket",
"table",
"debug",
"timer",
"window",
"buffer",
"resource",
"defos",
}

76
.luacov Normal file
View File

@ -0,0 +1,76 @@
local reporter = require("luacov.reporter.defold")
--- Default values for configuration options.
-- For project specific configuration create '.luacov' file in your project
-- folder. It should be a Lua script setting various options as globals
-- or returning table of options.
-- @class module
-- @name deftest.coverage.configuration
return {
--- Reporter class to use when creating a report. Default: DefaultReporter from reporter.lua
reporter = reporter,
--- Filename to store collected stats. Default: "luacov.stats.out".
statsfile = "luacov.stats.out",
--- Filename to store report. Default: "luacov.report.out".
reportfile = "luacov.report.out",
--- Enable saving coverage data after every `savestepsize` lines?
-- Setting this flag to `true` in config is equivalent to running LuaCov
-- using `luacov.tick` module. Default: false.
tick = false,
--- Stats file updating frequency for `luacov.tick`.
-- The lower this value - the more frequently results will be written out to the stats file.
-- You may want to reduce this value (to, for example, 2) to avoid losing coverage data in
-- case your program may terminate without triggering luacov exit hooks that are supposed
-- to save the data. Default: 100.
savestepsize = 100,
--- Run reporter on completion? Default: true.
runreport = true,
--- Delete stats file after reporting? Default: false.
deletestats = true,
--- Process Lua code loaded from raw strings?
-- That is, when the 'source' field in the debug info
-- does not start with '@'. Default: true.
codefromstrings = true,
--- Lua patterns for files to include when reporting.
-- All will be included if nothing is listed.
-- Do not include the '.lua' extension. Path separator is always '/'.
-- Overruled by `exclude`.
-- @usage
-- include = {
-- "mymodule$", -- the main module
-- "mymodule%/.+$", -- and everything namespaced underneath it
-- }
include = {},
--- Lua patterns for files to exclude when reporting.
-- Nothing will be excluded if nothing is listed.
-- Do not include the '.lua' extension. Path separator is always '/'.
-- Overrules `include`.
exclude = {
"^test%/.+$",
"^druid/system/utf8.lua$",
},
--- Table mapping names of modules to be included to their filenames.
-- Has no effect if empty.
-- Real filenames mentioned here will be used for reporting
-- even if the modules have been installed elsewhere.
-- Module name can contain '*' wildcard to match groups of modules,
-- in this case corresponding path will be used as a prefix directory
-- where modules from the group are located.
-- @usage
-- modules = {
-- ["some_rock"] = "src/some_rock.lua",
-- ["some_rock.*"] = "src"
-- }
modules = {},
}

41
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"Lua.diagnostics.globals": [
"init",
"final",
"update",
"on_message",
"on_input",
"describe",
"before",
"after",
"it",
"utf8",
"defos",
"clipboard",
"editor"
],
"Lua.workspace.checkThirdParty": false,
"Lua.diagnostics.neededFileStatus": {
"undefined-field": "Any",
"assign-type-mismatch": "Any",
"missing-return": "Any",
"missing-fields": "Any",
"return-type-mismatch": "Any",
"lowercase-global": "Any"
},
"Lua.workspace.ignoreDir": [
".vscode",
"test/tests/*.lua",
"utils/annotations_manual.lua"
],
"Lua.runtime.pathStrict": true,
"Lua.diagnostics.libraryFiles": "Disable",
"Lua.runtime.version": "Lua 5.1",
"Lua.workspace.library": [
"~/Library/Application Support/Cursor/User/globalStorage/astronachos.defold",
"~/Library/Application Support/Cursor/User/workspaceStorage/1446075a23c89451a63f0e82b2291def/astronachos.defold"
],
"files.exclude": {
"**/*.gui": true
}
}

116
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,116 @@
# Contributing to Druid
Thank you for your interest in contributing to **Druid**! We welcome contributions of all sizes - even small fixes make a big difference.
## Table of Contents
- [How to Report Issues](#how-to-report-issues)
- [Small Fixes](#small-fixes)
- [Larger Contributions](#larger-contributions)
- [Documentation Updates](#documentation-updates)
- [Adding or Updating Examples](#adding-or-updating-examples)
- [Unit Tests](#unit-tests)
## How to Report Issues
Found a bug? Please report it to our [issue tracker](https://github.com/druid-js/druid/issues) with:
- A clear description of the problem
- Steps to reproduce the issue
- Expected vs. actual behavior
- Your environment (Defold version, OS, etc.)
## Small Fixes
**We highly encourage small improvements!** For bug fixes, typo corrections, or minor improvements, you can create a pull request directly to the `master` or `develop` branch.
When making these contributions, you **must**:
1. Update the patch version number in both:
- `README.md` file (in the dependency section)
- `game.project` file (in the project section)
2. Add your changes to `wiki/changelog.md`
3. These steps are required to properly tag a new release
**Example of version updates:**
For README.md:
```
# Before
https://github.com/Insality/druid/archive/refs/tags/1.1.0.zip
# After (patch version increased)
https://github.com/Insality/druid/archive/refs/tags/1.1.1.zip
```
For game.project:
```
# Before
[project]
title = Druid
version = 1.1.0
# After (patch version increased)
[project]
title = Druid
version = 1.1.1
```
## Larger Contributions
For new features, major improvements, or complex fixes:
1. Fork the repository
2. Create a branch from `develop`
3. Make your changes
4. Ensure code follows project style guidelines
5. Test your changes thoroughly
6. Submit a pull request to the `develop` branch
7. Include references to any related issues (e.g., "Fixes #123")
Please keep changes focused on addressing specific issues or features, and maintain the existing code style.
## Documentation Updates
To improve documentation:
1. Fork the repository
2. Create a branch for your changes
3. Update the relevant documentation files
4. Submit a pull request to the `master` or `develop` branch
Clear, accurate documentation helps everyone, so documentation improvements are always appreciated!
## Adding or Updating Examples
Examples are vital for helping users understand how to use Druid. Each example should include:
1. A GUI scene with a Druid widget
2. Information about the example in `examples_list.lua`
To add a new example:
1. Create a new GUI file in the `/example/examples` directory
2. Add the example information to `examples_list.lua`
3. Include your GUI template in `/example/druid.gui`
- Place it inside the proper hierarchy: `root -> container_center -> examples -> widgets`
4. Test your example by running the game
5. Submit a pull request to the `develop` branch
## Unit Tests
Unit tests help ensure Druid works correctly. If you're facing an issue, unit tests can be a good starting point to understand or reproduce it.
All tests are located in the `/test/tests` directory.
To run tests:
1. Set the bootstrap collection to `/test/test.collection`
2. Run the project
To submit new or updated tests:
1. Create a branch for your changes
2. Add or modify tests
3. Verify your tests pass
4. Submit a pull request to the `develop` branch
---
Thank you for contributing to making Druid better for everyone! ❤️

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Maxim Tuprikov
Copyright (c) 2025 Maxim Tuprikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

354
README.md
View File

@ -1,173 +1,79 @@
[![](media/druid_logo.png)](https://insality.github.io/druid/)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/insality/druid)](https://github.com/Insality/druid/releases)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/insality/druid/Run%20tests)](https://github.com/Insality/druid/actions)
[![codecov](https://codecov.io/gh/Insality/druid/branch/master/graph/badge.svg)](https://codecov.io/gh/Insality/druid)
[![GitHub release (latest by date)](https://img.shields.io/github/v/tag/insality/druid?style=for-the-badge&label=Release)](https://github.com/Insality/druid/tags)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/insality/druid/ci-workflow.yml?branch=master&style=for-the-badge)](https://github.com/Insality/druid/actions)
[![codecov](https://img.shields.io/codecov/c/github/Insality/druid?style=for-the-badge)](https://codecov.io/gh/Insality/druid)
**Druid** - powerful Defold component UI library. Use basic and extended **Druid** components or make your own game-specific components to make amazing GUI in your games.
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/insality) [![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/insality) [![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/insality)
**Druid** - a powerful, flexible and easy to use **Defold** component UI framework. Contains a wide range of UI components that you can use to create a beautiful, responsive and customizable GUIs. Provides a powerful way to create, compose and manage your custom components and scenes.
## Druid Example
Check the [**HTML5 version**](https://insality.github.io/druid/) of the **Druid** example app.
In this example you can inspect a variety of **Druid** components and see how they work. Each example page provides a direct link to the corresponding example code, making it easier for you to understand how to use **Druid**.
## Features
- **Components Rich** - Provides a extensive set of components, from basic buttons to infinity data lists and rich texts
- **Customizable** - You can customize components appearance and behaviour with their API and styles
- **Widgets** - Powerful way to create your own reusable components
- **Input Handling** - Handles input in a stack-based manner and manage input priority
- **Event Based** - Uses [Defold Event](https://github.com/Insality/defold-event) for components callbacks and communication between components
## Quick Links
- [Basic Usage](wiki/basic_usage.md)
- [Quick API Reference](api/quick_api_reference.md)
- [List of Components](#druid-components)
- [Contributors](#contributors)
## Setup
### Dependency
### [Dependency](https://defold.com/manuals/libraries/#setting-up-library-dependencies)
You can use the **Druid** extension in your own project by adding this project as a [Defold library dependency](https://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:
> [https://github.com/Insality/druid/archive/master.zip](https://github.com/Insality/druid/archive/master.zip)
Or point to the ZIP file of a [specific release](https://github.com/Insality/druid/releases).
### Input bindings
**Druid** requires the following input bindings:
- Mouse trigger - `Button 1` -> `touch` _For basic input components_
- Key trigger - `Backspace` -> `key_backspace` _For back_handler component, input component_
- Key trigger - `Back` -> `key_back` _For back_handler component, Android back button, input component_
- Key trigger - `Enter` -> `key_enter` _For input component, optional_
- Key trigger - `Esc` -> `key_esc` _For input component, optional_
- Touch triggers - `Touch multi` -> `multitouch` _For scroll component_
![](media/input_binding_2.png)
![](media/input_binding_1.png)
Open your `game.project` file and add the following lines to the dependencies field under the project section:
### Input capturing [optional]
By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus")`
If you don't need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_:
```
[druid]
no_auto_input = 1
```
### Code [optional]
Adjust **Druid** settings, if needed:
```lua
local druid = require("druid.druid")
-- Used for button component and custom components
-- Callback should play sound by name
druid.set_sound_function(callback)
-- Used for lang_text component
-- Callback should return localized string by locale id
druid.set_text_function(callback)
-- Used for change default druid style
druid.set_default_style(your_style)
-- Call this function on language changing in the game,
-- to retranslate all lang_text components:
druid.on_language_change()
-- Call this function inside window.set_listener
-- to catch game focus lost/gained callbacks:
druid.on_window_callback(event)
```
## Components
**Druid** provides the following *basic* components:
- **[Button](docs_md/01-components.md#button)** - Basic Druid button input component. Handles all types of interactions (tap, long-tap, hold-tap, double-tap, simple key triggers, etc)
- **[Text](docs_md/01-components.md#text)** - Basic Druid text component. Wrap on gui text node, handle text size adjusting.
- **[Scroll](docs_md/01-components.md#scroll)** - Basic Druid scroll component
- **[Blocker](docs_md/01-components.md#blocker)** - Block input in node zone component
- **[Back Handler](docs_md/01-components.md#back-handler)** - Handle back button (Android back button, backspace key)
- **[Static Grid](docs_md/01-components.md#static-grid)** - Component to manage node positions with equal sizes
- **[Hover](docs_md/01-components.md#hover)** - System Druid component, handle hover node state
- **[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
**Druid** also provides the following *extended* components:
***Note**: In the future, to use extended components, you should register them first. This is required to make **Druid** modular - to exclude unused components from builds*
- **[Checkbox](docs_md/01-components.md#checkbox)** - Checkbox component
- **[Checkbox group](docs_md/01-components.md#checkbox-group)** - Several checkboxes in one group
- **[Dynamic Grid](docs_md/01-components.md#dynamic-grid)** - Component to manage node positions with different sizes. Only in one row or column
- **[Input](docs_md/01-components.md#input)** - User text input component
- **[Lang text](docs_md/01-components.md#lang-text)** - Wrap on Text component to handle localization
- **[Progress](docs_md/01-components.md#progress)** - Progress bar component
- **[Radio group](docs_md/01-components.md#radio-group)** - Several checkboxes in one group with a single choice
- **[Slider](docs_md/01-components.md#slider)** - Slider component
- **[Timer](docs_md/01-components.md#timer)** - Handle timer work on gui text node
For a complete overview, see: _[components.md](docs_md/01-components.md)_.
## Basic usage
To use **Druid**, first you should create a Druid instance to spawn components and add Druids main engine functions: *update*, *final*, *on_message* and *on_input*.
All **Druid** components take node name string as arguments, don't do `gui.get_node()` before.
All **Druid** and component methods are called with `:` like `self.druid:new_button()`.
```lua
local druid = require("druid.druid")
local function button_callback(self)
print("Button was clicked!")
end
function init(self)
self.druid = druid.new(self)
self.druid:new_button("button_node_name", button_callback)
end
function final(self)
self.druid:final()
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end
**[Druid](https://github.com/Insality/druid/)**
```
https://github.com/Insality/druid/archive/refs/tags/1.1.4.zip
```
For all **Druid** instance functions, [see here](https://insality.github.io/druid/modules/druid_instance.html).
**[Defold Event](https://github.com/Insality/defold-event)**
## Druid Events
```
https://github.com/Insality/defold-event/archive/refs/tags/11.zip
```
Any **Druid** components as callbacks use [Druid Events](https://insality.github.io/druid/modules/druid_event.html). In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe to those events with the following API:
After that, select `Project ▸ Fetch Libraries` to update [library dependencies]((https://defold.com/manuals/libraries/#setting-up-library-dependencies)). This happens automatically whenever you open a project so you will only need to do this if the dependencies change without re-opening the project.
- **event:subscribe**(callback)
Here is a list of [all releases](https://github.com/Insality/druid/releases).
- **event:unsubscribe**(callback)
- **event:clear**()
### Library Size
You can subscribe several callbacks to a single event.
> **Note:** The library size is calculated based on the build report per platform. Full size contains all components, they can be stripped out in the build process if you don't need them.
## Druid Lifecycle
| Platform | Full Size |
| ---------------- | ------------- |
| HTML5 | **84.52 KB** |
| Desktop / Mobile | **141.03 KB** |
### Input Bindings
**Druid** utilizes the `/builtins/input/all.input_binding` input bindings. Either use this file for your project by setting the `Runtime -> Input -> Game Binding` field in the `game.project` input section to `/builtins/input/all.input_binding`, or add the specific bindings you need to your game's input binding file. For custom input bindings, refer to the Input Binding section in the [Advanced Setup](https://github.com/Insality/druid/blob/master/wiki/advanced-setup.md#input-bindings).
## Usage
### Basic usage
The basic template for `gui_script` is:
Here is full Druid lifecycle setup for your ***.gui_script** file:
```lua
local druid = require("druid.druid")
@ -183,67 +89,145 @@ function update(self, dt)
self.druid:update(dt)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end
```
- *final* is a **required** function for a correct Druid lifecycle
- *on_input* is used in almost all Druid components
- *update* in used in progress bar, scroll and timer base components
- *on_message* is used for specific Druid events, like language change or layout change
Read the [Basic Usage](wiki/basic_usage.md) to learn how to use **Druid**, how to create your own components and how to use widgets.
It is recommended to fully integrate all **Druid** lifecycles functions.
### API Documentation
Best start is from the [Quick API Reference](api/quick_api_reference.md)
With next quick links:
- [Druid Instance](api/druid_instance_api.md) - **Druid** instance returned from `druid.new(self)`
- [Helper](api/druid_helper_api.md) - A lot of useful functions
- [Widgets](wiki/widgets.md) - About widgets and how to use them
## Druid Components
Here is full **Druid** components list.
### Components
| Name | Description | Example | <div style="width:200px">Preview</div> |
|------|-------------|---------|---------|
| **[Button](/api/components/base/button_api.md)** | Logic over GUI Node. Handle the user click interactions: click, long click, double click, etc. | [Button Example](https://insality.github.io/druid/?example=ui_example_basic_button) | <img src="media/preview/button.gif" width="200" height="100"> |
| **[Text](/api/components/base/text_api.md)** | Logic over GUI Text. By default Text component fit the text inside text node size area with different adjust modes. | [Text Example](https://insality.github.io/druid/?example=ui_example_basic_text) | <img src="media/preview/text.gif" width="200" height="100"> |
| **[Scroll](/api/components/base/scroll_api.md)** | Logic over two GUI Nodes: input and content. Provides basic behaviour for scrollable content. | [Scroll Example](https://insality.github.io/druid/?example=ui_example_basic_scroll) | <img src="media/preview/scroll.gif" width="200" height="100"> |
| **[Blocker](/api/components/base/blocker_api.md)** | Logic over GUI Node. Don't pass any user input below node area size. | [Blocker Example](https://insality.github.io/druid/?example=ui_example_basic_blocker) | <img src="media/preview/blocker.gif" width="200" height="100"> |
| **[Back Handler](/api/components/base/back_handler_api.md)** | Call callback on user "Back" action. It's a Android back button or keyboard backspace key | [Back Handler Example](https://insality.github.io/druid/?example=ui_example_basic_back_handler) | <img src="media/preview/back_handler.gif" width="200" height="100"> |
| **[Static Grid](/api/components/base/static_grid_api.md)** | Logic over GUI Node. Component to manage node positions with all equal node sizes. | [Static Gid Example](https://insality.github.io/druid/?example=ui_example_basic_grid) | <img src="media/preview/static_grid.gif" width="200" height="100"> |
| **[Hover](/api/components/base/hover_api.md)** | Logic over GUI Node. Handle hover action over node. For both: mobile touch and mouse cursor. | [Hover Example](https://insality.github.io/druid/?example=ui_example_basic_hover) | <img src="media/preview/hover.gif" width="200" height="100"> |
| **[Swipe](/api/components/extended/swipe_api.md)** | Logic over GUI Node. Handle swipe gestures over node. | [Swipe Example](https://insality.github.io/druid/?example=ui_example_basic_swipe) | <img src="media/preview/swipe.gif" width="200" height="100"> |
| **[Drag](/api/components/base/drag_api.md)** | Logic over GUI Node. Handle drag input actions. Can be useful to make on screen controlls. | [Drag Example](https://insality.github.io/druid/?example=ui_example_basic_drag) | <img src="media/preview/drag.gif" width="200" height="100"> |
| **[Data List](/api/components/extended/data_list_api.md)** | Logic over Scroll and Grid components. Create only visible GUI nodes or components to make "infinity" scroll befaviour | [Data List Example](https://insality.github.io/druid/?example=ui_example_data_list_basic) | <img src="media/preview/data_list.gif" width="200" height="100"> |
| **[Input](/api/components/extended/input_api.md)** | Logic over GUI Node and GUI Text (or Text component). Provides basic user text input. | [Input Example](https://insality.github.io/druid/?example=ui_example_basic_input) | <img src="media/preview/input.gif" width="200" height="100"> |
| **[Lang text](/api/components/extended/lang_text_api.md)** | Logic over Text component to handle localization. Can be translated in real-time with `druid.on_language_change` | [Lang Text Example](https://insality.github.io/druid/?example=ui_example_window_language) | <img src="media/preview/lang_text.gif" width="200" height="100"> |
| **[Progress](/api/components/extended/progress_api.md)** | Logic over GUI Node. Handle node size and scale to handle progress node size. | [Progress Example](https://insality.github.io/druid/?example=ui_example_basic_progress_bar) | <img src="media/preview/progress.gif" width="200" height="100"> |
| **[Slider](/api/components/extended/slider_api.md)** | Logic over GUI Node. Handle draggable node with position restrictions. | [Slider Example](https://insality.github.io/druid/?example=ui_example_basic_slider) | <img src="media/preview/slider.gif" width="200" height="100"> |
| **[Timer](/api/components/extended/timer_api.md)** | Logic over GUI Text. Handle basic timer functions. | [Timer Example](https://insality.github.io/druid/?example=ui_example_basic_timer) | <img src="media/preview/timer.gif" width="200" height="100"> |
| **[Hotkey](/api/components/extended/hotkey_api.md)** | Allow to set callbacks for keyboard hotkeys with key modificators. | [Hotkey Example](https://insality.github.io/druid/?example=ui_example_basic_hotkey) | <img src="media/preview/hotkey.gif" width="200" height="100"> |
| **[Layout](/api/components/extended/layout_api.md)** | Logic over GUI Node. Arrange nodes inside layout node with margin/paddings settings. | [Layout Example](https://insality.github.io/druid/?example=ui_example_layout_basic) | <img src="media/preview/layout.gif" width="200" height="100"> |
| **[Rich Input](/api/components/custom/rich_input_api.md)** | Logic over GUI Node and GUI Text (or Text component). Provides rich text input with different styles and text formatting. | [Rich Input Example](https://insality.github.io/druid/?example=ui_example_basic_rich_input) | <img src="media/preview/rich_input.gif" width="200" height="100"> |
| **[Rich Text](/api/components/custom/rich_text_api.md)** | Logic over GUI Text. Provides rich text formatting with different styles and text formatting. | [Rich Text Example](https://insality.github.io/druid/?example=ui_example_basic_rich_text) | <img src="media/preview/rich_text.gif" width="200" height="100"> |
## Druid Events
All **Druid** components using [Defold Event](https://github.com/Insality/defold-event) for components callbacks. In component API ([button example](/api/components/base/button_api.md#fields)) pointed list of component events. You can manually subscribe to these events with the following API:
- **event:subscribe**(callback)
- **event:unsubscribe**(callback)
You can subscribe several callbacks to a single event.
Examples:
```lua
button.on_click:subscribe(function(self, args)
print("Button clicked!")
end)
scroll.on_scroll:subscribe(function(self, position)
print("Scroll scrolled!")
end)
input.on_input_unselect:subscribe(function(self, text)
print("User enter input:", text)
end)
```
## Details
- Druid input goes as stack. Last created button will checked first. So create your GUI from back
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It is needed if you have more than 1 acquire inputs (several Druid, other input system, etc)
- By default, Druid will automatically _acquire_input_focus_. So you don't need do it manually. But only if you have components which require _on_input_
- If you want to delete a node which has a Druid component, don't forget to remove it via `druid:remove(component)`
[See full FAQ here](docs_md/FAQ.md)
- **Druid** processes input in a stack-based manner. The most recently created button will be checked first. Create your input GUI components from back to front.
- Remember to include `return` in the `on_input` function: `return self.druid:on_input()`. This is necessary if you have multiple input sources (multiple Druid instances, other input systems, etc.).
- Druid automatically calls `acquire_input_focus` if you have input components. Therefore, manual calling of `acquire_input_focus` is not required.
- When deleting a **Druid** component node, make sure to remove it using `druid:remove(component)`.
## Examples
See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
Try the [**HTML5 version**](https://insality.github.io/druid/) of the **Druid** example app.
See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles
Each example page provides a direct link to the corresponding example code, making it easier for you to understand how to use **Druid**.
Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app
Or refer directly to the [**example folder**](https://github.com/Insality/druid/tree/develop/example) for code examples demonstrating how to use **Druid**.
## Documentation
You can find the full **Druid** functions at [Quick API Reference](api/quick_api_reference.md)
To better understand **Druid**, read the following documentation:
- [Druid components](docs_md/01-components.md)
- [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/
- [How To GUI in Defold](https://forum.defold.com/t/how-to-gui-in-defold/73256)
- [Widgets](wiki/widgets.md)
- [Druid styles](wiki/styles.md)
- [Advanced Setup](wiki/advanced-setup.md)
- [Optimize Druid Size](wiki/optimize_druid_size.md)
- [Creating Custom Components](wiki/creating_custom_components.md)
- [Changelog](wiki/changelog.md)
## Games powered by Druid
## Licenses
_You published your game and you using Druid? Note me!_
## License
- Developed and supported by [Insality](https://github.com/Insality)
- Original idea by [AGulev](https://github.com/AGulev)
- Assets from [Kenney](http://www.kenney.nl/)
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Issues and suggestions
If you have any issues, questions or suggestions please [create an issue](https://github.com/Insality/druid/issues) or contact me: [insality@gmail.com](mailto:insality@gmail.com)
If you have any issues, questions or suggestions please [create an issue](https://github.com/Insality/druid/issues)
## History
For a complete history of the development of **Druid**, please check the [changelog](wiki/changelog.md).
## Contributors
Original Druid idea by [AGulev](https://github.com/AGulev)
Special thanks to all the contributors who have helped make **Druid** better!
<a href="https://github.com/Insality/druid/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=insality/druid"/>
</a>
Read the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
## ❤️ Support project ❤️
Your donation helps me stay engaged in creating valuable projects for **Defold**. If you appreciate what I'm doing, please consider supporting me!
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/insality) [![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/insality) [![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/insality)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
# druid.back_handler API
> at /druid/base/back_handler.lua
Component to handle back button. It handles Android back button and Backspace key.
### Setup
Create back handler component with druid: `druid:new_back_handler(callback)`
### Notes
- Key triggers in `input.binding` should be setup for correct working
- It uses a key_back and key_backspace action ids
## Functions
- [init](#init)
## Fields
- [on_back](#on_back)
- [params](#params)
### init
---
```lua
back_handler:init([callback], [params])
```
The Back Handler constructor
- **Parameters:**
- `[callback]` *(function|nil)*: The callback to call when the back handler is triggered
- `[params]` *(any)*: Custom args to pass in the callback
## Fields
<a name="on_back"></a>
- **on_back** (_event_): fun(self: druid.back_handler, params: any?) Trigger on back handler action
<a name="params"></a>
- **params** (_any_): Custom args to pass in the callback

View File

@ -0,0 +1,70 @@
# druid.blocker API
> at /druid/base/blocker.lua
Druid component for block input. Use it to block input in special zone.
### Setup
Create blocker component with druid: `druid:new_blocker(node_name)`
### Notes
- Blocker can be used to create safe zones, where you have big buttons
- Blocker will capture all input events that hit the node, preventing them from reaching other components
- Blocker works placed as usual component in stack, so any other component can be placed on top of it and will work as usual
## Functions
- [init](#init)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields
- [node](#node)
### init
---
```lua
blocker:init(node)
```
The Blocker constructor
- **Parameters:**
- `node` *(string|node)*: The node to use as a blocker
### set_enabled
---
```lua
blocker:set_enabled(state)
```
Set blocker enabled state
- **Parameters:**
- `state` *(boolean)*: The new enabled state
- **Returns:**
- `self` *(druid.blocker)*: The blocker instance
### is_enabled
---
```lua
blocker:is_enabled()
```
Get blocker enabled state
- **Returns:**
- `is_enabled` *(boolean)*: True if the blocker is enabled
## Fields
<a name="node"></a>
- **node** (_node_): The node that will block input

View File

@ -0,0 +1,271 @@
# druid.button API
> at /druid/base/button.lua
Basic Druid input component. Handle input on node and provide different callbacks on touch events.
### Setup
Create button with druid: `button = druid:new_button(node_name, callback, [params], [animation_node])`
Where node_name is name of node from GUI scene. You can use `node_name` as input trigger zone and point another node for animation via `animation_node`
### Notes
- Button callback have next params: (self, params, button_instance)
- - **self** - Druid self context
- - **params** - Additional params, specified on button creating
- - **button_instance** - button itself
- You can set _params_ on button callback on button creating: `druid:new_button("node_name", callback, params)`.
- Button have several events like on_click, on_repeated_click, on_long_click, on_hold_click, on_double_click
- Click event will not trigger if between pressed and released state cursor was outside of node zone
- Button can have key trigger to use them by key: `button:set_key_trigger`
-
## Functions
- [init](#init)
- [set_animations_disabled](#set_animations_disabled)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
- [set_click_zone](#set_click_zone)
- [set_key_trigger](#set_key_trigger)
- [get_key_trigger](#get_key_trigger)
- [set_check_function](#set_check_function)
- [set_web_user_interaction](#set_web_user_interaction)
## Fields
- [on_click](#on_click)
- [on_pressed](#on_pressed)
- [on_repeated_click](#on_repeated_click)
- [on_long_click](#on_long_click)
- [on_double_click](#on_double_click)
- [on_hold_callback](#on_hold_callback)
- [on_click_outside](#on_click_outside)
- [node](#node)
- [node_id](#node_id)
- [anim_node](#anim_node)
- [params](#params)
- [hover](#hover)
- [click_zone](#click_zone)
- [start_scale](#start_scale)
- [start_pos](#start_pos)
- [disabled](#disabled)
- [key_trigger](#key_trigger)
- [style](#style)
- [druid](#druid)
- [is_repeated_started](#is_repeated_started)
- [last_pressed_time](#last_pressed_time)
- [last_released_time](#last_released_time)
- [click_in_row](#click_in_row)
- [can_action](#can_action)
### init
---
```lua
button:init(node_or_node_id, [callback], [custom_args], [anim_node])
```
The constructor for the button component
- **Parameters:**
- `node_or_node_id` *(string|node)*: Node name or GUI Node itself
- `[callback]` *(fun()|nil)*: Callback on button click
- `[custom_args]` *(any)*: Custom args for any Button event, will be passed to callbacks
- `[anim_node]` *(string|node|nil)*: Node to animate instead of trigger node, useful for animating small icons on big panels
### set_animations_disabled
---
```lua
button:set_animations_disabled()
```
Remove default button style animations
- **Returns:**
- `self` *(druid.button)*: The current button instance
### set_enabled
---
```lua
button:set_enabled([state])
```
Set button enabled state.
The style.on_set_enabled will be triggered.
Disabled button is not clickable.
- **Parameters:**
- `[state]` *(boolean|nil)*: Enabled state
- **Returns:**
- `self` *(druid.button)*: The current button instance
### is_enabled
---
```lua
button:is_enabled()
```
Get button enabled state.
By default all Buttons are enabled on creating.
- **Returns:**
- `is_enabled` *(boolean)*: True, if button is enabled now, False otherwise
### set_click_zone
---
```lua
button:set_click_zone([zone])
```
Set additional button click area.
Useful to restrict click outside of stencil node or scrollable content.
If button node placed inside stencil node, it will be automatically set to this stencil node.
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
- **Returns:**
- `self` *(druid.button)*: The current button instance
### set_key_trigger
---
```lua
button:set_key_trigger(key)
```
Set key name to trigger this button by keyboard.
- **Parameters:**
- `key` *(string|hash)*: The action_id of the input key. Example: "key_space"
- **Returns:**
- `self` *(druid.button)*: The current button instance
### get_key_trigger
---
```lua
button:get_key_trigger()
```
Get current key name to trigger this button.
- **Returns:**
- `key_trigger` *(hash)*: The action_id of the input key
### set_check_function
---
```lua
button:set_check_function([check_function], [failure_callback])
```
Set function for additional check for button click availability.
- **Parameters:**
- `[check_function]` *(function|nil)*: Should return true or false. If true - button can be pressed.
- `[failure_callback]` *(function|nil)*: Function will be called on button click, if check function returns false
- **Returns:**
- `self` *(druid.button)*: The current button instance
### set_web_user_interaction
---
```lua
button:set_web_user_interaction([is_web_mode])
```
Set Button mode to work inside user HTML5 interaction event.
It's required to make protected things like copy & paste text, show mobile keyboard, etc
The HTML5 button doesn't call any events except on_click event.
If the game is not HTML, html mode will be not enabled
- **Parameters:**
- `[is_web_mode]` *(boolean|nil)*: If true - button will be called inside html5 callback
- **Returns:**
- `self` *(druid.button)*: The current button instance
## Fields
<a name="on_click"></a>
- **on_click** (_event_): fun(self, custom_args, button_instance)
<a name="on_pressed"></a>
- **on_pressed** (_event_): fun(self, custom_args, button_instance)
<a name="on_repeated_click"></a>
- **on_repeated_click** (_event_): fun(self, custom_args, button_instance, click_count) Repeated click callback, while holding the button
<a name="on_long_click"></a>
- **on_long_click** (_event_): fun(self, custom_args, button_instance, hold_time) Callback on long button tap
<a name="on_double_click"></a>
- **on_double_click** (_event_): fun(self, custom_args, button_instance, click_amount) Different callback, if tap button 2+ in row
<a name="on_hold_callback"></a>
- **on_hold_callback** (_event_): fun(self, custom_args, button_instance, press_time) Hold callback, before long_click trigger
<a name="on_click_outside"></a>
- **on_click_outside** (_event_): fun(self, custom_args, button_instance)
<a name="node"></a>
- **node** (_node_): Clickable node
<a name="node_id"></a>
- **node_id** (_hash_): Node id
<a name="anim_node"></a>
- **anim_node** (_node_): Animation node. In default case equals to clickable node
<a name="params"></a>
- **params** (_any_): Custom arguments for any Button event
<a name="hover"></a>
- **hover** (_druid.hover_): Hover component for this button
<a name="click_zone"></a>
- **click_zone** (_node_): Click zone node to restrict click area
<a name="start_scale"></a>
- **start_scale** (_vector3_): Start scale of the button
<a name="start_pos"></a>
- **start_pos** (_vector3_): Start position of the button
<a name="disabled"></a>
- **disabled** (_boolean_): Is button disabled
<a name="key_trigger"></a>
- **key_trigger** (_hash_): Key trigger for this button
<a name="style"></a>
- **style** (_table_): Style for this button
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_repeated_started"></a>
- **is_repeated_started** (_boolean_)
<a name="last_pressed_time"></a>
- **last_pressed_time** (_integer_)
<a name="last_released_time"></a>
- **last_released_time** (_integer_)
<a name="click_in_row"></a>
- **click_in_row** (_integer_)
<a name="can_action"></a>
- **can_action** (_boolean_): Can't interact, if touch outside of button

View File

@ -0,0 +1,445 @@
# druid.component API
> at /druid/component.lua
## Functions
- [create](#create)
- [create_widget](#create_widget)
- [init](#init)
- [update](#update)
- [on_remove](#on_remove)
- [on_input](#on_input)
- [on_input_interrupt](#on_input_interrupt)
- [on_message](#on_message)
- [on_late_init](#on_late_init)
- [on_focus_lost](#on_focus_lost)
- [on_focus_gained](#on_focus_gained)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [on_window_resized](#on_window_resized)
- [on_language_change](#on_language_change)
- [set_style](#set_style)
- [set_template](#set_template)
- [get_template](#get_template)
- [set_nodes](#set_nodes)
- [get_context](#get_context)
- [get_node](#get_node)
- [get_druid](#get_druid)
- [get_name](#get_name)
- [get_parent_name](#get_parent_name)
- [get_input_priority](#get_input_priority)
- [set_input_priority](#set_input_priority)
- [reset_input_priority](#reset_input_priority)
- [get_uid](#get_uid)
- [set_input_enabled](#set_input_enabled)
- [get_input_enabled](#get_input_enabled)
- [get_parent_component](#get_parent_component)
- [get_nodes](#get_nodes)
- [get_childrens](#get_childrens)
## Fields
- [druid](#druid)
### create
---
```lua
component.create([name], [input_priority])
```
Сreate a new component class, which will inherit from the base Druid component.
- **Parameters:**
- `[name]` *(string|nil)*: The name of the component
- `[input_priority]` *(number|nil)*: The input priority. The bigger number processed first. Default value: 10
- **Returns:**
- `` *(druid.component)*:
### create_widget
---
```lua
component.create_widget(self, widget_class, context)
```
Create the Druid component instance
- **Parameters:**
- `self` *(druid.instance)*: The Druid Factory used to create components
- `widget_class` *(druid.widget)*:
- `context` *(table)*:
- **Returns:**
- `` *(druid.widget)*:
### init
---
```lua
component:init()
```
Called when component is created
### update
---
```lua
component:update()
```
Called every frame
### on_remove
---
```lua
component:on_remove()
```
Called when component is removed
### on_input
---
```lua
component:on_input()
```
Called when input event is triggered
### on_input_interrupt
---
```lua
component:on_input_interrupt()
```
Called when input event is consumed before
### on_message
---
```lua
component:on_message()
```
Called when message is received
### on_late_init
---
```lua
component:on_late_init()
```
Called before update once time after GUI init
### on_focus_lost
---
```lua
component:on_focus_lost()
```
Called when app lost focus
### on_focus_gained
---
```lua
component:on_focus_gained()
```
Called when app gained focus
### on_style_change
---
```lua
component:on_style_change()
```
Called when style is changed
### on_layout_change
---
```lua
component:on_layout_change()
```
Called when GUI layout is changed
### on_window_resized
---
```lua
component:on_window_resized()
```
Called when window is resized
### on_language_change
---
```lua
component:on_language_change()
```
Called when language is changed
### set_style
---
```lua
component:set_style([druid_style])
```
Set component style. Pass nil to clear style
- **Parameters:**
- `[druid_style]` *(table|nil)*:
- **Returns:**
- `self` *(<T>)*: The component itself for chaining
### set_template
---
```lua
component:set_template([template])
```
Set component template name. Pass nil to clear template.
This template id used to access nodes inside the template on GUI scene.
Parent template will be added automatically if exist.
- **Parameters:**
- `[template]` *(string|nil)*:
- **Returns:**
- `self` *(<T>)*: The component itself for chaining
### get_template
---
```lua
component:get_template()
```
Get full template name.
- **Returns:**
- `` *(string)*:
### set_nodes
---
```lua
component:set_nodes([nodes])
```
Set current component nodes, returned from `gui.clone_tree` function.
- **Parameters:**
- `[nodes]` *(string|node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone or node id to clone
- **Returns:**
- `` *(druid.component)*:
### get_context
---
```lua
component:get_context()
```
Return current component context
- **Returns:**
- `context` *(any)*: Usually it's self of script but can be any other Druid component
### get_node
---
```lua
component:get_node(node_id)
```
Get component node by node_id. Respect to current template and nodes.
- **Parameters:**
- `node_id` *(string|node)*:
- **Returns:**
- `` *(node)*:
### get_druid
---
```lua
component:get_druid([template], [nodes])
```
Get Druid instance for inner component creation.
- **Parameters:**
- `[template]` *(string|nil)*:
- `[nodes]` *(string|node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone or node id to clone
- **Returns:**
- `` *(druid.instance)*:
### get_name
---
```lua
component:get_name()
```
Get component name
- **Returns:**
- `name` *(string)*: The component name + uid
### get_parent_name
---
```lua
component:get_parent_name()
```
Get parent component name
- **Returns:**
- `parent_name` *(string|nil)*: The parent component name if exist or nil
### get_input_priority
---
```lua
component:get_input_priority()
```
Get component input priority, the bigger number processed first. Default value: 10
- **Returns:**
- `` *(number)*:
### set_input_priority
---
```lua
component:set_input_priority(value, [is_temporary])
```
Set component input priority, the bigger number processed first. Default value: 10
- **Parameters:**
- `value` *(number)*:
- `[is_temporary]` *(boolean|nil)*: If true, the reset input priority will return to previous value
- **Returns:**
- `self` *(druid.component)*: The component itself for chaining
### reset_input_priority
---
```lua
component:reset_input_priority()
```
Reset component input priority to it's default value, that was set in `create` function or `set_input_priority`
- **Returns:**
- `self` *(druid.component)*: The component itself for chaining
### get_uid
---
```lua
component:get_uid()
```
Get component UID, unique identifier created in component creation order.
- **Returns:**
- `uid` *(number)*: The component uid
### set_input_enabled
---
```lua
component:set_input_enabled(state)
```
Set component input state. By default it's enabled.
If input is disabled, the component will not receive input events.
Recursive for all children components.
- **Parameters:**
- `state` *(boolean)*:
- **Returns:**
- `self` *(druid.component)*: The component itself for chaining
### get_input_enabled
---
```lua
component:get_input_enabled()
```
Get component input state. By default it's enabled. Can be disabled by `set_input_enabled` function.
- **Returns:**
- `` *(boolean)*:
### get_parent_component
---
```lua
component:get_parent_component()
```
Get parent component
- **Returns:**
- `parent_component` *(druid.component|nil)*: The parent component if exist or nil
### get_nodes
---
```lua
component:get_nodes()
```
Get current component nodes
- **Returns:**
- `` *(table<hash, node>|nil)*:
### get_childrens
---
```lua
component:get_childrens()
```
Return all children components, recursive
- **Returns:**
- `Array` *(table)*: of childrens if the Druid component instance
## Fields
<a name="druid"></a>
- **druid** (_druid.instance_): Druid instance to create inner components

View File

@ -0,0 +1,176 @@
# druid.drag API
> at /druid/base/drag.lua
A component that allows you to subscribe to drag events over a node
## Functions
- [init](#init)
- [set_drag_cursors](#set_drag_cursors)
- [set_click_zone](#set_click_zone)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields
- [node](#node)
- [on_touch_start](#on_touch_start)
- [on_touch_end](#on_touch_end)
- [on_drag_start](#on_drag_start)
- [on_drag](#on_drag)
- [on_drag_end](#on_drag_end)
- [style](#style)
- [click_zone](#click_zone)
- [is_touch](#is_touch)
- [is_drag](#is_drag)
- [can_x](#can_x)
- [can_y](#can_y)
- [dx](#dx)
- [dy](#dy)
- [touch_id](#touch_id)
- [x](#x)
- [y](#y)
- [screen_x](#screen_x)
- [screen_y](#screen_y)
- [touch_start_pos](#touch_start_pos)
- [druid](#druid)
- [hover](#hover)
### init
---
```lua
drag:init(node_or_node_id, [on_drag_callback])
```
The constructor for Drag component
- **Parameters:**
- `node_or_node_id` *(string|node)*: The node to subscribe to drag events over
- `[on_drag_callback]` *(fun(self: any, touch: any))*: The callback to call when a drag occurs
### set_drag_cursors
---
```lua
drag:set_drag_cursors(is_enabled)
```
Set Drag component enabled state.
- **Parameters:**
- `is_enabled` *(boolean)*: True if Drag component is enabled
### set_click_zone
---
```lua
drag:set_click_zone([node])
```
Set Drag click zone
- **Parameters:**
- `[node]` *(string|node|nil)*: Node or node id
- **Returns:**
- `self` *(druid.drag)*: Current instance
### set_enabled
---
```lua
drag:set_enabled(is_enabled)
```
Set Drag component enabled state.
- **Parameters:**
- `is_enabled` *(boolean)*:
- **Returns:**
- `self` *(druid.drag)*: Current instance
### is_enabled
---
```lua
drag:is_enabled()
```
Check if Drag component is capture input
- **Returns:**
- `is_enabled` *(boolean)*: True if Drag component is enabled
## Fields
<a name="node"></a>
- **node** (_node_): The node to subscribe to drag events over
<a name="on_touch_start"></a>
- **on_touch_start** (_event_): fun(self, touch) The event triggered when a touch starts
<a name="on_touch_end"></a>
- **on_touch_end** (_event_): fun(self, touch) The event triggered when a touch ends
<a name="on_drag_start"></a>
- **on_drag_start** (_event_): fun(self, touch) The event triggered when a drag starts
<a name="on_drag"></a>
- **on_drag** (_event_): fun(self, touch) The event triggered when a drag occurs
<a name="on_drag_end"></a>
- **on_drag_end** (_event_): fun(self, touch) The event triggered when a drag ends
<a name="style"></a>
- **style** (_druid.drag.style_): The style of Drag component
<a name="click_zone"></a>
- **click_zone** (_node_): The click zone of Drag component
<a name="is_touch"></a>
- **is_touch** (_boolean_): True if a touch is active
<a name="is_drag"></a>
- **is_drag** (_boolean_): True if a drag is active
<a name="can_x"></a>
- **can_x** (_boolean_): True if Drag can move horizontally
<a name="can_y"></a>
- **can_y** (_boolean_): True if Drag can move vertically
<a name="dx"></a>
- **dx** (_number_): The horizontal drag distance
<a name="dy"></a>
- **dy** (_number_): The vertical drag distance
<a name="touch_id"></a>
- **touch_id** (_number_): The touch id
<a name="x"></a>
- **x** (_number_): The current x position
<a name="y"></a>
- **y** (_number_): The current y position
<a name="screen_x"></a>
- **screen_x** (_number_): The current screen x position
<a name="screen_y"></a>
- **screen_y** (_number_): The current screen y position
<a name="touch_start_pos"></a>
- **touch_start_pos** (_vector3_): The touch start position
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="hover"></a>
- **hover** (_druid.hover_): The component for handling hover events on a node

View File

@ -0,0 +1,144 @@
# druid.hover API
> at /druid/base/hover.lua
The component for handling hover events on a node
## Functions
- [init](#init)
- [set_hover](#set_hover)
- [is_hovered](#is_hovered)
- [set_mouse_hover](#set_mouse_hover)
- [is_mouse_hovered](#is_mouse_hovered)
- [set_click_zone](#set_click_zone)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields
- [node](#node)
- [on_hover](#on_hover)
- [on_mouse_hover](#on_mouse_hover)
- [style](#style)
- [click_zone](#click_zone)
### init
---
```lua
hover:init(node, on_hover_callback, on_mouse_hover)
```
The constructor for the hover component
- **Parameters:**
- `node` *(node)*: Gui node
- `on_hover_callback` *(function)*: Hover callback
- `on_mouse_hover` *(function)*: On mouse hover callback
### set_hover
---
```lua
hover:set_hover([state])
```
Set hover state
- **Parameters:**
- `[state]` *(boolean|nil)*: The hover state
### is_hovered
---
```lua
hover:is_hovered()
```
Return current hover state. True if touch action was on the node at current time
- **Returns:**
- `is_hovered` *(boolean)*: The current hovered state
### set_mouse_hover
---
```lua
hover:set_mouse_hover([state])
```
Set mouse hover state
- **Parameters:**
- `[state]` *(boolean|nil)*: The mouse hover state
### is_mouse_hovered
---
```lua
hover:is_mouse_hovered()
```
Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time
- **Returns:**
- `The` *(boolean)*: current hovered state
### set_click_zone
---
```lua
hover:set_click_zone([zone])
```
Strict hover click area. Useful for no click events outside stencil node
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
### set_enabled
---
```lua
hover:set_enabled([state])
```
Set enable state of hover component.
If hover is not enabled, it will not generate
any hover events
- **Parameters:**
- `[state]` *(boolean|nil)*: The hover enabled state
### is_enabled
---
```lua
hover:is_enabled()
```
Return current hover enabled state
- **Returns:**
- `The` *(boolean)*: hover enabled state
## Fields
<a name="node"></a>
- **node** (_node_): Gui node
<a name="on_hover"></a>
- **on_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Hover event
<a name="on_mouse_hover"></a>
- **on_mouse_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Mouse hover event
<a name="style"></a>
- **style** (_druid.hover.style_): Style of the hover component
<a name="click_zone"></a>
- **click_zone** (_node_): Click zone of the hover component

View File

@ -0,0 +1,395 @@
# druid.scroll API
> at /druid/base/scroll.lua
Basic Druid scroll component. Handles all scrolling behavior in Druid GUI.
### Setup
Create scroll component with druid: `druid:new_scroll(view_node, content_node)`
### Notes
- View_node is the static part that captures user input and recognizes scrolling touches
- Content_node is the dynamic part that will change position according to the scroll system
- Initial scroll size will be equal to content_node size
- The initial view box will be equal to view_node size
- Scroll by default style has inertia and extra size for stretching effect
- You can setup "points of interest" to make scroll always center on closest point
- Scroll events:
- - on_scroll(self, position): On scroll move callback
- - on_scroll_to(self, position, is_instant): On scroll_to function callback
- - on_point_scroll(self, item_index, position): On scroll_to_index function callback
- Multitouch is required for scroll. Scroll correctly handles touch_id swap while dragging
## Functions
- [init](#init)
- [scroll_to](#scroll_to)
- [scroll_to_index](#scroll_to_index)
- [scroll_to_percent](#scroll_to_percent)
- [get_percent](#get_percent)
- [set_size](#set_size)
- [set_view_size](#set_view_size)
- [update_view_size](#update_view_size)
- [set_inert](#set_inert)
- [is_inert](#is_inert)
- [set_extra_stretch_size](#set_extra_stretch_size)
- [get_scroll_size](#get_scroll_size)
- [set_points](#set_points)
- [set_horizontal_scroll](#set_horizontal_scroll)
- [set_vertical_scroll](#set_vertical_scroll)
- [is_node_in_view](#is_node_in_view)
- [bind_grid](#bind_grid)
- [set_click_zone](#set_click_zone)
## Fields
- [node](#node)
- [click_zone](#click_zone)
- [on_scroll](#on_scroll)
- [on_scroll_to](#on_scroll_to)
- [on_point_scroll](#on_point_scroll)
- [view_node](#view_node)
- [view_border](#view_border)
- [content_node](#content_node)
- [view_size](#view_size)
- [position](#position)
- [target_position](#target_position)
- [available_pos](#available_pos)
- [available_size](#available_size)
- [drag](#drag)
- [selected](#selected)
- [is_animate](#is_animate)
- [style](#style)
- [druid](#druid)
- [hover](#hover)
- [points](#points)
- [available_pos_extra](#available_pos_extra)
- [available_size_extra](#available_size_extra)
### init
---
```lua
scroll:init(view_node, content_node)
```
The Scroll constructor
- **Parameters:**
- `view_node` *(string|node)*: GUI view scroll node - the static part that captures user input
- `content_node` *(string|node)*: GUI content scroll node - the dynamic part that will change position
### scroll_to
---
```lua
scroll:scroll_to(point, [is_instant])
```
Start scroll to target point.
- **Parameters:**
- `point` *(vector3)*: Target point
- `[is_instant]` *(boolean|nil)*: Instant scroll flag
### scroll_to_index
---
```lua
scroll:scroll_to_index(index, [skip_cb])
```
Scroll to item in scroll by point index.
- **Parameters:**
- `index` *(number)*: Point index
- `[skip_cb]` *(boolean|nil)*: If true, skip the point callback
### scroll_to_percent
---
```lua
scroll:scroll_to_percent(percent, [is_instant])
```
Start scroll to target scroll percent
- **Parameters:**
- `percent` *(vector3)*: target percent
- `[is_instant]` *(boolean|nil)*: instant scroll flag
### get_percent
---
```lua
scroll:get_percent()
```
Return current scroll progress status.
Values will be in [0..1] interval
- **Returns:**
- `New` *(vector3)*: vector with scroll progress values
### set_size
---
```lua
scroll:set_size(size, [offset])
```
Set scroll content size.
It will change content gui node size
- **Parameters:**
- `size` *(vector3)*: The new size for content node
- `[offset]` *(vector3|nil)*: Offset value to set, where content is starts
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### set_view_size
---
```lua
scroll:set_view_size(size)
```
Set new scroll view size in case the node size was changed.
- **Parameters:**
- `size` *(vector3)*: The new size for view node
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### update_view_size
---
```lua
scroll:update_view_size()
```
Refresh scroll view size, used when view node size is changed
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### set_inert
---
```lua
scroll:set_inert(state)
```
Enable or disable scroll inert
If disabled, scroll through points (if exist)
If no points, just simple drag without inertion
- **Parameters:**
- `state` *(boolean)*: Inert scroll state
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### is_inert
---
```lua
scroll:is_inert()
```
Return if scroll have inertion
- **Returns:**
- `is_inert` *(boolean)*: If scroll have inertion
### set_extra_stretch_size
---
```lua
scroll:set_extra_stretch_size([stretch_size])
```
Set extra size for scroll stretching
Set 0 to disable stretching effect
- **Parameters:**
- `[stretch_size]` *(number|nil)*: Size in pixels of additional scroll area
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### get_scroll_size
---
```lua
scroll:get_scroll_size()
```
Return vector of scroll size with width and height.
- **Returns:**
- `Available` *(vector3)*: scroll size
### set_points
---
```lua
scroll:set_points(points)
```
Set points of interest.
Scroll will always centered on closer points
- **Parameters:**
- `points` *(table)*: Array of vector3 points
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### set_horizontal_scroll
---
```lua
scroll:set_horizontal_scroll(state)
```
Lock or unlock horizontal scroll
- **Parameters:**
- `state` *(boolean)*: True, if horizontal scroll is enabled
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### set_vertical_scroll
---
```lua
scroll:set_vertical_scroll(state)
```
Lock or unlock vertical scroll
- **Parameters:**
- `state` *(boolean)*: True, if vertical scroll is enabled
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### is_node_in_view
---
```lua
scroll:is_node_in_view(node)
```
Check node if it visible now on scroll.
Extra border is not affected. Return true for elements in extra scroll zone
- **Parameters:**
- `node` *(node)*: The node to check
- **Returns:**
- `True` *(boolean)*: if node in visible scroll area
### bind_grid
---
```lua
scroll:bind_grid([grid])
```
Bind the grid component (Static or Dynamic) to recalculate
scroll size on grid changes
- **Parameters:**
- `[grid]` *(druid.grid|nil)*: Druid grid component
- **Returns:**
- `self` *(druid.scroll)*: Current scroll instance
### set_click_zone
---
```lua
scroll:set_click_zone(node)
```
Strict drag scroll area. Useful for
restrict events outside stencil node
- **Parameters:**
- `node` *(string|node)*: Gui node
## Fields
<a name="node"></a>
- **node** (_node_): The root node
<a name="click_zone"></a>
- **click_zone** (_node_): Optional click zone to restrict scroll area
<a name="on_scroll"></a>
- **on_scroll** (_event_): fun(self: druid.scroll, position: vector3) Triggered on scroll move
<a name="on_scroll_to"></a>
- **on_scroll_to** (_event_): fun(self: druid.scroll, target: vector3, is_instant: boolean) Triggered on scroll_to
<a name="on_point_scroll"></a>
- **on_point_scroll** (_event_): fun(self: druid.scroll, index: number, point: vector3) Triggered on scroll_to_index
<a name="view_node"></a>
- **view_node** (_node_): The scroll view node (static part)
<a name="view_border"></a>
- **view_border** (_vector4_): The scroll view borders
<a name="content_node"></a>
- **content_node** (_node_): The scroll content node (moving part)
<a name="view_size"></a>
- **view_size** (_vector3_): Size of the view node
<a name="position"></a>
- **position** (_vector3_): Current scroll position
<a name="target_position"></a>
- **target_position** (_vector3_): Target scroll position for animations
<a name="available_pos"></a>
- **available_pos** (_vector4_): Available content position (min_x, max_y, max_x, min_y)
<a name="available_size"></a>
- **available_size** (_vector3_): Size of available positions (width, height, 0)
<a name="drag"></a>
- **drag** (_druid.drag_): The drag component instance
<a name="selected"></a>
- **selected** (_number_): Current selected point of interest index
<a name="is_animate"></a>
- **is_animate** (_boolean_): True if scroll is animating
<a name="style"></a>
- **style** (_druid.scroll.style_): Component style parameters
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="hover"></a>
- **hover** (_druid.hover_): The component for handling hover events on a node
<a name="points"></a>
- **points** (_table_)
<a name="available_pos_extra"></a>
- **available_pos_extra** (_vector4_)
<a name="available_size_extra"></a>
- **available_size_extra** (_vector3_)

View File

@ -0,0 +1,387 @@
# druid.grid API
> at /druid/base/static_grid.lua
The component for manage the nodes position in the grid with various options
## Functions
- [init](#init)
- [get_pos](#get_pos)
- [get_index](#get_index)
- [get_index_by_node](#get_index_by_node)
- [set_anchor](#set_anchor)
- [refresh](#refresh)
- [set_pivot](#set_pivot)
- [add](#add)
- [set_items](#set_items)
- [remove](#remove)
- [get_size](#get_size)
- [get_size_for](#get_size_for)
- [get_borders](#get_borders)
- [get_all_pos](#get_all_pos)
- [set_position_function](#set_position_function)
- [clear](#clear)
- [get_offset](#get_offset)
- [set_in_row](#set_in_row)
- [set_item_size](#set_item_size)
- [sort_nodes](#sort_nodes)
## Fields
- [on_add_item](#on_add_item)
- [on_remove_item](#on_remove_item)
- [on_change_items](#on_change_items)
- [on_clear](#on_clear)
- [on_update_positions](#on_update_positions)
- [parent](#parent)
- [nodes](#nodes)
- [first_index](#first_index)
- [last_index](#last_index)
- [anchor](#anchor)
- [pivot](#pivot)
- [node_size](#node_size)
- [border](#border)
- [in_row](#in_row)
- [style](#style)
- [node_pivot](#node_pivot)
### init
---
```lua
grid:init(parent, element, [in_row])
```
The constructor for the grid component
- **Parameters:**
- `parent` *(string|node)*: The GUI Node container, where grid's items will be placed
- `element` *(node)*: Element prefab. Need to get it size
- `[in_row]` *(number|nil)*: How many nodes in row can be placed. By default 1
### get_pos
---
```lua
grid:get_pos(index)
```
Return pos for grid node index
- **Parameters:**
- `index` *(number)*: The grid element index
- **Returns:**
- `position` *(vector3)*: Node position
### get_index
---
```lua
grid:get_index(pos)
```
Return grid index by position
- **Parameters:**
- `pos` *(vector3)*: The node position in the grid
- **Returns:**
- `index` *(number)*: The node index
### get_index_by_node
---
```lua
grid:get_index_by_node(node)
```
Return grid index by node
- **Parameters:**
- `node` *(node)*: The gui node in the grid
- **Returns:**
- `index` *(number|nil)*: The node index
### set_anchor
---
```lua
grid:set_anchor(anchor)
```
Set grid anchor. Default anchor is equal to anchor of grid parent node
- **Parameters:**
- `anchor` *(vector3)*: Anchor
### refresh
---
```lua
grid:refresh()
```
Instantly update the grid content
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_pivot
---
```lua
grid:set_pivot(pivot)
```
Set grid pivot
- **Parameters:**
- `pivot` *(constant)*: The new pivot
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### add
---
```lua
grid:add(item, [index], [shift_policy], [is_instant])
```
Add new item to the grid
- **Parameters:**
- `item` *(node)*: GUI node
- `[index]` *(number|nil)*: The item position. By default add as last item
- `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_items
---
```lua
grid:set_items(nodes, [is_instant])
```
Set new items to the grid. All previous items will be removed
- **Parameters:**
- `nodes` *(node[])*: The new grid nodes
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### remove
---
```lua
grid:remove(index, [shift_policy], [is_instant])
```
Remove the item from the grid. Note that gui node will be not deleted
- **Parameters:**
- `index` *(number)*: The grid node index to remove
- `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `node` *(node)*: The deleted gui node from grid
### get_size
---
```lua
grid:get_size()
```
Return grid content size
- **Returns:**
- `size` *(vector3)*: The grid content size
### get_size_for
---
```lua
grid:get_size_for(count)
```
Return grid content size for given count of nodes
- **Parameters:**
- `count` *(number)*: The count of nodes
- **Returns:**
- `size` *(vector3)*: The grid content size
### get_borders
---
```lua
grid:get_borders()
```
Return grid content borders
- **Returns:**
- `borders` *(vector4)*: The grid content borders
### get_all_pos
---
```lua
grid:get_all_pos()
```
Return array of all node positions
- **Returns:**
- `positions` *(vector3[])*: All grid node positions
### set_position_function
---
```lua
grid:set_position_function(callback)
```
Change set position function for grid nodes. It will call on
update poses on grid elements. Default: gui.set_position
- **Parameters:**
- `callback` *(function)*: Function on node set position
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### clear
---
```lua
grid:clear()
```
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
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### get_offset
---
```lua
grid:get_offset()
```
Return StaticGrid offset, where StaticGrid content starts.
- **Returns:**
- `offset` *(vector3)*: The StaticGrid offset
### set_in_row
---
```lua
grid:set_in_row(in_row)
```
Set new in_row elements for grid
- **Parameters:**
- `in_row` *(number)*: The new in_row value
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_item_size
---
```lua
grid:set_item_size([width], [height])
```
Set new node size for grid
- **Parameters:**
- `[width]` *(number|nil)*: The new node width
- `[height]` *(number|nil)*: The new node height
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### sort_nodes
---
```lua
grid:sort_nodes(comparator)
```
Sort grid nodes by custom comparator function
- **Parameters:**
- `comparator` *(function)*: The comparator function. (a, b) -> boolean
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
## Fields
<a name="on_add_item"></a>
- **on_add_item** (_event_): fun(self: druid.grid, item: node, index: number) Trigger on add item event
<a name="on_remove_item"></a>
- **on_remove_item** (_event_): fun(self: druid.grid, index: number) Trigger on remove item event
<a name="on_change_items"></a>
- **on_change_items** (_event_): fun(self: druid.grid, index: number) Trigger on change items event
<a name="on_clear"></a>
- **on_clear** (_event_): fun(self: druid.grid) Trigger on clear event
<a name="on_update_positions"></a>
- **on_update_positions** (_event_): fun(self: druid.grid) Trigger on update positions event
<a name="parent"></a>
- **parent** (_node_): Parent node
<a name="nodes"></a>
- **nodes** (_node[]_): Nodes array
<a name="first_index"></a>
- **first_index** (_number_): First index
<a name="last_index"></a>
- **last_index** (_number_): Last index
<a name="anchor"></a>
- **anchor** (_vector3_): Anchor
<a name="pivot"></a>
- **pivot** (_vector3_): Pivot
<a name="node_size"></a>
- **node_size** (_vector3_): Node size
<a name="border"></a>
- **border** (_vector4_): Border
<a name="in_row"></a>
- **in_row** (_number_): In row
<a name="style"></a>
- **style** (_druid.grid.style_): Style
<a name="node_pivot"></a>
- **node_pivot** (_unknown_)

View File

@ -0,0 +1,349 @@
# druid.text API
> at /druid/base/text.lua
Basic Druid text component. Text components by default have the text size adjusting.
### Setup
Create text node with druid: `text = druid:new_text(node_name, [initial_value], [text_adjust_type])`
### Notes
- Text component by default have auto adjust text sizing. Text never will be bigger, than text node size, which you can setup in GUI scene.
- Text pivot can be changed with `text:set_pivot`, and text will save their position inside their text size box
- There are several text adjust types:
- - **"downscale"** - Change text's scale to fit in the text node size (default)
- - **"trim"** - Trim the text with postfix (default - "...") to fit in the text node size
- - **"no_adjust"** - No any adjust, like default Defold text node
- - **"downscale_limited"** - Change text's scale like downscale, but there is limit for text's scale
- - **"scroll"** - Change text's pivot to imitate scrolling in the text box. Use with stencil node for better effect.
- - **"scale_then_scroll"** - Combine two modes: first limited downscale, then scroll
- - **"trim_left"** - Trim the text with postfix (default - "...") to fit in the text node size
- - **"scale_then_trim"** - Combine two modes: first limited downscale, then trim
- - **"scale_then_trim_left"** - Combine two modes: first limited downscale, then trim left
## Functions
- [init](#init)
- [get_text_size](#get_text_size)
- [get_text_index_by_width](#get_text_index_by_width)
- [set_to](#set_to)
- [set_text](#set_text)
- [get_text](#get_text)
- [set_size](#set_size)
- [set_color](#set_color)
- [set_alpha](#set_alpha)
- [set_scale](#set_scale)
- [set_pivot](#set_pivot)
- [is_multiline](#is_multiline)
- [set_text_adjust](#set_text_adjust)
- [set_minimal_scale](#set_minimal_scale)
- [get_text_adjust](#get_text_adjust)
## Fields
- [node](#node)
- [on_set_text](#on_set_text)
- [on_update_text_scale](#on_update_text_scale)
- [on_set_pivot](#on_set_pivot)
- [style](#style)
- [start_pivot](#start_pivot)
- [start_scale](#start_scale)
- [scale](#scale)
- [pos](#pos)
- [node_id](#node_id)
- [start_size](#start_size)
- [text_area](#text_area)
- [adjust_type](#adjust_type)
- [color](#color)
- [last_value](#last_value)
- [last_scale](#last_scale)
### init
---
```lua
text:init(node, [value], adjust_type)
```
The Text constructor
```lua
adjust_type:
| "downscale"
| "trim"
| "no_adjust"
| "downscale_limited"
| "scroll"
| "scale_then_scroll"
| "trim_left"
| "scale_then_trim"
| "scale_then_trim_left"
```
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Text Node itself
- `[value]` *(string|nil)*: Initial text. Default value is node text from GUI scene. Default: nil
- `adjust_type` *("downscale"|"downscale_limited"|"no_adjust"|"scale_then_scroll"|"scale_then_trim"...(+5))*: Adjust type for text. By default is "downscale". Options: "downscale", "trim", "no_adjust", "downscale_limited", "scroll", "scale_then_scroll", "trim_left", "scale_then_trim", "scale_then_trim_left"
### get_text_size
---
```lua
text:get_text_size([text])
```
Calculate text width with font with respect to trailing space
- **Parameters:**
- `[text]` *(string|nil)*: The text to calculate the size of, if nil - use current text
- **Returns:**
- `width` *(number)*: The text width
- `height` *(number)*: The text height
### get_text_index_by_width
---
```lua
text:get_text_index_by_width(width)
```
Get chars count by width
- **Parameters:**
- `width` *(number)*: The width to get the chars count of
- **Returns:**
- `index` *(number)*: The chars count
### set_to
---
```lua
text:set_to(set_to)
```
Set text to text field
- **Parameters:**
- `set_to` *(string)*: Text for node
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_text
---
```lua
text:set_text([new_text])
```
- **Parameters:**
- `[new_text]` *(any)*:
- **Returns:**
- `` *(druid.text)*:
### get_text
---
```lua
text:get_text()
```
- **Returns:**
- `` *(unknown)*:
### set_size
---
```lua
text:set_size(size)
```
Set text area size
- **Parameters:**
- `size` *(vector3)*: The new text area size
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_color
---
```lua
text:set_color(color)
```
Set color
- **Parameters:**
- `color` *(vector4)*: Color for node
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_alpha
---
```lua
text:set_alpha(alpha)
```
Set alpha
- **Parameters:**
- `alpha` *(number)*: Alpha for node
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_scale
---
```lua
text:set_scale(scale)
```
Set scale
- **Parameters:**
- `scale` *(vector3)*: Scale for node
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_pivot
---
```lua
text:set_pivot(pivot)
```
Set text pivot. Text will re-anchor inside text area
- **Parameters:**
- `pivot` *(userdata)*: The gui.PIVOT_* constant
- **Returns:**
- `self` *(druid.text)*: Current text instance
### is_multiline
---
```lua
text:is_multiline()
```
Return true, if text with line break
- **Returns:**
- `Is` *(boolean)*: text node with line break
### set_text_adjust
---
```lua
text:set_text_adjust(adjust_type, [minimal_scale])
```
Set text adjust, refresh the current text visuals, if needed
```lua
adjust_type:
| "downscale"
| "trim"
| "no_adjust"
| "downscale_limited"
| "scroll"
| "scale_then_scroll"
| "trim_left"
| "scale_then_trim"
| "scale_then_trim_left"
```
- **Parameters:**
- `adjust_type` *("downscale"|"downscale_limited"|"no_adjust"|"scale_then_scroll"|"scale_then_trim"...(+5))*: The adjust type to set, values: "downscale", "trim", "no_adjust", "downscale_limited", "scroll", "scale_then_scroll", "trim_left", "scale_then_trim", "scale_then_trim_left"
- `[minimal_scale]` *(number|nil)*: To remove minimal scale, use `text:set_minimal_scale(nil)`, if pass nil - not change minimal scale
- **Returns:**
- `self` *(druid.text)*: Current text instance
### set_minimal_scale
---
```lua
text:set_minimal_scale(minimal_scale)
```
Set minimal scale for "downscale_limited" or "scale_then_scroll" adjust types
- **Parameters:**
- `minimal_scale` *(number)*: If pass nil - not use minimal scale
- **Returns:**
- `self` *(druid.text)*: Current text instance
### get_text_adjust
---
```lua
text:get_text_adjust()
```
Return current text adjust type
- **Returns:**
- `adjust_type` *(string)*: The current text adjust type
## Fields
<a name="node"></a>
- **node** (_node_): The text node
<a name="on_set_text"></a>
- **on_set_text** (_event_): fun(self: druid.text, text: string) The event triggered when the text is set
<a name="on_update_text_scale"></a>
- **on_update_text_scale** (_event_): fun(self: druid.text, scale: vector3, metrics: table) The event triggered when the text scale is updated
<a name="on_set_pivot"></a>
- **on_set_pivot** (_event_): fun(self: druid.text, pivot: userdata) The event triggered when the text pivot is set
<a name="style"></a>
- **style** (_druid.text.style_): The style of the text
<a name="start_pivot"></a>
- **start_pivot** (_userdata_): The start pivot of the text
<a name="start_scale"></a>
- **start_scale** (_vector3_): The start scale of the text
<a name="scale"></a>
- **scale** (_vector3_): The current scale of the text
<a name="pos"></a>
- **pos** (_unknown_)
<a name="node_id"></a>
- **node_id** (_unknown_)
<a name="start_size"></a>
- **start_size** (_unknown_)
<a name="text_area"></a>
- **text_area** (_unknown_)
<a name="adjust_type"></a>
- **adjust_type** (_string|"downscale"|"downscale_limited"|"no_adjust"|"scale_then_scroll"...(+6)_)
<a name="color"></a>
- **color** (_unknown_)
<a name="last_value"></a>
- **last_value** (_unknown_)
<a name="last_scale"></a>
- **last_scale** (_vector3_)

View File

@ -0,0 +1,168 @@
# druid.rich_input API
> at /druid/custom/rich_input/rich_input.lua
The component that handles a rich text input field, it's a wrapper around the druid.input component
## Functions
- [init](#init)
- [set_placeholder](#set_placeholder)
- [select](#select)
- [set_text](#set_text)
- [set_font](#set_font)
- [get_text](#get_text)
- [set_allowed_characters](#set_allowed_characters)
## Fields
- [root](#root)
- [input](#input)
- [cursor](#cursor)
- [cursor_text](#cursor_text)
- [cursor_position](#cursor_position)
- [druid](#druid)
- [is_lshift](#is_lshift)
- [is_lctrl](#is_lctrl)
- [is_button_input_enabled](#is_button_input_enabled)
- [drag](#drag)
- [placeholder](#placeholder)
- [text_position](#text_position)
### init
---
```lua
rich_input:init(template, nodes)
```
- **Parameters:**
- `template` *(string)*: The template string name
- `nodes` *(table)*: Nodes table from gui.clone_tree
### set_placeholder
---
```lua
rich_input:set_placeholder(placeholder_text)
```
Set placeholder text
- **Parameters:**
- `placeholder_text` *(string)*: The placeholder text
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
### select
---
```lua
rich_input:select()
```
Select input field
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
### set_text
---
```lua
rich_input:set_text(text)
```
Set input field text
- **Parameters:**
- `text` *(string)*: The input text
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
### set_font
---
```lua
rich_input:set_font(font)
```
Set input field font
- **Parameters:**
- `font` *(hash)*: The font hash
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
### get_text
---
```lua
rich_input:get_text()
```
Set input field text
- **Returns:**
- `` *(string)*:
### set_allowed_characters
---
```lua
rich_input:set_allowed_characters(characters)
```
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
- **Parameters:**
- `characters` *(string)*: Regular expression for validate user input
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
## Fields
<a name="root"></a>
- **root** (_node_): The root node of the rich input
<a name="input"></a>
- **input** (_druid.input_): The input component
<a name="cursor"></a>
- **cursor** (_node_): The cursor node
<a name="cursor_text"></a>
- **cursor_text** (_node_): The cursor text node
<a name="cursor_position"></a>
- **cursor_position** (_vector3_): The position of the cursor
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_lshift"></a>
- **is_lshift** (_boolean_)
<a name="is_lctrl"></a>
- **is_lctrl** (_boolean_)
<a name="is_button_input_enabled"></a>
- **is_button_input_enabled** (_unknown_)
<a name="drag"></a>
- **drag** (_druid.drag_): A component that allows you to subscribe to drag events over a node
<a name="placeholder"></a>
- **placeholder** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_position"></a>
- **text_position** (_unknown_)

View File

@ -0,0 +1,153 @@
# druid.rich_text API
> at /druid/custom/rich_text/rich_text.lua
The component that handles a rich text display, allows to custom color, size, font, etc. of the parts of the text
## Functions
- [init](#init)
- [set_text](#set_text)
- [get_text](#get_text)
- [clear](#clear)
- [tagged](#tagged)
- [get_words](#get_words)
- [get_line_metric](#get_line_metric)
## Fields
- [root](#root)
- [text_prefab](#text_prefab)
- [style](#style)
### init
---
```lua
rich_text:init(text_node, [value])
```
- **Parameters:**
- `text_node` *(string|node)*: The text node to make Rich Text
- `[value]` *(string|nil)*: The initial text value. Default will be gui.get_text(text_node)
### set_text
---
```lua
rich_text:set_text([text])
```
Set text for Rich Text
- **Parameters:**
- `[text]` *(string|nil)*: The text to set
- **Returns:**
- `words` *(druid.rich_text.word[])*:
- `line_metrics` *(druid.rich_text.lines_metrics)*:
- **Example Usage:**
```lua
-- Color
rich_text:set_text("color=redFoobar/color")
rich_text:set_text("color=1.0,0,0,1.0Foobar/color")
rich_text:set_text("color=#ff0000Foobar/color")
rich_text:set_text("color=#ff0000ffFoobar/color")
-- Shadow
rich_text:set_text("shadow=redFoobar/shadow")
rich_text:set_text("shadow=1.0,0,0,1.0Foobar/shadow")
rich_text:set_text("shadow=#ff0000Foobar/shadow")
rich_text:set_text("shadow=#ff0000ffFoobar/shadow")
-- Outline
rich_text:set_text("outline=redFoobar/outline")
rich_text:set_text("outline=1.0,0,0,1.0Foobar/outline")
rich_text:set_text("outline=#ff0000Foobar/outline")
rich_text:set_text("outline=#ff0000ffFoobar/outline")
-- Font
rich_text:set_text("font=MyCoolFontFoobar/font")
-- Size
rich_text:set_text("size=2Twice as large/size")
-- Line break
rich_text:set_text("br/Insert a line break")
-- No break
rich_text:set_text("nobrPrevent the text from breaking")
-- Image
rich_text:set_text("img=texture:imageDisplay image")
rich_text:set_text("img=texture:image,sizeDisplay image with size")
rich_text:set_text("img=texture:image,width,heightDisplay image with width and height")
```
### get_text
---
```lua
rich_text:get_text()
```
Get the current text of the rich text
- **Returns:**
- `text` *(string)*: The current text of the rich text
### clear
---
```lua
rich_text:clear()
```
Clear all created words.
### tagged
---
```lua
rich_text:tagged(tag)
```
Get all words, which has a passed tag.
- **Parameters:**
- `tag` *(string)*: The tag to get the words for
- **Returns:**
- `words` *(druid.rich_text.word[])*: The words with the passed tag
### get_words
---
```lua
rich_text:get_words()
```
Get all current created words, each word is a table that contains the information about the word
- **Returns:**
- `` *(druid.rich_text.word[])*:
### get_line_metric
---
```lua
rich_text:get_line_metric()
```
Get the current line metrics
- **Returns:**
- `lines_metrics` *(druid.rich_text.lines_metrics)*: The line metrics of the rich text
## Fields
<a name="root"></a>
- **root** (_node_): The root node of the rich text
<a name="text_prefab"></a>
- **text_prefab** (_node_): The text prefab node
<a name="style"></a>
- **style** (_table_)

View File

@ -0,0 +1,394 @@
# druid.container API
> at /druid/extended/container.lua
Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
### Setup
Create container component with druid: `container = druid:new_container(node, mode, callback)`
### Notes
- Container can be used to create adaptable layouts that respond to window size changes
- Container supports different layout modes: FIT, STRETCH, STRETCH_X, STRETCH_Y
- Container can be nested inside other containers
- Container supports fixed margins and percentage-based sizing
- Container can be positioned using pivot points
- Container supports minimum size constraints
- Container can be fitted into window or custom size
## Functions
- [init](#init)
- [refresh_origins](#refresh_origins)
- [set_pivot](#set_pivot)
- [set_size](#set_size)
- [get_position](#get_position)
- [set_position](#set_position)
- [get_size](#get_size)
- [get_scale](#get_scale)
- [fit_into_size](#fit_into_size)
- [fit_into_window](#fit_into_window)
- [add_container](#add_container)
- [remove_container_by_node](#remove_container_by_node)
- [set_parent_container](#set_parent_container)
- [refresh](#refresh)
- [refresh_scale](#refresh_scale)
- [update_child_containers](#update_child_containers)
- [create_draggable_corners](#create_draggable_corners)
- [clear_draggable_corners](#clear_draggable_corners)
- [fit_into_node](#fit_into_node)
- [set_min_size](#set_min_size)
- [set_max_size](#set_max_size)
## Fields
- [node](#node)
- [druid](#druid)
- [node_offset](#node_offset)
- [origin_size](#origin_size)
- [size](#size)
- [origin_position](#origin_position)
- [position](#position)
- [pivot_offset](#pivot_offset)
- [center_offset](#center_offset)
- [mode](#mode)
- [fit_size](#fit_size)
- [min_size_x](#min_size_x)
- [min_size_y](#min_size_y)
- [max_size_x](#max_size_x)
- [max_size_y](#max_size_y)
- [on_size_changed](#on_size_changed)
- [node_fill_x](#node_fill_x)
- [node_fill_y](#node_fill_y)
- [x_koef](#x_koef)
- [y_koef](#y_koef)
- [x_anchor](#x_anchor)
- [y_anchor](#y_anchor)
- [style](#style)
### init
---
```lua
container:init(node, mode, [callback])
```
The Container constructor
- **Parameters:**
- `node` *(node)*: Gui node
- `mode` *(string)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
### refresh_origins
---
```lua
container:refresh_origins()
```
Refresh the origins of the container, origins is the size and position of the container when it was created
### set_pivot
---
```lua
container:set_pivot(pivot)
```
Set the pivot of the container
- **Parameters:**
- `pivot` *(constant)*: The pivot to set
### set_size
---
```lua
container:set_size([width], [height], [anchor_pivot])
```
Set new size of layout node
- **Parameters:**
- `[width]` *(number|nil)*: The width to set
- `[height]` *(number|nil)*: The height to set
- `[anchor_pivot]` *(constant|nil)*: If set will keep the corner position relative to the new size
- **Returns:**
- `Container` *(druid.container)*:
### get_position
---
```lua
container:get_position()
```
Get the position of the container
- **Returns:**
- `position` *(vector3)*: The position of the container
### set_position
---
```lua
container:set_position(pos_x, pos_y)
```
Set the position of the container
- **Parameters:**
- `pos_x` *(number)*: The x position to set
- `pos_y` *(number)*: The y position to set
### get_size
---
```lua
container:get_size()
```
Get the current size of the layout node
- **Returns:**
- `size` *(vector3)*: The current size of the layout node
### get_scale
---
```lua
container:get_scale()
```
Get the current scale of the layout node
- **Returns:**
- `scale` *(vector3)*: The current scale of the layout node
### fit_into_size
---
```lua
container:fit_into_size(target_size)
```
Set size for layout node to fit inside it
- **Parameters:**
- `target_size` *(vector3)*: The target size to fit into
- **Returns:**
- `self` *(druid.container)*: Current container instance
### fit_into_window
---
```lua
container:fit_into_window()
```
Set current size for layout node to fit inside it
- **Returns:**
- `self` *(druid.container)*: Current container instance
### add_container
---
```lua
container:add_container(node_or_container, [mode], [on_resize_callback])
```
- **Parameters:**
- `node_or_container` *(string|table|druid.container|node)*: The node or container to add
- `[mode]` *(string|nil)*: stretch, fit, stretch_x, stretch_y. Default: Pick from node, "fit" or "stretch"
- `[on_resize_callback]` *(fun(self: userdata, size: vector3)|nil)*:
- **Returns:**
- `Container` *(druid.container)*: New created layout instance
### remove_container_by_node
---
```lua
container:remove_container_by_node([node])
```
- **Parameters:**
- `[node]` *(any)*:
- **Returns:**
- `` *(druid.container|nil)*:
### set_parent_container
---
```lua
container:set_parent_container([parent_container])
```
- **Parameters:**
- `[parent_container]` *(druid.container|nil)*: Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
### refresh
---
```lua
container:refresh()
```
### refresh_scale
---
```lua
container:refresh_scale()
```
### update_child_containers
---
```lua
container:update_child_containers()
```
### create_draggable_corners
---
```lua
container:create_draggable_corners()
```
- **Returns:**
- `self` *(druid.container)*: Current container instance
### clear_draggable_corners
---
```lua
container:clear_draggable_corners()
```
- **Returns:**
- `self` *(druid.container)*: Current container instance
### fit_into_node
---
```lua
container:fit_into_node(node)
```
Set node for layout node to fit inside it. Pass nil to reset
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- `self` *(druid.container)*: Current container instance
### set_min_size
---
```lua
container:set_min_size([min_size_x], [min_size_y])
```
Set the minimum size of the container
- **Parameters:**
- `[min_size_x]` *(number|nil)*: The minimum size x
- `[min_size_y]` *(number|nil)*: The minimum size y
- **Returns:**
- `self` *(druid.container)*: Current container instance
### set_max_size
---
```lua
container:set_max_size([max_size_x], [max_size_y])
```
Set the maximum size of the container
- **Parameters:**
- `[max_size_x]` *(number|nil)*: The maximum size x
- `[max_size_y]` *(number|nil)*: The maximum size y
- **Returns:**
- `self` *(druid.container)*: Current container instance
## Fields
<a name="node"></a>
- **node** (_node_): The gui node
<a name="druid"></a>
- **druid** (_druid.instance_): The druid instance
<a name="node_offset"></a>
- **node_offset** (_vector4_): The node offset
<a name="origin_size"></a>
- **origin_size** (_vector3_): The origin size
<a name="size"></a>
- **size** (_vector3_): The current size
<a name="origin_position"></a>
- **origin_position** (_vector3_): The origin position
<a name="position"></a>
- **position** (_vector3_): The current position
<a name="pivot_offset"></a>
- **pivot_offset** (_vector3_): The pivot offset
<a name="center_offset"></a>
- **center_offset** (_vector3_): The center offset
<a name="mode"></a>
- **mode** (_string_): The layout mode
<a name="fit_size"></a>
- **fit_size** (_vector3_): The fit size
<a name="min_size_x"></a>
- **min_size_x** (_number_): The minimum size x
<a name="min_size_y"></a>
- **min_size_y** (_number_): The minimum size y
<a name="max_size_x"></a>
- **max_size_x** (_number_): The maximum size x
<a name="max_size_y"></a>
- **max_size_y** (_number_): The maximum size y
<a name="on_size_changed"></a>
- **on_size_changed** (_event_): fun(self: druid.container, size: vector3) The event triggered when the size changes
<a name="node_fill_x"></a>
- **node_fill_x** (_nil_)
<a name="node_fill_y"></a>
- **node_fill_y** (_nil_)
<a name="x_koef"></a>
- **x_koef** (_number_)
<a name="y_koef"></a>
- **y_koef** (_number_)
<a name="x_anchor"></a>
- **x_anchor** (_unknown_)
<a name="y_anchor"></a>
- **y_anchor** (_unknown_)
<a name="style"></a>
- **style** (_table_)

View File

@ -0,0 +1,239 @@
# druid.data_list API
> at /druid/extended/data_list.lua
Druid component to manage a list of data with a scrollable view, used to manage huge list data and render only visible elements.
### Setup
Create data list component with druid: `data_list = druid:new_data_list(scroll, grid, create_function)`
### Notes
- Data List uses a scroll component for scrolling and a grid component for layout
- Data List only renders visible elements for better performance
- Data List supports caching of elements for better performance
- Data List supports adding, removing and updating elements
- Data List supports scrolling to specific elements
- Data List supports custom element creation and cleanup
## Functions
- [init](#init)
- [set_use_cache](#set_use_cache)
- [set_data](#set_data)
- [get_data](#get_data)
- [add](#add)
- [remove](#remove)
- [remove_by_data](#remove_by_data)
- [clear](#clear)
- [get_index](#get_index)
- [get_created_nodes](#get_created_nodes)
- [get_created_components](#get_created_components)
- [scroll_to_index](#scroll_to_index)
## Fields
- [scroll](#scroll)
- [grid](#grid)
- [on_scroll_progress_change](#on_scroll_progress_change)
- [on_element_add](#on_element_add)
- [on_element_remove](#on_element_remove)
- [top_index](#top_index)
- [last_index](#last_index)
- [scroll_progress](#scroll_progress)
### init
---
```lua
data_list:init(scroll, grid, create_function)
```
The DataList constructor
- **Parameters:**
- `scroll` *(druid.scroll)*: The Scroll instance for Data List component
- `grid` *(druid.grid)*: The StaticGrid instance for Data List component
- `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
### set_use_cache
---
```lua
data_list:set_use_cache(is_use_cache)
```
Set use cache version of DataList. Requires make setup of components in on_element_add callback and clean in on_element_remove
- **Parameters:**
- `is_use_cache` *(boolean)*: Use cache version of DataList
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### set_data
---
```lua
data_list:set_data(data)
```
Set new data set for DataList component
- **Parameters:**
- `data` *(table)*: The new data array
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### get_data
---
```lua
data_list:get_data()
```
Return current data from DataList component
- **Returns:**
- `data` *(table)*: The current data array
### add
---
```lua
data_list:add(data, [index], [shift_policy])
```
Add element to DataList
- **Parameters:**
- `data` *(table)*: The data to add
- `[index]` *(number|nil)*: The index to add the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove
---
```lua
data_list:remove([index], [shift_policy])
```
Remove element from DataList
- **Parameters:**
- `[index]` *(number|nil)*: The index to remove the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove_by_data
---
```lua
data_list:remove_by_data(data, [shift_policy])
```
Remove element from DataList by data value
- **Parameters:**
- `data` *(table)*: The data to remove
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### clear
---
```lua
data_list:clear()
```
Clear the DataList and refresh visuals
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### get_index
---
```lua
data_list:get_index(data)
```
Return index for data value
- **Parameters:**
- `data` *(table)*:
- **Returns:**
- `` *(unknown|nil)*:
### get_created_nodes
---
```lua
data_list:get_created_nodes()
```
Return all currently created nodes in DataList
- **Returns:**
- `List` *(node[])*: of created nodes
### get_created_components
---
```lua
data_list:get_created_components()
```
Return all currently created components in DataList
- **Returns:**
- `components` *(druid.component[])*: List of created components
### scroll_to_index
---
```lua
data_list:scroll_to_index(index)
```
Instant scroll to element with passed index
- **Parameters:**
- `index` *(number)*: The index to scroll to
## Fields
<a name="scroll"></a>
- **scroll** (_druid.scroll_): The scroll instance for Data List component
<a name="grid"></a>
- **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component
<a name="on_scroll_progress_change"></a>
- **on_scroll_progress_change** (_event_): fun(self: druid.data_list, progress: number) The event triggered when the scroll progress changes
<a name="on_element_add"></a>
- **on_element_add** (_event_): fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when a new element is added
<a name="on_element_remove"></a>
- **on_element_remove** (_event_): fun(self: druid.data_list, index: number, node: node, instance: druid.component, data: table) The event triggered when an element is removed
<a name="top_index"></a>
- **top_index** (_number_): The top index of the visible elements
<a name="last_index"></a>
- **last_index** (_number_): The last index of the visible elements
<a name="scroll_progress"></a>
- **scroll_progress** (_number_): The scroll progress

View File

@ -0,0 +1,102 @@
# druid.hotkey API
> at /druid/extended/hotkey.lua
Druid component to manage hotkeys and trigger callbacks when hotkeys are pressed.
### Setup
Create hotkey component with druid: `hotkey = druid:new_hotkey(keys, callback, callback_argument)`
### Notes
- Hotkey can be triggered by pressing a single key or a combination of keys
- Hotkey supports modificator keys (e.g. Ctrl, Shift, Alt)
- Hotkey can be triggered on key press, release or repeat
- Hotkey can be added or removed at runtime
- Hotkey can be enabled or disabled
- Hotkey can be set to repeat on key hold
## Functions
- [init](#init)
- [add_hotkey](#add_hotkey)
- [is_processing](#is_processing)
- [set_repeat](#set_repeat)
## Fields
- [on_hotkey_pressed](#on_hotkey_pressed)
- [on_hotkey_released](#on_hotkey_released)
- [style](#style)
- [druid](#druid)
### init
---
```lua
hotkey:init(keys, callback, [callback_argument])
```
The Hotkey constructor
- **Parameters:**
- `keys` *(string|string[])*: The keys to be pressed for trigger callback. Should contains one key and any modificator keys
- `callback` *(function)*: The callback function
- `[callback_argument]` *(any)*: The argument to pass into the callback function
### add_hotkey
---
```lua
hotkey:add_hotkey(keys, [callback_argument])
```
Add hotkey for component callback
- **Parameters:**
- `keys` *(string|hash|hash[]|string[])*: that have to be pressed before key pressed to activate
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- `self` *(druid.hotkey)*: Current instance
### is_processing
---
```lua
hotkey:is_processing()
```
- **Returns:**
- `` *(boolean)*:
### set_repeat
---
```lua
hotkey:set_repeat(is_enabled_repeated)
```
If true, the callback will be triggered on action.repeated
- **Parameters:**
- `is_enabled_repeated` *(boolean)*: The flag value
- **Returns:**
- `self` *(druid.hotkey)*: Current instance
## Fields
<a name="on_hotkey_pressed"></a>
- **on_hotkey_pressed** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is pressed
<a name="on_hotkey_released"></a>
- **on_hotkey_released** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is released
<a name="style"></a>
- **style** (_druid.hotkey.style_): The style of the hotkey component
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components

View File

@ -0,0 +1,307 @@
# druid.input API
> at /druid/extended/input.lua
Basic Druid text input component. Handles user text input via component with button and text.
### Setup
Create input component with druid: `input = druid:new_input(button_node_name, text_node_name, keyboard_type)`
### Notes
- Input component handles user text input. Input contains button and text components
- Button needed for selecting/unselecting input field
- Click outside of button to unselect input field
- On focus lost (game minimized) input field will be unselected
- You can setup max length of the text
- You can setup allowed characters. On add not allowed characters `on_input_wrong` will be called
## Functions
- [init](#init)
- [get_text_selected](#get_text_selected)
- [get_text_selected_replaced](#get_text_selected_replaced)
- [set_text](#set_text)
- [select](#select)
- [unselect](#unselect)
- [get_text](#get_text)
- [set_max_length](#set_max_length)
- [set_allowed_characters](#set_allowed_characters)
- [reset_changes](#reset_changes)
- [select_cursor](#select_cursor)
- [move_selection](#move_selection)
## Fields
- [on_input_select](#on_input_select)
- [on_input_unselect](#on_input_unselect)
- [on_input_text](#on_input_text)
- [on_input_empty](#on_input_empty)
- [on_input_full](#on_input_full)
- [on_input_wrong](#on_input_wrong)
- [on_select_cursor_change](#on_select_cursor_change)
- [style](#style)
- [druid](#druid)
- [text](#text)
- [is_selected](#is_selected)
- [value](#value)
- [previous_value](#previous_value)
- [current_value](#current_value)
- [marked_value](#marked_value)
- [is_empty](#is_empty)
- [text_width](#text_width)
- [market_text_width](#market_text_width)
- [total_width](#total_width)
- [cursor_index](#cursor_index)
- [start_index](#start_index)
- [end_index](#end_index)
- [max_length](#max_length)
- [allowed_characters](#allowed_characters)
- [keyboard_type](#keyboard_type)
- [button](#button)
- [marked_text_width](#marked_text_width)
### init
---
```lua
input:init(click_node, text_node, [keyboard_type])
```
- **Parameters:**
- `click_node` *(node)*: Node to enabled input component
- `text_node` *(druid.text|node)*: Text node what will be changed on user input. You can pass text component instead of text node name Text
- `[keyboard_type]` *(constant|nil)*: Gui keyboard type for input field
### get_text_selected
---
```lua
input:get_text_selected()
```
- **Returns:**
- `` *(string|unknown)*:
### get_text_selected_replaced
---
```lua
input:get_text_selected_replaced(text)
```
Replace selected text with new text
- **Parameters:**
- `text` *(string)*: The text to replace selected text
- **Returns:**
- `new_text` *(string)*: New input text
### set_text
---
```lua
input:set_text([input_text])
```
Set text for input field
- **Parameters:**
- `[input_text]` *(string?)*: The string to apply for input field, if nil - will be set to empty string
### select
---
```lua
input:select()
```
Select input field. It will show the keyboard and trigger on_select events
### unselect
---
```lua
input:unselect()
```
Remove selection from input. It will hide the keyboard and trigger on_unselect events
### get_text
---
```lua
input:get_text()
```
Return current input field text
- **Returns:**
- `text` *(string)*: The current input field text
### set_max_length
---
```lua
input:set_max_length(max_length)
```
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
- **Parameters:**
- `max_length` *(number)*: Maximum length for input text field
- **Returns:**
- `self` *(druid.input)*: Current input instance
### set_allowed_characters
---
```lua
input:set_allowed_characters(characters)
```
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
ex: [abcdef] to allow only these characters
ex: [^%s] to allow only non-space characters
- **Parameters:**
- `characters` *(string)*: Regular expression for validate user input
- **Returns:**
- `self` *(druid.input)*: Current input instance
### reset_changes
---
```lua
input:reset_changes()
```
Reset current input selection and return previous value
- **Returns:**
- `self` *(druid.input)*: Current input instance
### select_cursor
---
```lua
input:select_cursor([cursor_index], [start_index], [end_index])
```
Set cursor position in input field
- **Parameters:**
- `[cursor_index]` *(number|nil)*: Cursor index for cursor position, if nil - will be set to the end of the text
- `[start_index]` *(number|nil)*: Start index for cursor position, if nil - will be set to the end of the text
- `[end_index]` *(number|nil)*: End index for cursor position, if nil - will be set to the start_index
- **Returns:**
- `self` *(druid.input)*: Current input instance
### move_selection
---
```lua
input:move_selection(delta, is_add_to_selection, is_move_to_end)
```
Change cursor position by delta
- **Parameters:**
- `delta` *(number)*: side for cursor position, -1 for left, 1 for right
- `is_add_to_selection` *(boolean)*: (Shift key)
- `is_move_to_end` *(boolean)*: (Ctrl key)
- **Returns:**
- `self` *(druid.input)*: Current input instance
## Fields
<a name="on_input_select"></a>
- **on_input_select** (_event_): fun(self: druid.input, input: druid.input) The event triggered when the input field is selected
<a name="on_input_unselect"></a>
- **on_input_unselect** (_event_): fun(self: druid.input, text: string, input: druid.input) The event triggered when the input field is unselected
<a name="on_input_text"></a>
- **on_input_text** (_event_): fun(self: druid.input) The event triggered when the input field is changed
<a name="on_input_empty"></a>
- **on_input_empty** (_event_): fun(self: druid.input) The event triggered when the input field is empty
<a name="on_input_full"></a>
- **on_input_full** (_event_): fun(self: druid.input) The event triggered when the input field is full
<a name="on_input_wrong"></a>
- **on_input_wrong** (_event_): fun(self: druid.input) The event triggered when the input field is wrong
<a name="on_select_cursor_change"></a>
- **on_select_cursor_change** (_event_): fun(self: druid.input, cursor_index: number, start_index: number, end_index: number) The event triggered when the cursor index is changed
<a name="style"></a>
- **style** (_druid.input.style_): The style of the input component
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="text"></a>
- **text** (_druid.text|node_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="is_selected"></a>
- **is_selected** (_boolean_)
<a name="value"></a>
- **value** (_unknown_)
<a name="previous_value"></a>
- **previous_value** (_unknown_)
<a name="current_value"></a>
- **current_value** (_unknown_)
<a name="marked_value"></a>
- **marked_value** (_string_)
<a name="is_empty"></a>
- **is_empty** (_boolean_)
<a name="text_width"></a>
- **text_width** (_integer_)
<a name="market_text_width"></a>
- **market_text_width** (_integer_)
<a name="total_width"></a>
- **total_width** (_integer_)
<a name="cursor_index"></a>
- **cursor_index** (_integer_)
<a name="start_index"></a>
- **start_index** (_number_)
<a name="end_index"></a>
- **end_index** (_number_)
<a name="max_length"></a>
- **max_length** (_nil_)
<a name="allowed_characters"></a>
- **allowed_characters** (_nil_)
<a name="keyboard_type"></a>
- **keyboard_type** (_constant_)
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="marked_text_width"></a>
- **marked_text_width** (_number_)

View File

@ -0,0 +1,122 @@
# druid.lang_text API
> at /druid/extended/lang_text.lua
The component used for displaying localized text, can automatically update text when locale is changed.
It wraps the Text component to handle localization using druid's get_text_function to set text by its id.
### Setup
Create lang text component with druid: `text = druid:new_lang_text(node_name, locale_id)`
### Notes
- Component automatically updates text when locale is changed
- Uses druid's get_text_function to get localized text by id
- Supports string formatting with additional parameters
## Functions
- [init](#init)
- [set_to](#set_to)
- [set_text](#set_text)
- [translate](#translate)
- [format](#format)
## Fields
- [text](#text)
- [node](#node)
- [on_change](#on_change)
- [druid](#druid)
### init
---
```lua
lang_text:init(node, [locale_id], [adjust_type])
```
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- `[locale_id]` *(string|nil)*: Default locale id or text from node as default. If not provided, will use text from the node
- `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
- **Returns:**
- `` *(druid.lang_text)*:
### set_to
---
```lua
lang_text:set_to(text)
```
Setup raw text to lang_text component. This will clear any locale settings.
- **Parameters:**
- `text` *(string)*: Text for text node
- **Returns:**
- `self` *(druid.lang_text)*: Current instance
### set_text
---
```lua
lang_text:set_text(text)
```
Setup raw text to lang_text component. This will clear any locale settings.
- **Parameters:**
- `text` *(string)*: Text for text node
- **Returns:**
- `self` *(druid.lang_text)*: Current instance
### translate
---
```lua
lang_text:translate(locale_id, ...)
```
Translate the text by locale_id. The text will be automatically updated when locale changes.
- **Parameters:**
- `locale_id` *(string)*: Locale id to get text from
- `...` *(...)*: vararg
- **Returns:**
- `self` *(druid.lang_text)*: Current instance
### format
---
```lua
lang_text:format(...)
```
Format string with new text params on localized text. Keeps the current locale but updates the format parameters.
- **Parameters:**
- `...` *(...)*: vararg
- **Returns:**
- `self` *(druid.lang_text)*: Current instance
## Fields
<a name="text"></a>
- **text** (_druid.text_): The text component
<a name="node"></a>
- **node** (_node_): The node of the text component
<a name="on_change"></a>
- **on_change** (_event_): fun(self: druid.lang_text) The event triggered when the text is changed
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components

View File

@ -0,0 +1,344 @@
# druid.layout API
> at /druid/extended/layout.lua
Druid component to manage the layout of nodes, placing them inside the node size with respect to the size and pivot of each node.
### Setup
Create layout component with druid: `layout = druid:new_layout(node, layout_type)`
### Notes
- Layout can be horizontal, vertical or horizontal with wrapping
- Layout can resize parent node to fit content
- Layout can justify content
- Layout supports margins and padding
- Layout automatically updates when nodes are added or removed
- Layout can be manually updated by calling set_dirty()
## Functions
- [init](#init)
- [update](#update)
- [get_entities](#get_entities)
- [set_node_index](#set_node_index)
- [set_margin](#set_margin)
- [set_padding](#set_padding)
- [set_dirty](#set_dirty)
- [set_justify](#set_justify)
- [set_type](#set_type)
- [set_hug_content](#set_hug_content)
- [add](#add)
- [remove](#remove)
- [get_size](#get_size)
- [get_content_size](#get_content_size)
- [refresh_layout](#refresh_layout)
- [clear_layout](#clear_layout)
- [get_node_size](#get_node_size)
- [calculate_rows_data](#calculate_rows_data)
- [set_node_position](#set_node_position)
## Fields
- [node](#node)
- [rows_data](#rows_data)
- [is_dirty](#is_dirty)
- [entities](#entities)
- [margin](#margin)
- [padding](#padding)
- [type](#type)
- [is_resize_width](#is_resize_width)
- [is_resize_height](#is_resize_height)
- [is_justify](#is_justify)
- [on_size_changed](#on_size_changed)
- [size](#size)
### init
---
```lua
layout:init(node_or_node_id, layout_type)
```
```lua
layout_type:
| "horizontal"
| "vertical"
| "horizontal_wrap"
```
- **Parameters:**
- `node_or_node_id` *(string|node)*: The node to manage the layout of
- `layout_type` *("horizontal"|"horizontal_wrap"|"vertical")*: The type of layout (horizontal, vertical, horizontal_wrap)
### update
---
```lua
layout:update()
```
### get_entities
---
```lua
layout:get_entities()
```
- **Returns:**
- `entities` *(node[])*: The entities to manage the layout of
### set_node_index
---
```lua
layout:set_node_index(node, index)
```
- **Parameters:**
- `node` *(node)*: The node to set the index of
- `index` *(number)*: The index to set the node to
- **Returns:**
- `self` *(druid.layout)*: for chaining
### set_margin
---
```lua
layout:set_margin([margin_x], [margin_y])
```
Set the margin of the layout
- **Parameters:**
- `[margin_x]` *(number|nil)*: The margin x
- `[margin_y]` *(number|nil)*: The margin y
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### set_padding
---
```lua
layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
```
- **Parameters:**
- `[padding_x]` *(number|nil)*: The padding x
- `[padding_y]` *(number|nil)*: The padding y
- `[padding_z]` *(number|nil)*: The padding z
- `[padding_w]` *(number|nil)*: The padding w
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### set_dirty
---
```lua
layout:set_dirty()
```
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### set_justify
---
```lua
layout:set_justify(is_justify)
```
- **Parameters:**
- `is_justify` *(boolean)*:
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### set_type
---
```lua
layout:set_type(layout_type)
```
```lua
layout_type:
| "horizontal"
| "vertical"
| "horizontal_wrap"
```
- **Parameters:**
- `layout_type` *("horizontal"|"horizontal_wrap"|"vertical")*:
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### set_hug_content
---
```lua
layout:set_hug_content(is_hug_width, is_hug_height)
```
- **Parameters:**
- `is_hug_width` *(boolean)*:
- `is_hug_height` *(boolean)*:
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### add
---
```lua
layout:add(node_or_node_id)
```
Add node to layout
- **Parameters:**
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### remove
---
```lua
layout:remove(node_or_node_id)
```
Remove node from layout
- **Parameters:**
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- `self` *(druid.layout)*: for chaining
### get_size
---
```lua
layout:get_size()
```
- **Returns:**
- `` *(vector3)*:
### get_content_size
---
```lua
layout:get_content_size()
```
- **Returns:**
- `` *(number)*:
- `` *(number)*:
### refresh_layout
---
```lua
layout:refresh_layout()
```
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### clear_layout
---
```lua
layout:clear_layout()
```
- **Returns:**
- `self` *(druid.layout)*: Current layout instance
### get_node_size
---
```lua
layout:get_node_size(node)
```
- **Parameters:**
- `node` *(node)*:
- **Returns:**
- `width` *(number)*: The width of the node
- `height` *(number)*: The height of the node
### calculate_rows_data
---
```lua
layout:calculate_rows_data()
```
Calculate rows data for layout. Contains total width, height and rows info (width, height, count of elements in row)
- **Returns:**
- `` *(druid.layout.rows_data)*:
### set_node_position
---
```lua
layout:set_node_position(node, x, y)
```
- **Parameters:**
- `node` *(node)*:
- `x` *(number)*:
- `y` *(number)*:
- **Returns:**
- `` *(node)*:
## Fields
<a name="node"></a>
- **node** (_node_): The node to manage the layout of
<a name="rows_data"></a>
- **rows_data** (_druid.layout.rows_data_): Last calculated rows data
<a name="is_dirty"></a>
- **is_dirty** (_boolean_): True if layout needs to be updated
<a name="entities"></a>
- **entities** (_node[]_): The entities to manage the layout of
<a name="margin"></a>
- **margin** (_{ x: number, y: number }_): The margin of the layout
<a name="padding"></a>
- **padding** (_vector4_): The padding of the layout
<a name="type"></a>
- **type** (_string_): The type of the layout
<a name="is_resize_width"></a>
- **is_resize_width** (_boolean_): True if the layout should resize the width of the node
<a name="is_resize_height"></a>
- **is_resize_height** (_boolean_): True if the layout should resize the height of the node
<a name="is_justify"></a>
- **is_justify** (_boolean_): True if the layout should justify the nodes
<a name="on_size_changed"></a>
- **on_size_changed** (_event.on_size_changed_): fun(self: druid.layout, size: vector3) The event triggered when the size of the layout is changed
<a name="size"></a>
- **size** (_unknown_)

View File

@ -0,0 +1,215 @@
# druid.progress API
> at /druid/extended/progress.lua
Basic Druid progress bar component. Changes the size or scale of a node to represent progress.
### Setup
Create progress bar component with druid: `progress = druid:new_progress(node_name, key, init_value)`
### Notes
- Node should have maximum node size in GUI scene, it represents the progress bar's maximum size
- Key is value from druid const: "x" or "y"
- Progress works correctly with 9slice nodes, it tries to set size by _set_size_ first until minimum size is reached, then it continues sizing via _set_scale_
- Progress bar can fill only by vertical or horizontal size. For diagonal progress bar, just rotate the node in GUI scene
- If you have glitchy or dark texture bugs with progress bar, try to disable mipmaps in your texture profiles
## Functions
- [init](#init)
- [update](#update)
- [fill](#fill)
- [empty](#empty)
- [set_to](#set_to)
- [get](#get)
- [set_steps](#set_steps)
- [to](#to)
- [set_max_size](#set_max_size)
## Fields
- [node](#node)
- [on_change](#on_change)
- [style](#style)
- [key](#key)
- [prop](#prop)
- [scale](#scale)
- [size](#size)
- [max_size](#max_size)
- [slice](#slice)
- [last_value](#last_value)
- [slice_size](#slice_size)
- [target](#target)
- [steps](#steps)
- [step_callback](#step_callback)
- [target_callback](#target_callback)
### init
---
```lua
progress:init(node, key, [init_value])
```
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- `key` *(string)*: Progress bar direction: "x" or "y"
- `[init_value]` *(number|nil)*: Initial value of progress bar (0 to 1). Default: 1
### update
---
```lua
progress:update(dt)
```
- **Parameters:**
- `dt` *(number)*: Delta time
### fill
---
```lua
progress:fill()
```
Fill the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### empty
---
```lua
progress:empty()
```
Empty the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_to
---
```lua
progress:set_to(to)
```
Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### get
---
```lua
progress:get()
```
Return the current value of the progress bar
- **Returns:**
- `value` *(number)*: The current value of the progress bar
### set_steps
---
```lua
progress:set_steps(steps, callback)
```
Set points on progress bar to fire the callback
- **Parameters:**
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### to
---
```lua
progress:to(to, [callback])
```
Start animation of a progress bar
- **Parameters:**
- `to` *(number)*: value between 0..1
- `[callback]` *(function|nil)*: Callback on animation ends
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_max_size
---
```lua
progress:set_max_size(max_size)
```
Set progress bar max node size
- **Parameters:**
- `max_size` *(vector3)*: The new node maximum (full) size
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
## Fields
<a name="node"></a>
- **node** (_node_): The progress bar node
<a name="on_change"></a>
- **on_change** (_event_): fun(self: druid.progress, value: number) Event triggered when progress value changes
<a name="style"></a>
- **style** (_druid.progress.style_): Component style parameters
<a name="key"></a>
- **key** (_string_): Progress bar direction: "x" or "y"
<a name="prop"></a>
- **prop** (_hash_): Property for scaling the progress bar
<a name="scale"></a>
- **scale** (_unknown_)
<a name="size"></a>
- **size** (_unknown_)
<a name="max_size"></a>
- **max_size** (_unknown_)
<a name="slice"></a>
- **slice** (_unknown_)
<a name="last_value"></a>
- **last_value** (_number_)
<a name="slice_size"></a>
- **slice_size** (_unknown_)
<a name="target"></a>
- **target** (_nil_)
<a name="steps"></a>
- **steps** (_number[]_)
<a name="step_callback"></a>
- **step_callback** (_function_)
<a name="target_callback"></a>
- **target_callback** (_function|nil_)

View File

@ -0,0 +1,135 @@
# druid.slider API
> at /druid/extended/slider.lua
Basic Druid slider component. Creates a draggable node over a line with progress reporting.
### Setup
Create slider component with druid: `slider = druid:new_slider(node_name, end_pos, callback)`
### Notes
- Pin node should be placed in initial position at zero progress
- It will be available to move Pin node between start pos and end pos
- You can setup points of interests on slider via `slider:set_steps`. If steps exist, slider values will be only from these steps (notched slider)
- Start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)
- To catch input across all slider, you can setup input node via `slider:set_input_node`
## Functions
- [init](#init)
- [set](#set)
- [set_steps](#set_steps)
- [set_input_node](#set_input_node)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields
- [node](#node)
- [on_change_value](#on_change_value)
- [style](#style)
### init
---
```lua
slider:init(node, end_pos, [callback])
```
The Slider constructor
- **Parameters:**
- `node` *(node)*: GUI node to drag as a slider
- `end_pos` *(vector3)*: The end position of slider, should be on the same axis as the node
- `[callback]` *(function|nil)*: On slider change callback
### set
---
```lua
slider:set(value, [is_silent])
```
Set value for slider
- **Parameters:**
- `value` *(number)*: Value from 0 to 1
- `[is_silent]` *(boolean|nil)*: Don't trigger event if true
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### set_steps
---
```lua
slider:set_steps(steps)
```
Set slider steps. Pin node will
apply closest step position
- **Parameters:**
- `steps` *(number[])*: Array of steps
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### set_input_node
---
```lua
slider:set_input_node([input_node])
```
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+
- **Parameters:**
- `[input_node]` *(string|node|nil)*:
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### set_enabled
---
```lua
slider:set_enabled(is_enabled)
```
Set Slider input enabled or disabled
- **Parameters:**
- `is_enabled` *(boolean)*: True if slider is enabled
- **Returns:**
- `self` *(druid.slider)*: Current slider instance
### is_enabled
---
```lua
slider:is_enabled()
```
Check if Slider component is enabled
- **Returns:**
- `is_enabled` *(boolean)*: True if slider is enabled
## Fields
<a name="node"></a>
- **node** (_node_): The node to manage the slider
<a name="on_change_value"></a>
- **on_change_value** (_event_): fun(self: druid.slider, value: number) The event triggered when the slider value changes
<a name="style"></a>
- **style** (_table_): The style of the slider

View File

@ -0,0 +1,57 @@
# druid.swipe API
> at /druid/extended/swipe.lua
The component to manage swipe events over a node
## Functions
- [init](#init)
- [set_click_zone](#set_click_zone)
## Fields
- [node](#node)
- [on_swipe](#on_swipe)
- [style](#style)
- [click_zone](#click_zone)
### init
---
```lua
swipe:init(node_or_node_id, on_swipe_callback)
```
- **Parameters:**
- `node_or_node_id` *(string|node)*:
- `on_swipe_callback` *(function)*:
### set_click_zone
---
```lua
swipe:set_click_zone([zone])
```
Set the click zone for the swipe, useful for restricting events outside stencil node
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
## Fields
<a name="node"></a>
- **node** (_node_): The node to manage the swipe
<a name="on_swipe"></a>
- **on_swipe** (_event_): fun(context, side, dist, dt) The event triggered when a swipe is detected
<a name="style"></a>
- **style** (_druid.swipe.style_): The style of the swipe
<a name="click_zone"></a>
- **click_zone** (_node_): The click zone of the swipe

View File

@ -0,0 +1,130 @@
# druid.timer API
> at /druid/extended/timer.lua
Druid component to handle timer work on gui text node. Displays time in a formatted way.
### Setup
Create timer component with druid: `timer = druid:new_timer(text_node, from_seconds, to_seconds, callback)`
### Notes
- Timer fires callback when timer value equals to _to_seconds_
- Timer will set text node with current timer value
- Timer uses update function to handle time
## Functions
- [init](#init)
- [set_to](#set_to)
- [set_state](#set_state)
- [set_interval](#set_interval)
## Fields
- [on_tick](#on_tick)
- [on_set_enabled](#on_set_enabled)
- [on_timer_end](#on_timer_end)
- [node](#node)
- [from](#from)
- [target](#target)
- [value](#value)
- [is_on](#is_on)
- [temp](#temp)
- [last_value](#last_value)
### init
---
```lua
timer:init(node, [seconds_from], [seconds_to], [callback])
```
- **Parameters:**
- `node` *(node)*: Gui text node
- `[seconds_from]` *(number|nil)*: Start timer value in seconds
- `[seconds_to]` *(number|nil)*: End timer value in seconds
- `[callback]` *(function|nil)*: Function that triggers when timer value equals to seconds_to
- **Returns:**
- `` *(druid.timer)*:
### set_to
---
```lua
timer:set_to(set_to)
```
Set the timer to a specific value
- **Parameters:**
- `set_to` *(number)*: Value in seconds
- **Returns:**
- `self` *(druid.timer)*: Current timer instance
### set_state
---
```lua
timer:set_state([is_on])
```
Set the timer to a specific value
- **Parameters:**
- `[is_on]` *(boolean|nil)*: Timer enable state
- **Returns:**
- `self` *(druid.timer)*: Current timer instance
### set_interval
---
```lua
timer:set_interval(from, to)
```
Set the timer interval
- **Parameters:**
- `from` *(number)*: Start time in seconds
- `to` *(number)*: Target time in seconds
- **Returns:**
- `self` *(druid.timer)*: Current timer instance
## Fields
<a name="on_tick"></a>
- **on_tick** (_event_): fun(context, value) The event triggered when the timer ticks
<a name="on_set_enabled"></a>
- **on_set_enabled** (_event_): fun(context, is_on) The event triggered when the timer is enabled
<a name="on_timer_end"></a>
- **on_timer_end** (_event_): fun(context) The event triggered when the timer ends
<a name="node"></a>
- **node** (_node_): The node to display the timer
<a name="from"></a>
- **from** (_number_): The start time of the timer
<a name="target"></a>
- **target** (_number_): The target time of the timer
<a name="value"></a>
- **value** (_number_): The current value of the timer
<a name="is_on"></a>
- **is_on** (_boolean_): True if the timer is on
<a name="temp"></a>
- **temp** (_unknown_)
<a name="last_value"></a>
- **last_value** (_number_)

View File

@ -0,0 +1,93 @@
# druid.widget.fps_panel API
> at /druid/widget/fps_panel/fps_panel.lua
## Functions
- [init](#init)
- [on_remove](#on_remove)
- [update](#update)
- [push_fps_value](#push_fps_value)
## Fields
- [root](#root)
- [delta_time](#delta_time)
- [collect_time](#collect_time)
- [collect_time_counter](#collect_time_counter)
- [graph_samples](#graph_samples)
- [fps_samples](#fps_samples)
- [mini_graph](#mini_graph)
- [text_min_fps](#text_min_fps)
- [text_fps](#text_fps)
- [timer_id](#timer_id)
- [previous_time](#previous_time)
### init
---
```lua
fps_panel:init()
```
### on_remove
---
```lua
fps_panel:on_remove()
```
### update
---
```lua
fps_panel:update([dt])
```
- **Parameters:**
- `[dt]` *(any)*:
### push_fps_value
---
```lua
fps_panel:push_fps_value()
```
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="delta_time"></a>
- **delta_time** (_number_): in seconds
<a name="collect_time"></a>
- **collect_time** (_integer_): in seconds
<a name="collect_time_counter"></a>
- **collect_time_counter** (_integer_)
<a name="graph_samples"></a>
- **graph_samples** (_number_)
<a name="fps_samples"></a>
- **fps_samples** (_table_): Store frame time in seconds last collect_time seconds
<a name="mini_graph"></a>
- **mini_graph** (_druid.widget.mini_graph_): Widget to display a several lines with different height in a row
<a name="text_min_fps"></a>
- **text_min_fps** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_fps"></a>
- **text_fps** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="timer_id"></a>
- **timer_id** (_unknown_)
<a name="previous_time"></a>
- **previous_time** (_unknown_)

View File

@ -0,0 +1,101 @@
# druid.widget.memory_panel API
> at /druid/widget/memory_panel/memory_panel.lua
## Functions
- [init](#init)
- [on_remove](#on_remove)
- [set_low_memory_limit](#set_low_memory_limit)
- [push_next_value](#push_next_value)
- [update_text_memory](#update_text_memory)
## Fields
- [root](#root)
- [delta_time](#delta_time)
- [samples_count](#samples_count)
- [memory_limit](#memory_limit)
- [mini_graph](#mini_graph)
- [max_value](#max_value)
- [text_per_second](#text_per_second)
- [text_memory](#text_memory)
- [memory](#memory)
- [memory_samples](#memory_samples)
- [timer_id](#timer_id)
### init
---
```lua
memory_panel:init()
```
### on_remove
---
```lua
memory_panel:on_remove()
```
### set_low_memory_limit
---
```lua
memory_panel:set_low_memory_limit([limit])
```
- **Parameters:**
- `[limit]` *(any)*:
### push_next_value
---
```lua
memory_panel:push_next_value()
```
### update_text_memory
---
```lua
memory_panel:update_text_memory()
```
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="delta_time"></a>
- **delta_time** (_number_)
<a name="samples_count"></a>
- **samples_count** (_integer_)
<a name="memory_limit"></a>
- **memory_limit** (_integer_)
<a name="mini_graph"></a>
- **mini_graph** (_druid.widget.mini_graph_): Widget to display a several lines with different height in a row
<a name="max_value"></a>
- **max_value** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_per_second"></a>
- **text_per_second** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_memory"></a>
- **text_memory** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="memory"></a>
- **memory** (_unknown_)
<a name="memory_samples"></a>
- **memory_samples** (_table_)
<a name="timer_id"></a>
- **timer_id** (_unknown_)

View File

@ -0,0 +1,233 @@
# druid.widget.mini_graph API
> at /druid/widget/mini_graph/mini_graph.lua
Widget to display a several lines with different height in a row
Init, set amount of samples and max value of value means that the line will be at max height
Use `push_line_value` to add a new value to the line
Or `set_line_value` to set a value to the line by index
Setup colors inside template file (at minimum and maximum)
## Functions
- [init](#init)
- [on_remove](#on_remove)
- [clear](#clear)
- [set_samples](#set_samples)
- [get_samples](#get_samples)
- [set_line_value](#set_line_value)
- [get_line_value](#get_line_value)
- [push_line_value](#push_line_value)
- [set_max_value](#set_max_value)
- [set_line_height](#set_line_height)
- [get_lowest_value](#get_lowest_value)
- [get_highest_value](#get_highest_value)
- [on_drag_widget](#on_drag_widget)
- [toggle_hide](#toggle_hide)
## Fields
- [root](#root)
- [text_header](#text_header)
- [icon_drag](#icon_drag)
- [content](#content)
- [layout](#layout)
- [prefab_line](#prefab_line)
- [color_zero](#color_zero)
- [color_one](#color_one)
- [is_hidden](#is_hidden)
- [max_value](#max_value)
- [lines](#lines)
- [values](#values)
- [container](#container)
- [default_size](#default_size)
- [samples](#samples)
### init
---
```lua
mini_graph:init()
```
### on_remove
---
```lua
mini_graph:on_remove()
```
### clear
---
```lua
mini_graph:clear()
```
### set_samples
---
```lua
mini_graph:set_samples([samples])
```
- **Parameters:**
- `[samples]` *(any)*:
### get_samples
---
```lua
mini_graph:get_samples()
```
- **Returns:**
- `` *(unknown)*:
### set_line_value
---
```lua
mini_graph:set_line_value(index, value)
```
Set normalized to control the color of the line
- **Parameters:**
- `index` *(number)*:
- `value` *(number)*: The normalized value from 0 to 1
- **Example Usage:**
```lua
for index = 1, mini_graph:get_samples() do
mini_graph:set_line_value(index, math.random())
end
```
### get_line_value
---
```lua
mini_graph:get_line_value([index])
```
- **Parameters:**
- `[index]` *(any)*:
- **Returns:**
- `` *(number)*:
### push_line_value
---
```lua
mini_graph:push_line_value([value])
```
- **Parameters:**
- `[value]` *(any)*:
### set_max_value
---
```lua
mini_graph:set_max_value([max_value])
```
- **Parameters:**
- `[max_value]` *(any)*:
### set_line_height
---
```lua
mini_graph:set_line_height([index])
```
- **Parameters:**
- `[index]` *(any)*:
### get_lowest_value
---
```lua
mini_graph:get_lowest_value()
```
### get_highest_value
---
```lua
mini_graph:get_highest_value()
```
### on_drag_widget
---
```lua
mini_graph:on_drag_widget([dx], [dy])
```
- **Parameters:**
- `[dx]` *(any)*:
- `[dy]` *(any)*:
### toggle_hide
---
```lua
mini_graph:toggle_hide()
```
- **Returns:**
- `` *(druid.widget.mini_graph)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="text_header"></a>
- **text_header** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="icon_drag"></a>
- **icon_drag** (_node_)
<a name="content"></a>
- **content** (_node_)
<a name="layout"></a>
- **layout** (_druid.layout_): Druid component to manage the layout of nodes, placing them inside the node size with respect to the size and pivot of each node.
<a name="prefab_line"></a>
- **prefab_line** (_node_)
<a name="color_zero"></a>
- **color_zero** (_unknown_)
<a name="color_one"></a>
- **color_one** (_unknown_)
<a name="is_hidden"></a>
- **is_hidden** (_boolean_)
<a name="max_value"></a>
- **max_value** (_integer_): in this value line will be at max height
<a name="lines"></a>
- **lines** (_table_)
<a name="values"></a>
- **values** (_table_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="default_size"></a>
- **default_size** (_vector3_)
<a name="samples"></a>
- **samples** (_any_)

View File

@ -0,0 +1,97 @@
# druid.widget.property_button API
> at /druid/widget/properties_panel/properties/property_button.lua
## Functions
- [init](#init)
- [on_click](#on_click)
- [set_text_property](#set_text_property)
- [set_text_button](#set_text_button)
- [set_color](#set_color)
## Fields
- [root](#root)
- [container](#container)
- [text_name](#text_name)
- [button](#button)
- [text_button](#text_button)
- [druid](#druid)
- [selected](#selected)
### init
---
```lua
property_button:init()
```
### on_click
---
```lua
property_button:on_click()
```
### set_text_property
---
```lua
property_button:set_text_property(text)
```
- **Parameters:**
- `text` *(string)*:
- **Returns:**
- `` *(druid.widget.property_button)*:
### set_text_button
---
```lua
property_button:set_text_button(text)
```
- **Parameters:**
- `text` *(string)*:
- **Returns:**
- `` *(druid.widget.property_button)*:
### set_color
---
```lua
property_button:set_color([color_value])
```
- **Parameters:**
- `[color_value]` *(any)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="text_button"></a>
- **text_button** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="selected"></a>
- **selected** (_node_)

View File

@ -0,0 +1,111 @@
# druid.widget.property_checkbox API
> at /druid/widget/properties_panel/properties/property_checkbox.lua
## Functions
- [init](#init)
- [set_value](#set_value)
- [get_value](#get_value)
- [on_click](#on_click)
- [set_text_property](#set_text_property)
- [on_change](#on_change)
## Fields
- [root](#root)
- [druid](#druid)
- [text_name](#text_name)
- [button](#button)
- [selected](#selected)
- [icon](#icon)
- [container](#container)
- [on_change_value](#on_change_value)
### init
---
```lua
property_checkbox:init()
```
### set_value
---
```lua
property_checkbox:set_value(value, [is_instant])
```
- **Parameters:**
- `value` *(boolean)*:
- `[is_instant]` *(any)*:
### get_value
---
```lua
property_checkbox:get_value()
```
- **Returns:**
- `` *(boolean)*:
### on_click
---
```lua
property_checkbox:on_click()
```
### set_text_property
---
```lua
property_checkbox:set_text_property(text)
```
Set the text property of the checkbox
- **Parameters:**
- `text` *(string)*:
### on_change
---
```lua
property_checkbox:on_change(callback)
```
Set the callback function for when the checkbox value changes
- **Parameters:**
- `callback` *(function)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="selected"></a>
- **selected** (_node_)
<a name="icon"></a>
- **icon** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="on_change_value"></a>
- **on_change_value** (_unknown_)

View File

@ -0,0 +1,93 @@
# druid.widget.property_input API
> at /druid/widget/properties_panel/properties/property_input.lua
## Functions
- [init](#init)
- [set_text_property](#set_text_property)
- [set_text_value](#set_text_value)
- [on_change](#on_change)
## Fields
- [root](#root)
- [container](#container)
- [text_name](#text_name)
- [button](#button)
- [druid](#druid)
- [selected](#selected)
- [rich_input](#rich_input)
- [on_change_value](#on_change_value)
### init
---
```lua
property_input:init()
```
### set_text_property
---
```lua
property_input:set_text_property(text)
```
- **Parameters:**
- `text` *(string)*:
- **Returns:**
- `` *(druid.widget.property_input)*:
### set_text_value
---
```lua
property_input:set_text_value(text)
```
- **Parameters:**
- `text` *(string|number)*:
- **Returns:**
- `` *(druid.widget.property_input)*:
### on_change
---
```lua
property_input:on_change(callback, [callback_context])
```
- **Parameters:**
- `callback` *(fun(self: druid.widget.property_input, text: string))*:
- `[callback_context]` *(any)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="selected"></a>
- **selected** (_node_)
<a name="rich_input"></a>
- **rich_input** (_druid.rich_input_): The component that handles a rich text input field, it's a wrapper around the druid.input component
<a name="on_change_value"></a>
- **on_change_value** (_event.event_): fun(text) Event triggered when the value of the input changes.

View File

@ -0,0 +1,171 @@
# druid.widget.property_left_right_selector API
> at /druid/widget/properties_panel/properties/property_left_right_selector.lua
## Functions
- [init](#init)
- [set_text](#set_text)
- [on_button_left](#on_button_left)
- [on_button_right](#on_button_right)
- [add_step](#add_step)
- [set_number_type](#set_number_type)
- [set_array_type](#set_array_type)
- [set_value](#set_value)
- [get_value](#get_value)
## Fields
- [root](#root)
- [druid](#druid)
- [text_name](#text_name)
- [button](#button)
- [selected](#selected)
- [value](#value)
- [on_change_value](#on_change_value)
- [text_value](#text_value)
- [button_left](#button_left)
- [button_right](#button_right)
- [container](#container)
- [number_type](#number_type)
- [array_type](#array_type)
### init
---
```lua
property_left_right_selector:init()
```
### set_text
---
```lua
property_left_right_selector:set_text([text])
```
- **Parameters:**
- `[text]` *(any)*:
- **Returns:**
- `` *(druid.widget.property_left_right_selector)*:
### on_button_left
---
```lua
property_left_right_selector:on_button_left()
```
### on_button_right
---
```lua
property_left_right_selector:on_button_right()
```
### add_step
---
```lua
property_left_right_selector:add_step(koef)
```
- **Parameters:**
- `koef` *(number)*: -1 0 1, on 0 will not move
### set_number_type
---
```lua
property_left_right_selector:set_number_type([min], [max], [is_loop], [steps])
```
- **Parameters:**
- `[min]` *(any)*:
- `[max]` *(any)*:
- `[is_loop]` *(any)*:
- `[steps]` *(any)*:
- **Returns:**
- `` *(druid.widget.property_left_right_selector)*:
### set_array_type
---
```lua
property_left_right_selector:set_array_type([array], [is_loop], [steps])
```
- **Parameters:**
- `[array]` *(any)*:
- `[is_loop]` *(any)*:
- `[steps]` *(any)*:
- **Returns:**
- `` *(druid.widget.property_left_right_selector)*:
### set_value
---
```lua
property_left_right_selector:set_value(value, [is_instant])
```
- **Parameters:**
- `value` *(string|number)*:
- `[is_instant]` *(any)*:
### get_value
---
```lua
property_left_right_selector:get_value()
```
- **Returns:**
- `` *(string|number)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="selected"></a>
- **selected** (_node_)
<a name="value"></a>
- **value** (_string_)
<a name="on_change_value"></a>
- **on_change_value** (_event_): fun(value: string|number)
<a name="text_value"></a>
- **text_value** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button_left"></a>
- **button_left** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="button_right"></a>
- **button_right** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="number_type"></a>
- **number_type** (_table_)
<a name="array_type"></a>
- **array_type** (_table_)

View File

@ -0,0 +1,150 @@
# druid.widget.property_slider API
> at /druid/widget/properties_panel/properties/property_slider.lua
## Functions
- [init](#init)
- [set_text_function](#set_text_function)
- [set_text_property](#set_text_property)
- [on_change](#on_change)
- [set_value](#set_value)
- [get_value](#get_value)
- [update_value](#update_value)
- [set_number_type](#set_number_type)
## Fields
- [root](#root)
- [container](#container)
- [druid](#druid)
- [text_name](#text_name)
- [text_value](#text_value)
- [slider](#slider)
- [on_change_value](#on_change_value)
- [selected](#selected)
- [min](#min)
- [max](#max)
- [step](#step)
### init
---
```lua
property_slider:init()
```
### set_text_function
---
```lua
property_slider:set_text_function(callback)
```
- **Parameters:**
- `callback` *(fun(value: number):string)*:
### set_text_property
---
```lua
property_slider:set_text_property(text)
```
Sets the text property of the slider
- **Parameters:**
- `text` *(string)*:
### on_change
---
```lua
property_slider:on_change(callback)
```
Sets the callback function for when the slider value changes
- **Parameters:**
- `callback` *(fun(value: number))*:
### set_value
---
```lua
property_slider:set_value(value, [is_instant])
```
- **Parameters:**
- `value` *(number)*:
- `[is_instant]` *(any)*:
### get_value
---
```lua
property_slider:get_value()
```
- **Returns:**
- `` *(number)*:
### update_value
---
```lua
property_slider:update_value([value])
```
- **Parameters:**
- `[value]` *(any)*:
### set_number_type
---
```lua
property_slider:set_number_type([min], [max], [step])
```
- **Parameters:**
- `[min]` *(any)*:
- `[max]` *(any)*:
- `[step]` *(any)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_value"></a>
- **text_value** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="slider"></a>
- **slider** (_druid.slider_): Basic Druid slider component. Creates a draggable node over a line with progress reporting.
<a name="on_change_value"></a>
- **on_change_value** (_event_): fun(value:number)
<a name="selected"></a>
- **selected** (_node_)
<a name="min"></a>
- **min** (_integer_)
<a name="max"></a>
- **max** (_integer_)
<a name="step"></a>
- **step** (_number_)

View File

@ -0,0 +1,66 @@
# druid.widget.property_text API
> at /druid/widget/properties_panel/properties/property_text.lua
## Functions
- [init](#init)
- [set_text_property](#set_text_property)
- [set_text_value](#set_text_value)
## Fields
- [root](#root)
- [container](#container)
- [text_name](#text_name)
- [text_right](#text_right)
### init
---
```lua
property_text:init()
```
### set_text_property
---
```lua
property_text:set_text_property(text)
```
- **Parameters:**
- `text` *(string)*:
- **Returns:**
- `` *(druid.widget.property_text)*:
### set_text_value
---
```lua
property_text:set_text_value([text])
```
- **Parameters:**
- `[text]` *(string|nil)*:
- **Returns:**
- `` *(druid.widget.property_text)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="text_right"></a>
- **text_right** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.

View File

@ -0,0 +1,104 @@
# druid.widget.property_vector3 API
> at /druid/widget/properties_panel/properties/property_vector3.lua
## Functions
- [init](#init)
- [set_text_property](#set_text_property)
- [set_value](#set_value)
## Fields
- [root](#root)
- [container](#container)
- [text_name](#text_name)
- [button](#button)
- [druid](#druid)
- [selected_x](#selected_x)
- [selected_y](#selected_y)
- [selected_z](#selected_z)
- [rich_input_x](#rich_input_x)
- [rich_input_y](#rich_input_y)
- [rich_input_z](#rich_input_z)
- [value](#value)
- [on_change](#on_change)
### init
---
```lua
property_vector3:init()
```
### set_text_property
---
```lua
property_vector3:set_text_property(text)
```
- **Parameters:**
- `text` *(string)*:
- **Returns:**
- `` *(druid.widget.property_vector3)*:
### set_value
---
```lua
property_vector3:set_value(x, y, z)
```
- **Parameters:**
- `x` *(number)*:
- `y` *(number)*:
- `z` *(number)*:
- **Returns:**
- `` *(druid.widget.property_vector3)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="text_name"></a>
- **text_name** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="button"></a>
- **button** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="druid"></a>
- **druid** (_druid.instance_): The Druid Factory used to create components
<a name="selected_x"></a>
- **selected_x** (_node_)
<a name="selected_y"></a>
- **selected_y** (_node_)
<a name="selected_z"></a>
- **selected_z** (_node_)
<a name="rich_input_x"></a>
- **rich_input_x** (_druid.rich_input_): The component that handles a rich text input field, it's a wrapper around the druid.input component
<a name="rich_input_y"></a>
- **rich_input_y** (_druid.rich_input_): The component that handles a rich text input field, it's a wrapper around the druid.input component
<a name="rich_input_z"></a>
- **rich_input_z** (_druid.rich_input_): The component that handles a rich text input field, it's a wrapper around the druid.input component
<a name="value"></a>
- **value** (_unknown_)
<a name="on_change"></a>
- **on_change** (_unknown_)

View File

@ -0,0 +1,389 @@
# druid.widget.properties_panel API
> at /druid/widget/properties_panel/properties_panel.lua
# Properties API:
- [property_button](properties_panel/property_button_api.md)
- [property_checkbox](properties_panel/property_checkbox_api.md)
- [property_slider](properties_panel/property_slider_api.md)
- [property_input](properties_panel/property_input_api.md)
- [property_text](properties_panel/property_text_api.md)
- [property_left_right_selector](properties_panel/property_left_right_selector_api.md)
- [property_vector3](properties_panel/property_vector3_api.md)
## Functions
- [properties_constructors](#properties_constructors)
- [init](#init)
- [on_remove](#on_remove)
- [on_drag_widget](#on_drag_widget)
- [clear_created_properties](#clear_created_properties)
- [clear](#clear)
- [on_size_changed](#on_size_changed)
- [update](#update)
- [add_checkbox](#add_checkbox)
- [add_slider](#add_slider)
- [add_button](#add_button)
- [add_input](#add_input)
- [add_text](#add_text)
- [add_left_right_selector](#add_left_right_selector)
- [add_vector3](#add_vector3)
- [add_inner_widget](#add_inner_widget)
- [add_widget](#add_widget)
- [remove](#remove)
- [set_hidden](#set_hidden)
- [is_hidden](#is_hidden)
- [set_properties_per_page](#set_properties_per_page)
- [set_page](#set_page)
## Fields
- [root](#root)
- [scroll](#scroll)
- [layout](#layout)
- [container](#container)
- [container_content](#container_content)
- [container_scroll_view](#container_scroll_view)
- [contaienr_scroll_content](#contaienr_scroll_content)
- [button_hidden](#button_hidden)
- [text_header](#text_header)
- [paginator](#paginator)
- [properties](#properties)
- [content](#content)
- [default_size](#default_size)
- [current_page](#current_page)
- [properties_per_page](#properties_per_page)
- [property_checkbox_prefab](#property_checkbox_prefab)
- [property_slider_prefab](#property_slider_prefab)
- [property_button_prefab](#property_button_prefab)
- [property_input_prefab](#property_input_prefab)
- [property_text_prefab](#property_text_prefab)
- [property_left_right_selector_prefab](#property_left_right_selector_prefab)
- [property_vector3_prefab](#property_vector3_prefab)
- [is_dirty](#is_dirty)
### properties_constructors
---
```lua
properties_panel:properties_constructors()
```
List of properties functions to create a new widget. Used to not spawn non-visible widgets but keep the reference
### init
---
```lua
properties_panel:init()
```
### on_remove
---
```lua
properties_panel:on_remove()
```
### on_drag_widget
---
```lua
properties_panel:on_drag_widget([dx], [dy])
```
- **Parameters:**
- `[dx]` *(any)*:
- `[dy]` *(any)*:
### clear_created_properties
---
```lua
properties_panel:clear_created_properties()
```
### clear
---
```lua
properties_panel:clear()
```
### on_size_changed
---
```lua
properties_panel:on_size_changed([new_size])
```
- **Parameters:**
- `[new_size]` *(any)*:
### update
---
```lua
properties_panel:update([dt])
```
- **Parameters:**
- `[dt]` *(any)*:
### add_checkbox
---
```lua
properties_panel:add_checkbox([on_create])
```
Inspect Property Checkbox API [here](properties_panel/property_checkbox_api.md)
- **Parameters:**
- `[on_create]` *(fun(checkbox: druid.widget.property_checkbox)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_slider
---
```lua
properties_panel:add_slider([on_create])
```
Inspect Property Slider API [here](properties_panel/property_slider_api.md)
- **Parameters:**
- `[on_create]` *(fun(slider: druid.widget.property_slider)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_button
---
```lua
properties_panel:add_button([on_create])
```
Inspect Property Button API [here](properties_panel/property_button_api.md)
- **Parameters:**
- `[on_create]` *(fun(button: druid.widget.property_button)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_input
---
```lua
properties_panel:add_input([on_create])
```
Inspect Property Input API [here](properties_panel/property_input_api.md)
- **Parameters:**
- `[on_create]` *(fun(input: druid.widget.property_input)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_text
---
```lua
properties_panel:add_text([on_create])
```
Inspect Property Text API [here](properties_panel/property_text_api.md)
- **Parameters:**
- `[on_create]` *(fun(text: druid.widget.property_text)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_left_right_selector
---
```lua
properties_panel:add_left_right_selector([on_create])
```
Inspect Property Left Right Selector API [here](properties_panel/property_left_right_selector_api.md)
- **Parameters:**
- `[on_create]` *(fun(selector: druid.widget.property_left_right_selector)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_vector3
---
```lua
properties_panel:add_vector3([on_create])
```
Inspect Property Vector3 API [here](properties_panel/property_vector3_api.md)
- **Parameters:**
- `[on_create]` *(fun(vector3: druid.widget.property_vector3)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_inner_widget
---
```lua
properties_panel:add_inner_widget(widget_class, [template], [nodes], [on_create])
```
- **Parameters:**
- `widget_class` *(<T:druid.widget>)*:
- `[template]` *(string|nil)*:
- `[nodes]` *(node|table<hash, node>|nil)*:
- `[on_create]` *(fun(widget: <T:druid.widget>)|nil)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### add_widget
---
```lua
properties_panel:add_widget(create_widget_callback)
```
- **Parameters:**
- `create_widget_callback` *(fun():druid.widget)*:
- **Returns:**
- `` *(druid.widget.properties_panel)*:
### remove
---
```lua
properties_panel:remove([widget])
```
- **Parameters:**
- `[widget]` *(any)*:
### set_hidden
---
```lua
properties_panel:set_hidden([is_hidden])
```
- **Parameters:**
- `[is_hidden]` *(any)*:
### is_hidden
---
```lua
properties_panel:is_hidden()
```
- **Returns:**
- `` *(unknown)*:
### set_properties_per_page
---
```lua
properties_panel:set_properties_per_page(properties_per_page)
```
- **Parameters:**
- `properties_per_page` *(number)*:
### set_page
---
```lua
properties_panel:set_page([page])
```
- **Parameters:**
- `[page]` *(any)*:
## Fields
<a name="root"></a>
- **root** (_node_)
<a name="scroll"></a>
- **scroll** (_druid.scroll_): Basic Druid scroll component. Handles all scrolling behavior in Druid GUI.
<a name="layout"></a>
- **layout** (_druid.layout_): Druid component to manage the layout of nodes, placing them inside the node size with respect to the size and pivot of each node.
<a name="container"></a>
- **container** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="container_content"></a>
- **container_content** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="container_scroll_view"></a>
- **container_scroll_view** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="contaienr_scroll_content"></a>
- **contaienr_scroll_content** (_druid.container_): Druid component to manage the size and positions with other containers relations to create a adaptable layouts.
<a name="button_hidden"></a>
- **button_hidden** (_druid.button_): Basic Druid input component. Handle input on node and provide different callbacks on touch events.
<a name="text_header"></a>
- **text_header** (_druid.text_): Basic Druid text component. Text components by default have the text size adjusting.
<a name="paginator"></a>
- **paginator** (_druid.widget.property_left_right_selector_)
<a name="properties"></a>
- **properties** (_druid.widget[]_): List of created properties
<a name="content"></a>
- **content** (_node_)
<a name="default_size"></a>
- **default_size** (_vector3_)
<a name="current_page"></a>
- **current_page** (_integer_)
<a name="properties_per_page"></a>
- **properties_per_page** (_integer_)
<a name="property_checkbox_prefab"></a>
- **property_checkbox_prefab** (_node_)
<a name="property_slider_prefab"></a>
- **property_slider_prefab** (_node_)
<a name="property_button_prefab"></a>
- **property_button_prefab** (_node_)
<a name="property_input_prefab"></a>
- **property_input_prefab** (_node_)
<a name="property_text_prefab"></a>
- **property_text_prefab** (_node_)
<a name="property_left_right_selector_prefab"></a>
- **property_left_right_selector_prefab** (_node_)
<a name="property_vector3_prefab"></a>
- **property_vector3_prefab** (_node_)
<a name="is_dirty"></a>
- **is_dirty** (_boolean_)

172
api/druid_api.md Normal file
View File

@ -0,0 +1,172 @@
# druid API
> at /druid/druid.lua
Entry point for Druid UI Framework.
Create a new Druid instance and adjust the Druid settings here.
## Functions
- [new](#new)
- [register](#register)
- [set_default_style](#set_default_style)
- [set_text_function](#set_text_function)
- [set_sound_function](#set_sound_function)
- [init_window_listener](#init_window_listener)
- [on_window_callback](#on_window_callback)
- [on_language_change](#on_language_change)
- [get_widget](#get_widget)
- [register_druid_as_widget](#register_druid_as_widget)
- [unregister_druid_as_widget](#unregister_druid_as_widget)
### new
---
```lua
druid.new(context, [style])
```
Create a new Druid instance for creating GUI components.
- **Parameters:**
- `context` *(table)*: The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks.
- `[style]` *(table|nil)*: The Druid style table to override style parameters for this Druid instance.
- **Returns:**
- `druid_instance` *(druid.instance)*: The new Druid instance
### register
---
```lua
druid.register(name, module)
```
Register a new external Druid component.
Register component just makes the druid:new_{name} function.
For example, if you register a component called "my_component", you can create it using druid:new_my_component(...).
This can be useful if you have your own "basic" components that you don't want to require in every file.
The default way to create component is `druid_instance:new(component_class, ...)`.
- **Parameters:**
- `name` *(string)*: Module name
- `module` *(table)*: Lua table with component
### set_default_style
---
```lua
druid.set_default_style(style)
```
Set the default style for all Druid instances.
- **Parameters:**
- `style` *(table)*: Default style
### set_text_function
---
```lua
druid.set_text_function(callback)
```
Set the text function for the LangText component.
- **Parameters:**
- `callback` *(fun(text_id: string):string)*: Get localized text function
### set_sound_function
---
```lua
druid.set_sound_function(callback)
```
Set the sound function to able components to play sounds.
- **Parameters:**
- `callback` *(fun(sound_id: string))*: Sound play callback
### init_window_listener
---
```lua
druid.init_window_listener()
```
Subscribe Druid to the window listener. It will override your previous
window listener, so if you have one, you should call M.on_window_callback manually.
### on_window_callback
---
```lua
druid.on_window_callback(window_event)
```
Set the window callback to enable Druid window events.
- **Parameters:**
- `window_event` *(constant)*: Event param from window listener
### on_language_change
---
```lua
druid.on_language_change()
```
Call this function when the game language changes.
It will notify all Druid instances to update the lang text components.
### get_widget
---
```lua
druid.get_widget(widget_class, gui_url)
```
Create a widget from the binded Druid GUI instance.
The widget will be created and all widget functions can be called from Game Object contexts.
This allow use only `druid_widget.gui_script` for GUI files and call this widget functions from Game Object script file.
Widget class here is a your lua file for the GUI scene (a widgets in Druid)
- **Parameters:**
- `widget_class` *(<T:druid.widget>)*: The class of the widget to return
- `gui_url` *(url)*: GUI url
- **Returns:**
- `widget` *(<T:druid.widget>?)*: The new created widget,
- **Example Usage:**
```lua
msg.url(nil, nil, "gui_widget") -- current game object
msg.url(nil, object_url, "gui_widget") -- other game object
```
### register_druid_as_widget
---
```lua
druid.register_druid_as_widget(druid)
```
Bind a Druid GUI instance to the current game object.
This instance now can produce widgets from `druid.get_widget()` function.
Only one widget can be set per game object.
- **Parameters:**
- `druid` *(druid.instance)*: The druid instance to register
### unregister_druid_as_widget
---
```lua
druid.unregister_druid_as_widget()
```
Should be called on final, where druid instance is destroyed.

540
api/druid_helper_api.md Normal file
View File

@ -0,0 +1,540 @@
# druid.helper API
> at /druid/helper.lua
The helper module contains various functions that are used in the Druid library.
You can use these functions in your projects as well.
## Functions
- [centrate_text_with_icon](#centrate_text_with_icon)
- [centrate_icon_with_text](#centrate_icon_with_text)
- [centrate_nodes](#centrate_nodes)
- [get_node](#get_node)
- [get_screen_aspect_koef](#get_screen_aspect_koef)
- [get_gui_scale](#get_gui_scale)
- [step](#step)
- [clamp](#clamp)
- [distance](#distance)
- [sign](#sign)
- [round](#round)
- [lerp](#lerp)
- [contains](#contains)
- [deepcopy](#deepcopy)
- [add_array](#add_array)
- [pick_node](#pick_node)
- [get_scaled_size](#get_scaled_size)
- [get_scene_scale](#get_scene_scale)
- [get_closest_stencil_node](#get_closest_stencil_node)
- [get_pivot_offset](#get_pivot_offset)
- [is_desktop](#is_desktop)
- [is_mobile](#is_mobile)
- [is_web](#is_web)
- [is_web_mobile](#is_web_mobile)
- [is_multitouch_supported](#is_multitouch_supported)
- [table_to_string](#table_to_string)
- [get_border](#get_border)
- [get_text_metrics_from_node](#get_text_metrics_from_node)
- [insert_with_shift](#insert_with_shift)
- [remove_with_shift](#remove_with_shift)
- [get_full_position](#get_full_position)
- [get_animation_data_from_node](#get_animation_data_from_node)
### centrate_text_with_icon
---
```lua
helper.centrate_text_with_icon([text_node], [icon_node], margin)
```
Center two nodes.
Nodes will be center around 0 x position
text_node will be first (at left side)
- **Parameters:**
- `[text_node]` *(node|nil)*: Gui text node
- `[icon_node]` *(node|nil)*: Gui box node
- `margin` *(number)*: Offset between nodes
- **Returns:**
- `` *(unknown)*:
### centrate_icon_with_text
---
```lua
helper.centrate_icon_with_text([icon_node], [text_node], [margin])
```
Center two nodes.
Nodes will be center around 0 x position
icon_node will be first (at left side)
- **Parameters:**
- `[icon_node]` *(node|nil)*: Gui box node
- `[text_node]` *(node|nil)*: Gui text node
- `[margin]` *(number|nil)*: Offset between nodes
- **Returns:**
- `` *(unknown)*:
### centrate_nodes
---
```lua
helper.centrate_nodes([margin], ...)
```
Centerate nodes by x position with margin.
This functions calculate total width of nodes and set position for each node.
The centrate will be around 0 x position.
- **Parameters:**
- `[margin]` *(number|nil)*: Offset between nodes
- `...` *(...)*: vararg
- **Returns:**
- `` *(unknown)*:
### get_node
---
```lua
helper.get_node(node_id, [template], [nodes])
```
- **Parameters:**
- `node_id` *(string|node)*:
- `[template]` *(string|nil)*: Full Path to the template
- `[nodes]` *(table<hash, node>|nil)*: Nodes what created with gui.clone_tree
- **Returns:**
- `` *(node)*:
### get_screen_aspect_koef
---
```lua
helper.get_screen_aspect_koef()
```
Get current screen stretch multiplier for each side
- **Returns:**
- `stretch_x` *(number)*:
- `stretch_y` *(number)*:
### get_gui_scale
---
```lua
helper.get_gui_scale()
```
Get current GUI scale for each side
- **Returns:**
- `scale_x` *(number)*:
### step
---
```lua
helper.step(current, target, step)
```
Move value from current to target value with step amount
- **Parameters:**
- `current` *(number)*: Current value
- `target` *(number)*: Target value
- `step` *(number)*: Step amount
- **Returns:**
- `New` *(number)*: value
### clamp
---
```lua
helper.clamp(value, [v1], [v2])
```
Clamp value between min and max. Works with nil values and swap min and max if needed.
- **Parameters:**
- `value` *(number)*: Value
- `[v1]` *(number|nil)*: Min value. If nil, value will be clamped to positive infinity
- `[v2]` *(number|nil)*: Max value If nil, value will be clamped to negative infinity
- **Returns:**
- `value` *(number)*: Clamped value
### distance
---
```lua
helper.distance(x1, y1, x2, y2)
```
Calculate distance between two points
- **Parameters:**
- `x1` *(number)*: First point x
- `y1` *(number)*: First point y
- `x2` *(number)*: Second point x
- `y2` *(number)*: Second point y
- **Returns:**
- `distance` *(number)*:
### sign
---
```lua
helper.sign(val)
```
Return sign of value
- **Parameters:**
- `val` *(number)*: Value
- **Returns:**
- `sign` *(number)*: Sign of value, -1, 0 or 1
### round
---
```lua
helper.round(num, [num_decimal_places])
```
Round number to specified decimal places
- **Parameters:**
- `num` *(number)*: Number
- `[num_decimal_places]` *(number|nil)*: Decimal places
- **Returns:**
- `value` *(number)*: Rounded number
### lerp
---
```lua
helper.lerp(a, b, t)
```
Lerp between two values
- **Parameters:**
- `a` *(number)*: First value
- `b` *(number)*: Second value
- `t` *(number)*: Lerp amount
- **Returns:**
- `value` *(number)*: Lerped value
### contains
---
```lua
helper.contains([array], [value])
```
Check if value contains in array
- **Parameters:**
- `[array]` *(any[])*: Array to check
- `[value]` *(any)*: Value
- **Returns:**
- `index` *(number|nil)*: Index of value in array or nil if value not found
### deepcopy
---
```lua
helper.deepcopy(orig_table)
```
Make a copy table with all nested tables
- **Parameters:**
- `orig_table` *(table)*: Original table
- **Returns:**
- `Copy` *(table)*: of original table
### add_array
---
```lua
helper.add_array([target], [source])
```
Add all elements from source array to the target array
- **Parameters:**
- `[target]` *(any[])*: Array to put elements from source
- `[source]` *(any[]|nil)*: The source array to get elements from
- **Returns:**
- `The` *(any[])*: target array
### pick_node
---
```lua
helper.pick_node(node, x, y, [node_click_area])
```
Make a check with gui.pick_node, but with additional node_click_area check.
- **Parameters:**
- `node` *(node)*:
- `x` *(number)*:
- `y` *(number)*:
- `[node_click_area]` *(node|nil)*: Additional node to check for click area. If nil, only node will be checked
- **Returns:**
- `` *(unknown)*:
### get_scaled_size
---
```lua
helper.get_scaled_size(node)
```
Get size of node with scale multiplier
- **Parameters:**
- `node` *(node)*: GUI node
- **Returns:**
- `scaled_size` *(vector3)*:
### get_scene_scale
---
```lua
helper.get_scene_scale(node, [include_passed_node_scale])
```
Get cumulative parent's node scale
- **Parameters:**
- `node` *(node)*: Gui node
- `[include_passed_node_scale]` *(boolean|nil)*: True if add current node scale to result
- **Returns:**
- `The` *(vector3)*: scene node scale
### get_closest_stencil_node
---
```lua
helper.get_closest_stencil_node(node)
```
Return closest non inverted clipping parent node for given node
- **Parameters:**
- `node` *(node)*: GUI node
- **Returns:**
- `stencil_node` *(node|nil)*: The closest stencil node or nil
### get_pivot_offset
---
```lua
helper.get_pivot_offset(pivot_or_node)
```
Get pivot offset for given pivot or node
Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top.
- **Parameters:**
- `pivot_or_node` *(number|node)*: GUI pivot or node
- **Returns:**
- `offset` *(vector3)*: The pivot offset
### is_desktop
---
```lua
helper.is_desktop()
```
Check if device is desktop
- **Returns:**
- `` *(boolean)*:
### is_mobile
---
```lua
helper.is_mobile()
```
Check if device is native mobile (Android or iOS)
- **Returns:**
- `Is` *(boolean)*: mobile
### is_web
---
```lua
helper.is_web()
```
Check if device is HTML5
- **Returns:**
- `` *(boolean)*:
### is_web_mobile
---
```lua
helper.is_web_mobile()
```
Check if device is HTML5 mobile
- **Returns:**
- `` *(boolean)*:
### is_multitouch_supported
---
```lua
helper.is_multitouch_supported()
```
Check if device is mobile and can support multitouch
- **Returns:**
- `is_multitouch` *(boolean)*: Is multitouch supported
### table_to_string
---
```lua
helper.table_to_string(t)
```
Simple table to one-line string converter
- **Parameters:**
- `t` *(table)*:
- **Returns:**
- `` *(string)*:
### get_border
---
```lua
helper.get_border(node, [offset])
```
Distance from node position to his borders
- **Parameters:**
- `node` *(node)*: GUI node
- `[offset]` *(vector3|nil)*: Offset from node position. Pass current node position to get non relative border values
- **Returns:**
- `border` *(vector4)*: Vector4 with border values (left, top, right, down)
### get_text_metrics_from_node
---
```lua
helper.get_text_metrics_from_node(text_node)
```
Get text metric from GUI node.
- **Parameters:**
- `text_node` *(node)*:
- **Returns:**
- `` *(GUITextMetrics)*:
### insert_with_shift
---
```lua
helper.insert_with_shift(array, [item], [index], [shift_policy])
```
Add value to array with shift policy
Shift policy can be: left, right, no_shift
- **Parameters:**
- `array` *(table)*: Array
- `[item]` *(any)*: Item to insert
- `[index]` *(number|nil)*: Index to insert. If nil, item will be inserted at the end of array
- `[shift_policy]` *(number|nil)*: The druid_const.SHIFT.* constant
- **Returns:**
- `Inserted` *(any)*: item
### remove_with_shift
---
```lua
helper.remove_with_shift([array], [index], [shift_policy])
```
Remove value from array with shift policy
Shift policy can be: left, right, no_shift
- **Parameters:**
- `[array]` *(any[])*: Array
- `[index]` *(number|nil)*: Index to remove. If nil, item will be removed from the end of array
- `[shift_policy]` *(number|nil)*: The druid_const.SHIFT.* constant
- **Returns:**
- `Removed` *(any)*: item
### get_full_position
---
```lua
helper.get_full_position(node, [root])
```
Get full position of node in the GUI tree
- **Parameters:**
- `node` *(node)*: GUI node
- `[root]` *(node|nil)*: GUI root node to stop search
- **Returns:**
- `` *(unknown)*:
### get_animation_data_from_node
---
```lua
helper.get_animation_data_from_node(node, atlas_path)
```
- **Parameters:**
- `node` *(node)*:
- `atlas_path` *(string)*: Path to the atlas
- **Returns:**
- `` *(druid.system.animation_data)*:

540
api/druid_instance_api.md Normal file
View File

@ -0,0 +1,540 @@
# druid.instance API
> at /druid/system/druid_instance.lua
The Druid Factory used to create components
## Functions
- [create_druid_instance](#create_druid_instance)
- [new](#new)
- [final](#final)
- [remove](#remove)
- [update](#update)
- [on_input](#on_input)
- [on_message](#on_message)
- [on_window_event](#on_window_event)
- [set_whitelist](#set_whitelist)
- [set_blacklist](#set_blacklist)
- [new_widget](#new_widget)
- [new_button](#new_button)
- [new_blocker](#new_blocker)
- [new_back_handler](#new_back_handler)
- [new_hover](#new_hover)
- [new_text](#new_text)
- [new_grid](#new_grid)
- [new_scroll](#new_scroll)
- [new_drag](#new_drag)
- [new_swipe](#new_swipe)
- [new_lang_text](#new_lang_text)
- [new_slider](#new_slider)
- [new_input](#new_input)
- [new_data_list](#new_data_list)
- [new_timer](#new_timer)
- [new_progress](#new_progress)
- [new_layout](#new_layout)
- [new_container](#new_container)
- [new_hotkey](#new_hotkey)
- [new_rich_text](#new_rich_text)
- [new_rich_input](#new_rich_input)
### create_druid_instance
---
```lua
instance.create_druid_instance(context, [style])
```
Druid class constructor which used to create a Druid's components
- **Parameters:**
- `context` *(table)*: Druid context. Usually it is self of gui script
- `[style]` *(table?)*: Druid style table
- **Returns:**
- `instance` *(druid.instance)*: The new Druid instance
### new
---
```lua
instance:new(component, ...)
```
Create new Druid component instance
- **Parameters:**
- `component` *(<T:druid.component>)*: The component class to create
- `...` *(...)*: vararg
- **Returns:**
- `instance` *(<T:druid.component>)*: The new ready to use component
### final
---
```lua
instance:final()
```
Call this in gui_script final function.
### remove
---
```lua
instance:remove(component)
```
Remove created component from Druid instance.
Component `on_remove` function will be invoked, if exist.
- **Parameters:**
- `component` *(<T:druid.component>)*: Component instance
- **Returns:**
- `is_removed` *(boolean)*: True if component was removed
### update
---
```lua
instance:update(dt)
```
Call this in gui_script update function.
- **Parameters:**
- `dt` *(number)*: Delta time
### on_input
---
```lua
instance:on_input(action_id, action)
```
Call this in gui_script on_input function.
- **Parameters:**
- `action_id` *(hash)*: Action_id from on_input
- `action` *(table)*: Action from on_input
- **Returns:**
- `is_input_consumed` *(boolean)*: The boolean value is input was consumed
### on_message
---
```lua
instance:on_message(message_id, message, sender)
```
Call this in gui_script on_message function.
- **Parameters:**
- `message_id` *(hash)*: Message_id from on_message
- `message` *(table)*: Message from on_message
- `sender` *(url)*: Sender from on_message
### on_window_event
---
```lua
instance:on_window_event(window_event)
```
Called when the window event occurs
- **Parameters:**
- `window_event` *(number)*: The window event
### set_whitelist
---
```lua
instance:set_whitelist(whitelist_components)
```
Set whitelist components for input processing.
If whitelist is not empty and component not contains in this list,
component will be not processed on input step
- **Parameters:**
- `whitelist_components` *(table|druid.component[])*: The array of component to whitelist
- **Returns:**
- `self` *(druid.instance)*: The Druid instance
### set_blacklist
---
```lua
instance:set_blacklist(blacklist_components)
```
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 DruidInstance
- **Parameters:**
- `blacklist_components` *(table|druid.component[])*: The array of component to blacklist
- **Returns:**
- `self` *(druid.instance)*: The Druid instance
### new_widget
---
```lua
instance:new_widget(widget, [template], [nodes], ...)
```
Create new Druid widget instance
- **Parameters:**
- `widget` *(<T:druid.component>)*: The widget class to create
- `[template]` *(string|nil)*: The template name used by widget
- `[nodes]` *(string|node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone or node id to clone
- `...` *(...)*: vararg
- **Returns:**
- `widget` *(<T:druid.component>)*: The new ready to use widget
### new_button
---
```lua
instance:new_button(node, [callback], [params], [anim_node])
```
Create Button component
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- `[callback]` *(function|event|nil)*: Button callback
- `[params]` *(any)*: Button callback params
- `[anim_node]` *(string|node|nil)*: Button anim node (node, if not provided)
- **Returns:**
- `button` *(druid.button)*: The new button component
### new_blocker
---
```lua
instance:new_blocker(node)
```
Create Blocker component
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- `blocker` *(druid.blocker)*: The new blocker component
### new_back_handler
---
```lua
instance:new_back_handler([callback], [params])
```
Create BackHandler component
- **Parameters:**
- `[callback]` *(function|event|nil)*: The callback(self, custom_args) to call on back event
- `[params]` *(any)*: Callback argument
- **Returns:**
- `back_handler` *(druid.back_handler)*: The new back handler component
### new_hover
---
```lua
instance:new_hover(node, [on_hover_callback], [on_mouse_hover_callback])
```
Create Hover component
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- `[on_hover_callback]` *(function|nil)*: Hover callback
- `[on_mouse_hover_callback]` *(function|nil)*: Mouse hover callback
- **Returns:**
- `hover` *(druid.hover)*: The new hover component
### new_text
---
```lua
instance:new_text(node, [value], [adjust_type])
```
Create Text component
- **Parameters:**
- `node` *(string|druid.text|node)*: The node_id or gui.get_node(node_id)
- `[value]` *(string|nil)*: Initial text. Default value is node text from GUI scene.
- `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
- **Returns:**
- `text` *(druid.text)*: The new text component
### new_grid
---
```lua
instance:new_grid(parent_node, item, [in_row])
```
Create Grid component
- **Parameters:**
- `parent_node` *(string|node)*: The node_id or gui.get_node(node_id). Parent of all Grid items.
- `item` *(string|node)*: Item prefab. Required to get grid's item size. Can be adjusted separately.
- `[in_row]` *(number|nil)*: How many nodes in row can be placed
- **Returns:**
- `grid` *(druid.grid)*: The new grid component
### new_scroll
---
```lua
instance:new_scroll(view_node, content_node)
```
Create Scroll component
- **Parameters:**
- `view_node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as user input node.
- `content_node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node.
- **Returns:**
- `scroll` *(druid.scroll)*: The new scroll component
### new_drag
---
```lua
instance:new_drag(node, [on_drag_callback])
```
Create Drag component
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as user input node.
- `[on_drag_callback]` *(function|nil)*: Callback for on_drag_event(self, dx, dy)
- **Returns:**
- `drag` *(druid.drag)*: The new drag component
### new_swipe
---
```lua
instance:new_swipe(node, [on_swipe_callback])
```
Create Swipe component
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as user input node.
- `[on_swipe_callback]` *(function|nil)*: Swipe callback for on_swipe_end event
- **Returns:**
- `swipe` *(druid.swipe)*: The new swipe component
### new_lang_text
---
```lua
instance:new_lang_text(node, [locale_id], [adjust_type])
```
Create LangText component
- **Parameters:**
- `node` *(string|node)*: The_node id or gui.get_node(node_id)
- `[locale_id]` *(string|nil)*: Default locale id or text from node as default
- `[adjust_type]` *(string|nil)*: Adjust type for text node. Default: "downscale"
- **Returns:**
- `lang_text` *(druid.lang_text)*: The new lang text component
### new_slider
---
```lua
instance:new_slider(pin_node, end_pos, [callback])
```
Create Slider component
- **Parameters:**
- `pin_node` *(string|node)*: The_node id or gui.get_node(node_id).
- `end_pos` *(vector3)*: The end position of slider
- `[callback]` *(function|nil)*: On slider change callback
- **Returns:**
- `slider` *(druid.slider)*: The new slider component
### new_input
---
```lua
instance:new_input(click_node, text_node, [keyboard_type])
```
Create Input component
- **Parameters:**
- `click_node` *(string|node)*: Button node to enabled input component
- `text_node` *(string|druid.text|node)*: Text node what will be changed on user input
- `[keyboard_type]` *(number|nil)*: Gui keyboard type for input field
- **Returns:**
- `input` *(druid.input)*: The new input component
### new_data_list
---
```lua
instance:new_data_list(druid_scroll, druid_grid, create_function)
```
Create DataList component
- **Parameters:**
- `druid_scroll` *(druid.scroll)*: The Scroll instance for Data List component
- `druid_grid` *(druid.grid)*: The Grid instance for Data List component
- `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
- **Returns:**
- `data_list` *(druid.data_list)*: The new data list component
### new_timer
---
```lua
instance:new_timer(node, [seconds_from], [seconds_to], [callback])
```
Create Timer component
- **Parameters:**
- `node` *(string|node)*: Gui text node
- `[seconds_from]` *(number|nil)*: Start timer value in seconds
- `[seconds_to]` *(number|nil)*: End timer value in seconds
- `[callback]` *(function|nil)*: Function on timer end
- **Returns:**
- `timer` *(druid.timer)*: The new timer component
### new_progress
---
```lua
instance:new_progress(node, key, [init_value])
```
Create Progress component
- **Parameters:**
- `node` *(string|node)*: Progress bar fill node or node name
- `key` *(string)*: Progress bar direction: "x" or "y"
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
- **Returns:**
- `progress` *(druid.progress)*: The new progress component
### new_layout
---
```lua
instance:new_layout(node, [mode])
```
Create Layout component
- **Parameters:**
- `node` *(string|node)*: The_node id or gui.get_node(node_id).
- `[mode]` *(string|nil)*: vertical|horizontal|horizontal_wrap. Default: horizontal
- **Returns:**
- `layout` *(druid.layout)*: The new layout component
### new_container
---
```lua
instance:new_container(node, [mode], [callback])
```
Create Container component
- **Parameters:**
- `node` *(string|node)*: The_node id or gui.get_node(node_id).
- `[mode]` *(string|nil)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
- **Returns:**
- `container` *(druid.container)*: The new container component
### new_hotkey
---
```lua
instance:new_hotkey(keys_array, [callback], [callback_argument])
```
Create Hotkey component
- **Parameters:**
- `keys_array` *(string|string[])*: Keys for trigger action. Should contains one action key and any amount of modificator keys
- `[callback]` *(function|event|nil)*: The callback function
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- `hotkey` *(druid.hotkey)*: The new hotkey component
### new_rich_text
---
```lua
instance:new_rich_text(text_node, [value])
```
Create RichText component.
- **Parameters:**
- `text_node` *(string|node)*: The text node to make Rich Text
- `[value]` *(string|nil)*: The initial text value. Default will be gui.get_text(text_node)
- **Returns:**
- `rich_text` *(druid.rich_text)*: The new rich text component
### new_rich_input
---
```lua
instance:new_rich_input(template, [nodes])
```
Create RichInput component.
As a template please check rich_input.gui layout.
- **Parameters:**
- `template` *(string)*: The template string name
- `[nodes]` *(table|nil)*: Nodes table from gui.clone_tree
- **Returns:**
- `rich_input` *(druid.rich_input)*: The new rich input component

643
api/quick_api_reference.md Normal file
View File

@ -0,0 +1,643 @@
# Quick API Reference
# Table of Contents
1. [Druid](#druid)
2. [Druid Instance](#druid-instance)
3. [Components](#components)
1. [Base Component](#base-component)
2. [Blocker](#blocker)
3. [Button](#button)
4. [Container](#container)
5. [Data List](#data-list)
6. [Drag](#drag)
7. [Grid](#grid)
8. [Hotkey](#hotkey)
9. [Hover](#hover)
10. [Input](#input)
11. [Lang Text](#lang-text)
12. [Layout](#layout)
13. [Progress](#progress)
14. [Rich Input](#rich-input)
15. [Rich Text](#rich-text)
16. [Scroll](#scroll)
17. [Slider](#slider)
18. [Swipe](#swipe)
19. [Text](#text)
20. [Timer](#timer)
4. [Helper](#helper)
5. [Widgets](#widgets)
# API Reference
## [Druid](druid_api.md)
Inspect [API Here](druid_api.md)
```lua
local druid = require("druid.druid")
druid.init_window_listener()
druid.on_language_change()
druid.on_window_callback(window_event)
druid.set_default_style(style)
druid.set_sound_function(callback)
druid.set_text_function(callback)
self.druid = druid.new(context, [style])
```
## [Druid Instance](druid_instance_api.md)
Inspect [API Here](druid_instance_api.md)
```lua
-- Lifecycle
self.druid:final()
self.druid:update(dt)
self.druid:on_input(action_id, action)
self.druid:on_message(message_id, message, sender)
-- Custom components
self.druid:new(component, ...)
self.druid:new_widget(widget, [template], [nodes], ...)
-- Built-in components
self.druid:new_button(node, [callback], [params], [anim_node])
self.druid:new_text(node, [value], [no_adjust])
self.druid:new_grid(parent_node, item, [in_row])
self.druid:new_scroll(view_node, content_node)
self.druid:new_data_list(druid_scroll, druid_grid, create_function)
self.druid:new_progress(node, key, [init_value])
self.druid:new_lang_text(node, [locale_id], [adjust_type])
self.druid:new_rich_text(text_node, [value])
self.druid:new_back_handler([callback], [params])
self.druid:new_blocker(node)
self.druid:new_hover(node, [on_hover_callback], [on_mouse_hover_callback])
self.druid:new_drag(node, [on_drag_callback])
self.druid:new_swipe(node, [on_swipe_callback])
self.druid:new_input(click_node, text_node, [keyboard_type])
self.druid:new_rich_input(template, [nodes])
self.druid:new_layout(node, [mode])
self.druid:new_container(node, [mode], [callback])
self.druid:new_hotkey(keys_array, [callback], [callback_argument])
self.druid:new_slider(pin_node, end_pos, [callback])
self.druid:new_timer(node, [seconds_from], [seconds_to], [callback])
-- Operational
self.druid:remove(component)
self.druid:set_blacklist(blacklist_components)
self.druid:set_whitelist(whitelist_components)
```
## Components
### [Base Component](components/base/component_api.md)
Inspect [API Here](components/base/component_api.md)
Basic methods for all components and widgets.
```lua
component:get_childrens()
component:get_context()
component:get_druid([template], [nodes])
component:get_input_priority()
component:get_node(node_id)
component:get_nodes()
component:get_parent_component()
component:get_template()
component:reset_input_priority()
component:set_input_enabled(state)
component:set_input_priority(value, [is_temporary])
component:set_nodes(nodes)
component:set_style([druid_style])
component:set_template([template])
-- All widgets goes with created Druid instance
-- All other component's functions also exists
widget.druid
```
### [Blocker](components/base/blocker_api.md)
Inspect [API Here](components/base/blocker_api.md)
```lua
local blocker = self.druid:new_blocker(node)
blocker:is_enabled()
blocker:set_enabled(state)
```
### [Button](components/base/button_api.md)
Inspect [API Here](components/base/button_api.md)
```lua
local button = require("druid.base.button")
button:init(node_or_node_id, [callback], [custom_args], [anim_node])
button:set_animations_disabled()
button:set_enabled([state])
button:is_enabled()
button:set_click_zone([zone])
button:set_key_trigger(key)
button:get_key_trigger()
button:set_check_function([check_function], [failure_callback])
button:set_web_user_interaction([is_web_mode])
button.on_click
button.on_pressed
button.on_repeated_click
button.on_long_click
button.on_double_click
button.on_hold_callback
button.on_click_outside
```
### [Container](components/extended/container_api.md)
Inspect [API Here](components/extended/container_api.md)
```lua
local container = self.druid:new_container(node, [mode], [callback])
container:add_container(node_or_container, [mode], [on_resize_callback])
container:clear_draggable_corners()
container:create_draggable_corners()
container:fit_into_node(node)
container:fit_into_size(target_size)
container:fit_into_window()
container:get_position()
container:get_scale()
container:get_size()
container:on_window_resized()
container:refresh()
container:refresh_origins()
container:refresh_scale()
container:remove_container_by_node([node])
container:set_min_size([min_size_x], [min_size_y])
container:set_max_size([max_size_x], [max_size_y])
container:set_parent_container([parent_container])
container:set_pivot(pivot)
container:set_position(pos_x, pos_y)
container:set_size([width], [height], [anchor_pivot])
container:update_child_containers()
container.on_size_changeed
```
### [Data List](components/extended/data_list_api.md)
Inspect [API Here](components/extended/data_list_api.md)
```lua
local data_list = self.druid:new_data_list(druid_scroll, druid_grid, create_function)
data_list:add(data, [index], [shift_policy])
data_list:clear()
data_list:get_created_components()
data_list:get_created_nodes()
data_list:get_data()
data_list:get_index(data)
data_list:remove([index], [shift_policy])
data_list:remove_by_data(data, [shift_policy])
data_list:scroll_to_index(index)
data_list:set_data(data)
data_list:set_use_cache(is_use_cache)
data_list.on_scroll_progress_change
data_list.on_element_add
data_list.on_element_remove
```
### [Drag](components/base/drag_api.md)
Inspect [API Here](components/base/drag_api.md)
```lua
local drag = self.druid:new_drag(node, [on_drag_callback])
drag:is_enabled()
drag:on_window_resized()
drag:set_click_zone([node])
drag:set_drag_cursors(is_enabled)
drag:set_enabled(is_enabled)
drag.on_touch_start
drag.on_touch_end
drag.on_drag_start
drag.on_drag
drag.on_drag_end
```
### [Grid](components/base/static_grid_api.md)
Inspect [API Here](components/base/static_grid_api.md)
```lua
local grid = self.druid:new_grid(parent_node, item, [in_row])
grid:add(item, [index], [shift_policy], [is_instant])
grid:clear()
grid:get_all_pos()
grid:get_borders()
grid:get_index(pos)
grid:get_index_by_node(node)
grid:get_offset()
grid:get_pos(index)
grid:get_size()
grid:get_size_for([count])
grid:refresh()
grid:remove(index, [shift_policy], [is_instant])
grid:set_anchor(anchor)
grid:set_in_row(in_row)
grid:set_item_size([width], [height])
grid:set_items(nodes, [is_instant])
grid:set_pivot([pivot])
grid:set_position_function(callback)
grid:sort_nodes(comparator)
grid.on_add_item
grid.on_remove_item
grid.on_change_items
grid.on_clear
grid.on_update_positions
```
### [Hotkey](components/extended/hotkey_api.md)
Inspect [API Here](components/extended/hotkey_api.md)
```lua
local hotkey = self.druid:new_hotkey(keys_array, [callback], [callback_argument])
hotkey:add_hotkey(keys, [callback_argument])
hotkey:is_processing()
hotkey:on_focus_gained()
hotkey:set_repeat(is_enabled_repeated)
hotkey.on_hotkey_pressed
hotkey.on_hotkey_released
```
### [Hover](components/base/hover_api.md)
Inspect [API Here](components/base/hover_api.md)
```lua
local hover = self.druid:new_hover(node, [on_hover_callback], [on_mouse_hover_callback])
hover:is_enabled()
hover:is_hovered()
hover:is_mouse_hovered()
hover:set_click_zone([zone])
hover:set_enabled([state])
hover:set_hover([state])
hover:set_mouse_hover([state])
hover.on_hover
hover.on_mouse_hover
```
### [Input](components/extended/input_api.md)
Inspect [API Here](components/extended/input_api.md)
```lua
local input = self.druid:new_input(click_node, text_node, [keyboard_type])
input:get_text()
input:get_text_selected()
input:get_text_selected_replaced(text)
input:move_selection(delta, is_add_to_selection, is_move_to_end)
input:on_focus_lost()
input:reset_changes()
input:select()
input:select_cursor([cursor_index], [start_index], [end_index])
input:set_allowed_characters(characters)
input:set_max_length(max_length)
input:set_text(input_text)
input:unselect()
input.on_input_select
input.on_input_unselect
input.on_input_text
input.on_input_empty
input.on_input_full
input.on_input_wrong
input.on_select_cursor_change
```
### [Lang Text](components/extended/lang_text_api.md)
Inspect [API Here](components/extended/lang_text_api.md)
```lua
local lang_text = self.druid:new_lang_text(node, [locale_id], [adjust_type])
lang_text:format([a], [b], [c], [d], [e], [f], [g])
lang_text:on_language_change()
lang_text:set_text(text)
lang_text:set_to(text)
lang_text:translate(locale_id, [a], [b], [c], [d], [e], [f], [g])
lang_text.on_change
```
### [Layout](components/extended/layout_api.md)
Inspect [API Here](components/extended/layout_api.md)
```lua
local layout = self.druid:new_layout(node, [mode])
layout:add(node_or_node_id)
layout:calculate_rows_data()
layout:clear_layout()
layout:get_content_size()
layout:get_entities()
layout:get_node_size(node)
layout:get_size()
layout:refresh_layout()
layout:remove(node_or_node_id)
layout:set_dirty()
layout:set_hug_content(is_hug_width, is_hug_height)
layout:set_justify(is_justify)
layout:set_margin([margin_x], [margin_y])
layout:set_node_index([node], [index])
layout:set_node_position(node, x, y)
layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
layout:set_type(type)
layout:update()
layout.on_size_changed
```
### [Progress](components/extended/progress_api.md)
Inspect [API Here](components/extended/progress_api.md)
```lua
local progress = self.druid:new_progress(node, key, [init_value])
progress:empty()
progress:fill()
progress:get()
progress:set_max_size(max_size)
progress:set_steps(steps, callback)
progress:set_to(to)
progress:to(to, [callback])
progress:update([dt])
progress.on_change
```
### [Rich Input](components/custom/rich_input_api.md)
Inspect [API Here](components/custom/rich_input_api.md)
```lua
local rich_input = self.druid:new_rich_input(template, [nodes])
rich_input:get_text()
rich_input:select()
rich_input:set_allowed_characters(characters)
rich_input:set_font(font)
rich_input:set_placeholder(placeholder_text)
rich_input:set_text(text)
```
### [Rich Text](components/custom/rich_text_api.md)
Inspect [API Here](components/custom/rich_text_api.md)
```lua
local rich_text = self.druid:new_rich_text(text_node, [value])
rich_text:characters(word)
rich_text:clear()
rich_text:get_line_metric()
rich_text:get_text()
rich_text:get_words()
rich_text:set_text([text])
rich_text:tagged(tag)
```
### [Scroll](components/base/scroll_api.md)
Inspect [API Here](components/base/scroll_api.md)
```lua
local scroll = self.druid:new_scroll(view_node, content_node)
scroll:bind_grid([grid])
scroll:get_percent()
scroll:get_scroll_size()
scroll:is_inert()
scroll:is_node_in_view(node)
scroll:scroll_to(point, [is_instant])
scroll:scroll_to_index(index, [skip_cb])
scroll:scroll_to_percent(percent, [is_instant])
scroll:set_click_zone(node)
scroll:set_extra_stretch_size([stretch_size])
scroll:set_horizontal_scroll(state)
scroll:set_inert(state)
scroll:set_points(points)
scroll:set_size(size, [offset])
scroll:set_vertical_scroll(state)
scroll:set_view_size(size)
scroll:update([dt])
scroll:update_view_size()
scroll.on_scroll
scroll.on_scroll_to
scroll.on_point_scroll
```
### [Slider](components/extended/slider_api.md)
Inspect [API Here](components/extended/slider_api.md)
```lua
local slider = self.druid:new_slider(pin_node, end_pos, [callback])
slider:is_enabled()
slider:set(value, [is_silent])
slider:set_enabled(is_enabled)
slider:set_input_node([input_node])
slider:set_steps(steps)
slider.on_change_value
```
### [Swipe](components/extended/swipe_api.md)
Inspect [API Here](components/extended/swipe_api.md)
```lua
local swipe = self.druid:new_swipe(node, [on_swipe_callback])
swipe:set_click_zone([zone])
swipe.on_swipe
```
### [Text](components/base/text_api.md)
Inspect [API Here](components/base/text_api.md)
```lua
local text = self.druid:new_text(node, [value], [no_adjust])
text:get_text()
text:get_text_adjust()
text:get_text_index_by_width(width)
text:get_text_size([text])
text:is_multiline()
text:set_alpha(alpha)
text:set_color(color)
text:set_minimal_scale(minimal_scale)
text:set_pivot(pivot)
text:set_scale(scale)
text:set_size(size)
text:set_text([new_text])
text:set_text_adjust([adjust_type], [minimal_scale])
text:set_to(set_to)
text.on_set_text
text.on_update_text_scale
text.on_set_pivot
```
### [Timer](components/extended/timer_api.md)
Inspect [API Here](components/extended/timer_api.md)
```lua
local timer = self.druid:new_timer(node, [seconds_from], [seconds_to], [callback])
timer:set_interval(from, to)
timer:set_state([is_on])
timer:set_to(set_to)
timer:update([dt])
timer.on_tick
timer.on_set_enabled
timer.on_timer_end
```
## [Helper](druid_helper_api.md)
Inspect [API Here](druid_helper_api.md)
```lua
local helper = require("druid.helper")
helper.add_array([target], [source])
helper.centrate_icon_with_text([icon_node], [text_node], [margin])
helper.centrate_nodes([margin], ...)
helper.centrate_text_with_icon([text_node], [icon_node], margin)
helper.clamp(value, [v1], [v2])
helper.contains([array], [value])
helper.deepcopy(orig_table)
helper.distance(x1, y1, x2, y2)
helper.get_animation_data_from_node(node, atlas_path)
helper.get_border(node, [offset])
helper.get_closest_stencil_node(node)
helper.get_full_position(node, [root])
helper.get_gui_scale()
helper.get_node(node_id, [template], [nodes])
helper.get_pivot_offset(pivot_or_node)
helper.get_scaled_size(node)
helper.get_scene_scale(node, [include_passed_node_scale])
helper.get_screen_aspect_koef()
helper.get_text_metrics_from_node(text_node)
helper.insert_with_shift(array, [item], [index], [shift_policy])
helper.is_mobile()
helper.is_multitouch_supported()
helper.is_web()
helper.is_web_mobile()
helper.lerp(a, b, t)
helper.pick_node(node, x, y, [node_click_area])
helper.remove_with_shift([array], [index], [shift_policy])
helper.round(num, [num_decimal_places])
helper.sign(val)
helper.step(current, target, step)
helper.table_to_string(t)
```
## [Widgets](widgets_api.md)
Inspect [API Here](widgets_api.md)
### [FPS Panel](/api/components/widgets/fps_panel_api.md)
Inspect [API Here](/api/components/widgets/fps_panel_api.md)
```lua
local fps_panel = require("druid.widget.fps_panel.fps_panel")
fps_panel:init()
fps_panel:push_fps_value()
```
### [Memory Panel](/api/components/widgets/memory_panel_api.md)
Inspect [API Here](/api/components/widgets/memory_panel_api.md)
```lua
local memory_panel = require("druid.widget.memory_panel.memory_panel")
memory_panel:init()
memory_panel:set_low_memory_limit([limit])
memory_panel:push_next_value()
memory_panel:update_text_memory()
```
### [Mini Graph](/api/components/widgets/mini_graph_api.md)
Inspect [API Here](/api/components/widgets/mini_graph_api.md)
```lua
local mini_graph = require("druid.widget.mini_graph.mini_graph")
mini_graph:clear()
mini_graph:set_samples([samples])
mini_graph:get_samples()
mini_graph:set_line_value(index, value)
mini_graph:get_line_value([index])
mini_graph:push_line_value([value])
mini_graph:set_max_value([max_value])
mini_graph:set_line_height([index])
mini_graph:get_lowest_value()
mini_graph:get_highest_value()
mini_graph:toggle_hide()
```
### [Properties Panel](/api/components/widgets/properties_panel_api.md)
Inspect [API Here](/api/components/widgets/properties_panel_api.md)
```lua
local properties_panel = require("druid.widget.properties_panel.properties_panel")
properties_panel:properties_constructors()
properties_panel:init()
properties_panel:clear_created_properties()
properties_panel:clear()
properties_panel:add_checkbox([on_create])
properties_panel:add_slider([on_create])
properties_panel:add_button([on_create])
properties_panel:add_input([on_create])
properties_panel:add_text([on_create])
properties_panel:add_left_right_selector([on_create])
properties_panel:add_vector3([on_create])
properties_panel:add_inner_widget(widget_class, [template], [nodes], [on_create])
properties_panel:add_widget(create_widget_callback)
properties_panel:remove([widget])
properties_panel:set_hidden([is_hidden])
properties_panel:is_hidden()
properties_panel:set_properties_per_page(properties_per_page)
properties_panel:set_page([page])
```

View File

@ -1,16 +0,0 @@
project='Druid'
title='Defold Druid UI Library'
description='Documentation for Druid Library'
file={"./druid",
exclude = {
"./druid/styles/",
"./druid/system/middleclass.lua"
}
}
package='druid'
sort=false
dir='./docs'
style='!fixed'
topics={}
use_markdown_titles=true
no_space_before_args=true

BIN
docs/Druid.wasm Normal file

Binary file not shown.

36
docs/Druid_asmjs.js Normal file

File diff suppressed because one or more lines are too long

1
docs/Druid_wasm.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"content":[{"name":"game.projectc","size":4552,"pieces":[{"name":"game0.projectc","offset":0}]},{"name":"game.arci","size":15008,"pieces":[{"name":"game0.arci","offset":0}]},{"name":"game.arcd","size":3789178,"pieces":[{"name":"game0.arcd","offset":0},{"name":"game1.arcd","offset":2097152}]},{"name":"game.dmanifest","size":17041,"pieces":[{"name":"game0.dmanifest","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game0.public.der","offset":0}]}],"total_size":3825941}

BIN
docs/archive/game0.arcd Normal file

Binary file not shown.

BIN
docs/archive/game0.arci Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,33 +1,38 @@
[project]
title = druid
version = 0.6.459
title = Druid
version = 1.1.0
write_log = 0
minimum_log_level = 1
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = 015564f5b3e0d5e63e422056c69e53826ed689bf
build_time = 2021-04-05T21:00:43Z
developer = Maksim Tuprikov
custom_resources = /example/locales
commit_sha = 423a5239036790befe5fd0afd5b7a653314ad8be
title_as_file_name = Druid
[display]
width = 600
height = 900
high_dpi = 0
width = 1920
height = 1080
high_dpi = 1
samples = 0
fullscreen = 0
update_frequency = 0
update_frequency = 60
swap_interval = 1
vsync = 1
display_profiles = /builtins/render/default.display_profilesc
dynamic_orientation = 0
dynamic_orientation = 1
display_device_info = 0
[render]
clear_color_red = 0
clear_color_green = 0
clear_color_blue = 0
clear_color_alpha = 0
clear_color_alpha = 1
[physics]
type = 2D
max_collision_object_count = 128
use_fixed_timestep = 0
gravity_y = -10
debug = 0
debug_alpha = 0.9
@ -35,7 +40,7 @@ world_count = 4
gravity_x = 0
gravity_z = 0
scale = 1
allow_dynamic_transforms = 0
allow_dynamic_transforms = 1
debug_scale = 30
max_collisions = 64
max_contacts = 128
@ -43,19 +48,24 @@ contact_impulse_limit = 0
ray_cast_limit_2d = 64
ray_cast_limit_3d = 128
trigger_overlap_capacity = 16
velocity_threshold = 1
max_fixed_timesteps = 2
[bootstrap]
main_collection = /example/example.collectionc
main_collection = /example/druid.collectionc
render = /builtins/render/default.renderc
[graphics]
default_texture_min_filter = linear
default_texture_mag_filter = linear
max_draw_calls = 1024
max_draw_calls = 128
max_characters = 8192
max_font_batches = 128
max_debug_vertices = 10000
texture_profiles = /example/custom.texture_profiles
verify_graphics_calls = 1
texture_profiles = /builtins/graphics/default.texture_profiles
verify_graphics_calls = 0
opengl_version_hint = 33
opengl_core_profile_hint = true
memory_size = 512
[shader]
@ -78,90 +88,101 @@ max_resources = 1024
repeat_delay = 0.5
repeat_interval = 0.2
gamepads = /builtins/input/default.gamepadsc
game_binding = /input/game.input_bindingc
game_binding = /builtins/input/all.input_bindingc
use_accelerometer = 0
[sprite]
max_count = 128
max_count = 16
subpixels = 1
[spine]
max_count = 128
[model]
max_count = 128
max_count = 0
split_meshes = 0
[mesh]
max_count = 128
max_count = 0
[gui]
max_count = 64
max_particlefx_count = 64
max_particle_count = 1024
max_animation_count = 1024
[collection]
max_instances = 1024
max_instances = 128
max_input_stack_entries = 16
[collection_proxy]
max_count = 8
[collectionfactory]
max_count = 128
max_count = 64
[factory]
max_count = 128
max_count = 16
[ios]
launch_screen = /builtins/manifests/ios/LaunchScreen.storyboardc
pre_renderered_icons = 0
bundle_identifier = example.unnamed
bundle_name =
infoplist = /builtins/manifests/ios/Info.plist
privacymanifest = /builtins/manifests/ios/PrivacyInfo.xcprivacy
default_language = en
localizations = en
[android]
version_code = 459
minimum_sdk_version = 16
target_sdk_version = 29
version_code = 970
minimum_sdk_version = 19
target_sdk_version = 35
package = com.insality.druid
gcm_sender_id =
manifest = /builtins/manifests/android/AndroidManifest.xml
iap_provider = GooglePlay
input_method = HiddenInputField
immersive_mode = 0
display_cutout = 1
debuggable = 0
proguard =
extract_native_libs = 1
[osx]
app_icon =
infoplist = /builtins/manifests/osx/Info.plist
privacymanifest = /builtins/manifests/osx/PrivacyInfo.xcprivacy
bundle_identifier = example.unnamed
bundle_name =
bundle_version = 1
default_language = en
localizations = en
[windows]
app_icon =
[html5]
custom_heap_size = 0
heap_size = 64
htmlfile = /builtins/manifests/web/engine_template.html
cssfile = /builtins/manifests/web/light_theme.css
cssfile = /builtins/manifests/web/dark_theme.css
splash_image = /media/druid_logo.png
archive_location_prefix = archive
archive_location_suffix =
engine_arguments = --verify-graphics-calls=false
wasm_streaming = 0
show_fullscreen_button = 0
show_made_with_defold = 0
scale_mode = fit
engine_arguments = --verify-graphics-calls=false
splash_image = /media/druid_logo.png
show_console_banner = 0
scale_mode = stretch
transparent_graphics_context = 0
[particle_fx]
max_count = 64
max_particle_count = 1024
[iap]
auto_finish_transactions = 1
max_count = 0
max_emitter_count = 0
max_particle_count = 0
[network]
http_timeout = 0
ssl_certificates =
http_thread_count = 4
http_cache_enabled = 1
@ -172,26 +193,51 @@ include_dirs = druid
shared_state = 1
[label]
max_count = 64
max_count = 0
subpixels = 1
[profiler]
track_cpu = 0
sleep_between_server_updates = 0
[liveupdate]
settings = /liveupdate.settings
enabled = 1
mount_on_start = 1
[tilemap]
max_count = 16
max_tile_count = 2048
max_count = 0
max_tile_count = 0
[engine]
run_while_iconified = 0
fixed_update_frequency = 60
max_time_step = 0.5
[druid]
no_auto_input = 0
input_text = text
input_touch = touch
input_marked_text = marked_text
input_key_esc = key_esc
input_key_back = key_back
input_key_enter = key_enter
input_key_backspace = key_backspace
input_multitouch = touch_multi
input_scroll_up = mouse_wheel_up
input_scroll_down = mouse_wheel_down
[native_extension]
app_manifest = /example/game.appmanifest
app_manifest =
[saver]
autosave_timer = 2
[lang]
path = /example/locales
langs = en,ru,es,de,fr,ja,pt,it,kr,zh
default = es
[event]
use_xpcall = 1

Binary file not shown.

BIN
docs/archive/game1.arcd Normal file

Binary file not shown.

1172
docs/dmloader.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
{"content":[{"name":"game.projectc","size":3432,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":10608,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":384566,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":23386,"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.

Binary file not shown.

View File

@ -1,866 +0,0 @@
// file downloader
// wraps XMLHttpRequest and adds retry support and progress updates when the
// content is gzipped (gzipped content doesn't report a computable content length
// on Google Chrome)
var FileLoader = {
options: {
retryCount: 4,
retryInterval: 1000,
},
// do xhr request with retries
request: function(url, method, responseType, currentAttempt) {
if (typeof method === 'undefined') throw "No method specified";
if (typeof method === 'responseType') throw "No responseType specified";
if (typeof currentAttempt === 'undefined') currentAttempt = 0;
var obj = {
send: function() {
var onprogress = this.onprogress;
var onload = this.onload;
var onerror = this.onerror;
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.responseType = responseType;
xhr.onprogress = function(e) {
if (onprogress) onprogress(xhr, e);
};
xhr.onerror = function(e) {
if (currentAttempt == FileLoader.options.retryCount) {
if (onerror) onerror(xhr, e);
return;
}
currentAttempt = currentAttempt + 1;
setTimeout(obj.send, FileLoader.options.retryInterval);
};
xhr.onload = function(e) {
if (onload) onload(xhr, e);
};
xhr.send(null);
}
};
return obj;
},
// Do HTTP HEAD request to get size of resource
// callback will receive size or undefined in case of an error
size: function(url, callback) {
var request = FileLoader.request(url, "HEAD", "text");
request.onerror = function(xhr, e) {
callback(undefined);
};
request.onload = function(xhr, e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var total = xhr.getResponseHeader('content-length');
callback(total);
} else {
callback(undefined);
}
}
};
request.send();
},
// Do HTTP GET request
// onprogress(loaded, total)
// onerror(error)
// onload(response)
load: function(url, responseType, estimatedSize, onprogress, onerror, onload) {
var request = FileLoader.request(url, "GET", responseType);
request.onprogress = function(xhr, e) {
if (e.lengthComputable) {
onprogress(e.loaded, e.total);
return;
}
var contentLength = xhr.getResponseHeader('content-length');
var size = contentLength != undefined ? contentLength : estimatedSize;
if (size) {
onprogress(e.loaded, size);
} else {
onprogress(e.loaded, e.loaded);
}
};
request.onerror = function(xhr, e) {
onerror("Error loading '" + url + "' (" + e + ")");
};
request.onload = function(xhr, e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var res = xhr.response;
if (responseType == "json" && typeof res === "string") {
onload(JSON.parse(res));
} else {
onload(res);
}
} else {
onerror("Error loading '" + url + "' (" + e + ")");
}
}
};
request.send();
}
};
var EngineLoader = {
wasm_size: 2000000,
wasm_from: 0,
wasm_to: 40,
wasmjs_size: 250000,
wasmjs_from: 40,
wasmjs_to: 50,
asmjs_size: 4000000,
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) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
function(wasm) {
Module.instantiateWasm = function(imports, successCallback) {
var wasmInstantiate = WebAssembly.instantiate(new Uint8Array(wasm), imports).then(function(output) {
successCallback(output.instance);
}).catch(function(e) {
console.log('wasm instantiation failed! ' + e);
throw e;
});
return {}; // Compiling asynchronously, no exports.
}
callback();
});
},
// load and start engine script (asm.js or wasm.js)
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
FileLoader.load(src, "text", estimatedSize,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
function(response) {
var tag = document.createElement("script");
tag.text = response;
document.head.appendChild(tag);
});
},
// load engine (asm.js or wasm.js + wasm)
// engine load progress goes from 1-50% for ams.js
// engine load progress goes from 0-40% for .wasm and 40-50% for wasm.js
load: function(appCanvasId, exeName) {
Progress.addProgress(Module.setupCanvas(appCanvasId));
if (Module['isWASMSupported']) {
EngineLoader.loadWasmAsync(exeName + ".wasm", EngineLoader.wasm_from, EngineLoader.wasm_to, function(wasm) {
EngineLoader.loadScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, EngineLoader.wasmjs_from, EngineLoader.wasmjs_to);
});
} else {
EngineLoader.loadScriptAsync(exeName + '_asmjs.js', EngineLoader.asmjs_size, EngineLoader.asmjs_from, EngineLoader.asmjs_to);
}
}
}
/* ********************************************************************* */
/* Load and combine game archive data that is split into archives */
/* ********************************************************************* */
var GameArchiveLoader = {
// which files to load
_files: [],
_fileIndex: 0,
// file
// name: intended filepath of built object
// size: expected size of built object.
// data: combined pieces
// downloaded: total bytes downloaded
// pieces: array of name, offset and data objects
// numExpectedFiles: total number of files expected in description
// lastRequestedPiece: index of last data file requested (strictly ascending)
// totalLoadedPieces: counts the number pieces received
//MAX_CONCURRENT_XHR: 6, // remove comment if throttling of XHR is desired.
isCompleted: false, // status of process
_onFileLoadedListeners: [], // signature: name, data.
_onArchiveLoadedListeners:[], // signature: void
_onFileDownloadErrorListeners: [], // signature: name
_currentDownloadBytes: 0,
_totalDownloadBytes: 0,
_archiveLocationFilter: function(path) { return "split" + path; },
cleanUp: function() {
this._files = [];
this._fileIndex = 0;
this.isCompleted = false;
this._onGameArchiveLoaderCompletedListeners = [];
this._onAllTargetsBuiltListeners = [];
this._onFileDownloadErrorListeners = [];
this._currentDownloadBytes = 0;
this._totalDownloadBytes = 0;
},
addListener: function(list, callback) {
if (typeof callback !== 'function') throw "Invalid callback registration";
list.push(callback);
},
notifyListeners: function(list, data) {
for (i=0; i<list.length; ++i) {
list[i](data);
}
},
addFileDownloadErrorListener: function(callback) {
this.addListener(this._onFileDownloadErrorListeners, callback);
},
notifyFileDownloadError: function(url) {
this.notifyListeners(this._onFileDownloadErrorListeners, url);
},
addFileLoadedListener: function(callback) {
this.addListener(this._onFileLoadedListeners, callback);
},
notifyFileLoaded: function(file) {
this.notifyListeners(this._onFileLoadedListeners, { name: file.name, data: file.data });
},
addArchiveLoadedListener: function(callback) {
this.addListener(this._onArchiveLoadedListeners, callback);
},
notifyArchiveLoaded: function() {
this.notifyListeners(this._onArchiveLoadedListeners);
},
setFileLocationFilter: function(filter) {
if (typeof filter !== 'function') throw "Invalid filter";
this._archiveLocationFilter = filter;
},
// load the archive_files.json with the list of files and their individual
// pieces
// descriptionUrl: location of text file describing files to be preloaded
loadArchiveDescription: function(descriptionUrl) {
FileLoader.load(
this._archiveLocationFilter(descriptionUrl),
"json",
undefined,
function (loaded, total) { },
function (error) { GameArchiveLoader.notifyFileDownloadError(descriptionUrl); },
function (json) { GameArchiveLoader.onReceiveDescription(json); });
},
onReceiveDescription: function(json) {
this._files = json.content;
this._totalDownloadBytes = 0;
this._currentDownloadBytes = 0;
// calculate total download size of all files
for(var i=0; i<this._files.length; ++i) {
this._totalDownloadBytes += this._files[i].size;
}
this.downloadContent();
},
downloadContent: function() {
var file = this._files[this._fileIndex];
// if the file consists of more than one piece we prepare an array to store the pieces in
if (file.pieces.length > 1) {
file.data = new Uint8Array(file.size);
}
// how many pieces to download at a time
var limit = file.pieces.length;
if (typeof this.MAX_CONCURRENT_XHR !== 'undefined') {
limit = Math.min(limit, this.MAX_CONCURRENT_XHR);
}
// download pieces
for (var i=0; i<limit; ++i) {
this.downloadPiece(file, i);
}
},
notifyDownloadProgress: function() {
Progress.calculateProgress(50, 100, this._currentDownloadBytes, this._totalDownloadBytes);
},
downloadPiece: function(file, index) {
if (index < file.lastRequestedPiece) {
throw "Request out of order";
}
var piece = file.pieces[index];
file.lastRequestedPiece = index;
file.totalLoadedPieces = 0;
var total = 0;
var downloaded = 0;
var url = this._archiveLocationFilter('/' + piece.name);
FileLoader.load(
url, "arraybuffer", undefined,
function (loaded, total) {
var delta = loaded - downloaded;
downloaded = loaded;
GameArchiveLoader._currentDownloadBytes += delta;
GameArchiveLoader.notifyDownloadProgress();
},
function (error) {
GameArchiveLoader.notifyFileDownloadError(error);
},
function (response) {
piece.data = new Uint8Array(response);
piece.dataLength = piece.data.length;
total = piece.dataLength;
downloaded = piece.dataLength;
GameArchiveLoader.onPieceLoaded(file, piece);
GameArchiveLoader.notifyDownloadProgress();
piece.data = undefined;
});
},
addPieceToFile: function(file, piece) {
if (1 == file.pieces.length) {
file.data = piece.data;
} else {
var start = piece.offset;
var end = start + piece.data.length;
if (0 > start) {
throw "Buffer underflow";
}
if (end > file.data.length) {
throw "Buffer overflow";
}
file.data.set(piece.data, piece.offset);
}
},
onPieceLoaded: function(file, piece) {
this.addPieceToFile(file, piece);
++file.totalLoadedPieces;
// is all pieces of the file loaded?
if (file.totalLoadedPieces == file.pieces.length) {
this.onFileLoaded(file);
}
// continue loading more pieces of the file
// if not all pieces are already in progress
else {
var next = file.lastRequestedPiece + 1;
if (next < file.pieces.length) {
this.downloadPiece(file, next);
}
}
},
verifyFile: function(file) {
// verify that we downloaded as much as we were supposed to
var actualSize = 0;
for (var i=0;i<file.pieces.length; ++i) {
actualSize += file.pieces[i].dataLength;
}
if (actualSize != file.size) {
throw "Unexpected data size";
}
// verify the pieces
if (file.pieces.length > 1) {
var output = file.data;
var pieces = file.pieces;
for (i=0; i<pieces.length; ++i) {
var item = pieces[i];
// Bounds check
var start = item.offset;
var end = start + item.dataLength;
if (0 < i) {
var previous = pieces[i - 1];
if (previous.offset + previous.dataLength > start) {
throw "Segment underflow";
}
}
if (pieces.length - 2 > i) {
var next = pieces[i + 1];
if (end > next.offset) {
throw "Segment overflow";
}
}
}
}
},
onFileLoaded: function(file) {
this.verifyFile(file);
this.notifyFileLoaded(file);
++this._fileIndex;
if (this._fileIndex == this._files.length) {
this.onArchiveLoaded();
} else {
this.downloadContent();
}
},
onArchiveLoaded: function() {
this.isCompleted = true;
this.notifyArchiveLoaded();
}
};
/* ********************************************************************* */
/* Default splash and progress visualisation */
/* ********************************************************************* */
var Progress = {
progress_id: "defold-progress",
bar_id: "defold-progress-bar",
listeners: [],
addListener: function(callback) {
if (typeof callback !== 'function') throw "Invalid callback registration";
this.listeners.push(callback);
},
notifyListeners: function(percentage) {
for (i=0; i<this.listeners.length; ++i) {
this.listeners[i](percentage);
}
},
addProgress : function (canvas) {
/* Insert default progress bar below canvas */
canvas.insertAdjacentHTML('afterend', '<div id="' + Progress.progress_id + '" class="canvas-app-progress"><div id="' + Progress.bar_id + '" class="canvas-app-progress-bar" style="width: 0%;"></div></div>');
Progress.bar = document.getElementById(Progress.bar_id);
Progress.progress = document.getElementById(Progress.progress_id);
},
updateProgress: function(percentage) {
if (Progress.bar) {
Progress.bar.style.width = percentage + "%";
}
Progress.notifyListeners(percentage);
},
calculateProgress: function (from, to, current, total) {
this.updateProgress(from + (current / total) * (to - from));
},
removeProgress: function () {
if (Progress.progress.parentElement !== null) {
Progress.progress.parentElement.removeChild(Progress.progress);
// Remove any background/splash image that was set in runApp().
// Workaround for Safari bug DEF-3061.
Module.canvas.style.background = "";
}
}
};
/* ********************************************************************* */
/* 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 */
/* ********************************************************************* */
var Module = {
noInitialRun: true,
_filesToPreload: [],
_archiveLoaded: false,
_preLoadDone: false,
_waitingForArchive: false,
// Persistent storage
persistentStorage: true,
_syncInProgress: false,
_syncNeeded: false,
_syncInitial: false,
_syncMaxTries: 3,
_syncTries: 0,
arguments: [],
print: function(text) { console.log(text); },
printErr: function(text) { console.error(text); },
setStatus: function(text) { console.log(text); },
isWASMSupported: (function() {
try {
if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
if (module instanceof WebAssembly.Module)
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
}
} catch (e) {
}
return false;
})(),
prepareErrorObject: function (err, url, line, column, errObj) {
line = typeof line == "undefined" ? 0 : line;
column = typeof column == "undefined" ? 0 : column;
url = typeof url == "undefined" ? "" : url;
var errorLine = url + ":" + line + ":" + column;
var error = errObj || (typeof window.event != "undefined" ? window.event.error : "" ) || err || "Undefined Error";
var message = "";
var stack = "";
var backtrace = "";
if (typeof error == "object" && typeof error.stack != "undefined" && typeof error.message != "undefined") {
stack = String(error.stack);
message = String(error.message);
} else {
stack = String(error).split("\n");
message = stack.shift();
stack = stack.join("\n");
}
stack = stack || errorLine;
var callLine = /at (\S+:\d*$)/.exec(message);
if (callLine) {
message = message.replace(/(at \S+:\d*$)/, "");
stack = callLine[1] + "\n" + stack;
}
message = message.replace(/(abort\(.+\)) at .+/, "$1");
stack = stack.replace(/\?{1}\S+(:\d+:\d+)/g, "$1");
stack = stack.replace(/ *at (\S+)$/gm, "@$1");
stack = stack.replace(/ *at (\S+)(?: \[as \S+\])? +\((.+)\)/g, "$1@$2");
stack = stack.replace(/^((?:Object|Array)\.)/gm, "");
stack = stack.split("\n");
return { stack:stack, message:message };
},
hasWebGLSupport: function() {
var webgl_support = false;
try {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
if (gl && gl instanceof WebGLRenderingContext) {
webgl_support = true;
}
} catch (error) {
console.log("An error occurred while detecting WebGL support: " + error);
webgl_support = false;
}
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);
return Module.canvas;
},
/**
* Module.runApp - Starts the application given a canvas element id
*
* 'extra_params' is an optional object that can have the following fields:
*
* 'archive_location_filter':
* Filter function that will run for each archive path.
*
* 'unsupported_webgl_callback':
* Function that is called if WebGL is not supported.
*
* 'engine_arguments':
* List of arguments (strings) that will be passed to the engine.
*
* 'persistent_storage':
* Boolean toggling the usage of persistent storage.
*
* 'custom_heap_size':
* Number of bytes specifying the memory heap size.
*
* 'disable_context_menu':
* Disables the right-click context menu on the canvas element if true.
*
* 'retry_time':
* Pause before retry file loading after error.
*
* 'retry_count':
* How many attempts we do when trying to download a file.
*
* 'can_not_download_file_callback':
* Function that is called if you can't download file after 'retry_count' attempts.
**/
runApp: function(appCanvasId, extra_params) {
Module.setupCanvas(appCanvasId);
var params = {
archive_location_filter: function(path) { return 'split' + path; },
unsupported_webgl_callback: undefined,
engine_arguments: [],
persistent_storage: true,
custom_heap_size: undefined,
disable_context_menu: true,
retry_time: 1,
retry_count: 10,
can_not_download_file_callback: undefined,
};
for (var k in extra_params) {
if (extra_params.hasOwnProperty(k)) {
params[k] = extra_params[k];
}
}
Module.arguments = params["engine_arguments"];
Module.persistentStorage = params["persistent_storage"];
var fullScreenContainer = params["full_screen_container"];
if (typeof fullScreenContainer === "string") {
fullScreenContainer = document.querySelector(fullScreenContainer);
}
Module.fullScreenContainer = fullScreenContainer || Module.canvas;
if (Module.hasWebGLSupport()) {
// Override game keys
CanvasInput.addToCanvas(Module.canvas);
Module.setupVisibilityChangeListener();
// Add context menu hide-handler if requested
if (params["disable_context_menu"])
{
Module.canvas.oncontextmenu = function(e) {
e.preventDefault();
};
}
FileLoader.options.retryCount = params["retry_count"];
FileLoader.options.retryInterval = params["retry_time"] * 1000;
if (typeof params["can_not_download_file_callback"] === "function") {
GameArchiveLoader.addFileDownloadErrorListener(params["can_not_download_file_callback"]);
}
// Load and assemble archive
GameArchiveLoader.addFileLoadedListener(Module.onArchiveFileLoaded);
GameArchiveLoader.addArchiveLoadedListener(Module.onArchiveLoaded);
GameArchiveLoader.setFileLocationFilter(params["archive_location_filter"]);
GameArchiveLoader.loadArchiveDescription('/archive_files.json');
} else {
Progress.updateProgress(100, "Unable to start game, WebGL not supported");
Module.setStatus = function(text) {
if (text) Module.printErr('[missing WebGL] ' + text);
};
if (typeof params["unsupported_webgl_callback"] === "function") {
params["unsupported_webgl_callback"]();
}
}
},
onArchiveFileLoaded: function(file) {
Module._filesToPreload.push({path: file.name, data: file.data});
},
onArchiveLoaded: function() {
GameArchiveLoader.cleanUp();
Module._archiveLoaded = true;
Progress.updateProgress(100, "Starting...");
if (Module._waitingForArchive) {
Module._preloadAndCallMain();
}
},
toggleFullscreen: function(element) {
if (GLFW.isFullscreen) {
GLFW.cancelFullScreen();
} else {
GLFW.requestFullScreen(element);
}
},
preSync: function(done) {
// Initial persistent sync before main is called
FS.syncfs(true, function(err) {
if(err) {
Module._syncTries += 1;
console.error("FS syncfs error: " + err);
if (Module._syncMaxTries > Module._syncTries) {
Module.preSync(done);
} else {
Module._syncInitial = true;
done();
}
} else {
Module._syncInitial = true;
if (done !== undefined) {
done();
}
}
});
},
preloadAll: function() {
if (Module._preLoadDone) {
return;
}
Module._preLoadDone = true;
for (var i = 0; i < Module._filesToPreload.length; ++i) {
var item = Module._filesToPreload[i];
FS.createPreloadedFile("", item.path, item.data, true, true);
}
},
// Tries to do a MEM->IDB sync
// It will flag that another one is needed if there is already one sync running.
persistentSync: function() {
// Need to wait for the initial sync to finish since it
// will call close on all its file streams which will trigger
// new persistentSync for each.
if (Module._syncInitial) {
if (Module._syncInProgress) {
Module._syncNeeded = true;
} else {
Module._startSyncFS();
}
}
},
preInit: [function() {
/* Mount filesystem on preinit */
var dir = DMSYS.GetUserPersistentDataRoot();
FS.mkdir(dir);
// If IndexedDB is supported we mount the persistent data root as IDBFS,
// then try to do a IDB->MEM sync before we start the engine to get
// previously saved data before boot.
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
if (Module.persistentStorage && window.indexedDB) {
FS.mount(IDBFS, {}, dir);
// Patch FS.close so it will try to sync MEM->IDB
var _close = FS.close; FS.close = function(stream) { var r = _close(stream); Module.persistentSync(); return r; }
// Sync IDB->MEM before calling main()
Module.preSync(function() {
Module._preloadAndCallMain();
});
} else {
Module._preloadAndCallMain();
}
}],
preRun: [function() {
/* If archive is loaded, preload all its files */
if(Module._archiveLoaded) {
Module.preloadAll();
}
}],
postRun: [function() {
if(Module._archiveLoaded) {
Progress.removeProgress();
}
}],
_preloadAndCallMain: function() {
// If the archive isn't loaded,
// we will have to wait with calling main.
if (!Module._archiveLoaded) {
Module._waitingForArchive = true;
} else {
Module.preloadAll();
Progress.removeProgress();
if (Module.callMain === undefined) {
Module.noInitialRun = false;
} else {
Module.callMain(Module.arguments);
}
}
},
// Wrap IDBFS syncfs call with logic to avoid multiple syncs
// running at the same time.
_startSyncFS: function() {
Module._syncInProgress = true;
if (Module._syncMaxTries > Module._syncTries) {
FS.syncfs(false, function(err) {
Module._syncInProgress = false;
if (err) {
console.error("Module._startSyncFS error: " + err);
Module._syncTries += 1;
}
if (Module._syncNeeded) {
Module._syncNeeded = false;
Module._startSyncFS();
}
});
}
},
};
window.onerror = function(err, url, line, column, errObj) {
if (typeof Module.ccall !== 'undefined') {
var errorObject = Module.prepareErrorObject(err, url, line, column, errObj);
Module.ccall('JSWriteDump', 'null', ['string'], [JSON.stringify(errorObject.stack)]);
}
Module.setStatus('Exception thrown, see JavaScript console');
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,210 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimal-ui, shrink-to-fit=no">
<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.6.459</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
* drag the selected text but block mouse down/up events to the engine.
*/
body {
position: fixed; /* Prevent overscroll */
margin:0;
padding:0;
}
.canvas-app-container {
width: 100%;
height: 100%;
position: absolute;
align-items: center;
justify-content: center;
overflow: hidden;
}
.canvas-app-container:-webkit-full-screen {
/* Auto width and height in Safari/Chrome fullscreen. */
width: auto;
height: auto;
}
#canvas {
outline: none;
border: 0;
width: 100%;
vertical-align: bottom;
}
#canvas-container {
position: relative;
}
canvas:focus, canvas:active {
outline: none;
border: 0;
ie-dummy: expression(this.hideFocus=true);
-moz-outline-style: none;
}
div {
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.canvas-app-progress {
position: absolute;
background-color: #d1dbeb;
height: 6px;
margin-top: -6px;
width: 100%;
}
.canvas-app-progress-bar {
font-size: 12px;
height: 6px;
color: rgb(255, 255, 255);
background-color: #1a72eb;
text-align: center;
line-height: 20px;
}
.link, .button {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: 0px;
padding-top: 12px;
}
.buttons-background {
background-color: #ffffff;
width: 100%;
height: 42px;
}
body {
background-color: #ffffff;
}
.canvas-app-container {
background: rgba(250,252,255,1);
background: -moz-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%);
background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(250,252,255,1)), color-stop(50%, rgba(250,252,255,1)), color-stop(50%, rgba(245,249,255,1)), color-stop(100%, rgba(245,249,255,1)));
background: -webkit-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%);
background: -o-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%);
background: -ms-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%);
background: linear-gradient(135deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fafcff', endColorstr='#f5f9ff', GradientType=1 );
}
.canvas-app-canvas {
background-repeat:no-repeat;
background-position: center center;
background-image: url("druid_logo.png");
}
</style>
</head>
<body>
<div id="app-container" class="canvas-app-container">
<div id="canvas-container" class="canvas-app-canvas-container">
<canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="600" height="900"></canvas>
</div>
<div class="buttons-background">
</div>
</div>
<!-- -->
<script id='engine-loader' type='text/javascript' src="dmloader.js"></script>
<!-- -->
<script id='engine-setup' type='text/javascript'>
var extra_params = {
archive_location_filter: function( path ) {
return ("archive" + path + "");
},
engine_arguments: ["--verify-graphics-calls=false",],
custom_heap_size: 67108864,
full_screen_container: "#canvas-container",
disable_context_menu: true
}
Module['INITIAL_MEMORY'] = extra_params.custom_heap_size;
Module['onRuntimeInitialized'] = function() {
Module.runApp("canvas", extra_params);
};
Module["locateFile"] = function(path, scriptDirectory)
{
// dmengine*.wasm is hardcoded in the built JS loader for WASM,
// we need to replace it here with the correct project name.
if (path == "dmengine.wasm" || path == "dmengine_release.wasm" || path == "dmengine_headless.wasm") {
path = "druid.wasm";
}
return scriptDirectory + path;
};
var is_iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var buttonHeight = 0;
// Resize on init, screen resize and orientation change
function resize_game_canvas() {
// Hack for iOS when exit from Fullscreen mode
if (is_iOS) {
window.scrollTo(0, 0);
}
var app_container = document.getElementById('app-container');
var game_canvas = document.getElementById('canvas');
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight - buttonHeight;
var width = 600;
var height = 900;
var targetRatio = width / height;
var actualRatio = innerWidth / innerHeight;
//Fit
if (actualRatio > targetRatio) {
width = innerHeight * targetRatio;
height = innerHeight;
app_container.style.marginLeft = ((innerWidth - width) / 2) + "px";
app_container.style.marginTop = "0px";
}
else {
width = innerWidth;
height = innerWidth / targetRatio;
app_container.style.marginLeft = "0px";
app_container.style.marginTop = ((innerHeight - height) / 2) + "px";
}
app_container.style.width = width + "px";
app_container.style.height = height + buttonHeight + "px";
game_canvas.width = width;
game_canvas.height = height;
}
resize_game_canvas();
window.addEventListener('resize', resize_game_canvas, false);
window.addEventListener('orientationchange', resize_game_canvas, false);
</script>
<script id='engine-start' type='text/javascript'>
EngineLoader.load("canvas", "druid");
</script>
</body>
</html>

BIN
docs/druid_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@ -1,176 +1,161 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="ldoc_fixed.css" type="text/css" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimal-ui, shrink-to-fit=no">
<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 1.1.0</title>
<style type='text/css'>
/* Disable user selection to avoid strange bug in Chrome on Windows:
* Selecting a text outside the canvas, then clicking+draging would
* drag the selected text but block mouse down/up events to the engine.
*/
body {
position: fixed; /* Prevent overscroll */
margin:0;
padding:0;
}
.canvas-app-container {
width: 100%;
height: 100%;
position: absolute;
align-items: center;
justify-content: center;
overflow: hidden;
}
.canvas-app-container:-webkit-full-screen {
/* Auto width and height in Safari/Chrome fullscreen. */
width: auto;
height: auto;
}
#canvas {
outline: none;
border: 0;
width: 100%;
vertical-align: bottom;
}
#canvas-container {
position: relative;
}
canvas:focus, canvas:active {
outline: none;
border: 0;
ie-dummy: expression(this.hideFocus=true);
-moz-outline-style: none;
}
body, div {
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.canvas-app-progress {
position: absolute;
background-color: #394046;
height: 6px;
margin-top: -6px;
width: 100%;
}
.canvas-app-progress-bar {
font-size: 12px;
height: 6px;
color: rgb(255, 255, 255);
background-color: #1a72eb;
text-align: center;
line-height: 20px;
transition: transform 1s ease;
transform-origin: left;
transform: scaleX(1.0);
}
.link, .button {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: 0px;
padding-top: 12px;
}
.buttons-background {
background-color: #1e2226;
width: 100%;
height: 42px;
}
body {
background-color: #1e2226;
}
.canvas-app-container {
background: rgba(36,41,46,1);
background: -moz-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(36,41,46,1)), color-stop(49%, rgba(36,41,46,1)), color-stop(50%, rgba(38,43,49,1)), color-stop(100%, rgba(38,43,49,1)));
background: -webkit-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -o-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -ms-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: linear-gradient(135deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#24292e', endColorstr='#262b31', GradientType=1 );
}
.canvas-app-canvas {
background-repeat:no-repeat;
background-position: center center;
background-image: url("druid_logo.png");
}
</style>
</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>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/BackHandler.html">BackHandler</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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="modules/Input.html">Input</a></li>
<li><a href="modules/LangText.html">LangText</a></li>
<li><a href="modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h2>Documentation for Druid Library</h2>
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/BackHandler.html">BackHandler</a></td>
<td class="summary">Component to handle back key (android, backspace)</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Blocker.html">Blocker</a></td>
<td class="summary">Component to block input on specify zone by node</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Button.html">Button</a></td>
<td class="summary">Component to handle basic GUI button</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Drag.html">Drag</a></td>
<td class="summary">Component to handle drag action on node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Hover.html">Hover</a></td>
<td class="summary">Component to handle hover node interaction</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Scroll.html">Scroll</a></td>
<td class="summary">Component to handle scroll content.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/StaticGrid.html">StaticGrid</a></td>
<td class="summary">Component to handle placing components by row and columns.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Swipe.html">Swipe</a></td>
<td class="summary">Component to handle swipe gestures on node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Text.html">Text</a></td>
<td class="summary">Component to handle all GUI texts.</td>
</tr>
<tr>
<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/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>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td>
<td class="summary">Druid checkbox component</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/CheckboxGroup.html">CheckboxGroup</a></td>
<td class="summary">Checkbox group module</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DataList.html">DataList</a></td>
<td class="summary">Component to manage data for huge dataset in scroll.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DynamicGrid.html">DynamicGrid</a></td>
<td class="summary">Component to handle placing components in row</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Input.html">Input</a></td>
<td class="summary">Druid input text component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/LangText.html">LangText</a></td>
<td class="summary">Component to handle all GUI texts
Good working with localization system</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Progress.html">Progress</a></td>
<td class="summary">Basic progress bar component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RadioGroup.html">RadioGroup</a></td>
<td class="summary">Radio group module</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Slider.html">Slider</a></td>
<td class="summary">Druid slider component</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Timer.html">Timer</a></td>
<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>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
<td class="summary">Instance of Druid.</td>
</tr>
</table>
</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-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
<div id="app-container" class="canvas-app-container">
<div id="running-from-file-warning" style="display: none; margin: 3em;">
<h1>Running from local file ⚠️</h1>
<p>It seems like you have opened this file by double-clicking on it. In order to test your build in a browser <b>you need to load this file from a web server</b>. You can either upload this file and the rest of the files from a Defold HTML5 bundle to a web hosting service OR host them using a local web server on your home network.</p>
<p><a href="https://defold.com/manuals/html5/#testing-html5-build" target="_blank">Learn more about running a local web server in the Defold HTML5 manual</a>.</p>
</div>
<div id="webgl-not-supported" style="display: none; margin: 3em;">
<h1>WebGL not supported ⚠️</h1>
<p>WebGL is not supported by your browser - visit <a href="https://get.webgl.org/">https://get.webgl.org/</a> to learn more.</p>
</div>
<div id="canvas-container" class="canvas-app-canvas-container">
<canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="1920" height="1080"></canvas>
</div>
<div class="buttons-background">
</div>
</div>
<!-- -->
<script id='engine-loader' type='text/javascript' src="dmloader.js"></script>
<script id='engine-setup' type='text/javascript'>
// From here you can configure game startup parameters via the CUSTOM_PARAMETERS object,
// override ProgressView to create your own loader. See dmloader.js for more details.
</script>
<script id='engine-start' type='text/javascript'>
var runningFromFileWarning = document.getElementById("running-from-file-warning");
if (window.location.href.startsWith("file://")) {
runningFromFileWarning.style.display = "block";
}
else {
EngineLoader.load("canvas", "Druid");
runningFromFileWarning.parentNode.removeChild(runningFromFileWarning);
}
</script>
</body>
</html>

View File

@ -1,311 +0,0 @@
/* BEGIN RESET
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.8.2r1
*/
html {
color: #000;
background: #FFF;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
font-style: inherit;
font-weight: inherit;
}
del,ins {
text-decoration: none;
}
li {
margin-left: 20px;
}
caption,th {
text-align: left;
}
h1,h2,h3,h4,h5,h6 {
font-size: 100%;
font-weight: bold;
}
q:before,q:after {
content: '';
}
abbr,acronym {
border: 0;
font-variant: normal;
}
sup {
vertical-align: baseline;
}
sub {
vertical-align: baseline;
}
legend {
color: #000;
}
input,button,textarea,select,optgroup,option {
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
input,button,textarea,select {*font-size:100%;
}
/* END RESET */
body {
margin-left: 1em;
margin-right: 1em;
font-family: arial, helvetica, geneva, sans-serif;
background-color: #ffffff; margin: 0px;
}
code, tt { font-family: monospace; font-size: 1.1em; }
span.parameter { font-family:monospace; }
span.parameter:after { content:":"; }
span.types:before { content:"("; }
span.types:after { content:")"; }
.type { font-weight: bold; font-style:italic }
body, p, td, th { font-size: .95em; line-height: 1.2em;}
p, ul { margin: 10px 0 0 0px;}
strong { font-weight: bold;}
em { font-style: italic;}
h1 {
font-size: 1.5em;
margin: 0 0 20px 0;
}
h2, h3, h4 { margin: 15px 0 10px 0; }
h2 { font-size: 1.25em; }
h3 { font-size: 1.15em; }
h4 { font-size: 1.06em; }
a:link { font-weight: bold; color: #004080; text-decoration: none; }
a:visited { font-weight: bold; color: #006699; text-decoration: none; }
a:link:hover { text-decoration: underline; }
hr {
color:#cccccc;
background: #00007f;
height: 1px;
}
blockquote { margin-left: 3em; }
ul { list-style-type: disc; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
}
pre {
background-color: rgb(245, 245, 245);
border: 1px solid #C0C0C0; /* silver */
padding: 10px;
margin: 10px 0 10px 0;
overflow: auto;
font-family: "Andale Mono", monospace;
}
pre.example {
font-size: .85em;
}
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
#container {
margin-left: 1em;
margin-right: 1em;
background-color: #ffffff;
}
#product {
text-align: center;
border-bottom: 1px solid #cccccc;
background-color: #ffffff;
}
#product big {
font-size: 2em;
}
#main {
background-color:#FFFFFF; // #f0f0f0;
border-left: 1px solid #cccccc;
}
#navigation {
position: fixed;
top: 0;
left: 0;
float: left;
width: 14em;
vertical-align: top;
background-color:#FFFFFF; // #f0f0f0;
border-right: 2px solid #cccccc;
overflow: visible;
overflow-y: scroll;
height: 100%;
padding-left: 1em;
}
#navigation h2 {
background-color:#FFFFFF;//:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align: left;
padding:0.2em;
border-bottom:1px solid #dddddd;
}
#navigation ul
{
font-size:1em;
list-style-type: none;
margin: 1px 1px 10px 1px;
}
#navigation li {
text-indent: -1em;
display: block;
margin: 3px 0px 0px 22px;
}
#navigation li li a {
margin: 0px 3px 0px -1em;
}
#content {
margin-left: 14em;
padding: 1em;
padding-left: 2em;
width: 700px;
border-left: 2px solid #cccccc;
// border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about {
clear: both;
padding-left: 1em;
margin-left: 14em; // avoid the damn sidebar!
border-top: 2px solid #cccccc;
border-left: 2px solid #cccccc;
background-color: #ffffff;
}
@media print {
body {
font: 12pt "Times New Roman", "TimeNR", Times, serif;
}
a { font-weight: bold; color: #004080; text-decoration: underline; }
#main {
background-color: #ffffff;
border-left: 0px;
}
#container {
margin-left: 2%;
margin-right: 2%;
background-color: #ffffff;
}
#content {
padding: 1em;
background-color: #ffffff;
}
#navigation {
display: none;
}
pre.example {
font-family: "Andale Mono", monospace;
font-size: 10pt;
page-break-inside: avoid;
}
}
table.module_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.module_list td {
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.module_list td.name { background-color: #f0f0f0; ; min-width: 200px; }
table.module_list td.summary { width: 100%; }
table.function_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.function_list td {
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.function_list td.name { background-color: #f6f6ff; ; min-width: 200px; }
table.function_list td.summary { width: 100%; }
dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;}
dl.table h3, dl.function h3 {font-size: .95em;}
ul.nowrap {
overflow:auto;
whitespace:nowrap;
}
/* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }
/* make the target distinct; helps when we're navigating to a function */
a:target + * {
background-color: #FF9;
}
/* styles for prettification of source */
pre .comment { color: #558817; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #aa5050; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }

View File

@ -1,221 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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><strong>BackHandler</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><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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>BackHandler</code></h1>
<p>Component to handle back key (android, backspace)</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, callback[, params])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input">on_input(self, action_id, action)</a></td>
<td class="summary">Input handler for component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_back">on_back</a></td>
<td class="summary">On back handler callback(self, params)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Params to back callback</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[, params])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">callback</span></span>
On back button
</li>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
Callback argument
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "on_input"></a>
<strong>on_input(self, action_id, action)</strong>
</dt>
<dd>
Input handler for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
</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>
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>
on_input action
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_back"></a>
<strong>on_back</strong>
</dt>
<dd>
On back handler callback(self, params)
<ul>
<li><span class="parameter">on_back</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Params to back callback
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,584 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>BaseComponent</code></h1>
<p>Basic class for all Druid components.</p>
<p>
To create you component, use `component.create`</p>
<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>
</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>
</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>
</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>
</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>
</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>
</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>
</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="summary">Component Interests</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "set_style"></a>
<strong>set_style(self, druid_style)</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
<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
</li>
</ul>
</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>
</dd>
<dt>
<a name = "get_context"></a>
<strong>get_context(self)</strong>
</dt>
<dd>
Get current component context
<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.6">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.
Use it to create component inside of other components.
<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"><span class="type">Druid</span></span>
Druid instance with component context
</ol>
</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>
<strong>get_input_priority(self)</strong>
</dt>
<dd>
Return component input priority
<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"><span class="type">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "set_input_priority"></a>
<strong>set_input_priority(self, value)</strong>
</dt>
<dd>
Set component input priority
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</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">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "reset_input_priority"></a>
<strong>reset_input_priority(self)</strong>
</dt>
<dd>
Reset component input priority to default value
<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"><span class="type">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "get_uid"></a>
<strong>get_uid(self)</strong>
</dt>
<dd>
Return component uid. 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>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component uid
</ol>
</dd>
<dt>
<a name = "set_input_enabled"></a>
<strong>set_input_enabled(self, state)</strong>
</dt>
<dd>
Set component input state. By default it enabled
You can disable any input of component by this function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The component input state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
BaseComponent itself
</ol>
</dd>
<dt>
<a name = "get_parent_component"></a>
<strong>get_parent_component(self)</strong>
</dt>
<dd>
Return the parent for current component
<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"><span class="type">druid.base_component</span> or <span class="type">nil</span></span>
The druid component instance or nil
</ol>
</dd>
<dt>
<a name = "setup_component"></a>
<strong>setup_component(self, druid_instance, context, style)</strong>
</dt>
<dd>
Setup component context and his style table
<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_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>
Druid style module
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">component</span></span>
BaseComponent itself
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "ALL"></a>
<strong>ALL</strong>
</dt>
<dd>
Component Interests
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,219 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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><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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Blocker</code></h1>
<p>Component to block input on specify zone by node</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node)</a></td>
<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>
</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">Trigger 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, node)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Blocker.html#node">node</a></span>
Gui node
</li>
</ul>
</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>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return blocked enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if blocker is enabled
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Trigger node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Blocker.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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,721 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Button</code></h1>
<p>Component to handle basic GUI button</p>
<p></p>
<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>
</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="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return button enabled state</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_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>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<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>
</tr>
<tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
<td class="summary">On double tap button callback(self, params, button_instance, click_amount)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_hold_callback">on_hold_callback</a></td>
<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>
</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="#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>
</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>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</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, 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"><span class="type">hash</span></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>
</dt>
<dd>
Get 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>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">hash</span></span>
The action_id of the key
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">LONGTAP_TIME</span>
<span class="types"><span class="type">number</span></span>
Minimum time to trigger on_hold_callback
(<em>default</em> 0.4)
</li>
<li><span class="parameter">AUTOHOLD_TRIGGER</span>
<span class="types"><span class="type">number</span></span>
Maximum hold time to trigger button release while holding
(<em>default</em> 0.8)
</li>
<li><span class="parameter">DOUBLETAP_TIME</span>
<span class="types"><span class="type">number</span></span>
Time between double taps
(<em>default</em> 0.4)
</li>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">function</span></span>
(self, node)
</li>
<li><span class="parameter">on_click_disabled</span>
<span class="types"><span class="type">function</span></span>
(self, node)
</li>
<li><span class="parameter">on_hover</span>
<span class="types"><span class="type">function</span></span>
(self, node, hover_state)
</li>
<li><span class="parameter">on_mouse_hover</span>
<span class="types"><span class="type">function</span></span>
(self, node, hover_state)
</li>
<li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">function</span></span>
(self, node, enabled_state)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">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>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "anim_node"></a>
<strong>anim_node</strong>
</dt>
<dd>
Animation node
<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>
</ul>
</dd>
<dt>
<a name = "start_scale"></a>
<strong>start_scale</strong>
</dt>
<dd>
Initial scale of anim_node
<ul>
<li><span class="parameter">start_scale</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>
Initial pos of anim_node
<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>
Initial pos of anim_node
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</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 = "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>
</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-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,340 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Checkbox</code></h1>
<p>Druid checkbox component</p>
<p></p>
<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="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="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">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
<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>
</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>
</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, node, callback[, click_node=node])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Checkbox callback
</li>
<li><span class="parameter">click_node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
Trigger node, by default equals to node
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, state, is_silent)</strong>
</dt>
<dd>
Set checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</li>
<li><span class="parameter">is_silent</span>
<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>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">function</span></span>
(self, node, state)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">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>
</ul>
</dd>
<dt>
<a name = "click_node"></a>
<strong>click_node</strong>
</dt>
<dd>
Button trigger node
<ul>
<li><span class="parameter">click_node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "button"></a>
<strong>button</strong>
</dt>
<dd>
Button component from click_node
<ul>
<li><span class="parameter">button</span>
<span class="types"><span class="type">Button</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,252 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>CheckboxGroup</code></h1>
<p>Checkbox group module</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<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="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>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
Array of gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Checkbox callback
</li>
<li><span class="parameter">click_nodes</span>
<span class="types"><span class="type">node[]</span></span>
Array of trigger nodes, by default equals to nodes
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, indexes)</strong>
</dt>
<dd>
Set checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
</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>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
</dd>
</dl>
<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>
</dt>
<dd>
Array of checkbox components
<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>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,506 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>DataList</code></h1>
<p>Component to manage data for huge dataset in scroll.</p>
<p>
It requires Druid Scroll and Druid Grid (Static or Dynamic) components</p>
<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>
</tr>
<tr>
<td class="name" nowrap><a href="#get_first_index">get_first_index(self)</a></td>
<td class="summary">Return first index from data.</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>
<tr>
<td class="name" nowrap><a href="#get_length">get_length(self)</a></td>
<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>
</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>
</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="#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>
</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, scroll, grid, create_function)</strong>
</dt>
<dd>
Data list constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">druid.scroll</span></span>
The Scroll 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
</li>
<li><span class="parameter">create_function</span>
<span class="types"><span class="type">function</span></span>
The create function callback(self, data, index, data_list). Function should return (node, [component])
</li>
</ul>
</dd>
<dt>
<a name = "on_remove"></a>
<strong>on_remove(self)</strong>
</dt>
<dd>
Druid System on_remove function
<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 = "set_data"></a>
<strong>set_data(self, data)</strong>
</dt>
<dd>
Set new data set for DataList component
<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>
The new data array
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.data_list</span></span>
Current DataList instance
</ol>
</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>
</dt>
<dd>
The Druid Grid component
<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>
</li>
</ul>
</dd>
<dt>
<a name = "last_index"></a>
<strong>last_index</strong>
</dt>
<dd>
The current visual last data index
<ul>
<li><span class="parameter">last_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_progress"></a>
<strong>scroll_progress</strong>
</dt>
<dd>
The current progress of scroll posititon
<ul>
<li><span class="parameter">scroll_progress</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</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">druid_event</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,496 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Drag</code></h1>
<p>Component to handle drag action on node.</p>
<p>
Drag have correct handling for multitouch and swap
touched while dragging. Drag will be processed even
the cursor is outside of node, if drag is already started</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, on_drag_callback)</a></td>
<td class="summary">Drag component constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, node)</a></td>
<td class="summary">Strict drag click area.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
<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>
</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>
</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>
</tr>
<tr>
<td class="name" nowrap><a href="#on_drag">on_drag</a></td>
<td class="summary">on drag progress callback(self, dx, dy)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_drag_end">on_drag_end</a></td>
<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>
</tr>
<tr>
<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="#can_x">can_x</a></td>
<td class="summary">Is drag component process vertical dragging.</td>
</tr>
<tr>
<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="#x">x</a></td>
<td class="summary">Current touch x position</td>
</tr>
<tr>
<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/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, node, on_drag_callback)</strong>
</dt>
<dd>
Drag component constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
GUI node to detect dragging
</li>
<li><span class="parameter">on_drag_callback</span>
<span class="types"><span class="type">function</span></span>
Callback for on_drag_event(self, dx, dy)
</li>
</ul>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, node)</strong>
</dt>
<dd>
Strict drag click area. Useful for
restrict events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">DRAG_DEADZONE</span>
<span class="types"><span class="type">number</span></span>
Distance in pixels to start dragging
(<em>default</em> 10)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">druid_event</span></span>
</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">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>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_drag"></a>
<strong>is_drag</strong>
</dt>
<dd>
Is component now dragging
<ul>
<li><span class="parameter">is_drag</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "can_x"></a>
<strong>can_x</strong>
</dt>
<dd>
Is drag component process vertical dragging. Default - true
<ul>
<li><span class="parameter">can_x</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "can_y"></a>
<strong>can_y</strong>
</dt>
<dd>
Is drag component process horizontal. Default - true
<ul>
<li><span class="parameter">can_y</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "x"></a>
<strong>x</strong>
</dt>
<dd>
Current touch x position
<ul>
<li><span class="parameter">x</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "y"></a>
<strong>y</strong>
</dt>
<dd>
Current touch y position
<ul>
<li><span class="parameter">y</span>
<span class="types"><span class="type">number</span></span>
</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>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,278 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>DruidEvent</code></h1>
<p>Lua event small library</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<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>
</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>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "initialize"></a>
<strong>initialize(self, initial_callback)</strong>
</dt>
<dd>
Event constructur
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">initial_callback</span>
<span class="types"><span class="type">function</span></span>
Subscribe the callback on new event, if callback exist
</li>
</ul>
</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>
<strong>is_exist(self)</strong>
</dt>
<dd>
Return true, if event have at lease one handler
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True if event have handlers
</ol>
</dd>
<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>
</li>
</ul>
</dd>
<dt>
<a name = "trigger"></a>
<strong>trigger(self, ...)</strong>
</dt>
<dd>
Trigger the event and call all subscribed callbacks
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">any</span></span>
All event params
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,783 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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><strong>DynamicGrid</strong></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>DynamicGrid</code></h1>
<p>Component to handle placing components in row</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td>
<td class="summary">Component init function</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]])</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])</a></td>
<td class="summary">Remove the item from the grid.</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>
</tr>
<tr>
<td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td>
<td class="summary">Return grid content borders</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_index_by_node">get_index_by_node(self, node)</a></td>
<td class="summary">Return grid index by node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_all_pos">get_all_pos(self)</a></td>
<td class="summary">Return array of all node positions</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_position_function">set_position_function(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>
</tr>
<tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td>
<td class="summary">The first index of node in grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#last_index">last_index</a></td>
<td class="summary">The last index of node in grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node_size">node_size</a></td>
<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>
</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, parent)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed
</li>
</ul>
</dd>
<dt>
<a name = "get_pos"></a>
<strong>get_pos(self, index, node[, origin_index])</strong>
</dt>
<dd>
Return pos for grid node index
<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 element index
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The node to be placed
</li>
<li><span class="parameter">origin_index</span>
<span class="types"><span class="type">number</span></span>
Index of nearby node
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Node position
</ol>
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT]])</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>
</ul>
</dd>
<dt>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT])</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>
</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>
<strong>get_size(self, border)</strong>
</dt>
<dd>
Return grid content size
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content size
</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>
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_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>
<span class="types"><span class="type">node</span></span>
The gui node in the grid
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd>
<dt>
<a name = "get_all_pos"></a>
<strong>get_all_pos(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>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "set_position_function"></a>
<strong>set_position_function(self, callback)</strong>
</dt>
<dd>
Change set position function for grid nodes. It will call on
update poses on grid elements. Default: gui.set_position
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Function on node set position
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.dynamic_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(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>
</dt>
<dd>
On item add callback(self, node, index)
<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>
</ul>
</dd>
<dt>
<a name = "first_index"></a>
<strong>first_index</strong>
</dt>
<dd>
The first index of node in grid
<ul>
<li><span class="parameter">first_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "last_index"></a>
<strong>last_index</strong>
</dt>
<dd>
The last index of node in grid
<ul>
<li><span class="parameter">last_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node_size"></a>
<strong>node_size</strong>
</dt>
<dd>
Item size
<ul>
<li><span class="parameter">node_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "border"></a>
<strong>border</strong>
</dt>
<dd>
The size of item content
<ul>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector4</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,337 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Hover</code></h1>
<p>Component to handle hover node interaction</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, on_hover_callback)</a></td>
<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>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict hover click area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<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>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_hover">on_hover</a></td>
<td class="summary">On hover callback(self, state)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_mouse_hover">on_mouse_hover</a></td>
<td class="summary">On mouse hover callback(self, state)</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, node, on_hover_callback)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</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">on_hover_callback</span>
<span class="types"><span class="type">function</span></span>
Hover callback
</li>
</ul>
</dd>
<dt>
<a name = "set_hover"></a>
<strong>set_hover(self, state)</strong>
</dt>
<dd>
Set 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 hover state
</li>
</ul>
</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>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict hover 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">Hover</span></span>
</li>
<li><span class="parameter">zone</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enable state of hover component.
If hover is not enabled, it will not generate
any hover events
<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 enabled state
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
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>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The hover enabled state
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_hover"></a>
<strong>on_hover</strong>
</dt>
<dd>
On hover callback(self, state)
<ul>
<li><span class="parameter">on_hover</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_mouse_hover"></a>
<strong>on_mouse_hover</strong>
</dt>
<dd>
On mouse hover callback(self, state)
<ul>
<li><span class="parameter">on_mouse_hover</span>
<span class="types"><span class="type">druid_event</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,695 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><strong>Input</strong></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Input</code></h1>
<p>Druid input text component.</p>
<p>
Carry on user text input</p>
<h3>Info:</h3>
<ul>
<li><strong>Author</strong>: Part of code from Britzl gooey input component</li>
</ul>
<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>
</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>
</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>
</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>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
<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>
</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>
</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_empty">on_input_empty</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="#on_input_full">on_input_full</a></td>
<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_wrong">on_input_wrong</a></td>
<td class="summary">On trying user input with not allowed character callback(self, params, button_instance)</td>
</tr>
<tr>
<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/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<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>
</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
</li>
</ul>
</dd>
<dt>
<a name = "select"></a>
<strong>select(self)</strong>
</dt>
<dd>
Select input field. It will show the keyboard and trigger on_select events
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "unselect"></a>
<strong>unselect(self)</strong>
</dt>
<dd>
Remove selection from input. It will hide the keyboard and trigger on_unselect events
<h3>Parameters:</h3>
<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>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">IS_LONGTAP_ERASE</span>
<span class="types"><span class="type">bool</span></span>
Is long tap will erase current input data
(<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>
Default character mask for password input
(<em>default</em> *)
</li>
<li><span class="parameter">IS_UNSELECT_ON_RESELECT</span>
<span class="types"><span class="type">bool</span></span>
If true, call unselect on select selected input
(<em>default</em> false)
</li>
<li><span class="parameter">on_select</span>
<span class="types"><span class="type">function</span></span>
(self, button_node) Callback on input field selecting
</li>
<li><span class="parameter">on_unselect</span>
<span class="types"><span class="type">function</span></span>
(self, button_node) Callback on input field unselecting
</li>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">function</span></span>
(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>
Custom button style for input node
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">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>
</ul>
</dd>
<dt>
<a name = "button"></a>
<strong>button</strong>
</dt>
<dd>
Button component
<ul>
<li><span class="parameter">button</span>
<span class="types"><span class="type">druid.button</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_selected"></a>
<strong>is_selected</strong>
</dt>
<dd>
Is current input selected now
<ul>
<li><span class="parameter">is_selected</span>
<span class="types"><span class="type">bool</span></span>
</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>
</dd>
<dt>
<a name = "max_length"></a>
<strong>max_length</strong>
</dt>
<dd>
Max length for input text
<ul>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "allowerd_characters"></a>
<strong>allowerd_characters</strong>
</dt>
<dd>
Pattern matching for user input
<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>
</ul>
</dd>
<dt>
<a name = "keyboard_type"></a>
<strong>keyboard_type</strong>
</dt>
<dd>
Gui keyboard type for input field
<ul>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,250 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>LangText</code></h1>
<p>Component to handle all GUI texts
Good working with localization system</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id, no_adjust)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, text)</a></td>
<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="summary">Translate the text by locale_id</td>
</tr>
</table>
<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 change text callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#text">text</a></td>
<td class="summary">The text component</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, node, locale_id, no_adjust)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
</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
</li>
<li><span class="parameter">no_adjust</span>
<span class="types"><span class="type">bool</span></span>
If true, will not correct text size
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, text)</strong>
</dt>
<dd>
Setup raw text to lang_text component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
</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>
Text for text node
</li>
</ul>
</dd>
<dt>
<a name = "translate"></a>
<strong>translate(self, locale_id)</strong>
</dt>
<dd>
Translate the text by locale_id
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
</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>
Locale id
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_change"></a>
<strong>on_change</strong>
</dt>
<dd>
On change text callback
<ul>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
The text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,529 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><strong>Progress</strong></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Progress</code></h1>
<p>Basic progress bar component.</p>
<p>
For correct progress bar init it should be in max size from gui</p>
<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>
</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="#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="#to">to(self, to[, callback])</a></td>
<td class="summary">Start animation of a progress bar</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
<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>
</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>
</tr>
<tr>
<td class="name" nowrap><a href="#scale">scale</a></td>
<td class="summary">Current progress bar scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#size">size</a></td>
<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>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<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>
</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)
</li>
</ul>
</dd>
<dt>
<a name = "fill"></a>
<strong>fill(self)</strong>
</dt>
<dd>
Fill a progress bar and stop progress animation
<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 = "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
</li>
</ul>
</dd>
<dt>
<a name = "get"></a>
<strong>get(self)</strong>
</dt>
<dd>
Return current progress bar value
<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_steps"></a>
<strong>set_steps(self, steps, callback)</strong>
</dt>
<dd>
Set points on progress bar to fire the callback
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
<li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span>
Array of progress bar values
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback on intersect step value
</li>
</ul>
<h3>Usage:</h3>
<ul>
<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 = "to"></a>
<strong>to(self, to[, callback])</strong>
</dt>
<dd>
Start animation of a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
value between 0..1
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback on animation ends
(<em>optional</em>)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">SPEED</span>
<span class="types"><span class="type">number</span></span>
Progress bas fill rate. More -> faster
(<em>default</em> 5)
</li>
<li><span class="parameter">MIN_DELTA</span>
<span class="types"><span class="type">number</span></span>
Minimum step to fill progress bar
(<em>default</em> 0.005)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_change"></a>
<strong>on_change</strong>
</dt>
<dd>
On progress bar change callback(self, new_value)
<ul>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Progress bar fill node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Progress.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "key"></a>
<strong>key</strong>
</dt>
<dd>
The progress bar direction
<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>
</ul>
</dd>
<dt>
<a name = "scale"></a>
<strong>scale</strong>
</dt>
<dd>
Current progress bar scale
<ul>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "size"></a>
<strong>size</strong>
</dt>
<dd>
Current progress bar size
<ul>
<li><span class="parameter">size</span>
<span class="types"><span class="type">vector3</span></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>
</dd>
<dt>
<a name = "slice"></a>
<strong>slice</strong>
</dt>
<dd>
Progress bar slice9 settings
<ul>
<li><span class="parameter">slice</span>
<span class="types"><span class="type">vector4</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,252 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RadioGroup</code></h1>
<p>Radio group module</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<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="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>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
Array of gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Radio callback
</li>
<li><span class="parameter">click_nodes</span>
<span class="types"><span class="type">node[]</span></span>
Array of trigger nodes, by default equals to nodes
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, index)</strong>
</dt>
<dd>
Set radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
</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>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
</dd>
</dl>
<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>
</dt>
<dd>
Array of checkbox components
<ul>
<li><span class="parameter">checkboxes</span>
<span class="types"><span class="type">Checkbox[]</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,428 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><strong>Slider</strong></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>
</ul>
</div>
<div id="content">
<h1>Module <code>Slider</code></h1>
<p>Druid slider component</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, end_pos[, callback])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set">set(self, value[, is_silent])</a></td>
<td class="summary">Set value 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>
</table>
<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>
</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="#value">value</a></td>
<td class="summary">Current slider value</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, node, end_pos[, callback])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
Gui pin node
</li>
<li><span class="parameter">end_pos</span>
<span class="types"><span class="type">vector3</span></span>
The end position of slider
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
On slider change callback
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set"></a>
<strong>set(self, value[, is_silent])</strong>
</dt>
<dd>
Set value for slider
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
Value from 0 to 1
</li>
<li><span class="parameter">is_silent</span>
<span class="types"><span class="type">bool</span></span>
Don't trigger event if true
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_steps"></a>
<strong>set_steps(self, steps)</strong>
</dt>
<dd>
Set slider steps. Pin node will
apply closest step position
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
</li>
<li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span>
Array of steps
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">slider:set_steps({<span class="number">0</span>, <span class="number">0.2</span>, <span class="number">0.6</span>, <span class="number">1</span>})</pre>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">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>
</ul>
</dd>
<dt>
<a name = "end_pos"></a>
<strong>end_pos</strong>
</dt>
<dd>
End pin node position
<ul>
<li><span class="parameter">end_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</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>
<strong>is_drag</strong>
</dt>
<dd>
Current drag state
<ul>
<li><span class="parameter">is_drag</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "value"></a>
<strong>value</strong>
</dt>
<dd>
Current slider value
<ul>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,838 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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><strong>StaticGrid</strong></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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>StaticGrid</code></h1>
<p>Component to handle placing components by row and columns.</p>
<p>
Grid can anchor your elements, get content size and other</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, parent, element[, in_row=1])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index)</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_index">get_index(self, pos)</a></td>
<td class="summary">Return index for grid pos</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_index_by_node">get_index_by_node(self, node)</a></td>
<td class="summary">Return grid index by node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_anchor">set_anchor(self, anchor)</a></td>
<td class="summary">Set grid anchor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add">add(self, item[, index[, shift_policy=SHIFT.RIGHT]])</a></td>
<td class="summary">Add new item to the grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT])</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_size">get_size(self)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td>
<td class="summary">Return grid content borders</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>
</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_offset">get_offset(self)</a></td>
<td class="summary">Return StaticGrid offset, where StaticGrid content starts.</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 nodes</td>
</tr>
<tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td>
<td class="summary">The first index of node in grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#last_index">last_index</a></td>
<td class="summary">The last index of node in grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#anchor">anchor</a></td>
<td class="summary">Item anchor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node_size">node_size</a></td>
<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>
</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, parent, element[, in_row=1])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed
</li>
<li><span class="parameter">element</span>
<span class="types"><span class="type">node</span></span>
Element prefab. Need to get it size
</li>
<li><span class="parameter">in_row</span>
<span class="types"><span class="type">number</span></span>
How many nodes in row can be placed
(<em>default</em> 1)
</li>
</ul>
</dd>
<dt>
<a name = "get_pos"></a>
<strong>get_pos(self, index)</strong>
</dt>
<dd>
Return pos for grid node index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid element index
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Node position
</ol>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, pos)</strong>
</dt>
<dd>
Return index for grid pos
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
The node position in the grid
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(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">StaticGrid</span></span>
</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 = "set_anchor"></a>
<strong>set_anchor(self, anchor)</strong>
</dt>
<dd>
Set grid anchor. Default anchor is equal to anchor of grid parent node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">anchor</span>
<span class="types"><span class="type">vector3</span></span>
Anchor
</li>
</ul>
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, item[, index[, shift_policy=SHIFT.RIGHT]])</strong>
</dt>
<dd>
Add new item to the grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">item</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The item position. By default add as last item
(<em>optional</em>)
</li>
<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>
</ul>
</dd>
<dt>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT])</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">StaticGrid</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>
</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>
<strong>get_size(self)</strong>
</dt>
<dd>
Return grid content size
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content size
</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">StaticGrid</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_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">StaticGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "set_position_function"></a>
<strong>set_position_function(self, callback)</strong>
</dt>
<dd>
Change set position function for grid nodes. It will call on
update poses on grid elements. Default: gui.set_position
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Function on node set position
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.static_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear grid nodes array. GUI nodes will be not deleted!
If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.static_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "get_offset"></a>
<strong>get_offset(self)</strong>
</dt>
<dd>
Return StaticGrid offset, where StaticGrid content starts.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
The StaticGrid instance
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The StaticGrid offset
</ol>
</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>
</dt>
<dd>
On item add callback(self, node, index)
<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 nodes
<ul>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "first_index"></a>
<strong>first_index</strong>
</dt>
<dd>
The first index of node in grid
<ul>
<li><span class="parameter">first_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "last_index"></a>
<strong>last_index</strong>
</dt>
<dd>
The last index of node in grid
<ul>
<li><span class="parameter">last_index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "anchor"></a>
<strong>anchor</strong>
</dt>
<dd>
Item anchor
<ul>
<li><span class="parameter">anchor</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node_size"></a>
<strong>node_size</strong>
</dt>
<dd>
Item size
<ul>
<li><span class="parameter">node_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "border"></a>
<strong>border</strong>
</dt>
<dd>
The size of item content
<ul>
<li><span class="parameter">border</span>
<span class="types"><span class="type">vector4</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,290 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Swipe</code></h1>
<p>Component to handle swipe gestures on node.</p>
<p>
Swipe will be triggered, if swipe was started and
ended on one node</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, on_swipe_callback)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict swipe click area.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</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="#on_swipe">on_swipe</a></td>
<td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time</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, node, on_swipe_callback)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">on_swipe_callback</span>
<span class="types"><span class="type">function</span></span>
Swipe callback for on_swipe_end event
</li>
</ul>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict swipe click area. Useful for
restrict events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
Gui node
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">SWIPE_TIME</span>
<span class="types"><span class="type">number</span></span>
Maximum time for swipe trigger
(<em>default</em> 0.4)
</li>
<li><span class="parameter">SWIPE_THRESHOLD</span>
<span class="types"><span class="type">number</span></span>
Minimum distance for swipe trigger
(<em>default</em> 50)
</li>
<li><span class="parameter">SWIPE_TRIGGER_ON_MOVE</span>
<span class="types"><span class="type">bool</span></span>
If true, trigger on swipe moving, not only release action
(<em>default</em> false)
</li>
</ul>
</dd>
</dl>
<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>
</dt>
<dd>
Restriction zone
<ul>
<li><span class="parameter">click_zone</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
(<em>optional</em>)
</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
<ul>
<li><span class="parameter">on_swipe</span>
<span class="types"><span class="type">druid_event</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,618 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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><strong>Text</strong></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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Text</code></h1>
<p>Component to handle all GUI texts.</p>
<p>
Druid text can adjust itself for text node size
Text will never will be outside of his text size (even multiline)</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node[, value[, no_adjust]])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_text_width">get_text_width(self[, text])</a></td>
<td class="summary">Calculate text width with font with respect to trailing space</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>
</tr>
<tr>
<td class="name" nowrap><a href="#set_color">set_color(self, color)</a></td>
<td class="summary">Set color</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_alpha">set_alpha(self, alpha)</a></td>
<td class="summary">Set alpha</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_scale">set_scale(self, scale)</a></td>
<td class="summary">Set scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_pivot">set_pivot(self, pivot)</a></td>
<td class="summary">Set text pivot.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_multiline">is_multiline(self)</a></td>
<td class="summary">Return true, if text with line break</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_set_text">on_set_text</a></td>
<td class="summary">On set text callback(self, text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_text_scale">on_update_text_scale</a></td>
<td class="summary">On adjust text size callback(self, new_scale)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_set_pivot">on_set_pivot</a></td>
<td class="summary">On change pivot callback(self, pivot)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Text node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current text position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial text node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scale">scale</a></td>
<td class="summary">Current text node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_size">start_size</a></td>
<td class="summary">Initial text node size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#text_area">text_area</a></td>
<td class="summary">Current text node available are</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_no_adjust">is_no_adjust</a></td>
<td class="summary">Current text size adjust settings</td>
</tr>
<tr>
<td class="name" nowrap><a href="#color">color</a></td>
<td class="summary">Current text color</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, node[, value[, no_adjust]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Text.html#node">node</a></span>
Gui text node
</li>
<li><span class="parameter">value</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Initial text. Default value is node text from GUI scene.
(<em>optional</em>)
</li>
<li><span class="parameter">no_adjust</span>
<span class="types"><span class="type">bool</span></span>
If true, text will be not auto-adjust size
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "get_text_width"></a>
<strong>get_text_width(self[, text])</strong>
</dt>
<dd>
Calculate text width with font with respect to trailing space
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</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>
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, set_to)</strong>
</dt>
<dd>
Set text to text field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">set_to</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Text for node
</li>
</ul>
</dd>
<dt>
<a name = "set_color"></a>
<strong>set_color(self, color)</strong>
</dt>
<dd>
Set color
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">color</span>
<span class="types"><span class="type">vector4</span></span>
Color for node
</li>
</ul>
</dd>
<dt>
<a name = "set_alpha"></a>
<strong>set_alpha(self, alpha)</strong>
</dt>
<dd>
Set alpha
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">alpha</span>
<span class="types"><span class="type">number</span></span>
Alpha for node
</li>
</ul>
</dd>
<dt>
<a name = "set_scale"></a>
<strong>set_scale(self, scale)</strong>
</dt>
<dd>
Set scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
Scale for node
</li>
</ul>
</dd>
<dt>
<a name = "set_pivot"></a>
<strong>set_pivot(self, pivot)</strong>
</dt>
<dd>
Set text pivot. Text will re-anchor inside
his text area
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
Gui pivot constant
</li>
</ul>
</dd>
<dt>
<a name = "is_multiline"></a>
<strong>is_multiline(self)</strong>
</dt>
<dd>
Return true, if text with line break
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is text node with line break
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "on_set_text"></a>
<strong>on_set_text</strong>
</dt>
<dd>
On set text callback(self, text)
<ul>
<li><span class="parameter">on_set_text</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_text_scale"></a>
<strong>on_update_text_scale</strong>
</dt>
<dd>
On adjust text size callback(self, new_scale)
<ul>
<li><span class="parameter">on_update_text_scale</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_set_pivot"></a>
<strong>on_set_pivot</strong>
</dt>
<dd>
On change pivot callback(self, pivot)
<ul>
<li><span class="parameter">on_set_pivot</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Text node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Text.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current text position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_scale"></a>
<strong>start_scale</strong>
</dt>
<dd>
Initial text node scale
<ul>
<li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "scale"></a>
<strong>scale</strong>
</dt>
<dd>
Current text node scale
<ul>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_size"></a>
<strong>start_size</strong>
</dt>
<dd>
Initial text node size
<ul>
<li><span class="parameter">start_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "text_area"></a>
<strong>text_area</strong>
</dt>
<dd>
Current text node available are
<ul>
<li><span class="parameter">text_area</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_no_adjust"></a>
<strong>is_no_adjust</strong>
</dt>
<dd>
Current text size adjust settings
<ul>
<li><span class="parameter">is_no_adjust</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "color"></a>
<strong>color</strong>
</dt>
<dd>
Current text color
<ul>
<li><span class="parameter">color</span>
<span class="types"><span class="type">vector3</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,410 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/Slider.html">Slider</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>
</ul>
</div>
<div id="content">
<h1>Module <code>Timer</code></h1>
<p>Component to handle GUI timers.</p>
<p>
Timer updating by game delta time. If game is not focused -
timer will be not updated.</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, seconds_from[, seconds_to=0[, callback]])</a></td>
<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>
</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>
</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>
</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>
</tr>
<tr>
<td class="name" nowrap><a href="#target">target</a></td>
<td class="summary">Target timer value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#value">value</a></td>
<td class="summary">Current timer value</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, node, seconds_from[, seconds_to=0[, callback]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Timer.html#node">node</a></span>
Gui text node
</li>
<li><span class="parameter">seconds_from</span>
<span class="types"><span class="type">number</span></span>
Start timer value in seconds
</li>
<li><span class="parameter">seconds_to</span>
<span class="types"><span class="type">number</span></span>
End timer value in seconds
(<em>default</em> 0)
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Function on timer end
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, set_to)</strong>
</dt>
<dd>
Set text to text field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
</li>
<li><span class="parameter">set_to</span>
<span class="types"><span class="type">number</span></span>
Value in seconds
</li>
</ul>
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, is_on)</strong>
</dt>
<dd>
Called when update
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
</li>
<li><span class="parameter">is_on</span>
<span class="types"><span class="type">bool</span></span>
Timer enable state
</li>
</ul>
</dd>
<dt>
<a name = "set_interval"></a>
<strong>set_interval(self, from, to)</strong>
</dt>
<dd>
Set time interval
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span>
</li>
<li><span class="parameter">from</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
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">druid_event</span></span>
</li>
</ul>
</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>
<strong>node</strong>
</dt>
<dd>
Trigger node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Timer.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "from"></a>
<strong>from</strong>
</dt>
<dd>
Initial timer value
<ul>
<li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target"></a>
<strong>target</strong>
</dt>
<dd>
Target timer value
<ul>
<li><span class="parameter">target</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "value"></a>
<strong>value</strong>
</dt>
<dd>
Current timer value
<ul>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></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 1.4.6</a></i>
<i style="float:right;">Last updated 2021-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,363 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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><strong>druid.helper</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>druid.helper</code></h1>
<p>Text node or icon node can be nil</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#centrate_text_with_icon">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="#centrate_icon_with_text">centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#centrate_nodes">centrate_nodes([margin=0[, ...]])</a></td>
<td class="summary">Center several nodes nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in gui hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pivot_offset">get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given gui pivot</td>
</tr>
<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="#is_web">is_web()</a></td>
<td class="summary">Check if device is HTML5</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_border">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="#deprecated">deprecated(message)</a></td>
<td class="summary">Show deprecated message.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "centrate_text_with_icon"></a>
<strong>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 = "centrate_icon_with_text"></a>
<strong>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 = "centrate_nodes"></a>
<strong>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 = "is_enabled"></a>
<strong>is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in gui hierarchy.
Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is enabled in hierarchy
</ol>
</dd>
<dt>
<a name = "get_pivot_offset"></a>
<strong>get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given gui pivot
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
The node pivot
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Vector offset with [-1..1] values
</ol>
</dd>
<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 = "is_web"></a>
<strong>is_web()</strong>
</dt>
<dd>
Check if device is HTML5
</dd>
<dt>
<a name = "get_border"></a>
<strong>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 = "deprecated"></a>
<strong>deprecated(message)</strong>
</dt>
<dd>
Show deprecated message. Once time per message
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
The deprecated message
</li>
</ul>
</dd>
</dl>
</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-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,321 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_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/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/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<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/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>druid</code></h1>
<p>Druid UI Library.</p>
<p>
Powerful Defold component based UI library. Use standart
components or make your own game-specific components to
make amazing GUI in your games.
<p> Contains the several basic components and examples
to how to do your custom complex components to
separate UI game logic to small files
<p> require("druid.druid")
function init(self)
self.druid = druid.new(self)
end
</p>
<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>
</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>
</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>
</tr>
</table>
<br/>
<br/>
<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>
</dt>
<dd>
Create Druid instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Druid context. Usually it is self of script
</li>
<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>
Druid style module
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid_instance</span></span>
Druid instance
</ol>
</dd>
<dt>
<a name = "set_default_style"></a>
<strong>set_default_style(style)</strong>
</dt>
<dd>
Set new default style.
<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>
Druid style module
</li>
</ul>
</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>
<strong>set_sound_function(callback)</strong>
</dt>
<dd>
Set sound function.
Component will call this function to
play sound by sound_id
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Sound play callback
</li>
</ul>
</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.3/manual.html#6.4">string</a></span>
Event param from window listener
</li>
</ul>
</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>
</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-04-06 00:03:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,357 +0,0 @@
# Druid components
## Button
[Button API here](https://insality.github.io/druid/modules/druid.button.html)
### Overview
Basic Druid input component. Handle input on node and provide different callbacks on touch events.
### Setup
Create button with druid: `button = druid:new_button(node_name, callback, [params], [animation_node])`
Where node name is name of node from GUI scene. You can use `node_name` as input trigger zone and point another node for animation via `animation_node`
### Usecase
_fill example usecases_
### Notes
- Button callback have next params: (self, params, button_instance)
- **self** - Druid self context
- **params** - Additional params, specified on button creating
- **button_instance** - button itself
- You can set _params_ on button callback on button creating: `druid:new_button("node_name", callback, params)`. This _params_ will pass in callback as second argument
- Button have next events:
- **on_click** - basic button callback
- **on_repeated_click** - repeated click callback, while holding the button, don't trigger if callback is empty
- **on_long_click** - callback on long button tap, don't trigger if callback is empty
- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
- Click event will not trigger, if between pressed and released state cursor was outside of node zone
- If button have double click event and it is triggered, usual callback will be not invoked
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone
- Button can have key trigger to use then by key: `button:set_key_trigger`
- Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be `big panel` and animation node will be `small icon`
## Text
[Text API here](https://insality.github.io/druid/modules/druid.text.html)
### Overview
Basic Druid text component. Text components by default have the text size adjusting.
### Setup
Create text node with druid: `text = druid:new_text(node_name, [initial_value], [is_disable_size_adjust])`
### Notes
- Text component by default have auto adjust text sizing. Text never will be bigger, than text node size, which you can setup in GUI scene. It can be disabled on component creating by settings argument `is_no_adjust` to _true_
![](../media/text_autosize.png)
- Text pivot can be changed with `text:set_pivot`, and text will save their position inside their text size box:
![](../media/text_anchor.gif)
## Blocker
[Blocker API here](https://insality.github.io/druid/modules/druid.blocker.html)
### Overview
Druid component for block input. Use it to block input in special zone.
### Setup
Create blocker component with druid: `druid:new_blocker(node_name)`
### Notes
Explanation:
![](../media/blocker_scheme.png)
Blue zone is **button** with close_window callback
Yellow zone is blocker with window content
So you can do the safe zones, when you have the big buttons
## Back Handler
[Back handler API here](https://insality.github.io/druid/modules/druid.back_handler.html)
### Overview
Component to handle back button. It handle Android back button and Backspace key. Key triggers in `input.binding` should be setup for correct working.
### Setup
Setup callback with `druid:new_back_handler(callback)`
### Notes
## Lang text
[Lang text API here](https://insality.github.io/druid/modules/druid.lang_text.html)
### Overview
Wrap on Text component to handle localization. It uses druid get_text_function to set text by it's id
### Setup
Create lang text component with druid `text = druid:new_lang_text(node_name, locale_id)`
### Notes
## Scroll
[Scroll API here](https://insality.github.io/druid/modules/druid.scroll.html)
### Overview
Basic Druid scroll component. Handle all scrolling stuff in druid GUI
### Setup
Create scroll component with druid: `scroll = druid:new_scroll(view_node, content_node)`.
_View_node_ - is static part. It capturing user input and recognize scrolling touches
_Content_node_ - is dynamic part. This node will change position by scroll system
Initial scroll size will be equal to _content_node_ node size. The initial view box will be equal to _view_node_ node size
Usually, Place _view_node_ and as children add _content_node_:
![](../media/scroll_scheme.png)
![](../media/scroll_outline.png)
*Here content_node below view_node, in game content_node be able to scroll left until end*
### Notes
- Scroll by default style have inertion and extra size for strecthing effect. It can be adjust via scroll [style settings](https://insality.github.io/druid/modules/druid.scroll.html#Style)
- You can setup "points of interest". Scroll always will be centered on closes point of interest. It is able to create slider without inertion and points of interest on each scroll element.
- Scroll have next events:
- *on_scroll* (self, position) On scroll move callback
- *on_scroll_to* (self, position, is_instant) On scroll_to function callback
- *on_point_scroll* (self, item_index, position) On scroll_to_index function callback
- You can adjust scroll content size by `scroll:set_size(node_size)`. It will setup new size to _content node_
- You can enabled or disable inertion mode via `scroll:set_intert(state)`
- You can adjust extra stretch size via `scroll:set_extra_stretch_size`
- Multitouch is required for scroll. Scroll is correctly handling touch_id swap while dragging scroll
## Progress
[Progress API here](https://insality.github.io/druid/modules/druid.progress.html)
### Overview
Basic Druid progress bar component
### Setup
Create progress bar component with druid: `progress = druid:new_progress(node_name, key, init_value)`
Node name should have maximum node size, so in GUI scene, node_name should be fully filled.
Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or just "y")
### Notes
- Progress correct working with 9slice nodes, it trying to set size by _set_size_ first, if it is not possible, it set up sizing via _set_scale_
- Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
- If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles
## Slider
[Slider API here](https://insality.github.io/druid/modules/druid.slider.html)
### Overview
Basic Druid slider component
### Setup
Create slider component with druid: `slider = druid:new_slider(node_name, end_pos, callback)`
Pin node (node_name in params) should be placed in zero position (initial). It will be available to mode Pin node between start pos and end pos.
### Notes
- You can setup points of interests on slider via `slider:set_steps`. If steps are exist, slider values will be only from this steps (notched slider)
- For now, start pos and end pos should be on vertical or horizontal line (their x or y value should be equal)
## Input
[Input API here](https://insality.github.io/druid/modules/druid.input.html)
### Overview
Basic Druid text input component
### Setup
Create input component with druid: `input = druid:new_input(button_node_name, text_node_name, keyboard_type)`
### Notes
- Input component handle user text input. Input contains from button and text components. Button needed for selecting/unselecting input field
- Long click on input field for clear and select input field (clearing can be disable via styles)
- Click outside of button to unselect input field
- On focus lost (game minimized) input field will be unselected
- You can setup max length of the text
- You can setup allowed characters. On add not allowed characters `on_input_wrong` will be called. By default it cause simple shake animation
- The keyboard for input will not show on mobile HTML5. So input field in mobile HTML5 is not working now
- To make work different keyboard type, make sure value in game.project Android:InputMethod set to HidderInputField (https://defold.com/manuals/project-settings/#input-method)
## Checkbox
[Checkbox API here](https://insality.github.io/druid/modules/druid.checkbox.html)
### Overview
Basic Druid checkbox component.
### Setup
Create checkbox component with druid: `checkbox = druid:new_checkbox(node, callback)`
### Notes
- Checkbox uses button to handle click
- You can setup another node to handle input with click_node arg in component init: `druid:new_checkbox(node, callback, [click_node])`
## Checkbox group
[Checkbox group API here](https://insality.github.io/druid/modules/druid.checkbox_group.html)
### Overview
Several checkboxes in one group
### Setup
Create checkbox_group component with druid: `group = druid:new_checkbox_group(nodes[], callback)`
### Notes
- Callback arguments: `function(self, checkbox_index)`. Index is equals in _nodes[]_ array in component constructor
- You can get/set checkbox_group state with `group:set_state()` and `group:get_state()`
## Radio group
[Radio group API here](https://insality.github.io/druid/modules/druid.radio_group.html)
### Overview
Several checkboxes in one group with single choice
### Setup
Create radio_group component with druid: `group = druid:new_radio_group(nodes[], callback)`
### Notes
- Callback arguments: `function(self, checkbox_index)`. Index is equals in _nodes[]_ array in component constructor
- You can get/set radio_group state with `group:set_state()` and `group:get_state()`
- Only different from checkbox_group: on click another checkboxes in this group will be unchecked
## Timer
[Timer API here](https://insality.github.io/druid/modules/druid.timer.html)
### Overview
Handle timer work on gui text node
### Setup
Create timer component with druid: `timer = druid:new_timer(text_node, from_seconds, to_seconds, callback)`
### Notes
- Timer fires callback, when timer value equals to _to_seconds_
- Timer will set text node with current timer value
- Timer uses update function to handle time
## Static Grid
[Static Grid API here](https://insality.github.io/druid/modules/druid.static_grid.html)
### Overview
Component for manage node positions.
Static grid have constant node size, so it possible to calculate node positions before placement. Nodes can be placed with gaps.
Static grid can shift elements on add/remove functions.
### Setup
Create component with druid: `grid = druid:new_static_grid(parent_node, prefab_node, max_in_row_elements)`
### Notes
- On _add node_ grid will set nodeup parent to _parent_node_
- You can get array of position of every element for setup points of interest in scroll component
- You can get size of all elements for setup size in scroll component
- You can also bind the grid to the scroll component for auto resize scroll content size
- Pivot of parent_node matter for node placement
- _Prefab node_ used to get node size and anchor
- You can point *position_function* for animations with _static_grid:set_position_function(node, pos)_ callback. Default - *gui.set_position()*
## Dynamic Grid
[Dynamic Grid API here](https://insality.github.io/druid/modules/druid.dynamic_grid.html)
### Overview
Component for manage node positions with different node sizes.
Unlike Static Grid, Dynamic Grid can place nodes only in one row or in one column.
Dynamic Grid can't have gaps between elements
- you will get error, if try spawn element far away from others.
Dynamic Grid should have __West__, __East__, __South__ or __North__ pivot (vertical or horizontal element placement)
### Setup
Create component with druid: `grid = druid:new_dynamic_grid(parent_node)`
Check the _parent_node_ have correct pivot point. You will get the error otherwise.
### Notes
- On _add node_ grid will set node parent to _parent_node_
- You can get array of position of every element for setup points of interest in scroll component
- You can get size of all elements for setup size in scroll component
- You can also bind the grid to the scroll component for auto resize scroll content size
- Pivot of parent_node matter for node placement
- You can point *position_function* for animations with _static_grid:set_position_function(node, pos)_ callback. Default - *gui.set_position()*
- First node placed at Grid pivot point. Other nodes placed nearby of other nodes.
- On *add/remove* nodes always shifted. You can point the shift side in this functions (*is_shift_left* boolean argumentp
## Hover
[Hover API here](https://insality.github.io/druid/modules/druid.hover.html)
### Overview
System Druid component, handle hover node state.
### Setup
Create hover component with druid: `hover = druid:new_hover(node, callback)`
### Notes
- By default, hover handles _hover event_ with pressed touch action_id. So it's mean, what mouse or touch have to be pressed
- On desktop platforms there is _on_mouse_hover_ event. It's event on mouse hover without any action id
- By default, assume what node is on not hovered state (both _hover_ and _mouse_hover_)
## Swipe
[Swipe API here](https://insality.github.io/druid/modules/druid.swipe.html)
### Overview
System Druid component, handle swipe actions on node
### Setup
Create swipe component with druid: `hover = druid:new_swipe(node, swipe_callback)`
### Notes
- Swipe callback have next params: (self, swipe_side, distance, time)
- **self** - Druid self context
- **swipe_side**: *string* - values from ["up", "down", "left", "right"]
- **distance**: *number* - in pixels, distance of swipe
- **time**: *number* - in seconds, time of swiping
- Swipe trigger only, if all input actions was on swipe node. If action will be outside of node, swipe status will be reseted
- In swipe style table you can adjust minimal distance and maximum time to trigg- Hover state trigger only with touch on mobile devices or button mouse holding. Just mouse over swipe
- In swipe style table you can toggle type of swipe triggering. if SWIPE_TRIGGER_ON_MOVE setup to true - swipe will trigger as swipe can be triggered. If setup to false - swipe will trigger only on released action
- If you have stencil on swipe node and you don't want trigger it outside of stencil node, you can use `swipe:set_click_zone` to restrict swipe zonethout buttons is now not allowed.
## Drag
[Drag API here](https://insality.github.io/druid/modules/druid.drag.html)
### Overview
System Druid component, handle drag actions on node
### Setup
Create drag component with druid: `hover = druid:new_drag(node, drag_callback)`
### Notes
- Drag callback have next params: (self, swipe_side, distance, time)
- **self**: Druid self context
- **dx**: *number* - delta x position
- **dy**: *number* - delta y position
- In styles, you can point the drag start deadzone. Default value is 10 pixels
- Drag correctly process multitouch. You can switch touch_id, while dragging on node with correct _dx_ and _dy_ values (made for correct scrolling)
- You can restrict horizontal or vertical dragging by setting `drag.can_x` or `drag.can_y` to _false_ value
- You can get info about current drag state:
- _is_touch_ - Is currently node touching
- _is_drag_ - Is currently node is dragging
- _x_ and _y_ - Current touch position
- _touch_start_pos_ - Touch stat positions
- Drag have next events:
- _on_touch_start_ (self) - Event on touch start
- _on_touch_end_ (self) - Event on touch end
- _on_drag_start_ (self) - Event on drag start
- _on_drag_ (self, dx, dy) - Event on drag process
- _on_drag_end_ (self) - Event on drag end
- Drag node zone can be restricted via `drag:set_click_zone(node)`

View File

@ -1,151 +0,0 @@
# Creating custom components
## Overview
Druid allows you to create your custom components from druid basic components or other custom components.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name}
## Custom components
Basic custom component template looks like this:
```lua
local component = require("druid.component")
local M = component.create("my_component")
-- Component constructor
function M.init(self, ...)
end
-- Call only if exist interest: component.ON_UPDATE
function M.update(self, dt)
end
-- Call only if exist interest: component.ON_INPUT or component.ON_INPUT_HIGH
function M.on_input(self, action_id, action)
end
-- Call on component creation and on component:set_style() function
function M.on_style_change(self, style)
end
-- Call only if exist interest: component.ON_MESSAGE
function M.on_message(self, message_id, message, sender)
end
-- Call only if component with ON_ANGUAGECHANinterest
function M.on_anguagechanself)
end
-- Call only if component with ON_LAYOUT_CHANGE interest
function M.on_layout_change(self)
end
-- Call, if input was capturing before this component
-- Example: scroll is start scrolling, so you need unhover button
function M.on_input_interrupt(self)
end
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
function M.on_focus_lost(self)
end
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
function M.on_focus_gained(self)
end
-- Call on component remove or on druid:final
function M.on_remove(self)
end
return M
```
Add your custom component to druid via `druid.register`
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
function init(self)
druid.register("my_component", my_component)
end
```
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`.
Or you can create component without registering with `druid:create(my_component_module)`
As component registered, you can create your component with next code:
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
function init(self)
self.druid = druid.new(self)
local my_component = self.druid:new_my_component(...)
-- or --
local my_component = self.druid:create(my_component, ...)
end
```
### 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
- **ON_INPUT_HIGH** - component will receive input from on_input, before other components with ON_INPUT
- **ON_INPUT** - component will receive input from on_input, after other components with ON_INPUT_HIGH
- **ON_LANGUAGE_CHANGE** - will call _on_language_change_ function on language change trigger
- **ON_LAYOUT_CHANGE** will call _on_layout_change_ function on layout change trigger
- **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`
- **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`
## Best practice on custom components
On each component recommended describe component scheme in next way:
```lua
-- Component module
local component = require("druid.component")
local M = component.create("your_component")
local SCHEME = {
ROOT = "root",
ITEM = "item",
TITLE = "title"
}
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.

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