280 Commits

Author SHA1 Message Date
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 0972c53c70.
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
690 changed files with 53978 additions and 82836 deletions

2
.defignore Normal file
View File

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

6
.github/FUNDING.yml vendored
View File

@@ -1,5 +1,5 @@
# These are supported funding model platforms
github: insality # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
ko_fi: insality # Replace with a single Ko-fi username
custom: ['https://www.buymeacoffee.com/insality']
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

6
.gitignore vendored
View File

@@ -10,4 +10,10 @@ Thumbs.db
builtins
dist
deployer_version_settings.txt
.deployer_cache
bob*.jar
manifest.private.der
manifest.public.der
/.editor_settings
/.deployer_cache

View File

@@ -1,56 +0,0 @@
std = "max"
files['.luacheckrc'].global = false
unused_args = false
max_code_line_length = 120
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",
"html5",
"describe",
"before",
"after",
"it",
}

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) 2021 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

219
README.md
View File

@@ -1,162 +1,173 @@
[![](media/druid_logo.png)](https://insality.github.io/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)
[![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)
[![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/actions/workflow/status/insality/druid/ci-workflow.yml?branch=master)](https://github.com/Insality/druid/actions)
[![codecov](https://codecov.io/gh/Insality/druid/branch/master/graph/badge.svg)](https://codecov.io/gh/Insality/druid)
**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** - powerful **Defold** component UI framework that empowers developers to create stunning and customizable GUIs by leveraging a wide range of embedded components or effortlessly designing their own game-specific components.
## Druid Example
Try the [**HTML5 version**](https://insality.github.io/druid/druid/) of the **Druid** example app.
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)
To integrate the **Druid** extension into your own project, add this project as a [dependency](https://www.defold.com/manuals/libraries/) in your **Defold** game. Open your `game.project` file and add the following line to the dependencies field under the project section:
Open your `game.project` file and add the following lines to the dependencies field under the project section:
**Druid v0.11.0**
> [https://github.com/Insality/druid/archive/refs/tags/0.11.0.zip](https://github.com/Insality/druid/archive/refs/tags/0.11.0.zip)
**[Druid](https://github.com/Insality/druid/)**
```
https://github.com/Insality/druid/archive/refs/tags/1.1.4.zip
```
**[Defold Event](https://github.com/Insality/defold-event)**
```
https://github.com/Insality/defold-event/archive/refs/tags/11.zip
```
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.
Here is a list of [all releases](https://github.com/Insality/druid/releases).
Size: **67.16 KB**
> The size metrics exlcude the extended components, which are including only on demand.
### Library Size
> **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.
| Platform | Full Size |
| ---------------- | ------------- |
| HTML5 | **84.52 KB** |
| Desktop / Mobile | **141.03 KB** |
### Input Bindings
**Druid** utilizes the `/builtins/input/all.input_binding` input bindings. For custom input bindings, refer to the Input Binding section in the **_[Advanced Setup](docs_md/advanced-setup.md#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
To utilize **Druid**, begin by creating a **Druid** instance to instantiate components and include the main functions of **Druid**: *update*, *final*, *on_message*, and *on_input*.
When using **Druid** components, provide a node name string as an argument. If you don't have the node name available in some cases, you can pass `gui.get_node()` instead.
All **Druid** and component methods are invoked using the `:` operator, such as `self.druid:new_button()`.
The basic template for `gui_script` is:
```lua
local druid = require("druid.druid")
-- All component callbacks pass "self" as first argument
-- This "self" is a context data passed in `druid.new(context)`
local function on_button_callback(self)
print("The button clicked!")
end
function init(self)
self.druid = druid.new(self)
self.button = self.druid:new_button("button_node_name", on_button_callback)
end
-- "final" is a required function for the correct Druid workflow
function final(self)
self.druid:final()
end
-- "update" is used in progress bar, scroll, and timer basic components
function update(self, dt)
self.druid:update(dt)
end
-- "on_message" is used for specific Druid events, like language change or layout change
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
-- "on_input" is used in almost all Druid components
-- The return value from `druid:on_input` is required!
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end
```
For all **Druid** instance functions, [see here](https://insality.github.io/druid/modules/DruidInstance.html).
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.
### API Documentation
**Druid** offers a wide range of components and functions. To facilitate usage, **Druid** provides comprehensive API documentation with examples and annotations.
Best start is from the [Quick API Reference](api/quick_api_reference.md)
Start reading the API documentation [here](https://insality.github.io/druid/modules/Druid.html).
With next quick links:
**Druid** provide the *EmmyLua* annotations to add autocomplete inside your IDE. Check [EmmyLua Setup here](docs_md/advanced-setup.md#emmylua-annotations).
### Create custom components
If you want to create your own components, refer to the [Create Custom Components](docs_md/02-creating_custom_components.md) section in the documentation.
Custom components are one of the most powerful features of **Druid**. They allow you to create your own components effortlessly and utilize them in your game.
- [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.
### Basic Components
> Basic components always included in the build and available for use.
### Components
| Name | Description | Example | <div style="width:200px">Preview</div> |
|------|-------------|---------|---------|
| **[Button](https://insality.github.io/druid/modules/Button.html)** | Logic over GUI Node. Handle the user click interactions: click, long click, double click, etc. | [Button Example](https://insality.github.io/druid/druid/?example=general_buttons) | <img src="media/preview/button.gif" width="200" height="100"> |
| **[Text](https://insality.github.io/druid/modules/Text.html)** | 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/druid/?example=texts_general) | <img src="media/preview/text.gif" width="200" height="100"> |
| **[Scroll](https://insality.github.io/druid/modules/Scroll.html)** | Logic over two GUI Nodes: input and content. Provides basic behaviour for scrollable content. | [Scroll Example](https://insality.github.io/druid/druid/?example=general_scroll) | <img src="media/preview/scroll.gif" width="200" height="100"> |
| **[Blocker](https://insality.github.io/druid/modules/Blocker.html)** | Logic over GUI Node. Don't pass any user input below node area size. | ❌ | |
| **[Back Handler](https://insality.github.io/druid/modules/BackHandler.html)** | Call callback on user "Back" action. It's a Android back button or keyboard backspace key | ❌ | |
| **[Static Grid](https://insality.github.io/druid/modules/StaticGrid.html)** | Logic over GUI Node. Component to manage node positions with all equal node sizes. | [Static Gid Example](https://insality.github.io/druid/druid/?example=general_grid) | <img src="media/preview/static_grid.gif" width="200" height="100"> |
| **[Hover](https://insality.github.io/druid/modules/Hover.html)** | Logic over GUI Node. Handle hover action over node. For both: mobile touch and mouse cursor. | | <img src="media/preview/hover.gif" width="200" height="100"> |
| **[Swipe](https://insality.github.io/druid/modules/Swipe.html)** | Logic over GUI Node. Handle swipe gestures over node. | [Swipe Example](https://insality.github.io/druid/druid/?example=general_swipe) | <img src="media/preview/swipe.gif" width="200" height="100"> |
| **[Drag](https://insality.github.io/druid/modules/Drag.html)** | Logic over GUI Node. Handle drag input actions. Can be useful to make on screen controlls. | [Drag Example](https://insality.github.io/druid/druid/?example=general_drag) | <img src="media/preview/drag.gif" width="200" height="100"> |
### Extended components
> Extended components before usage should be registered in **Druid** with [`druid.register()`](https://insality.github.io/druid/modules/Druid.html#druid.register) function.
> On usage of unregistered **Druid** component the next log will be shown in the console.
```
local data_list = require("druid.extended.data_list")
druid.register("data_list", data_list)
```
| Name | Description | Example | <div style="width:200px">Preview</div> |
|------|-------------|---------|---------|
| **[Checkbox](https://insality.github.io/druid/modules/Checkbox.html)** | Switch node state on click event. | [Checkbox Example](https://insality.github.io/druid/druid/?example=general_checkboxes) | <img src="media/preview/checkbox.gif" width="200" height="100"> |
| **[Checkbox group](https://insality.github.io/druid/modules/CheckboxGroup.html)** | Group of checkbox components. | [Checkbox group Example](https://insality.github.io/druid/druid/?example=general_checkboxes) | <img src="media/preview/checkbox_group.gif" width="200" height="100"> |
| **[Radio group](https://insality.github.io/druid/modules/RadioGroup.html)** | Like checkbox group but with single choise only. | [Radio Group Example](https://insality.github.io/druid/druid/?example=general_checkboxes) | <img src="media/preview/radio_group.gif" width="200" height="100"> |
| **[Dynamic Grid](https://insality.github.io/druid/modules/DynamicGrid.html)** | Logic over GUI Node. Component to manage node positions with all different node sizes. Only one direction: horizontal or vertical. | [Dynamic Grid Example](https://insality.github.io/druid/druid/?example=general_grid) | <img src="media/preview/dynamic_grid.gif" width="200" height="100"> |
| **[Data List](https://insality.github.io/druid/modules/DataList.html)** | 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/druid/?example=general_data_list) | <img src="media/preview/data_list.gif" width="200" height="100"> |
| **[Input](https://insality.github.io/druid/modules/Input.html)** | Logic over GUI Node and GUI Text (or Text component). Provides basic user text input. | [Input Example](https://insality.github.io/druid/druid/?example=general_input) | <img src="media/preview/input.gif" width="200" height="100"> |
| **[Lang text](https://insality.github.io/druid/modules/LangText.html)** | Logic over Text component to handle localization. Can be translated in real-time with `druid.on_language_change` | ❌ | <img src="media/preview/lang_text.gif" width="200" height="100"> |
| **[Progress](https://insality.github.io/druid/modules/Progress.html)** | Logic over GUI Node. Handle node size and scale to handle progress node size. | [Progress Example](https://insality.github.io/druid/druid/?example=general_progress_bar) | <img src="media/preview/progress.gif" width="200" height="100"> |
| **[Slider](https://insality.github.io/druid/modules/Slider.html)** | Logic over GUI Node. Handle draggable node with position restrictions. | [Slider Example](https://insality.github.io/druid/druid/?example=general_sliders) | <img src="media/preview/slider.gif" width="200" height="100"> |
| **[Timer](https://insality.github.io/druid/modules/Timer.html)** | Logic over GUI Text. Handle basic timer functions. | ❌ | <img src="media/preview/timer.gif" width="200" height="100"> |
| **[Hotkey](https://insality.github.io/druid/modules/Hotkey.html)** | Allow to set callbacks for keyboard hotkeys with key modificators. | [Hotkey Example](https://insality.github.io/druid/druid/?example=general_hotkey) | <img src="media/preview/hotkey.gif" width="200" height="100"> |
| **[Layout](https://insality.github.io/druid/modules/Layout.html)** | Logic over GUI Node. Handle node size depends on layout mode and screen aspect ratio. Contains helpers to build more complex UI layout. | [Layout Example](https://insality.github.io/druid/druid/?example=general_layout) | <img src="media/preview/layout.gif" width="200" height="100"> |
For a complete overview, see: **_[components.md](docs_md/01-components.md)_**.
| **[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
Any **Druid** components as callbacks use [Druid Events](https://insality.github.io/druid/modules/DruidEvent.html). In component API ([button example](https://insality.github.io/druid/modules/Button.html#on_click)) pointed list of component events. You can manually subscribe to these events with the following API:
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)
- **event:clear**()
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** 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.
@@ -164,43 +175,55 @@ You can subscribe several callbacks to a single event.
- 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
Try the [**HTML5 version**](https://insality.github.io/druid/druid/) of the **Druid** example app.
Try the [**HTML5 version**](https://insality.github.io/druid/) of the **Druid** example app.
Each example page provides a direct link to the corresponding example code, making it easier for you to understand how to use **Druid**.
Or refer directly to the [**example folder**](https://github.com/Insality/druid/tree/develop/example) for code examples demonstrating how to use **Druid**.
If you want to see examples of GUIs created with Druid, please refer to the [game_examples.md](docs_md/game_examples.md) file.
## Documentation
To better understand **Druid**, read the following documentation:
- [How To GUI in Defold](https://forum.defold.com/t/how-to-gui-in-defold/73256)
- [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)
You can find the full **Druid** functions at [Quick API Reference](api/quick_api_reference.md)
You can find the full **Druid** [documentation here](https://insality.github.io/druid/modules/Druid.html).
To better understand **Druid**, read the following documentation:
- [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)
## Licenses
- 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](docs_md/changelog.md).
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 ❤️

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,19 +0,0 @@
project='Druid'
title='Defold Druid UI Framework'
description='Documentation for Druid Framework'
file={"./druid",
exclude = {
"./druid/styles/",
"./druid/system/middleclass.lua",
"./druid/templates/",
"./druid/annotations.lua",
"./druid/custom/rich_text/module",
}
}
package='druid'
sort=true
dir='./docs'
style='!fixed'
topics={}
use_markdown_titles=true
no_space_before_args=true

View File

@@ -1,18 +0,0 @@
date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_count
2022-02-28T19:06:43Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,68,armv7-android,debug,true,521
2022-02-28T19:14:56Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,51,armv7-android,debug,true,521
2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-03-12T10:01:30Z,d0f3d6641a08b0d6b719b13017aa85907d1667e5,0.8.564,2200,44,js-web,release,true,564
2022-08-29T18:27:58Z,b2643ebd268b15884363efd17724e689279946f1,0.9.589,2316,45,js-web,release,true,589
2022-08-29T18:46:47Z,13003e472169cbd261e703eca7b133adf64a24f7,0.9.592,2316,40,js-web,release,true,592
2022-09-09T17:55:42Z,072507cc9e715541bdee7636d2e5eeeb3c22a57d,0.10.603,2340,43,js-web,release,true,603
2022-09-09T18:00:07Z,072507cc9e715541bdee7636d2e5eeeb3c22a57d,0.10.603,2340,5,js-web,release,true,603
2023-07-05T20:19:22Z,d0062c2a78e618871ebb4c8ee66b1509b763f069,0.10.671,3292,12,x86_64-linux,headless,true,671
2023-07-13T18:37:07Z,1cbe57376397a8352bbafcc67de0b6f95ae37b35,0.10.682,2496,53,js-web,release,true,682
2023-07-13T19:31:47Z,ea185622702e6691275187741b1e2ee0c7f079ec,0.11.686,2452,51,js-web,release,true,686
2023-07-15T12:56:18Z,556e1a9bae620e2df290b10287fa8d0f64d47293,0.11.690,2468,51,js-web,release,true,690
2023-08-05T16:02:55Z,628723386eb3875f7190d079a2e7c510d044a311,0.11.692,2456,40,js-web,release,true,692
2023-08-05T16:31:19Z,37fff52aa59feb20f761ef4d340d9f677743d54b,0.11.693,2456,43,js-web,release,true,693
2023-08-05T16:41:25Z,d7dd4a86b81d73d345ad7e136de9c2c488bc4d8b,0.11.694,2452,43,js-web,release,true,694
1 date sha version build_size build_time platform mode is_cache_using commits_count
2 2022-02-28T19:06:43Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 68 armv7-android debug true 521
3 2022-02-28T19:14:56Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 51 armv7-android debug true 521
4 2022-02-28T19:16:23Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
5 2022-02-28T19:19:46Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
6 2022-02-28T19:22:51Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
7 2022-03-12T10:01:30Z d0f3d6641a08b0d6b719b13017aa85907d1667e5 0.8.564 2200 44 js-web release true 564
8 2022-08-29T18:27:58Z b2643ebd268b15884363efd17724e689279946f1 0.9.589 2316 45 js-web release true 589
9 2022-08-29T18:46:47Z 13003e472169cbd261e703eca7b133adf64a24f7 0.9.592 2316 40 js-web release true 592
10 2022-09-09T17:55:42Z 072507cc9e715541bdee7636d2e5eeeb3c22a57d 0.10.603 2340 43 js-web release true 603
11 2022-09-09T18:00:07Z 072507cc9e715541bdee7636d2e5eeeb3c22a57d 0.10.603 2340 5 js-web release true 603
12 2023-07-05T20:19:22Z d0062c2a78e618871ebb4c8ee66b1509b763f069 0.10.671 3292 12 x86_64-linux headless true 671
13 2023-07-13T18:37:07Z 1cbe57376397a8352bbafcc67de0b6f95ae37b35 0.10.682 2496 53 js-web release true 682
14 2023-07-13T19:31:47Z ea185622702e6691275187741b1e2ee0c7f079ec 0.11.686 2452 51 js-web release true 686
15 2023-07-15T12:56:18Z 556e1a9bae620e2df290b10287fa8d0f64d47293 0.11.690 2468 51 js-web release true 690
16 2023-08-05T16:02:55Z 628723386eb3875f7190d079a2e7c510d044a311 0.11.692 2456 40 js-web release true 692
17 2023-08-05T16:31:19Z 37fff52aa59feb20f761ef4d340d9f677743d54b 0.11.693 2456 43 js-web release true 693
18 2023-08-05T16:41:25Z d7dd4a86b81d73d345ad7e136de9c2c488bc4d8b 0.11.694 2452 43 js-web release true 694

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,24 +1,25 @@
[project]
title = druid
version = 0.11.694
title = Druid
version = 1.1.0
write_log = 0
minimum_log_level = 1
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = d7dd4a86b81d73d345ad7e136de9c2c488bc4d8b
build_date = 2023-08-05T16:41:25Z
title_as_file_name = druid
developer = Maksim Tuprikov
custom_resources = /example/locales
commit_sha = 423a5239036790befe5fd0afd5b7a653314ad8be
title_as_file_name = Druid
[display]
width = 600
height = 900
width = 1920
height = 1080
high_dpi = 1
samples = 0
fullscreen = 0
update_frequency = 0
update_frequency = 60
swap_interval = 1
vsync = 1
display_profiles = /example/custom.display_profilesc
display_profiles = /builtins/render/default.display_profilesc
dynamic_orientation = 1
display_device_info = 0
@@ -26,7 +27,7 @@ display_device_info = 0
clear_color_red = 0
clear_color_green = 0
clear_color_blue = 0
clear_color_alpha = 0
clear_color_alpha = 1
[physics]
type = 2D
@@ -51,7 +52,7 @@ velocity_threshold = 1
max_fixed_timesteps = 2
[bootstrap]
main_collection = /example/example.collectionc
main_collection = /example/druid.collectionc
render = /builtins/render/default.renderc
[graphics]
@@ -59,9 +60,12 @@ default_texture_min_filter = linear
default_texture_mag_filter = linear
max_draw_calls = 128
max_characters = 8192
max_font_batches = 128
max_debug_vertices = 10000
texture_profiles = /example/custom.texture_profiles
texture_profiles = /builtins/graphics/default.texture_profiles
verify_graphics_calls = 0
opengl_version_hint = 33
opengl_core_profile_hint = true
memory_size = 512
[shader]
@@ -84,7 +88,7 @@ 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]
@@ -102,6 +106,7 @@ max_count = 0
max_count = 64
max_particlefx_count = 64
max_particle_count = 1024
max_animation_count = 1024
[collection]
max_instances = 128
@@ -122,13 +127,14 @@ 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 = 694
version_code = 970
minimum_sdk_version = 19
target_sdk_version = 33
target_sdk_version = 35
package = com.insality.druid
gcm_sender_id =
manifest = /builtins/manifests/android/AndroidManifest.xml
@@ -138,10 +144,12 @@ 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
@@ -155,7 +163,7 @@ app_icon =
custom_heap_size = 0
heap_size = 64
htmlfile = /builtins/manifests/web/engine_template.html
cssfile = /example/light_theme.css
cssfile = /builtins/manifests/web/dark_theme.css
splash_image = /media/druid_logo.png
archive_location_prefix = archive
archive_location_suffix =
@@ -163,17 +171,15 @@ engine_arguments = --verify-graphics-calls=false
wasm_streaming = 0
show_fullscreen_button = 0
show_made_with_defold = 0
show_console_banner = 1
scale_mode = fit
show_console_banner = 0
scale_mode = stretch
transparent_graphics_context = 0
[particle_fx]
max_count = 0
max_emitter_count = 0
max_particle_count = 0
[iap]
auto_finish_transactions = 1
[network]
http_timeout = 0
ssl_certificates =
@@ -197,6 +203,7 @@ sleep_between_server_updates = 0
[liveupdate]
settings = /liveupdate.settings
enabled = 1
mount_on_start = 1
[tilemap]
max_count = 0
@@ -205,11 +212,10 @@ max_tile_count = 0
[engine]
run_while_iconified = 0
fixed_update_frequency = 60
max_time_step = 0.5
[druid]
no_auto_input = 0
no_stencil_check = 0
no_auto_template = 0
input_text = text
input_touch = touch
input_marked_text = marked_text
@@ -222,5 +228,16 @@ 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":4114,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":23008,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":607568,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":24253,"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,873 +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.bind(obj), 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,
wasmjs_size: 250000,
asmjs_size: 4000000,
stream_wasm: false,
loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
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();
});
},
setupWasmStreamAsync: async function(src, fromProgress, toProgress) {
// https://stackoverflow.com/a/69179454
var fetchFn = fetch;
if (typeof TransformStream === "function" && ReadableStream.prototype.pipeThrough) {
async function fetchWithProgress(path) {
const response = await fetch(path);
// May be incorrect if compressed
const contentLength = response.headers.get("Content-Length");
const total = parseInt(contentLength, 10);
let bytesLoaded = 0;
const ts = new TransformStream({
transform (chunk, controller) {
bytesLoaded += chunk.byteLength;
Progress.calculateProgress(fromProgress, toProgress, bytesLoaded, total);
controller.enqueue(chunk)
}
});
return new Response(response.body.pipeThrough(ts), response);
}
fetchFn = fetchWithProgress;
}
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetchFn(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
successCallback(output.instance);
}).catch(function(e) {
console.log('wasm streaming instantiation failed! ' + e);
throw e;
});
return {}; // Compiling asynchronously, no exports.
}
},
// instantiate the .wasm file either by streaming it or first loading and then instantiate it
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(exeName) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.setupWasmStreamAsync(exeName + ".wasm", 10, 50);
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 0, 10);
}
else {
EngineLoader.loadAndInstantiateWasmAsync(exeName + ".wasm", 0, 40, function() {
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 40, 50);
});
}
},
loadAsmJsAsync: function(exeName) {
EngineLoader.loadAndRunScriptAsync(exeName + '_asmjs.js', EngineLoader.asmjs_size, 0, 50);
},
// load and start engine script (asm.js or wasm.js)
loadAndRunScriptAsync: 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.body.appendChild(tag);
});
},
// load engine (asm.js or wasm.js + wasm)
load: function(appCanvasId, exeName) {
Progress.addProgress(Module.setupCanvas(appCanvasId));
if (Module['isWASMSupported']) {
EngineLoader.loadWasmAsync(exeName);
} else {
EngineLoader.loadAsmJsAsync(exeName);
}
}
}
/* ********************************************************************* */
/* 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 = "";
}
}
};
/* ********************************************************************* */
/* 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;
},
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()) {
Module.canvas.focus();
// 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) {
if (Module.persistentStorage != true) {
Module._syncInitial = true;
done();
return;
}
// 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() {
if (Module.persistentStorage != true) {
return;
}
// 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();
try {
FS.mkdir(dir);
}
catch (error) {
Module.persistentStorage = false;
Module._preloadAndCallMain();
return;
}
// 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.
try {
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;
}
}
catch (error) {
Module.persistentStorage = false;
Module._preloadAndCallMain();
return;
}
// Sync IDB->MEM before calling main()
Module.preSync(function() {
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: 119 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,233 +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.11.694</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-size: contain;
background-image: url("druid_logo.png");
}
</style>
</head>
<body>
<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="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;
var prevInnerWidth = -1;
var prevInnerHeight = -1;
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;
if (prevInnerWidth == innerWidth && prevInnerHeight == innerHeight)
{
return;
}
prevInnerWidth = innerWidth;
prevInnerHeight = innerHeight;
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);
window.addEventListener('focus', resize_game_canvas, false);
</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.stream_wasm = "false" === "true";
EngineLoader.load("canvas", "druid");
runningFromFileWarning.parentNode.removeChild(runningFromFileWarning);
}
</script>
</body>
</html>

BIN
docs/druid_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@@ -1,206 +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 Framework</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/Text.html">Text</a></li>
<li><a href="modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="modules/PinKnob.html">PinKnob</a></li>
<li><a href="modules/RichInput.html">RichInput</a></li>
<li><a href="modules/RichText.html">RichText</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/Hotkey.html">Hotkey</a></li>
<li><a href="modules/Input.html">Input</a></li>
<li><a href="modules/LangText.html">LangText</a></li>
<li><a href="modules/Layout.html">Layout</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/Swipe.html">Swipe</a></li>
<li><a href="modules/Timer.html">Timer</a></li>
<li><a href="modules/Helper.html">Helper</a></li>
<li><a href="modules/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h2>Documentation for Druid Framework</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 with event on back and backspace button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Blocker.html">Blocker</a></td>
<td class="summary">Component to consume input in special zone defined by GUI node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Button.html">Button</a></td>
<td class="summary">Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.</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 component's position by row and columns.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Text.html">Text</a></td>
<td class="summary">Component for Wrapping GUI Text Nodes: Druid Text
<p> ## Overview ##
<p> Druid Text is a component that provides various adjustment modes for text nodes.</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/PinKnob.html">PinKnob</a></td>
<td class="summary">Druid pin knob custom component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td>
<td class="summary">Druid Rich Input custom component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RichText.html">RichText</a></td>
<td class="summary">Druid Rich Text Custom Component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Druid.html">Druid</a></td>
<td class="summary">Druid UI Component Framework.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidEvent.html">DruidEvent</a></td>
<td class="summary">Druid Event Module
<p> The Event module provides a simple class for handling callbacks.</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/Hotkey.html">Hotkey</a></td>
<td class="summary">Druid hotkey component</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 wrap over GUI Text nodes with localization helpers
<p> <b># Overview #</b>
<p> • The initialization of druid.set_text_function is required to enable localization
using the localization ID.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Layout.html">Layout</a></td>
<td class="summary">Layout management on node</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Progress.html">Progress</a></td>
<td class="summary">Druid component to handle the progress bars.</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/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/Timer.html">Timer</a></td>
<td class="summary">Component to handle GUI timers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Helper.html">Helper</a></td>
<td class="summary">Helper module with various usefull GUI functions.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
<td class="summary">Druid Instance which you use for component creation.</td>
</tr>
</table>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
<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: 900px;
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,177 +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 Framework</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="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><strong>BackHandler</strong></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>BackHandler</code></h1>
<p>Component with event on back and backspace button.</p>
<p>
<b># Overview #</b>
<p> Back Handler is recommended to put in every game window to close it
or in main screen to call settings window.
<p> <b># Notes #</b>
<p> • Back Handler inheritance <a href="../modules/BaseComponent.html#">BaseComponent</a>, you can use all of its methods in addition to those described here.
<p> • Back Handler react on release action ACTION_BACK or ACTION_BACKSPACE</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local callback = function(self, params) ... end
local params = {}
local back_handler = self.druid:new_back_handler(callback, [params])
</pre>
</ul>
<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">The <a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Custom args to pass in the callback</td>
</tr>
</table>
<br/>
<br/>
<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>
The <a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.
<p> Trigger on input action ACTION_BACK or ACTION_BACKSPACE
<ul>
<li><span class="parameter">on_back</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Subscribe additional callbacks:
</span>back_handler.on_back:subscribe(callback)</pre>
</ul>
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Custom args to pass in the callback
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Replace params on runtime:
</span>back_handler.params = { ... }</pre>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,661 +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 Framework</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><strong>BaseComponent</strong></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>BaseComponent</code></h1>
<p>Basic class for all Druid components.</p>
<p>
To create you custom component, use static function `component.create`</p>
<h3>Usage:</h3>
<ul>
<pre class="example">-- Create your component:
local component = require(&quot;druid.component&quot;)
local AwesomeComponent = component.create(&quot;awesome_component&quot;)
function AwesomeComponent:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
end
return AwesomeComponent
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#component:get_childrens">component:get_childrens(self)</a></td>
<td class="summary">Return all children components, recursive</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_context">component:get_context(self)</a></td>
<td class="summary">Context used as first arg in all Druid events</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_druid">component:get_druid(self)</a></td>
<td class="summary">Get Druid instance for inner component creation.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_input_priority">component:get_input_priority(self)</a></td>
<td class="summary">Return component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_name">component:get_name(self)</a></td>
<td class="summary">Return component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_node">component:get_node(self, node_or_name)</a></td>
<td class="summary">Get component node by name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_parent_component">component:get_parent_component(self)</a></td>
<td class="summary">Return the parent component if exist</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_parent_name">component:get_parent_name(self)</a></td>
<td class="summary">Return parent component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_template">component:get_template(self)</a></td>
<td class="summary">Get current component template name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:get_uid">component:get_uid(self)</a></td>
<td class="summary">Return component UID.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:reset_input_priority">component: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="#component:set_input_enabled">component:set_input_enabled(self, state)</a></td>
<td class="summary">Set component input state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_input_priority">component:set_input_priority(self, value, is_temporary)</a></td>
<td class="summary">Set component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_nodes">component:set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_style">component:set_style(self, druid_style)</a></td>
<td class="summary">Set current component style table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_template">component:set_template(self, template)</a></td>
<td class="summary">Set component template name.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "component:get_childrens"></a>
<strong>component:get_childrens(self)</strong>
</dt>
<dd>
Return all children components, recursive
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array of childrens if the Druid component instance
</ol>
</dd>
<dt>
<a name = "component:get_context"></a>
<strong>component:get_context(self)</strong>
</dt>
<dd>
Context used as first arg in all Druid events Context is usually self of gui_script.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent context
</ol>
</dd>
<dt>
<a name = "component:get_druid"></a>
<strong>component:get_druid(self)</strong>
</dt>
<dd>
Get Druid instance for inner component creation.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Druid</span></span>
Druid instance with component context
</ol>
</dd>
<dt>
<a name = "component:get_input_priority"></a>
<strong>component: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>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "component:get_name"></a>
<strong>component: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>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The component name
</ol>
</dd>
<dt>
<a name = "component:get_node"></a>
<strong>component:get_node(self, node_or_name)</strong>
</dt>
<dd>
Get component node by name.
<p> If component has nodes, node_or_name should be string
It autopick node by template name or from nodes by gui.clone_tree
if they was setup via component:set_nodes, component:set_template.
If node is not found, the exception will fired
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">node_or_name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
Node name or node itself
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span></span>
Gui node
</ol>
</dd>
<dt>
<a name = "component:get_parent_component"></a>
<strong>component:get_parent_component(self)</strong>
</dt>
<dd>
Return the parent component if exist
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span> or <span class="type">nil</span></span>
The druid component instance or nil
</ol>
</dd>
<dt>
<a name = "component:get_parent_name"></a>
<strong>component:get_parent_name(self)</strong>
</dt>
<dd>
Return parent component name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
The parent component name if exist or bil
</ol>
</dd>
<dt>
<a name = "component:get_template"></a>
<strong>component:get_template(self)</strong>
</dt>
<dd>
Get current component template name.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Component full template name
</ol>
</dd>
<dt>
<a name = "component:get_uid"></a>
<strong>component:get_uid(self)</strong>
</dt>
<dd>
Return component UID.
<p> UID generated in component creation order.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component uid
</ol>
</dd>
<dt>
<a name = "component:reset_input_priority"></a>
<strong>component: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>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "component:set_input_enabled"></a>
<strong>component:set_input_enabled(self, state)</strong>
</dt>
<dd>
Set component input state. By default it enabled
<p> If input is disabled, the component will not receive input events
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">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 = "component:set_input_priority"></a>
<strong>component:set_input_priority(self, value, is_temporary)</strong>
</dt>
<dd>
Set component input priority Default value: 10
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The new input priority value
</li>
<li><span class="parameter">is_temporary</span>
<span class="types"><span class="type">boolean</span></span>
If true, the reset input priority will return to previous 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 = "component:set_nodes"></a>
<strong>component:set_nodes(self, nodes)</strong>
</dt>
<dd>
Set current component nodes.
Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent nodes table
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> nodes = gui.clone_tree(self.prefab)
... In your component:
self:set_nodes(nodes)</pre>
</ul>
</dd>
<dt>
<a name = "component:set_style"></a>
<strong>component:set_style(self, druid_style)</strong>
</dt>
<dd>
Set current component style table.
<p> Invoke `on_style_change` on component, if exist. Component should handle
their style changing and store all style params
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">druid_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
</dd>
<dt>
<a name = "component:set_template"></a>
<strong>component:set_template(self, template)</strong>
</dt>
<dd>
Set component template name.
<p> Use on all your custom components with GUI layouts used as templates.
It will check parent template name to build full template name in self:get_node()
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
BaseComponent template name
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,237 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>Blocker</strong></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Blocker</code></h1>
<p>Component to consume input in special zone defined by GUI node.</p>
<p>
<b># Overview #</b>
<p> <b># Notes #</b>
<p> Blocker consume input if `gui.pick_node` works on it.
<p> • Blocker inheritance <a href="../modules/BaseComponent.html#">BaseComponent</a>, you can use all of its methods in addition to those described here.
<p> • Blocker initial enabled state is `gui.is_enabled(node, true)`
<p> • The Blocker node should be enabled to capture the input</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local node = gui.get_node(&quot;blocker_node&quot;)
local blocker = self.druid:new_blocker(node)
</pre>
</ul>
<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"><a href="../modules/Blocker.html#">Blocker</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return blocker enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Blocker 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>
<a href="../modules/Blocker.html#">Blocker</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Blocker.html#node">node</a></span>
Gui node
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return blocker enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if blocker is enabled
</ol>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state.
<p> Don't change node enabled state itself.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Blocker 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 TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,894 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><strong>Button</strong></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Button</code></h1>
<p>Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.</p>
<p>
<p> <b># Overview #</b>
<p> This component provides a versatile solution for handling user click interactions.
It allows you to make any GUI node clickable and define various callbacks for different types of clicks.
<p> <b># Notes #</b>
<p> • The click callback will not trigger if the cursor moves outside the node's
area between the pressed and released states.
<p> • If a button has a double click event subscriber and the double click event is triggered,
the regular click callback will not be triggered.
<p> • Buttons can be triggered using a keyboard key by calling the button:set_key_trigger method.
<p> • To animate a small icon on a big button panel, you can use an animation node.
The trigger node name should be set as "big panel," and the animation node should be set as "small icon."
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_buttons" target="_blank"><b>Example Link</b></a></p>
<h3>Usage:</h3>
<ul>
<pre class="example">local function on_button_click(self, args, button)
print(&quot;Button has clicked with params: &quot; .. args)
print(&quot;Also the button component is passed in callback params&quot;)
end
local custom_args = &quot;Any variable to pass inside callback&quot;
local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, custom_args)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get current key name to trigger this button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, custom_args[, anim_node]])</a></td>
<td class="summary">The <a href="../modules/Button.html#">Button</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Get button enabled state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_check_function">set_check_function(self[, check_function[, failure_callback]])</a></td>
<td class="summary">Set function for additional check for button click availability</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Set additional button click area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set button enabled state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(self, key)</a></td>
<td class="summary">Set key name to trigger this button by keyboard.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_web_user_interaction">set_web_user_interaction(self[, is_web_mode])</a></td>
<td class="summary">Set Button mode to work inside user HTML5 interaction event.</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="#anim_node">anim_node</a></td>
<td class="summary">Button animation node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Additional button click area, defined by another GUI Node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary">The <a href="../modules/Hover.html#">Hover</a>: Button Hover component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Button trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node_id">node_id</a></td>
<td class="summary">The GUI node id from button node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click">on_click</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_hold_callback">on_hold_callback</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_pressed">on_pressed</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Custom args for any Button event.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_key_trigger"></a>
<strong>get_key_trigger(self)</strong>
</dt>
<dd>
Get current key name 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 input key
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> key_hash = button:get_key_trigger()</pre>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, custom_args[, anim_node]])</strong>
</dt>
<dd>
The <a href="../modules/Button.html#">Button</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
Node name or GUI Node itself
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
On click button callback
</li>
<li><span class="parameter">custom_args</span>
<span class="types"><span class="type">any</span></span>
Button events custom arguments
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
Node to animate instead of trigger node.
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Get button enabled state.
<p> By default all Buttons is enabled on creating.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled now, False overwise
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_enabled = button:is_enabled()</pre>
</ul>
</dd>
<dt>
<a name = "set_check_function"></a>
<strong>set_check_function(self[, check_function[, failure_callback]])</strong>
</dt>
<dd>
Set function for additional check for button click availability
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">check_function</span>
<span class="types"><span class="type">function</span></span>
Should return true or false. If true - button can be pressed.
(<em>optional</em>)
</li>
<li><span class="parameter">failure_callback</span>
<span class="types"><span class="type">function</span></span>
Function will be called on button click, if check function return false
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Set additional button click area.
Useful to restrict click outside out stencil node or scrollable content.
<p> This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_click_zone(<span class="string">"stencil_node"</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set button enabled state.
The style.on_set_enabled will be triggered.
Disabled button is not clickable.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_enabled(<span class="keyword">false</span>)
button:set_enabled(<span class="keyword">true</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_key_trigger"></a>
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key name to trigger this button by keyboard.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">key</span>
<span class="types"><span class="type">hash</span></span>
The action_id of the input key
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_key_trigger(<span class="string">"key_space"</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_web_user_interaction"></a>
<strong>set_web_user_interaction(self[, is_web_mode])</strong>
</dt>
<dd>
Set Button mode to work inside user HTML5 interaction event.
<p> It's required to make protected things like copy & paste text, show mobile keyboard, etc
The HTML5 button's doesn't call any events except on_click event.
<p> If the game is not HTML, html mode will be not enabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">is_web_mode</span>
<span class="types"><span class="type">boolean</span></span>
If true - button will be called inside html5 callback
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_web_user_interaction(<span class="keyword">true</span>)</pre>
</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">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 = "anim_node"></a>
<strong>anim_node</strong>
</dt>
<dd>
Button animation node.
In default case equals to clickable node.
<p> Usecase: You have the big clickable panel, but want to animate only one small icon on it.
<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 = "click_zone"></a>
<strong>click_zone</strong>
</dt>
<dd>
Additional button click area, defined by another GUI Node
<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>
<dt>
<a name = "hover"></a>
<strong>hover</strong>
</dt>
<dd>
The <a href="../modules/Hover.html#">Hover</a>: Button Hover component
<ul>
<li><span class="parameter">hover</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Button trigger node
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node_id"></a>
<strong>node_id</strong>
</dt>
<dd>
The GUI node id from button node
<ul>
<li><span class="parameter">node_id</span>
<span class="types"><span class="type">hash</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_click"></a>
<strong>on_click</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_click_outside"></a>
<strong>on_click_outside</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.
<p> This event will be triggered for each button what was not clicked on user click action
<p> Usecase: Hide the popup when click outside
<ul>
<li><span class="parameter">on_click_outside</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_click_outside:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On click Button outside!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_double_click"></a>
<strong>on_double_click</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.
<p> If secondary click was too fast after previous one, the double
click will be called instead usual click (if on_double_click subscriber exists)
<ul>
<li><span class="parameter">on_double_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_double_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, click_amount)
<span class="global">print</span>(<span class="string">"On double Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_hold_callback"></a>
<strong>on_hold_callback</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.
<p> If long_click subscriber exists, the on_hold_callback will be called before long_click trigger.
<p> Usecase: Animate button progress of long tap
<ul>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_double_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, time)
<span class="global">print</span>(<span class="string">"On hold Button callback!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_long_click"></a>
<strong>on_long_click</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.
<p> This callback will be triggered if user pressed the button and hold the some amount of time.
The amount of time picked from button style param: LONGTAP_TIME
<ul>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_long_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, hold_time)
<span class="global">print</span>(<span class="string">"On long Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_pressed"></a>
<strong>on_pressed</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.
<ul>
<li><span class="parameter">on_pressed</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_pressed:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On Button pressed!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_repeated_click"></a>
<strong>on_repeated_click</strong>
</dt>
<dd>
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.
<p> This callback will be triggered if user hold the button. The repeat rate pick from `input.repeat_interval` in game.project
<ul>
<li><span class="parameter">on_repeated_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_repeated_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, click_count)
<span class="global">print</span>(<span class="string">"On repeated Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Custom args for any Button event. Setup in Button constructor
<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 TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,354 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><strong>Checkbox</strong></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Checkbox</code></h1>
<p>Druid checkbox component</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent, is_instant)</a></td>
<td class="summary">Set 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="#button">button</a></td>
<td class="summary">Button component from click_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_node">click_node</a></td>
<td class="summary">Button trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Visual node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td>
<td class="summary">On change state callback(self, state)</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, click_node=node[, initial_state=false]])</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>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
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>
<li><span class="parameter">initial_state</span>
<span class="types"><span class="type">boolean</span></span>
The initial state of checkbox, default - false
(<em>default</em> false)
</li>
</ul>
</dd>
<dt>
<a name = "set_state"></a>
<strong>set_state(self, state, is_silent, is_instant)</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>
<a href="../modules/Checkbox.html#">Checkbox</a>
</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>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">bool</span></span>
If instant checkbox change
</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">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 = "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>
<a href="../modules/Button.html#">Button</a>
</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 = "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 = "on_change_state"></a>
<strong>on_change_state</strong>
</dt>
<dd>
On change state callback(self, state)
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,261 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><strong>CheckboxGroup</strong></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>CheckboxGroup</code></h1>
<p>Checkbox group module</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, indexes, is_instant)</a></td>
<td class="summary">Set checkbox group state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_checkbox_click">on_checkbox_click</a></td>
<td class="summary">On any checkbox click callback(self, index)</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
<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, is_instant)</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>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
<li><span class="parameter">indexes</span>
<span class="types"><span class="type">bool[]</span></span>
Array of checkbox state
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If instant state change
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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.1/manual.html#5.5">table</a></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_checkbox_click"></a>
<strong>on_checkbox_click</strong>
</dt>
<dd>
On any checkbox click callback(self, index)
<ul>
<li><span class="parameter">on_checkbox_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,653 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><strong>DataList</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</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> <a href="https://insality.github.io/druid/druid/index.html?example=general_data_list" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the DataList and refresh visuals</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_created_components">get_created_components(self)</a></td>
<td class="summary">Return all currenly created components in DataList</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_created_nodes">get_created_nodes(self)</a></td>
<td class="summary">Return all currenly created nodes in DataList</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_data">get_data(self)</a></td>
<td class="summary">Return current data from DataList component</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_index">get_index(self, data)</a></td>
<td class="summary">Return index for data value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_last_index">get_last_index(self)</a></td>
<td class="summary">Return last index from data</td>
</tr>
<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="#init">init(self, scroll, grid, create_function)</a></td>
<td class="summary">Data list constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove">on_remove(self)</a></td>
<td class="summary">Druid System on_remove function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td>
<td class="summary">Instant scroll to element with passed index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_data">set_data(self, data)</a></td>
<td class="summary">Set new data set for DataList component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#grid">grid</a></td>
<td class="summary">The Druid Grid component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#last_index">last_index</a></td>
<td class="summary">The current visual last data index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_element_add">on_element_add</a></td>
<td class="summary">On DataList visual element created Event callback(self, index, node, instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_element_remove">on_element_remove</a></td>
<td class="summary">On DataList visual element created Event callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_scroll_progress_change">on_scroll_progress_change</a></td>
<td class="summary">Event triggered when scroll progress is changed; event(self, progress_value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll">scroll</a></td>
<td class="summary">The Druid scroll component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll_progress">scroll_progress</a></td>
<td class="summary">The current progress of scroll posititon</td>
</tr>
<tr>
<td class="name" nowrap><a href="#top_index">top_index</a></td>
<td class="summary">The current visual top data index</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the DataList and refresh visuals
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_created_components"></a>
<strong>get_created_components(self)</strong>
</dt>
<dd>
Return all currenly created components in DataList
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.base_component[]</span></span>
List of created nodes
</ol>
</dd>
<dt>
<a name = "get_created_nodes"></a>
<strong>get_created_nodes(self)</strong>
</dt>
<dd>
Return all currenly created nodes in DataList
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Node[]</span></span>
List of created nodes
</ol>
</dd>
<dt>
<a name = "get_data"></a>
<strong>get_data(self)</strong>
</dt>
<dd>
Return current data from DataList component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The current data array
</ol>
</dd>
<dt>
<a name = "get_first_index"></a>
<strong>get_first_index(self)</strong>
</dt>
<dd>
Return first index from data. It not always equals to 1
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, data)</strong>
</dt>
<dd>
Return index for data value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_last_index"></a>
<strong>get_last_index(self)</strong>
</dt>
<dd>
Return last index from data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_length"></a>
<strong>get_length(self)</strong>
</dt>
<dd>
Return amount of data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, scroll, grid, create_function)</strong>
</dt>
<dd>
Data list constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">Scroll</span></span>
The <a href="../modules/Scroll.html#">Scroll</a> instance for Data List component
</li>
<li><span class="parameter">grid</span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component
</li>
<li><span class="parameter">create_function</span>
<span class="types"><span class="type">function</span></span>
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>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_to_index"></a>
<strong>scroll_to_index(self, index)</strong>
</dt>
<dd>
Instant scroll to element with passed index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</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>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
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>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>, <a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
</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 = "on_element_add"></a>
<strong>on_element_add</strong>
</dt>
<dd>
On DataList visual element created Event callback(self, index, node, instance)
<ul>
<li><span class="parameter">on_element_add</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_element_remove"></a>
<strong>on_element_remove</strong>
</dt>
<dd>
On DataList visual element created Event callback(self, index)
<ul>
<li><span class="parameter">on_element_remove</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll"></a>
<strong>scroll</strong>
</dt>
<dd>
The Druid scroll component
<ul>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">Scroll</span></span>
<a href="../modules/Scroll.html#">Scroll</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_progress"></a>
<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 = "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>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,567 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</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> <a href="https://insality.github.io/druid/druid/index.html?example=general_drag" target="_blank"><b>Example Link</b></a></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="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Check if Drag component is enabled</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>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, is_enabled)</a></td>
<td class="summary">Set Drag input enabled or disabled</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="#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="#is_drag">is_drag</a></td>
<td class="summary">Is component now dragging</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_touch">is_touch</a></td>
<td class="summary">Is component now touching</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_drag">on_drag</a></td>
<td class="summary">on drag progress callback(self, dx, dy, total_x, total_y)</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, total_x, total_y)</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_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_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="#touch_start_pos">touch_start_pos</a></td>
<td class="summary">Touch start position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#x">x</a></td>
<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>
</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>
<a href="../modules/Drag.html#">Drag</a>
</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 = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Check if Drag component is enabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
</ol>
</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>
<a href="../modules/Drag.html#">Drag</a>
</li>
<li><span class="parameter">node</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, is_enabled)</strong>
</dt>
<dd>
Set Drag input enabled or disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li>
<li><span class="parameter">is_enabled</span>
<span class="types"><span class="type">bool</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">DRAG_DEADZONE</span>
<span class="types"><span class="type">number</span></span>
Distance in pixels to start dragging
(<em>default</em> 10)
</li>
<li><span class="parameter">NO_USE_SCREEN_KOEF</span>
<span class="types"><span class="type">boolean</span></span>
If screen aspect ratio affects on drag values
(<em>default</em> false)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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 = "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 = "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 = "on_drag"></a>
<strong>on_drag</strong>
</dt>
<dd>
on drag progress callback(self, dx, dy, total_x, total_y)
<ul>
<li><span class="parameter">on_drag</span>
<span class="types"><span class="type">DruidEvent</span></span>
Event <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_end"></a>
<strong>on_drag_end</strong>
</dt>
<dd>
Event on drag end callback(self, total_x, total_y)
<ul>
<li><span class="parameter">on_drag_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_start"></a>
<strong>on_drag_start</strong>
</dt>
<dd>
Event on drag start callback(self)
<ul>
<li><span class="parameter">on_drag_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_end"></a>
<strong>on_touch_end</strong>
</dt>
<dd>
Event on touch end callback(self)
<ul>
<li><span class="parameter">on_touch_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_start"></a>
<strong>on_touch_start</strong>
</dt>
<dd>
Event on touch start callback(self)
<ul>
<li><span class="parameter">on_touch_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "touch_start_pos"></a>
<strong>touch_start_pos</strong>
</dt>
<dd>
Touch start position
<ul>
<li><span class="parameter">touch_start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</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>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,326 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>DruidEvent</code></h1>
<p>Druid Event Module
<p> The Event module provides a simple class for handling callbacks.</p>
<p> It is used in many Druid components.
<p> You can subscribe to an event using the `:subscribe` method and unsubscribe using the `:unsubscribe` method.</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the all event handlers</td>
</tr>
<tr>
<td class="name" nowrap><a href="#initialize">initialize(self[, initial_callback])</a></td>
<td class="summary">DruidEvent constructor</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="#subscribe">subscribe(self, callback[, context])</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#trigger">trigger(self, ...)</a></td>
<td class="summary">Trigger the event and call all subscribed callbacks</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback[, context])</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the all event handlers
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">button.on_long_click:clear()</pre>
</ul>
</dd>
<dt>
<a name = "initialize"></a>
<strong>initialize(self[, initial_callback])</strong>
</dt>
<dd>
DruidEvent constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">initial_callback</span>
<span class="types"><span class="type">function</span></span>
Subscribe the callback on new event, if callback exist
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> Event = <span class="global">require</span>(<span class="string">"druid.event"</span>)
...
<span class="keyword">local</span> event = Event(initial_callback)</pre>
</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>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True if event have handlers
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_long_click_handler_exists = button.on_long_click:is_exist()</pre>
</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>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><span class="type">Any</span></span>
Additional context as first param to callback call, usually it's self
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> on_long_callback(self)
<span class="global">print</span>(<span class="string">"Long click!"</span>)
<span class="keyword">end</span>
...
<span class="keyword">local</span> button = self.druid:new_button(<span class="string">"button"</span>, callback)
button.on_long_click:subscribe(on_long_callback, self)</pre>
</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>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">Any</span></span>
All event params
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> Event = <span class="global">require</span>(<span class="string">"druid.event"</span>)
...
<span class="keyword">local</span> event = Event()
event:trigger(<span class="string">"Param1"</span>, <span class="string">"Param2"</span>)</pre>
</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>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><span class="type">Any</span></span>
Additional context as first param to callback call
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> on_long_callback(self)
<span class="global">print</span>(<span class="string">"Long click!"</span>)
<span class="keyword">end</span>
...
button.on_long_click:unsubscribe(on_long_callback, self)</pre>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,798 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><strong>DynamicGrid</strong></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>DynamicGrid</code></h1>
<p>Component to handle placing components in row</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_grid" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<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>
<tr>
<td class="name" nowrap><a href="#add">add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</a></td>
<td class="summary">Add new node to the grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear grid nodes array.</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="#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_offset">get_offset(self)</a></td>
<td class="summary">Return DynamicGrid offset, where DynamicGrid content starts.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index, node[, origin_index])</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_size">get_size(self, border)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_position_function">set_position_function(self, callback)</a></td>
<td class="summary">Change set position function for grid nodes.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#border">border</a></td>
<td class="summary">The size of item content</td>
</tr>
<tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td>
<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="#nodes">nodes</a></td>
<td class="summary">List of all grid elements.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td>
<td class="summary">On item add callback(self, node, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add or remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<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>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</strong>
</dt>
<dd>
Add new node to the grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The node position. By default add as last node
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear grid nodes array. GUI nodes will be not deleted!
If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.dynamic_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "get_all_pos"></a>
<strong>get_all_pos(self)</strong>
</dt>
<dd>
Return array of all node positions
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(self, node)</strong>
</dt>
<dd>
Return grid index by node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node in the grid
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd>
<dt>
<a name = "get_offset"></a>
<strong>get_offset(self)</strong>
</dt>
<dd>
Return DynamicGrid offset, where DynamicGrid content starts.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a> The DynamicGrid instance
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The DynamicGrid offset
</ol>
</dd>
<dt>
<a name = "get_pos"></a>
<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>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid 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 = "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>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</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 = "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>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</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 = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
</dt>
<dd>
Remove the item from the grid. Note that gui node will be not deleted
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid node index to remove
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span></span>
The deleted gui node from grid
</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>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</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>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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>
<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 = "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 = "on_add_item"></a>
<strong>on_add_item</strong>
</dt>
<dd>
On item add callback(self, node, index)
<ul>
<li><span class="parameter">on_add_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add or remove callback(self, index)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,891 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><strong>Helper</strong></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Helper</code></h1>
<p>Helper module with various usefull GUI functions.</p>
<p></p>
<h3>Usage:</h3>
<ul>
<pre class="example">local helper = require(&quot;druid.helper&quot;)
helper.centrate_nodes(0, node_1, node_2)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#helper.add_array">helper.add_array(target[, source])</a></td>
<td class="summary">Add all elements from source array to the target array</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0], ...)</a></td>
<td class="summary">Centerate nodes by x position with margin.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.clamp">helper.clamp(a, min, max)</a></td>
<td class="summary">Clamp value between min and max</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.contains">helper.contains(t, value)</a></td>
<td class="summary">Check if value is in array and return index of it</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.deepcopy">helper.deepcopy(orig_table)</a></td>
<td class="summary">Make a copy table with all nested tables</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.distance">helper.distance(x1, y1, x2, y2)</a></td>
<td class="summary">Calculate distance between two points</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_border">helper.get_border(node[, offset])</a></td>
<td class="summary">Distance from node position to his borders</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_closest_stencil_node">helper.get_closest_stencil_node(node)</a></td>
<td class="summary">Return closest non inverted clipping parent node for given node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_gui_scale">helper.get_gui_scale()</a></td>
<td class="summary">Get current GUI scale for each side</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_pivot_offset">helper.get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given GUI pivot.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_scaled_size">helper.get_scaled_size(node)</a></td>
<td class="summary">Get node size adjusted by scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_scene_scale">helper.get_scene_scale(node, include_passed_node_scale)</a></td>
<td class="summary">Get cumulative parent's node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_screen_aspect_koef">helper.get_screen_aspect_koef()</a></td>
<td class="summary">Get current screen stretch multiplier for each side</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_text_metrics_from_node">helper.get_text_metrics_from_node(text_node)</a></td>
<td class="summary">Get text metric from GUI node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.insert_with_shift">helper.insert_with_shift(array, item[, index[, shift_policy]])</a></td>
<td class="summary">Add value to array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_mobile">helper.is_mobile()</a></td>
<td class="summary">Check if device is native mobile (Android or iOS)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_web">helper.is_web()</a></td>
<td class="summary">Check if device is HTML5</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.lerp">helper.lerp(a, b, t)</a></td>
<td class="summary">Lerp between two values</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.remove_with_shift">helper.remove_with_shift(array[, index[, shift_policy]])</a></td>
<td class="summary">Remove value from array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.round">helper.round(num[, num_decimal_places=0])</a></td>
<td class="summary">Round number to specified decimal places</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.sign">helper.sign(val)</a></td>
<td class="summary">Return sign of value (-1, 0, 1)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.step">helper.step(current, target, step)</a></td>
<td class="summary">Move value from current to target value with step amount</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.table_to_string">helper.table_to_string(t)</a></td>
<td class="summary">Simple table to one-line string converter</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "helper.add_array"></a>
<strong>helper.add_array(target[, source])</strong>
</dt>
<dd>
Add all elements from source array to the target array
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">target</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array to put elements from source
</li>
<li><span class="parameter">source</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The source array to get elements from
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">array</span></span>
The target array
</ol>
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0], ...)</strong>
</dt>
<dd>
Centerate nodes by x position with margin.
<p> This functions calculate total width of nodes and set position for each node.
The centrate will be 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>
Gui nodes
</li>
</ul>
</dd>
<dt>
<a name = "helper.clamp"></a>
<strong>helper.clamp(a, min, max)</strong>
</dt>
<dd>
Clamp value between min and max
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
Value
</li>
<li><span class="parameter">min</span>
<span class="types"><span class="type">number</span></span>
Min value
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">number</span></span>
Max value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Clamped value
</ol>
</dd>
<dt>
<a name = "helper.contains"></a>
<strong>helper.contains(t, value)</strong>
</dt>
<dd>
Check if value is in array and return index of it
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">value</span>
Value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Index of value or nil
</ol>
</dd>
<dt>
<a name = "helper.deepcopy"></a>
<strong>helper.deepcopy(orig_table)</strong>
</dt>
<dd>
Make a copy table with all nested tables
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">orig_table</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Original table
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Copy of original table
</ol>
</dd>
<dt>
<a name = "helper.distance"></a>
<strong>helper.distance(x1, y1, x2, y2)</strong>
</dt>
<dd>
Calculate distance between two points
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">x1</span>
<span class="types"><span class="type">number</span></span>
First point x
</li>
<li><span class="parameter">y1</span>
<span class="types"><span class="type">number</span></span>
First point y
</li>
<li><span class="parameter">x2</span>
<span class="types"><span class="type">number</span></span>
Second point x
</li>
<li><span class="parameter">y2</span>
<span class="types"><span class="type">number</span></span>
Second point y
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Distance
</ol>
</dd>
<dt>
<a name = "helper.get_border"></a>
<strong>helper.get_border(node[, offset])</strong>
</dt>
<dd>
Distance from node position to his borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
GUI node
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vector3</span></span>
Offset from node position. Pass current node position to get non relative border values
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector4</span></span>
Vector4 with border values (left, top, right, down)
</ol>
</dd>
<dt>
<a name = "helper.get_closest_stencil_node"></a>
<strong>helper.get_closest_stencil_node(node)</strong>
</dt>
<dd>
Return closest non inverted clipping parent node for given node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
GUI node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span> or <span class="type">nil</span></span>
The closest stencil node or nil
</ol>
</dd>
<dt>
<a name = "helper.get_gui_scale"></a>
<strong>helper.get_gui_scale()</strong>
</dt>
<dd>
Get current GUI scale for each side
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
scale_x</li>
<li>
<span class="types"><span class="type">number</span></span>
scale_y</li>
</ol>
</dd>
<dt>
<a name = "helper.get_pivot_offset"></a>
<strong>helper.get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given GUI pivot.
<p> Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top.
<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 [-0.5..0.5] values
</ol>
</dd>
<dt>
<a name = "helper.get_scaled_size"></a>
<strong>helper.get_scaled_size(node)</strong>
</dt>
<dd>
Get node size adjusted by scale
<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">vector3</span></span>
Scaled size
</ol>
</dd>
<dt>
<a name = "helper.get_scene_scale"></a>
<strong>helper.get_scene_scale(node, include_passed_node_scale)</strong>
</dt>
<dd>
Get cumulative parent's node scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
<li><span class="parameter">include_passed_node_scale</span>
<span class="types"><span class="type">bool</span></span>
True if add current node scale to result
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The scene node scale
</ol>
</dd>
<dt>
<a name = "helper.get_screen_aspect_koef"></a>
<strong>helper.get_screen_aspect_koef()</strong>
</dt>
<dd>
Get current screen stretch multiplier for each side
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
stretch_x</li>
<li>
<span class="types"><span class="type">number</span></span>
stretch_y</li>
</ol>
</dd>
<dt>
<a name = "helper.get_text_metrics_from_node"></a>
<strong>helper.get_text_metrics_from_node(text_node)</strong>
</dt>
<dd>
Get text metric from GUI node.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">GUITextMetrics</span></span>
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">type</span> GUITextMetrics = {
width: number,
height: number,
max_ascent: number,
max_descent: number
}</pre>
</ul>
</dd>
<dt>
<a name = "helper.insert_with_shift"></a>
<strong>helper.insert_with_shift(array, item[, index[, shift_policy]])</strong>
</dt>
<dd>
Add value to array with shift policy Shift policy can be: left, right, no_shift
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">array</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">item</span>
Item to insert
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index to insert. If nil, item will be inserted at the end of array
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">const.SHIFT</span></span>
Shift policy
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">item</span></span>
Inserted item
</ol>
</dd>
<dt>
<a name = "helper.is_mobile"></a>
<strong>helper.is_mobile()</strong>
</dt>
<dd>
Check if device is native mobile (Android or iOS)
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is mobile
</ol>
</dd>
<dt>
<a name = "helper.is_web"></a>
<strong>helper.is_web()</strong>
</dt>
<dd>
Check if device is HTML5
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is web
</ol>
</dd>
<dt>
<a name = "helper.lerp"></a>
<strong>helper.lerp(a, b, t)</strong>
</dt>
<dd>
Lerp between two values
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
First value
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">number</span></span>
Second value
</li>
<li><span class="parameter">t</span>
<span class="types"><span class="type">number</span></span>
Lerp amount
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Lerped value
</ol>
</dd>
<dt>
<a name = "helper.remove_with_shift"></a>
<strong>helper.remove_with_shift(array[, index[, shift_policy]])</strong>
</dt>
<dd>
Remove value from array with shift policy Shift policy can be: left, right, no_shift
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">array</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index to remove. If nil, item will be removed from the end of array
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">const.SHIFT</span></span>
Shift policy
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">item</span></span>
Removed item
</ol>
</dd>
<dt>
<a name = "helper.round"></a>
<strong>helper.round(num[, num_decimal_places=0])</strong>
</dt>
<dd>
Round number to specified decimal places
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">num</span>
<span class="types"><span class="type">number</span></span>
Number
</li>
<li><span class="parameter">num_decimal_places</span>
<span class="types"><span class="type">number</span></span>
Decimal places
(<em>default</em> 0)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Rounded number
</ol>
</dd>
<dt>
<a name = "helper.sign"></a>
<strong>helper.sign(val)</strong>
</dt>
<dd>
Return sign of value (-1, 0, 1)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">val</span>
<span class="types"><span class="type">number</span></span>
Value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Sign
</ol>
</dd>
<dt>
<a name = "helper.step"></a>
<strong>helper.step(current, target, step)</strong>
</dt>
<dd>
Move value from current to target value with step amount
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">current</span>
<span class="types"><span class="type">number</span></span>
Current value
</li>
<li><span class="parameter">target</span>
<span class="types"><span class="type">number</span></span>
Target value
</li>
<li><span class="parameter">step</span>
<span class="types"><span class="type">number</span></span>
Step amount
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
New value
</ol>
</dd>
<dt>
<a name = "helper.table_to_string"></a>
<strong>helper.table_to_string(t)</strong>
</dt>
<dd>
Simple table to one-line string converter
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,315 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><strong>Hotkey</strong></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Hotkey</code></h1>
<p>Druid hotkey component</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_hotkey" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#add_hotkey">add_hotkey(self, keys[, callback_argument])</a></td>
<td class="summary">Add hotkey for component callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, keys, callback[, callback_argument])</a></td>
<td class="summary">Component init function</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="#button">button</a></td>
<td class="summary">Button component from click_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_node">click_node</a></td>
<td class="summary">Button trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Visual node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td>
<td class="summary">On change state callback(self, state)</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "add_hotkey"></a>
<strong>add_hotkey(self, keys[, callback_argument])</strong>
</dt>
<dd>
Add hotkey for component callback
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hotkey</span></span>
<a href="../modules/Hotkey.html#">Hotkey</a>
</li>
<li><span class="parameter">keys</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string[]</a>, <span class="type">hash[]</span>, <a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">hash</span></span>
that have to be pressed before key pressed to activate
</li>
<li><span class="parameter">callback_argument</span>
<span class="types"><span class="type">value</span></span>
The argument to pass into the callback function
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, keys, callback[, callback_argument])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hotkey</span></span>
<a href="../modules/Hotkey.html#">Hotkey</a>
</li>
<li><span class="parameter">keys</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string[]</a> or <a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The keys to be pressed for trigger callback. Should contains one key and any modificator keys
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
The callback function
</li>
<li><span class="parameter">callback_argument</span>
<span class="types"><span class="type">value</span></span>
The argument to pass into the callback function
(<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">MODIFICATORS</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string[]</a></span>
The list of action_id as hotkey modificators
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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>
<a href="../modules/Button.html#">Button</a>
</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/Hotkey.html#node">node</a></span>
(<em>default</em> node)
</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/Hotkey.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_state"></a>
<strong>on_change_state</strong>
</dt>
<dd>
On change state callback(self, state)
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,404 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><strong>Hover</strong></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</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="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return current hover enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_hovered">is_hovered(self)</a></td>
<td class="summary">Return current hover state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_mouse_hovered">is_mouse_hovered(self)</a></td>
<td class="summary">Return current 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="#set_hover">set_hover(self, state)</a></td>
<td class="summary">Set hover state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_mouse_hover">set_mouse_hover(self, state)</a></td>
<td class="summary">Set mouse hover state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<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, hover_instance)</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, hover_instance)</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>
<a href="../modules/Hover.html#">Hover</a>
</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 = "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>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The hover enabled state
</ol>
</dd>
<dt>
<a name = "is_hovered"></a>
<strong>is_hovered(self)</strong>
</dt>
<dd>
Return current hover state. True if touch action was on the node at current time
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The current hovered state
</ol>
</dd>
<dt>
<a name = "is_mouse_hovered"></a>
<strong>is_mouse_hovered(self)</strong>
</dt>
<dd>
Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The current hovered state
</ol>
</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>
<a href="../modules/Hover.html#">Hover</a>
</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>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover enabled state
</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>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover state
</li>
</ul>
</dd>
<dt>
<a name = "set_mouse_hover"></a>
<strong>set_mouse_hover(self, state)</strong>
</dt>
<dd>
Set mouse hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The mouse hover state
</li>
</ul>
</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, hover_instance)
<ul>
<li><span class="parameter">on_hover</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_mouse_hover"></a>
<strong>on_mouse_hover</strong>
</dt>
<dd>
On mouse hover callback(self, state, hover_instance)
<ul>
<li><span class="parameter">on_mouse_hover</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,744 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><strong>Input</strong></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Input</code></h1>
<p>Druid input text component.</p>
<p>
Carry on user text input
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_input" target="_blank"><b>Example Link</b></a></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="#get_text">get_text(self)</a></td>
<td class="summary">Return current input field text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, click_node, text_node[, keyboard_type])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_changes">reset_changes(self)</a></td>
<td class="summary">Reset current input selection and return previous value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#select">select(self)</a></td>
<td class="summary">Select input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_allowed_characters">set_allowed_characters(self, characters)</a></td>
<td class="summary">Set allowed charaters for input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_length">set_max_length(self, max_length)</a></td>
<td class="summary">Set maximum length for input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_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="#unselect">unselect(self)</a></td>
<td class="summary">Remove selection from input.</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="#allowerd_characters">allowerd_characters</a></td>
<td class="summary">Pattern matching for user input</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_empty">is_empty</a></td>
<td class="summary">Is current input is empty now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_selected">is_selected</a></td>
<td class="summary">Is current input selected now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#keyboard_type">keyboard_type</a></td>
<td class="summary">Gui keyboard type for input field</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_length">max_length</a></td>
<td class="summary">Max length for input text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_empty">on_input_empty</a></td>
<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_select">on_input_select</a></td>
<td class="summary">On input field select callback(self, button_node)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td>
<td class="summary">On input field unselect callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_wrong">on_input_wrong</a></td>
<td class="summary">On trying user input with not allowed character callback(self, params, button_instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#text">text</a></td>
<td class="summary">Text component</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<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>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The current input field text
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, click_node, text_node[, keyboard_type])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">click_node</span>
<span class="types"><span class="type">node</span></span>
Node to enabled input component
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">node</span> or <span class="type">Text</span></span>
Text node what will be changed on user input. You can pass text component instead of text node name <a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></span>
Gui keyboard type for input field
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "reset_changes"></a>
<strong>reset_changes(self)</strong>
</dt>
<dd>
Reset current input selection and return previous value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</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>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "set_allowed_characters"></a>
<strong>set_allowed_characters(self, characters)</strong>
</dt>
<dd>
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Regulax exp. for validate user input
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_max_length"></a>
<strong>set_max_length(self, max_length)</strong>
</dt>
<dd>
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
Maximum length for input text field
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_text"></a>
<strong>set_text(self, input_text)</strong>
</dt>
<dd>
Set text for input field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">input_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The string to apply for input field
</li>
</ul>
</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>
<a href="../modules/Input.html#">Input</a>
</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.1/manual.html#5.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">NO_CONSUME_INPUT_WHILE_SELECTED</span>
<span class="types"><span class="type">bool</span></span>
If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured)
(<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.1/manual.html#5.5">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 = "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.1/manual.html#5.4">string</a></span>
(<em>optional</em>)
</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">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
</dd>
<dt>
<a name = "is_empty"></a>
<strong>is_empty</strong>
</dt>
<dd>
Is current input is empty now
<ul>
<li><span class="parameter">is_empty</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</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 = "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>
<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 = "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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_select"></a>
<strong>on_input_select</strong>
</dt>
<dd>
On input field select callback(self, button_node)
<ul>
<li><span class="parameter">on_input_select</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_text"></a>
<strong>on_input_text</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">on_input_text</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_unselect"></a>
<strong>on_input_unselect</strong>
</dt>
<dd>
On input field unselect callback(self, input_text)
<ul>
<li><span class="parameter">on_input_unselect</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_wrong"></a>
<strong>on_input_wrong</strong>
</dt>
<dd>
On trying user input with not allowed character callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
Text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,375 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>LangText</code></h1>
<p>Component to wrap over GUI Text nodes with localization helpers
<p> <b># Overview #</b>
<p> • The initialization of druid.set_text_function is required to enable localization
using the localization ID.</p>
<p>
<p> • The LangText component supports up to 7 string format parameters.
This limitation exists due to certain issues with using ... arguments.
<p> <b># Notes #</b>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=texts_lang_text" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#format">format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</a></td>
<td class="summary">Format string with new text params on localized text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id[, adjust_type=downscale])</a></td>
<td class="summary">The <a href="../modules/LangText.html#">LangText</a> constructor</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[, b[, c[, d[, e[, f[, g]]]]]]])</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 = "format"></a>
<strong>format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</strong>
</dt>
<dd>
Format string with new text params on localized text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, locale_id[, adjust_type=downscale])</strong>
</dt>
<dd>
The <a href="../modules/LangText.html#">LangText</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
Node name or GUI Text Node itself
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Default locale id or text from node as default
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
(<em>default</em> downscale)
</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>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Text for text node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "translate"></a>
<strong>translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])</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>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale id
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</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>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,498 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><strong>Layout</strong></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Layout</code></h1>
<p>Layout management on node</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_layout" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#fit_into_node">fit_into_node(self[, node])</a></td>
<td class="summary">Set node for layout node to fit inside it.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#fit_into_size">fit_into_size(self, target_size)</a></td>
<td class="summary">Set size for layout node to fit inside it</td>
</tr>
<tr>
<td class="name" nowrap><a href="#fit_into_window">fit_into_window(self)</a></td>
<td class="summary">Set current size for layout node to fit inside it</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, mode[, on_size_changed_callback])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_gui_upscale">set_max_gui_upscale(self, max_gui_upscale)</a></td>
<td class="summary">Set max gui upscale for FIT adjust mode (or side).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_size">set_max_size(self, max_size)</a></td>
<td class="summary">Set maximum size of layout node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_min_size">set_min_size(self, min_size)</a></td>
<td class="summary">Set minimal size of layout node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_origin_position">set_origin_position(self, new_origin_position)</a></td>
<td class="summary">Set new origin position of layout node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_origin_size">set_origin_size(self, new_origin_size)</a></td>
<td class="summary">Set new origin size of layout node.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#mode">mode</a></td>
<td class="summary">Current layout mode</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Layout node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_size_changed">on_size_changed</a></td>
<td class="summary">On window resize callback(self, new_size)</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "fit_into_node"></a>
<strong>fit_into_node(self[, node])</strong>
</dt>
<dd>
Set node for layout node to fit inside it. Pass nil to reset
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">Node</span></span>
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "fit_into_size"></a>
<strong>fit_into_size(self, target_size)</strong>
</dt>
<dd>
Set size for layout node to fit inside it
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">target_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "fit_into_window"></a>
<strong>fit_into_window(self)</strong>
</dt>
<dd>
Set current size for layout node to fit inside it
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, mode[, on_size_changed_callback])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Layout.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">mode</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The layout mode (from const.LAYOUT_MODE)
</li>
<li><span class="parameter">on_size_changed_callback</span>
<span class="types"><span class="type">function</span></span>
The callback on window resize
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_max_gui_upscale"></a>
<strong>set_max_gui_upscale(self, max_gui_upscale)</strong>
</dt>
<dd>
Set max gui upscale for FIT adjust mode (or side). It happens on bigger render gui screen
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">max_gui_upscale</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "set_max_size"></a>
<strong>set_max_size(self, max_size)</strong>
</dt>
<dd>
Set maximum size of layout node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "set_min_size"></a>
<strong>set_min_size(self, min_size)</strong>
</dt>
<dd>
Set minimal size of layout node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">min_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "set_origin_position"></a>
<strong>set_origin_position(self, new_origin_position)</strong>
</dt>
<dd>
Set new origin position of layout node. You should apply this on node movement
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">new_origin_position</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "set_origin_size"></a>
<strong>set_origin_size(self, new_origin_size)</strong>
</dt>
<dd>
Set new origin size of layout node. You should apply this on node manual size change
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">new_origin_size</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "mode"></a>
<strong>mode</strong>
</dt>
<dd>
Current layout mode
<ul>
<li><span class="parameter">mode</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Layout node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Layout.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_size_changed"></a>
<strong>on_size_changed</strong>
</dt>
<dd>
On window resize callback(self, new_size)
<ul>
<li><span class="parameter">on_size_changed</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

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

View File

@@ -1,577 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><strong>Progress</strong></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Progress</code></h1>
<p>Druid component to handle the progress bars.</p>
<p>
<b># Overview #</b>
<p> <b># Notes #</b>
<p> • Progress Node should be fully filled in your GUI scene node. It will be the progress maximum size
<p> • Progress correct working with Slice9 nodes, it trying to set size by _set_size_ first, if it is not possible, it set up sizing via _set_scale_
<p> • Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
<p> • If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles
<p>
<a href="https://insality.github.io/druid/druid/index.html?example=general_progress_bar" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<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="#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="#get">get(self)</a></td>
<td class="summary">Return current progress bar value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td>
<td class="summary"><a href="../modules/Progress.html#">Progress</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_size">set_max_size(self, max_size)</a></td>
<td class="summary">Set progress bar max node size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps, callback)</a></td>
<td class="summary">Set points on progress bar to fire the callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, to)</a></td>
<td class="summary">Instant fill progress bar to value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to">to(self, to[, callback])</a></td>
<td class="summary">Start animation of a progress bar</td>
</tr>
</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="#key">key</a></td>
<td class="summary">The progress bar direction.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
<td class="summary">Maximum size of progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Progress bar fill node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">On progress bar change callback(self, new_value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scale">scale</a></td>
<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="#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 = "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>
<a href="../modules/Progress.html#">Progress</a>
</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>
<a href="../modules/Progress.html#">Progress</a>
</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>
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, key[, init_value=1])</strong>
</dt>
<dd>
<a href="../modules/Progress.html#">Progress</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span>
Node name or GUI Node itself.
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Progress bar direction: const.SIDE.X or const.SIDE.Y
</li>
<li><span class="parameter">init_value</span>
<span class="types"><span class="type">number</span></span>
Initial value of progress bar
(<em>default</em> 1)
</li>
</ul>
</dd>
<dt>
<a name = "set_max_size"></a>
<strong>set_max_size(self, max_size)</strong>
</dt>
<dd>
Set progress bar max node size
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">vector3</span></span>
The new node maximum (full) size
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</ol>
</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>
<a href="../modules/Progress.html#">Progress</a>
</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 = "set_to"></a>
<strong>set_to(self, to)</strong>
</dt>
<dd>
Instant fill progress bar to value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
</li>
</ul>
</dd>
<dt>
<a name = "to"></a>
<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>
<a href="../modules/Progress.html#">Progress</a>
</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 = "key"></a>
<strong>key</strong>
</dt>
<dd>
The progress bar direction.
<p> The values are: "x" or "y". (const.SIDE.X or const.SIDE.Y)
<ul>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "max_size"></a>
<strong>max_size</strong>
</dt>
<dd>
Maximum size of progress bar
<ul>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</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 = "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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</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 = "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 TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,261 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RadioGroup</code></h1>
<p>Radio group module</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return radio group state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_state">set_state(self, index, is_instant)</a></td>
<td class="summary">Set radio group state</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_radio_click">on_radio_click</a></td>
<td class="summary">On any checkbox click</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
<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, is_instant)</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>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index in radio group
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If is instant state change
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<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>
<dt>
<a name = "on_radio_click"></a>
<strong>on_radio_click</strong>
</dt>
<dd>
On any checkbox click
<ul>
<li><span class="parameter">on_radio_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

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

View File

@@ -1,430 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><strong>RichText</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RichText</code></h1>
<p>Druid Rich Text Custom Component.</p>
<p>
<b># Overview #</b>
<p> This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
It uses a similar syntax for tags but currently supports fewer tags.
<p> All parameters for the Rich Text component are adjusted in the GUI scene.
<p> This component uses GUI component template. (/druid/custom/rich_text/rich_text.gui).
<p> You able to customize it or make your own with the next node scructure:
<p> root
<p> - text_prefab
<p> - icon_prefab
<p> <b># Rich Text Setup #</b>
<p> • Root node size: Set the maximum width and height of the text.
<p> • Root anchor: Define the alignment of the Rich Text inside the root node size area.
<p> • Text prefab: Configure all default text parameters for the text node.
<p> • Text prefab anchor: Set the anchor for each text node (adjust this only if animating text).
<p> • Icon prefab: Configure all default node parameters for the icon node.
<p> • Icon prefab anchor: Set the anchor for each icon node (adjust this only if animating the icon).
<p> <b># Notes #</b>
<p> • Nested tags are supported
<p> <a href="https://insality.github.io/druid/druid/index.html?example=custom_rich_text" target="_blank"><b>Example Link</b></a></p>
<h3>Usage:</h3>
<ul>
<li><pre class="example">local RichText = require(&quot;druid.custom.rich_text.rich_text&quot;)
...
self.rich_text = self.druid:new(RichText, &quot;rich_text&quot;)
self.rich_text:set_text(&quot;Hello, Druid Rich Text!&quot;)
</pre></li>
<li><pre class="example">type druid.rich_text.word = {
node: Node,
relative_scale: number,
color: vector4,
position: vector3,
offset: vector3,
scale: vector3,
size: vector3,
metrics: druid.rich_text.metrics,
pivot: Pivot,
text: string,
shadow: vector4,
outline: vector4,
font: string,
image: druid.rich_text.image,
default_animation: string,
br: boolean,
nobr: boolean,
}
type druid.rich_text.word.image = {
texture: string,
anim: string,
width: number,
height: number,
}
type druid.rich_text.lines_metrics = {
text_width: number,
text_height: number,
lines: table&lt;number, druid.rich_text.metrics&gt;,
}
type druid.rich_text.metrics = {
width: number,
height: number,
offset_x: number|nil,
offset_y: number|nil,
node_size: vector3|nil @For images only,
}
</pre></li>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear()</a></td>
<td class="summary">Clear all created words.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_line_metric">get_line_metric()</a></td>
<td class="summary">Get current line metrics</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_words">get_words()</a></td>
<td class="summary">Get all current words.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, template, nodes)</a></td>
<td class="summary">Rich Text component constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text">set_text(self, text)</a></td>
<td class="summary">Set text for Rich Text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#tagged">tagged(tag)</a></td>
<td class="summary">Get all words, which has a passed tag.</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>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear()</strong>
</dt>
<dd>
Clear all created words.
</dd>
<dt>
<a name = "get_line_metric"></a>
<strong>get_line_metric()</strong>
</dt>
<dd>
Get current line metrics
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.rich_text.lines_metrics</span></span>
</ol>
</dd>
<dt>
<a name = "get_words"></a>
<strong>get_words()</strong>
</dt>
<dd>
Get all current words.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
druid.rich_text.word[]
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, template, nodes)</strong>
</dt>
<dd>
Rich Text component constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichText</span></span>
<a href="../modules/RichText.html#">RichText</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The Rich Text template name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The node table, if prefab was copied by gui.clone_tree()
</li>
</ul>
</dd>
<dt>
<a name = "set_text"></a>
<strong>set_text(self, text)</strong>
</dt>
<dd>
Set text for Rich Text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichText</span></span>
<a href="../modules/RichText.html#">RichText</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The text to set
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">druid.rich_text.word[]</span></span>
words</li>
<li>
<span class="types"><span class="type">druid.rich_text.lines_metrics</span></span>
line_metrics</li>
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">• color: Change text color
&lt;color=red&gt;Foobar&lt;/color&gt;
&lt;color=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/color&gt;
&lt;color=#ff0000&gt;Foobar&lt;/color&gt;
&lt;color=#ff0000ff&gt;Foobar&lt;/color&gt;
• shadow: Change text shadow
&lt;shadow=red&gt;Foobar&lt;/shadow&gt;
&lt;shadow=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/shadow&gt;
&lt;shadow=#ff0000&gt;Foobar&lt;/shadow&gt;
&lt;shadow=#ff0000ff&gt;Foobar&lt;/shadow&gt;
• outline: Change text shadow
&lt;outline=red&gt;Foobar&lt;/outline&gt;
&lt;outline=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/outline&gt;
&lt;outline=#ff0000&gt;Foobar&lt;/outline&gt;
&lt;outline=#ff0000ff&gt;Foobar&lt;/outline&gt;
• font: Change font
&lt;font=MyCoolFont&gt;Foobar&lt;/font&gt;
• size: Change text size, relative to default size
&lt;size=<span class="number">2</span>&gt;Twice as large&lt;/size&gt;
• br: Insert a line <span class="keyword">break</span>
&lt;br/&gt;
• nobr: Prevent the text from breaking
Words &lt;nobr&gt;inside tag&lt;/nobr&gt; won't <span class="keyword">break</span>
• img: Display image
&lt;img=texture:image/&gt;
&lt;img=texture:image,size/&gt;
&lt;img=texture:image,width,height/&gt;</pre>
</ul>
</dd>
<dt>
<a name = "tagged"></a>
<strong>tagged(tag)</strong>
</dt>
<dd>
Get all words, which has a passed tag.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">tag</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.rich_text.word[]</span></span>
words
</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">COLORS</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Rich Text color aliases
(<em>default</em> {})
</li>
<li><span class="parameter">ADJUST_STEPS</span>
<span class="types"><span class="type">number</span></span>
Amount steps of attemps text adjust by height
(<em>default</em> 20)
</li>
<li><span class="parameter">ADJUST_SCALE_DELTA</span>
<span class="types"><span class="type">number</span></span>
Scale step on each height adjust step
(<em>default</em> 0.02)
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,477 +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 Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><strong>Slider</strong></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Slider</code></h1>
<p>Druid slider component</p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_sliders" target="_blank"><b>Example Link</b></a></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_input_node">set_input_node(self, input_node)</a></td>
<td class="summary">Set input zone for slider.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps)</a></td>
<td class="summary">Set slider steps.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<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="#end_pos">end_pos</a></td>
<td class="summary">End pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Current drag state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Slider pin node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_value">on_change_value</a></td>
<td class="summary">On change value callback(self, value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Start pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target_pos">target_pos</a></td>
<td class="summary">Targer pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#value">value</a></td>
<td class="summary">Current slider value</td>
</tr>
</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>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
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>
<a href="../modules/Slider.html#">Slider</a>
</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_input_node"></a>
<strong>set_input_node(self, input_node)</strong>
</dt>
<dd>
Set input zone for slider.
User can touch any place of node, pin instantly will
move at this position and node drag will start.
This function require the Defold version 1.3.0+
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">input_node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
</dd>
<dt>
<a name = "set_steps"></a>
<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>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span>
Array of steps
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
<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 = "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 = "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 = "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 = "node"></a>
<strong>node</strong>
</dt>
<dd>
Slider pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_value"></a>
<strong>on_change_value</strong>
</dt>
<dd>
On change value callback(self, value)
<ul>
<li><span class="parameter">on_change_value</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current pin node position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Start pin node position
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target_pos"></a>
<strong>target_pos</strong>
</dt>
<dd>
Targer pin node position
<ul>
<li><span class="parameter">target_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "value"></a>
<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 TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,971 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>StaticGrid</code></h1>
<p>Component to handle component's position by row and columns.</p>
<p>
<b># Overview #</b>
<p> The Static Grid component allows for positioning components in rows and columns.
It provides a static grid layout with constant node sizes, allowing for pre-calculated
node positions and the option to include gaps between nodes.
<p> <b># Notes #</b>
<p> • In a static grid, the node size remains constant, enabling the calculation of node
positions before placement. If you want add gaps between nodes, increase the root prefab size,
including the padding and margin.
<p> • The static grid can automatically shift elements when nodes are added or removed.
<p> • When a node is added, the grid will set the node's parent to the specified parent_node.
<p> • You can obtain an array of positions for each element, which can be used to set
points of interest in a scroll component.
<p> • The size of all elements can be retrieved for setting up the size in a scroll component.
<p> • The grid can be bound to a scroll component for automatic resizing of the scroll content size.
<p> • The pivot of the parent_node affects the node placement within the grid.
<p> • A prefab node is used to determine the node size and anchor.
<p> • You can specify a position_function for animations using the
_static_grid:set_position_function(node, pos) callback. The default position function is gui.set_position().
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_grid" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#add">add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</a></td>
<td class="summary">Add new item to the grid</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_all_pos">get_all_pos(self)</a></td>
<td class="summary">Return array of all node positions</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td>
<td class="summary">Return grid content borders</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="#get_offset">get_offset(self)</a></td>
<td class="summary">Return StaticGrid offset, where StaticGrid content starts.</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_size">get_size(self)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent, element[, in_row=1])</a></td>
<td class="summary">The <a href="../modules/StaticGrid.html#">StaticGrid</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_anchor">set_anchor(self, anchor)</a></td>
<td class="summary">Set grid anchor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_in_row">set_in_row(self, in_row)</a></td>
<td class="summary">Set new in_row elements for grid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_position_function">set_position_function(self, callback)</a></td>
<td class="summary">Change set position function for grid nodes.</td>
</tr>
</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="#anchor">anchor</a></td>
<td class="summary">Item anchor [0..1]</td>
</tr>
<tr>
<td class="name" nowrap><a href="#border">border</a></td>
<td class="summary">The size of item content</td>
</tr>
<tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td>
<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="#nodes">nodes</a></td>
<td class="summary">List of all grid nodes</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td>
<td class="summary">On item add callback(self, node, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add, remove or change in_row callback(self, index|nil)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pivot">pivot</a></td>
<td class="summary">Item pivot [-0.5..0.5]</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "add"></a>
<strong>add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</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>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
</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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</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_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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index"></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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node in the grid
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd>
<dt>
<a name = "get_offset"></a>
<strong>get_offset(self)</strong>
</dt>
<dd>
Return 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>
<a href="../modules/StaticGrid.html#">StaticGrid</a> The StaticGrid instance
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The StaticGrid offset
</ol>
</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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</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_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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content size
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, parent, element[, in_row=1])</strong>
</dt>
<dd>
The <a href="../modules/StaticGrid.html#">StaticGrid</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">parent</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
The GUI Node container, where grid's 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 = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
</dt>
<dd>
Remove the item from the grid. Note that gui node will be not deleted
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid node index to remove
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Node</span></span>
The deleted gui node from grid
</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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">anchor</span>
<span class="types"><span class="type">vector3</span></span>
Anchor
</li>
</ul>
</dd>
<dt>
<a name = "set_in_row"></a>
<strong>set_in_row(self, in_row)</strong>
</dt>
<dd>
Set new in_row elements for grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">StaticGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">in_row</span>
<span class="types"><span class="type">number</span></span>
The new in_row value
</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 = "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>
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</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>
</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_DYNAMIC_NODE_POSES</span>
<span class="types"><span class="type">bool</span></span>
If true, always center grid content as grid pivot sets
(<em>default</em> false)
</li>
<li><span class="parameter">IS_ALIGN_LAST_ROW</span>
<span class="types"><span class="type">bool</span></span>
If true, always align last row of the grid as grid pivot sets
(<em>default</em> false)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "anchor"></a>
<strong>anchor</strong>
</dt>
<dd>
Item anchor [0..1]
<ul>
<li><span class="parameter">anchor</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>
<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 = "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 = "on_add_item"></a>
<strong>on_add_item</strong>
</dt>
<dd>
On item add callback(self, node, index)
<ul>
<li><span class="parameter">on_add_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add, remove or change in_row callback(self, index|nil)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "pivot"></a>
<strong>pivot</strong>
</dt>
<dd>
Item pivot [-0.5..0.5]
<ul>
<li><span class="parameter">pivot</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 TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,296 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</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> <a href="https://insality.github.io/druid/druid/index.html?example=general_swipe" target="_blank"><b>Example Link</b></a></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="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Swipe node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_swipe">on_swipe</a></td>
<td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time)</td>
</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>
<a href="../modules/Swipe.html#">Swipe</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
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>
<a href="../modules/Swipe.html#">Swipe</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
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 = "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 = "node"></a>
<strong>node</strong>
</dt>
<dd>
Swipe node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_swipe"></a>
<strong>on_swipe</strong>
</dt>
<dd>
Trigger on swipe event(self, swipe_side, dist, delta_time)
<ul>
<li><span class="parameter">on_swipe</span>
<span class="types"><span class="type">DruidEvent</span></span>
) <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -1,851 +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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><strong>Text</strong></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Text</code></h1>
<p>Component for Wrapping GUI Text Nodes: Druid Text
<p> ## Overview ##
<p> Druid Text is a component that provides various adjustment modes for text nodes.</p>
<p> It allows text to be scaled down to fit within the size of the text node.
<p> ## Notes ##
<p> • The text pivot can be changed using the text:set_pivot method.
The anchoring will be inside the text node's area size.
<p> • There are several text adjustment types available. The default is DOWNSCALE.
You can change the default adjustment type in the Text style. Refer to the example below to see all available adjustment types:
<p> - const.TEXT_ADJUST.DOWNSCALE: Changes the text's scale to fit within the text node's size.
<p> - const.TEXT_ADJUST.TRIM: Trims the text with a postfix (default: "...", can be overridden in styles)
to fit within the text node's size.
<p> - const.TEXT_ADJUST.NO_ADJUST: No adjustment is applied, similar
to the default Defold Text Node behavior.
<p> - const.TEXT_ADJUST.DOWNSCALE_LIMITED: Changes the text's scale
with a limited downscale. You can set the minimum scale using the text:set_minimal_scale() function.
<p> - const.TEXT_ADJUST.SCROLL: Changes the text's pivot to imitate scrolling within the text box.
For better effect, use with a stencil node.
<p> - const.TEXT_ADJUST.SCALE_THEN_SCROLL: Combines two modes: limited downscale first, then scroll.
<p> <a href="https://insality.github.io/druid/druid/index.html?example=texts_general" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_text_adjust">get_text_adjust(self, adjust_type)</a></td>
<td class="summary">Return current text adjust type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_text_size">get_text_size(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="#init">init(self, node[, value[, adjust_type=downscale]])</a></td>
<td class="summary"><a href="../modules/Text.html#">Text</a> constructor</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>
<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_color">set_color(self, color)</a></td>
<td class="summary">Set color</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_minimal_scale">set_minimal_scale(self, minimal_scale)</a></td>
<td class="summary">Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types</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="#set_scale">set_scale(self, scale)</a></td>
<td class="summary">Set scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_adjust">set_text_adjust(self[, adjust_type[, minimal_scale]])</a></td>
<td class="summary">Set text adjust, refresh the current text visuals, if needed</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>
</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="#adjust_type">adjust_type</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>
<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="#node_id">node_id</a></td>
<td class="summary">The node id of text node</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="#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, text_metrics)</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="#scale">scale</a></td>
<td class="summary">Current text node scale</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="#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>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "get_text_adjust"></a>
<strong>get_text_adjust(self, adjust_type)</strong>
</dt>
<dd>
Return current text adjust type
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">adjust_type</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The current text adjust type
</ol>
</dd>
<dt>
<a name = "get_text_size"></a>
<strong>get_text_size(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>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
Width</li>
<li>
<span class="types"><span class="type">number</span></span>
Height</li>
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node[, value[, adjust_type=downscale]])</strong>
</dt>
<dd>
<a href="../modules/Text.html#">Text</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Text.html#node">node</a></span>
Node name or GUI Text Node itself
</li>
<li><span class="parameter">value</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Initial text. Default value is node text from GUI scene.
(<em>optional</em>)
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
(<em>default</em> downscale)
</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>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is text node with line break
</ol>
</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>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">alpha</span>
<span class="types"><span class="type">number</span></span>
Alpha for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</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>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">color</span>
<span class="types"><span class="type">vector4</span></span>
Color for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_minimal_scale"></a>
<strong>set_minimal_scale(self, minimal_scale)</strong>
</dt>
<dd>
Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">minimal_scale</span>
<span class="types"><span class="type">number</span></span>
If pass nil - not use minimal scale
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_pivot"></a>
<strong>set_pivot(self, pivot)</strong>
</dt>
<dd>
Set text pivot. Text will re-anchor inside text area
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
Gui pivot constant
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</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>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
Scale for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_text_adjust"></a>
<strong>set_text_adjust(self[, adjust_type[, minimal_scale]])</strong>
</dt>
<dd>
Set text adjust, refresh the current text visuals, if needed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">number</span></span>
See const.TEXT_ADJUST. If pass nil - use current adjust type
(<em>optional</em>)
</li>
<li><span class="parameter">minimal_scale</span>
<span class="types"><span class="type">number</span></span>
If pass nil - not use minimal scale
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</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>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">set_to</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Text for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</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">TRIM_POSTFIX</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The postfix for TRIM adjust type
(<em>default</em> ...)
</li>
<li><span class="parameter">DEFAULT_ADJUST</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The default adjust type for any text component
(<em>default</em> DOWNSCALE)
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "adjust_type"></a>
<strong>adjust_type</strong>
</dt>
<dd>
Current text size adjust settings
<ul>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">number</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>
<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 = "node_id"></a>
<strong>node_id</strong>
</dt>
<dd>
The node id of text node
<ul>
<li><span class="parameter">node_id</span>
<span class="types"><span class="type">hash</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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<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">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</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, text_metrics)
<ul>
<li><span class="parameter">on_update_text_scale</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current text position
<ul>
<li><span class="parameter">pos</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_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 = "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>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

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