diff --git a/api/components/base/back_handler_api.md b/api/components/base/back_handler_api.md
index a5e209e..f55d129 100644
--- a/api/components/base/back_handler_api.md
+++ b/api/components/base/back_handler_api.md
@@ -1,6 +1,36 @@
-# Back Handler Quick API reference
+# druid.back_handler API
+> at /druid/base/back_handler.lua
+
+The component that handles the back handler action, like backspace or android back button
+
+
+## Functions
+- [init](#init)
+
+
+## Fields
+- [on_back](#on_back)
+- [params](#params)
+
+
+
+### init
+
+---
```lua
back_handler:init([callback], [params])
-back_handler:on_input([action_id], [action])
```
+
+- **Parameters:**
+ - `[callback]` *(function|nil)*: The callback to call when the back handler is triggered
+ - `[params]` *(any)*: Custom args to pass in the callback
+
+
+## Fields
+
+- **on_back** (_event_): Trigger on back handler action, fun(self, params)
+
+
+- **params** (_any_): Custom args to pass in the callback
+
diff --git a/api/components/base/blocker_api.md b/api/components/base/blocker_api.md
index 5e7d391..e7390f1 100644
--- a/api/components/base/blocker_api.md
+++ b/api/components/base/blocker_api.md
@@ -5,7 +5,6 @@
## Functions
- [init](#init)
-- [on_input](#on_input)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
@@ -23,21 +22,7 @@ blocker:init(node)
```
- **Parameters:**
- - `node` *(node)*:
-
-### on_input
-
----
-```lua
-blocker:on_input(action_id, action)
-```
-
-- **Parameters:**
- - `action_id` *(string)*:
- - `action` *(table)*:
-
-- **Returns:**
- - `` *(boolean)*:
+ - `node` *(string|node)*: The node to use as a blocker
### set_enabled
@@ -49,10 +34,10 @@ blocker:set_enabled(state)
Set blocker enabled state
- **Parameters:**
- - `state` *(boolean)*:
+ - `state` *(boolean)*: The new enabled state
- **Returns:**
- - `self` *(druid.blocker)*:
+ - `self` *(druid.blocker)*: The blocker instance
### is_enabled
@@ -64,7 +49,7 @@ blocker:is_enabled()
Get blocker enabled state
- **Returns:**
- - `` *(boolean)*:
+ - `is_enabled` *(boolean)*: True if the blocker is enabled
## Fields
diff --git a/api/components/base/button_api.md b/api/components/base/button_api.md
index 55fb9f3..c80a6ee 100644
--- a/api/components/base/button_api.md
+++ b/api/components/base/button_api.md
@@ -7,10 +7,7 @@ Druid component to make clickable node with various interaction callbacks
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
-- [on_late_init](#on_late_init)
-- [on_input](#on_input)
-- [on_input_interrupt](#on_input_interrupt)
+- [set_animations_disabled](#set_animations_disabled)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
- [set_click_zone](#set_click_zone)
@@ -55,50 +52,25 @@ Druid component to make clickable node with various interaction callbacks
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
- `[anim_node]` *(string|node|nil)*: Node to animate instead of trigger node
-### on_style_change
+### set_animations_disabled
---
```lua
-button:on_style_change(style)
+button:set_animations_disabled()
```
-- **Parameters:**
- - `style` *(druid.button.style)*: Button style params.
-You can override this component styles params in Druid styles table or create your own style
-
-### on_late_init
-
----
-```lua
-button:on_late_init()
-```
-
-### on_input
-
----
-```lua
-button:on_input(action_id, action)
-```
-
-- **Parameters:**
- - `action_id` *(hash)*:
- - `action` *(table)*:
+Remove default button style animations
- **Returns:**
- - `` *(boolean)*:
-
-### on_input_interrupt
-
----
-```lua
-button:on_input_interrupt()
-```
+ - `self` *(druid.button)*: The current button instance
### set_enabled
@@ -115,7 +87,7 @@ Disabled button is not clickable.
- `[state]` *(boolean|nil)*: Enabled state
- **Returns:**
- - `self` *(druid.button)*:
+ - `self` *(druid.button)*: The current button instance
### is_enabled
@@ -145,7 +117,7 @@ If button node placed inside stencil node, it will be automatically set to this
- `[zone]` *(string|node|nil)*: Gui node
- **Returns:**
- - `self` *(druid.button)*:
+ - `self` *(druid.button)*: The current button instance
### set_key_trigger
@@ -160,7 +132,7 @@ Set key name to trigger this button by keyboard.
- `key` *(string|hash)*: The action_id of the input key. Example: "key_space"
- **Returns:**
- - `self` *(druid.button)*:
+ - `self` *(druid.button)*: The current button instance
### get_key_trigger
@@ -188,7 +160,7 @@ Set function for additional check for button click availability
- `[failure_callback]` *(function|nil)*: Function will be called on button click, if check function return false
- **Returns:**
- - `self` *(druid.button)*:
+ - `self` *(druid.button)*: The current button instance
### set_web_user_interaction
@@ -206,7 +178,7 @@ If the game is not HTML, html mode will be not enabled
- `[is_web_mode]` *(boolean|nil)*: If true - button will be called inside html5 callback
- **Returns:**
- - `self` *(druid.button)*:
+ - `self` *(druid.button)*: The current button instance
## Fields
@@ -265,7 +237,7 @@ If the game is not HTML, html mode will be not enabled
- **style** (_table_): Style for this button
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
- **is_repeated_started** (_boolean_)
diff --git a/api/components/base/drag_api.md b/api/components/base/drag_api.md
index a26a635..34640c6 100644
--- a/api/components/base/drag_api.md
+++ b/api/components/base/drag_api.md
@@ -2,15 +2,12 @@
> at /druid/base/drag.lua
+A component that allows you to subscribe to drag events over a node
+
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
- [set_drag_cursors](#set_drag_cursors)
-- [on_late_init](#on_late_init)
-- [on_window_resized](#on_window_resized)
-- [on_input_interrupt](#on_input_interrupt)
-- [on_input](#on_input)
- [set_click_zone](#set_click_zone)
- [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
@@ -46,22 +43,14 @@
---
```lua
-drag:init(node_or_node_id, on_drag_callback)
+drag:init(node_or_node_id, [on_drag_callback])
```
-- **Parameters:**
- - `node_or_node_id` *(string|node)*:
- - `on_drag_callback` *(function)*:
-
-### on_style_change
-
----
-```lua
-drag:on_style_change(style)
-```
+The constructor for Drag component
- **Parameters:**
- - `style` *(druid.drag.style)*:
+ - `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
@@ -73,42 +62,7 @@ drag:set_drag_cursors(is_enabled)
Set Drag component enabled state.
- **Parameters:**
- - `is_enabled` *(boolean)*:
-
-### on_late_init
-
----
-```lua
-drag:on_late_init()
-```
-
-### on_window_resized
-
----
-```lua
-drag:on_window_resized()
-```
-
-### on_input_interrupt
-
----
-```lua
-drag:on_input_interrupt()
-```
-
-### on_input
-
----
-```lua
-drag:on_input(action_id, action)
-```
-
-- **Parameters:**
- - `action_id` *(hash)*:
- - `action` *(table)*:
-
-- **Returns:**
- - `` *(boolean)*:
+ - `is_enabled` *(boolean)*: True if Drag component is enabled
### set_click_zone
@@ -120,7 +74,7 @@ drag:set_click_zone([node])
Set Drag click zone
- **Parameters:**
- - `[node]` *(string|node|nil)*:
+ - `[node]` *(string|node|nil)*: Node or node id
- **Returns:**
- `self` *(druid.drag)*: Current instance
@@ -150,73 +104,73 @@ drag:is_enabled()
Check if Drag component is capture input
- **Returns:**
- - `` *(boolean)*:
+ - `is_enabled` *(boolean)*: True if Drag component is enabled
## Fields
-- **node** (_node_)
+- **node** (_node_): The node to subscribe to drag events over
-- **on_touch_start** (_event_)
+- **on_touch_start** (_event_): fun(self, touch) The event triggered when a touch starts
-- **on_touch_end** (_event_)
+- **on_touch_end** (_event_): fun(self, touch) The event triggered when a touch ends
-- **on_drag_start** (_event_)
+- **on_drag_start** (_event_): fun(self, touch) The event triggered when a drag starts
-- **on_drag** (_event_)
+- **on_drag** (_event_): fun(self, touch) The event triggered when a drag occurs
-- **on_drag_end** (_event_)
+- **on_drag_end** (_event_): fun(self, touch) The event triggered when a drag ends
-- **style** (_druid.drag.style_)
+- **style** (_druid.drag.style_): The style of Drag component
-- **click_zone** (_node_)
+- **click_zone** (_node_): The click zone of Drag component
-- **is_touch** (_boolean_)
+- **is_touch** (_boolean_): True if a touch is active
-- **is_drag** (_boolean_)
+- **is_drag** (_boolean_): True if a drag is active
-- **can_x** (_boolean_)
+- **can_x** (_boolean_): True if Drag can move horizontally
-- **can_y** (_boolean_)
+- **can_y** (_boolean_): True if Drag can move vertically
-- **dx** (_number_)
+- **dx** (_number_): The horizontal drag distance
-- **dy** (_number_)
+- **dy** (_number_): The vertical drag distance
-- **touch_id** (_number_)
+- **touch_id** (_number_): The touch id
-- **x** (_number_)
+- **x** (_number_): The current x position
-- **y** (_number_)
+- **y** (_number_): The current y position
-- **screen_x** (_number_)
+- **screen_x** (_number_): The current screen x position
-- **screen_y** (_number_)
+- **screen_y** (_number_): The current screen y position
-- **touch_start_pos** (_vector3_)
+- **touch_start_pos** (_vector3_): The touch start position
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
-- **hover** (_druid.hover_)
+- **hover** (_druid.hover_): The component for handling hover events on a node
diff --git a/api/components/base/hover_api.md b/api/components/base/hover_api.md
index 6b01f57..5064a7d 100644
--- a/api/components/base/hover_api.md
+++ b/api/components/base/hover_api.md
@@ -2,13 +2,11 @@
> at /druid/base/hover.lua
+The component for handling hover events on a node
+
## Functions
- [init](#init)
-- [on_late_init](#on_late_init)
-- [on_style_change](#on_style_change)
-- [on_input](#on_input)
-- [on_input_interrupt](#on_input_interrupt)
- [set_hover](#set_hover)
- [is_hovered](#is_hovered)
- [set_mouse_hover](#set_mouse_hover)
@@ -34,49 +32,13 @@
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
-### on_late_init
-
----
-```lua
-hover:on_late_init()
-```
-
-### on_style_change
-
----
-```lua
-hover:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.hover.style)*:
-
-### on_input
-
----
-```lua
-hover:on_input(action_id, action)
-```
-
-- **Parameters:**
- - `action_id` *(hash)*:
- - `action` *(table)*:
-
-- **Returns:**
- - `` *(boolean)*:
-
-### on_input_interrupt
-
----
-```lua
-hover:on_input_interrupt()
-```
-
### set_hover
---
@@ -166,17 +128,17 @@ Return current hover enabled state
## Fields
-- **node** (_node_)
+- **node** (_node_): Gui node
-- **on_hover** (_event_)
+- **on_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Hover event
-- **on_mouse_hover** (_event_)
+- **on_mouse_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Mouse hover event
-- **style** (_druid.hover.style_)
+- **style** (_druid.hover.style_): Style of the hover component
-- **click_zone** (_node_)
+- **click_zone** (_node_): Click zone of the hover component
diff --git a/api/components/base/scroll_api.md b/api/components/base/scroll_api.md
index 3d95685..cf747dd 100644
--- a/api/components/base/scroll_api.md
+++ b/api/components/base/scroll_api.md
@@ -5,12 +5,6 @@
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
-- [on_late_init](#on_late_init)
-- [on_layout_change](#on_layout_change)
-- [update](#update)
-- [on_input](#on_input)
-- [on_remove](#on_remove)
- [scroll_to](#scroll_to)
- [scroll_to_index](#scroll_to_index)
- [scroll_to_percent](#scroll_to_percent)
@@ -69,61 +63,6 @@ The Scroll constructor
- `view_node` *(string|node)*: GUI view scroll node
- `content_node` *(string|node)*: GUI content scroll node
-### on_style_change
-
----
-```lua
-scroll:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.scroll.style)*: Scroll style parameters
-
-### on_late_init
-
----
-```lua
-scroll:on_late_init()
-```
-
-### on_layout_change
-
----
-```lua
-scroll:on_layout_change()
-```
-
-### update
-
----
-```lua
-scroll:update([dt])
-```
-
-- **Parameters:**
- - `[dt]` *(any)*:
-
-### on_input
-
----
-```lua
-scroll:on_input([action_id], [action])
-```
-
-- **Parameters:**
- - `[action_id]` *(any)*:
- - `[action]` *(any)*:
-
-- **Returns:**
- - `` *(boolean)*:
-
-### on_remove
-
----
-```lua
-scroll:on_remove()
-```
-
### scroll_to
---
@@ -191,7 +130,7 @@ Set scroll content size.
- `[offset]` *(vector3|nil)*: Offset value to set, where content is starts
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### set_view_size
@@ -206,7 +145,7 @@ Set new scroll view size in case the node size was changed.
- `size` *(vector3)*: The new size for view node
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### update_view_size
@@ -215,10 +154,10 @@ Set new scroll view size in case the node size was changed.
scroll:update_view_size()
```
-Refresh scroll view size
+Refresh scroll view size, used when view node size is changed
- **Returns:**
- - `` *(druid.scroll)*:
+ - `self` *(druid.scroll)*: Current scroll instance
### set_inert
@@ -235,7 +174,7 @@ Enable or disable scroll inert
- `state` *(boolean)*: Inert scroll state
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### is_inert
@@ -263,7 +202,7 @@ Set extra size for scroll stretching
- `[stretch_size]` *(number|nil)*: Size in pixels of additional scroll area
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### get_scroll_size
@@ -291,7 +230,7 @@ Set points of interest.
- `points` *(table)*: Array of vector3 points
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### set_horizontal_scroll
@@ -306,7 +245,7 @@ Lock or unlock horizontal scroll
- `state` *(boolean)*: True, if horizontal scroll is enabled
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### set_vertical_scroll
@@ -321,7 +260,7 @@ Lock or unlock vertical scroll
- `state` *(boolean)*: True, if vertical scroll is enabled
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### is_node_in_view
@@ -353,7 +292,7 @@ Bind the grid component (Static or Dynamic) to recalculate
- `[grid]` *(druid.grid|nil)*: Druid grid component
- **Returns:**
- - `Current` *(druid.scroll)*: scroll instance
+ - `self` *(druid.scroll)*: Current scroll instance
### set_click_zone
@@ -422,10 +361,10 @@ Strict drag scroll area. Useful for
- **style** (_druid.scroll.style_): Component style parameters
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
-- **hover** (_druid.hover_)
+- **hover** (_druid.hover_): The component for handling hover events on a node
- **points** (_table_)
diff --git a/api/components/base/static_grid_api.md b/api/components/base/static_grid_api.md
index 15021f1..795349a 100644
--- a/api/components/base/static_grid_api.md
+++ b/api/components/base/static_grid_api.md
@@ -2,14 +2,14 @@
> at /druid/base/static_grid.lua
+The component for manage the nodes position in the grid with various options
+
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
- [get_pos](#get_pos)
- [get_index](#get_index)
- [get_index_by_node](#get_index_by_node)
-- [on_layout_change](#on_layout_change)
- [set_anchor](#set_anchor)
- [refresh](#refresh)
- [set_pivot](#set_pivot)
@@ -55,21 +55,13 @@
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
-### on_style_change
-
----
-```lua
-grid:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.grid.style)*:
-
### get_pos
---
@@ -92,13 +84,13 @@ Return pos for grid node index
grid:get_index(pos)
```
-Return index for grid pos
+Return grid index by position
- **Parameters:**
- `pos` *(vector3)*: The node position in the grid
- **Returns:**
- - `The` *(number)*: node index
+ - `index` *(number)*: The node index
### get_index_by_node
@@ -115,13 +107,6 @@ Return grid index by node
- **Returns:**
- `index` *(number|nil)*: The node index
-### on_layout_change
-
----
-```lua
-grid:on_layout_change()
-```
-
### set_anchor
---
@@ -141,17 +126,25 @@ Set grid anchor. Default anchor is equal to anchor of grid parent node
grid:refresh()
```
-Update grid content
+Instantly update the grid content
+
+- **Returns:**
+ - `self` *(druid.grid)*: Current grid instance
### set_pivot
---
```lua
-grid:set_pivot([pivot])
+grid:set_pivot(pivot)
```
+Set grid pivot
+
- **Parameters:**
- - `[pivot]` *(any)*:
+ - `pivot` *(constant)*: The new pivot
+
+- **Returns:**
+ - `self` *(druid.grid)*: Current grid instance
### add
@@ -168,6 +161,9 @@ Add new item to the grid
- `[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
---
@@ -181,6 +177,9 @@ Set new items to the grid. All previous items will be removed
- `nodes` *(node[])*: The new grid nodes
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
+- **Returns:**
+ - `self` *(druid.grid)*: Current grid instance
+
### remove
---
@@ -196,7 +195,7 @@ Remove the item from the grid. Note that gui node will be not deleted
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- - `The` *(node)*: deleted gui node from grid
+ - `node` *(node)*: The deleted gui node from grid
### get_size
@@ -208,17 +207,22 @@ grid:get_size()
Return grid content size
- **Returns:**
- - `The` *(vector3)*: grid content size
+ - `size` *(vector3)*: The grid content size
### get_size_for
---
```lua
-grid:get_size_for([count])
+grid:get_size_for(count)
```
+Return grid content size for given count of nodes
+
- **Parameters:**
- - `[count]` *(any)*:
+ - `count` *(number)*: The count of nodes
+
+- **Returns:**
+ - `size` *(vector3)*: The grid content size
### get_borders
@@ -230,7 +234,7 @@ grid:get_borders()
Return grid content borders
- **Returns:**
- - `The` *(vector4)*: grid content borders
+ - `borders` *(vector4)*: The grid content borders
### get_all_pos
@@ -242,7 +246,7 @@ grid:get_all_pos()
Return array of all node positions
- **Returns:**
- - `All` *(vector3[])*: grid node positions
+ - `positions` *(vector3[])*: All grid node positions
### set_position_function
@@ -258,7 +262,7 @@ Change set position function for grid nodes. It will call on
- `callback` *(function)*: Function on node set position
- **Returns:**
- - `Current` *(druid.grid)*: grid instance
+ - `self` *(druid.grid)*: Current grid instance
### clear
@@ -271,7 +275,7 @@ 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:**
- - `Current` *(druid.grid)*: grid instance
+ - `self` *(druid.grid)*: Current grid instance
### get_offset
@@ -283,7 +287,7 @@ grid:get_offset()
Return StaticGrid offset, where StaticGrid content starts.
- **Returns:**
- - `The` *(vector3)*: StaticGrid offset
+ - `offset` *(vector3)*: The StaticGrid offset
### set_in_row
@@ -298,7 +302,7 @@ Set new in_row elements for grid
- `in_row` *(number)*: The new in_row value
- **Returns:**
- - `Current` *(druid.grid)*: grid instance
+ - `self` *(druid.grid)*: Current grid instance
### set_item_size
@@ -314,7 +318,7 @@ Set new node size for grid
- `[height]` *(number|nil)*: The new node height
- **Returns:**
- - `Current` *(druid.grid)*: grid instance
+ - `self` *(druid.grid)*: Current grid instance
### sort_nodes
@@ -334,49 +338,49 @@ Sort grid nodes by custom comparator function
## Fields
-- **on_add_item** (_event_)
+- **on_add_item** (_event_): Trigger on add item event, fun(self, item, index)
-- **on_remove_item** (_event_)
+- **on_remove_item** (_event_): Trigger on remove item event, fun(self, index)
-- **on_change_items** (_event_)
+- **on_change_items** (_event_): Trigger on change items event, fun(self, index)
-- **on_clear** (_event_)
+- **on_clear** (_event_): Trigger on clear event, fun(self)
-- **on_update_positions** (_event_)
+- **on_update_positions** (_event_): Trigger on update positions event, fun(self)
-- **parent** (_node_)
+- **parent** (_node_): Parent node
-- **nodes** (_node[]_)
+- **nodes** (_node[]_): Nodes array
-- **first_index** (_number_)
+- **first_index** (_number_): First index
-- **last_index** (_number_)
+- **last_index** (_number_): Last index
-- **anchor** (_vector3_)
+- **anchor** (_vector3_): Anchor
-- **pivot** (_vector3_)
+- **pivot** (_vector3_): Pivot
-- **node_size** (_vector3_)
+- **node_size** (_vector3_): Node size
-- **border** (_vector4_)
+- **border** (_vector4_): Border
-- **in_row** (_number_)
+- **in_row** (_number_): In row
-- **style** (_table_)
+- **style** (_druid.grid.style_): Style
- **node_pivot** (_unknown_)
diff --git a/api/components/base/text_api.md b/api/components/base/text_api.md
index 66fab14..4d29dcf 100644
--- a/api/components/base/text_api.md
+++ b/api/components/base/text_api.md
@@ -2,11 +2,11 @@
> at /druid/base/text.lua
+The component to handle text behaviour over a GUI Text node, mainly used to automatically adjust text size to fit the text area
+
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
-- [on_layout_change](#on_layout_change)
- [get_text_size](#get_text_size)
- [get_text_index_by_width](#get_text_index_by_width)
- [set_to](#set_to)
@@ -54,26 +54,6 @@ The Text constructor
- `[value]` *(string|nil)*: Initial text. Default value is node text from GUI scene. Default: nil
- `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference. Default: DOWNSCALE
-- **Returns:**
- - `` *(druid.text)*:
-
-### on_style_change
-
----
-```lua
-text:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.text.style)*:
-
-### on_layout_change
-
----
-```lua
-text:on_layout_change()
-```
-
### get_text_size
---
@@ -84,11 +64,11 @@ text:get_text_size([text])
Calculate text width with font with respect to trailing space
- **Parameters:**
- - `[text]` *(string|nil)*:
+ - `[text]` *(string|nil)*: The text to calculate the size of, if nil - use current text
- **Returns:**
- - `Width` *(number)*:
- - `Height` *(number)*:
+ - `width` *(number)*: The text width
+ - `height` *(number)*: The text height
### get_text_index_by_width
@@ -100,10 +80,10 @@ text:get_text_index_by_width(width)
Get chars count by width
- **Parameters:**
- - `width` *(number)*:
+ - `width` *(number)*: The width to get the chars count of
- **Returns:**
- - `Chars` *(number)*: count
+ - `index` *(number)*: The chars count
### set_to
@@ -118,7 +98,7 @@ Set text to text field
- `set_to` *(string)*: Text for node
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### set_text
@@ -171,7 +151,7 @@ Set color
- `color` *(vector4)*: Color for node
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### set_alpha
@@ -186,7 +166,7 @@ Set alpha
- `alpha` *(number)*: Alpha for node
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### set_scale
@@ -201,7 +181,7 @@ Set scale
- `scale` *(vector3)*: Scale for node
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### set_pivot
@@ -216,7 +196,7 @@ Set text pivot. Text will re-anchor inside text area
- `pivot` *(userdata)*: The gui.PIVOT_* constant
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### is_multiline
@@ -261,7 +241,7 @@ Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
- `minimal_scale` *(number)*: If pass nil - not use minimal scale
- **Returns:**
- - `Current` *(druid.text)*: text instance
+ - `self` *(druid.text)*: Current text instance
### get_text_adjust
diff --git a/api/components/custom/rich_input_api.md b/api/components/custom/rich_input_api.md
index 623b98f..1ebca04 100644
--- a/api/components/custom/rich_input_api.md
+++ b/api/components/custom/rich_input_api.md
@@ -2,6 +2,8 @@
> 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)
@@ -68,7 +70,7 @@ Set placeholder text
- `placeholder_text` *(string)*: The placeholder text
- **Returns:**
- - `` *(druid.rich_input)*:
+ - `self` *(druid.rich_input)*: Current instance
### select
@@ -79,6 +81,9 @@ rich_input:select()
Select input field
+- **Returns:**
+ - `self` *(druid.rich_input)*: Current instance
+
### set_text
---
@@ -136,27 +141,27 @@ Set allowed charaters for input field.
- `characters` *(string)*: Regulax exp. for validate user input
- **Returns:**
- - `Current` *(druid.rich_input)*: instance
+ - `self` *(druid.rich_input)*: Current instance
## Fields
-- **root** (_node_)
+- **root** (_node_): The root node of the rich input
-- **input** (_druid.input_)
+- **input** (_druid.input_): The input component
-- **cursor** (_node_)
+- **cursor** (_node_): The cursor node
-- **cursor_text** (_node_)
+- **cursor_text** (_node_): The cursor text node
-- **cursor_position** (_vector3_)
+- **cursor_position** (_vector3_): The position of the cursor
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
- **is_lshift** (_boolean_)
@@ -168,10 +173,10 @@ Set allowed charaters for input field.
- **is_button_input_enabled** (_unknown_)
-- **drag** (_druid.drag_)
+- **drag** (_druid.drag_): A component that allows you to subscribe to drag events over a node
-- **placeholder** (_druid.text_)
+- **placeholder** (_druid.text_): The component to handle text behaviour over a GUI Text node, mainly used to automatically adjust text size to fit the text area
- **text_position** (_unknown_)
diff --git a/api/components/custom/rich_text_api.md b/api/components/custom/rich_text_api.md
index be9db6f..a234ae8 100644
--- a/api/components/custom/rich_text_api.md
+++ b/api/components/custom/rich_text_api.md
@@ -2,17 +2,15 @@
> 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)
-- [on_layout_change](#on_layout_change)
-- [on_style_change](#on_style_change)
- [set_text](#set_text)
- [get_text](#get_text)
-- [on_remove](#on_remove)
- [clear](#clear)
- [tagged](#tagged)
-- [characters](#characters)
- [get_words](#get_words)
- [get_line_metric](#get_line_metric)
@@ -35,23 +33,6 @@ rich_text:init(text_node, [value])
- `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)
-### on_layout_change
-
----
-```lua
-rich_text:on_layout_change()
-```
-
-### on_style_change
-
----
-```lua
-rich_text:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.rich_text.style)*:
-
### set_text
---
@@ -98,17 +79,10 @@ rich_text:set_text("<img=texture:image,width,height>Display image with width
rich_text:get_text()
```
-Get current text
+Get the current text of the rich text
- **Returns:**
- - `text` *(string)*:
-
-### on_remove
-
----
-```lua
-rich_text:on_remove()
-```
+ - `text` *(string)*: The current text of the rich text
### clear
@@ -129,25 +103,10 @@ rich_text:tagged(tag)
Get all words, which has a passed tag.
- **Parameters:**
- - `tag` *(string)*:
+ - `tag` *(string)*: The tag to get the words for
- **Returns:**
- - `words` *(druid.rich_text.word[])*:
-
-### characters
-
----
-```lua
-rich_text:characters(word)
-```
-
-Split a word into it's characters
-
-- **Parameters:**
- - `word` *(druid.rich_text.word)*:
-
-- **Returns:**
- - `characters` *(druid.rich_text.word[])*:
+ - `words` *(druid.rich_text.word[])*: The words with the passed tag
### get_words
@@ -156,7 +115,7 @@ Split a word into it's characters
rich_text:get_words()
```
-Get all current words.
+Get all current created words, each word is a table that contains the information about the word
- **Returns:**
- `` *(druid.rich_text.word[])*:
@@ -168,19 +127,18 @@ Get all current words.
rich_text:get_line_metric()
```
-Get current line metrics
--@return druid.rich_text.lines_metrics
+Get the current line metrics
- **Returns:**
- - `` *(druid.rich_text.lines_metrics)*:
+ - `lines_metrics` *(druid.rich_text.lines_metrics)*: The line metrics of the rich text
## Fields
-- **root** (_node_)
+- **root** (_node_): The root node of the rich text
-- **text_prefab** (_node_)
+- **text_prefab** (_node_): The text prefab node
- **style** (_table_)
diff --git a/api/components/extended/container_api.md b/api/components/extended/container_api.md
index 592d3ca..88044d1 100644
--- a/api/components/extended/container_api.md
+++ b/api/components/extended/container_api.md
@@ -2,14 +2,13 @@
> at /druid/extended/container.lua
+The component used for managing the size and positions with other containers relations to create a adaptable layouts
+
## Functions
- [init](#init)
-- [on_late_init](#on_late_init)
-- [on_remove](#on_remove)
- [refresh_origins](#refresh_origins)
- [set_pivot](#set_pivot)
-- [on_style_change](#on_style_change)
- [set_size](#set_size)
- [get_position](#get_position)
- [set_position](#set_position)
@@ -17,7 +16,6 @@
- [get_scale](#get_scale)
- [fit_into_size](#fit_into_size)
- [fit_into_window](#fit_into_window)
-- [on_window_resized](#on_window_resized)
- [add_container](#add_container)
- [remove_container_by_node](#remove_container_by_node)
- [set_parent_container](#set_parent_container)
@@ -67,20 +65,6 @@ container:init(node, mode, [callback])
- `mode` *(string)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
-### on_late_init
-
----
-```lua
-container:on_late_init()
-```
-
-### on_remove
-
----
-```lua
-container:on_remove()
-```
-
### refresh_origins
---
@@ -88,6 +72,8 @@ container:on_remove()
container:refresh_origins()
```
+Refresh the origins of the container, origins is the size and position of the container when it was created
+
### set_pivot
---
@@ -95,18 +81,10 @@ container:refresh_origins()
container:set_pivot(pivot)
```
-- **Parameters:**
- - `pivot` *(constant)*:
-
-### on_style_change
-
----
-```lua
-container:on_style_change(style)
-```
+Set the pivot of the container
- **Parameters:**
- - `style` *(druid.container.style)*:
+ - `pivot` *(constant)*: The pivot to set
### set_size
@@ -118,8 +96,8 @@ container:set_size([width], [height], [anchor_pivot])
Set new size of layout node
- **Parameters:**
- - `[width]` *(number|nil)*:
- - `[height]` *(number|nil)*:
+ - `[width]` *(number|nil)*: The width to set
+ - `[height]` *(number|nil)*: The height to set
- `[anchor_pivot]` *(constant|nil)*: If set will keep the corner possition relative to the new size
- **Returns:**
@@ -132,8 +110,10 @@ Set new size of layout node
container:get_position()
```
+Get the position of the container
+
- **Returns:**
- - `` *(unknown)*:
+ - `position` *(vector3)*: The position of the container
### set_position
@@ -142,9 +122,11 @@ container:get_position()
container:set_position(pos_x, pos_y)
```
+Set the position of the container
+
- **Parameters:**
- - `pos_x` *(number)*:
- - `pos_y` *(number)*:
+ - `pos_x` *(number)*: The x position to set
+ - `pos_y` *(number)*: The y position to set
### get_size
@@ -153,10 +135,10 @@ container:set_position(pos_x, pos_y)
container:get_size()
```
-Get current size of layout node
+Get the current size of the layout node
- **Returns:**
- - `size` *(vector3)*:
+ - `size` *(vector3)*: The current size of the layout node
### get_scale
@@ -165,10 +147,10 @@ Get current size of layout node
container:get_scale()
```
-Get current scale of layout node
+Get the current scale of the layout node
- **Returns:**
- - `scale` *(vector3)*:
+ - `scale` *(vector3)*: The current scale of the layout node
### fit_into_size
@@ -180,10 +162,10 @@ container:fit_into_size(target_size)
Set size for layout node to fit inside it
- **Parameters:**
- - `target_size` *(vector3)*:
+ - `target_size` *(vector3)*: The target size to fit into
- **Returns:**
- - `Container` *(druid.container)*:
+ - `self` *(druid.container)*: Current container instance
### fit_into_window
@@ -195,14 +177,7 @@ container:fit_into_window()
Set current size for layout node to fit inside it
- **Returns:**
- - `Container` *(druid.container)*:
-
-### on_window_resized
-
----
-```lua
-container:on_window_resized()
-```
+ - `self` *(druid.container)*: Current container instance
### add_container
@@ -212,7 +187,7 @@ container:add_container(node_or_container, [mode], [on_resize_callback])
```
- **Parameters:**
- - `node_or_container` *(string|table|druid.container|node)*:
+ - `node_or_container` *(string|table|druid.container|node)*: The component used for managing the size and positions with other containers relations to create a adaptable layouts
- `[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)*:
@@ -240,7 +215,7 @@ container:set_parent_container([parent_container])
```
- **Parameters:**
- - `[parent_container]` *(druid.container|nil)*:
+ - `[parent_container]` *(druid.container|nil)*: The component used for managing the size and positions with other containers relations to create a adaptable layouts
### refresh
@@ -274,7 +249,7 @@ container:create_draggable_corners()
```
- **Returns:**
- - `Container` *(druid.container)*:
+ - `self` *(druid.container)*: Current container instance
### clear_draggable_corners
@@ -284,7 +259,7 @@ container:clear_draggable_corners()
```
- **Returns:**
- - `Container` *(druid.container)*:
+ - `self` *(druid.container)*: Current container instance
### fit_into_node
@@ -299,7 +274,7 @@ Set node for layout node to fit inside it. Pass nil to reset
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- - `Layout` *(druid.container)*:
+ - `self` *(druid.container)*: Current container instance
### set_min_size
@@ -308,56 +283,58 @@ Set node for layout node to fit inside it. Pass nil to reset
container:set_min_size([min_size_x], [min_size_y])
```
+Set the minimum size of the container
+
- **Parameters:**
- - `[min_size_x]` *(number|nil)*:
- - `[min_size_y]` *(number|nil)*:
+ - `[min_size_x]` *(number|nil)*: The minimum size x
+ - `[min_size_y]` *(number|nil)*: The minimum size y
- **Returns:**
- - `` *(druid.container)*:
+ - `self` *(druid.container)*: Current container instance
## Fields
-- **node** (_node_)
+- **node** (_node_): The gui node
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The druid instance
-- **node_offset** (_vector4_)
+- **node_offset** (_vector4_): The node offset
-- **origin_size** (_vector3_)
+- **origin_size** (_vector3_): The origin size
-- **size** (_vector3_)
+- **size** (_vector3_): The current size
-- **origin_position** (_vector3_)
+- **origin_position** (_vector3_): The origin position
-- **position** (_vector3_)
+- **position** (_vector3_): The current position
-- **pivot_offset** (_vector3_)
+- **pivot_offset** (_vector3_): The pivot offset
-- **center_offset** (_vector3_)
+- **center_offset** (_vector3_): The center offset
-- **mode** (_string_)
+- **mode** (_string_): The layout mode
-- **fit_size** (_vector3_)
+- **fit_size** (_vector3_): The fit size
-- **min_size_x** (_number_)
+- **min_size_x** (_number_): The minimum size x
-- **min_size_y** (_number_)
+- **min_size_y** (_number_): The minimum size y
-- **on_size_changed** (_event_): fun(self: druid.container, size: vector3)
+- **on_size_changed** (_event_): fun(self: druid.container, size: vector3) The event triggered when the size changes
- **node_fill_x** (_nil_)
diff --git a/api/components/extended/data_list_api.md b/api/components/extended/data_list_api.md
index 084be29..934cb1b 100644
--- a/api/components/extended/data_list_api.md
+++ b/api/components/extended/data_list_api.md
@@ -2,6 +2,8 @@
> at /druid/extended/data_list.lua
+The component used for managing a list of data with a scrollable view, used to manage huge list data and render only visible elements
+
## Functions
- [init](#init)
@@ -40,7 +42,7 @@ data_list:init(scroll, grid, create_function)
- **Parameters:**
- `scroll` *(druid.scroll)*: The Scroll instance for Data List component
- - `grid` *(druid.grid)*: The StaticGrid} or @{DynamicGrid 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])
### on_remove
@@ -59,13 +61,13 @@ Druid System on_remove function
data_list:set_use_cache(is_use_cache)
```
-Set refresh function for DataList component
+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. Requires make setup of components in on_element_add callback and clean in on_element_remove
+ - `is_use_cache` *(boolean)*: Use cache version of DataList
- **Returns:**
- - `Current` *(druid.data_list)*: DataList instance
+ - `self` *(druid.data_list)*: Current DataList instance
### set_data
@@ -80,7 +82,7 @@ Set new data set for DataList component
- `data` *(table)*: The new data array
- **Returns:**
- - `Current` *(druid.data_list)*: DataList instance
+ - `self` *(druid.data_list)*: Current DataList instance
### get_data
@@ -92,7 +94,7 @@ data_list:get_data()
Return current data from DataList component
- **Returns:**
- - `The` *(table)*: current data array
+ - `data` *(table)*: The current data array
### add
@@ -101,13 +103,16 @@ Return current data from DataList component
data_list:add(data, [index], [shift_policy])
```
-Add element to DataList. Currenly untested
+Add element to DataList
- **Parameters:**
- - `data` *(table)*:
- - `[index]` *(number|nil)*:
+ - `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
---
@@ -115,12 +120,15 @@ Add element to DataList. Currenly untested
data_list:remove([index], [shift_policy])
```
-Remove element from DataList. Currenly untested
+Remove element from DataList
- **Parameters:**
- - `[index]` *(number|nil)*:
+ - `[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
---
@@ -128,12 +136,15 @@ Remove element from DataList. Currenly untested
data_list:remove_by_data(data, [shift_policy])
```
-Remove element from DataList by data value. Currenly untested
+Remove element from DataList by data value
- **Parameters:**
- - `data` *(table)*:
+ - `data` *(table)*: The data to remove
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
+- **Returns:**
+ - `self` *(druid.data_list)*: Current DataList instance
+
### clear
---
@@ -143,6 +154,9 @@ data_list:clear()
Clear the DataList and refresh visuals
+- **Returns:**
+ - `self` *(druid.data_list)*: Current DataList instance
+
### get_index
---
@@ -180,7 +194,7 @@ data_list:get_created_components()
Return all currenly created components in DataList
- **Returns:**
- - `List` *(druid.component[])*: of created nodes
+ - `components` *(druid.component[])*: List of created components
### scroll_to_index
@@ -192,31 +206,31 @@ data_list:scroll_to_index(index)
Instant scroll to element with passed index
- **Parameters:**
- - `index` *(number)*:
+ - `index` *(number)*: The index to scroll to
## Fields
-- **scroll** (_druid.scroll_)
+- **scroll** (_druid.scroll_): The scroll instance for Data List component
-- **grid** (_druid.grid_)
+- **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component
-- **on_scroll_progress_change** (_event_)
+- **on_scroll_progress_change** (_event_): The event triggered when the scroll progress changes
-- **on_element_add** (_event_)
+- **on_element_add** (_event_): The event triggered when a new element is added
-- **on_element_remove** (_event_)
+- **on_element_remove** (_event_): The event triggered when an element is removed
-- **top_index** (_number_)
+- **top_index** (_number_): The top index of the visible elements
-- **last_index** (_number_)
+- **last_index** (_number_): The last index of the visible elements
-- **scroll_progress** (_number_)
+- **scroll_progress** (_number_): The scroll progress
diff --git a/api/components/extended/hotkey_api.md b/api/components/extended/hotkey_api.md
index 52d231e..5231bd0 100644
--- a/api/components/extended/hotkey_api.md
+++ b/api/components/extended/hotkey_api.md
@@ -2,6 +2,8 @@
> at /druid/extended/hotkey.lua
+The component used for managing hotkeys and trigger callbacks when hotkeys are pressed
+
## Functions
- [init](#init)
@@ -59,7 +61,7 @@ Add hotkey for component callback
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- - `Current` *(druid.hotkey)*: instance
+ - `self` *(druid.hotkey)*: Current instance
### is_processing
@@ -86,11 +88,11 @@ hotkey:on_input([action_id], action)
```
- **Parameters:**
- - `[action_id]` *(hash|nil)*:
- - `action` *(action)*:
+ - `[action_id]` *(hash|nil)*: The action id
+ - `action` *(action)*: The action
- **Returns:**
- - `` *(boolean)*:
+ - `is_consume` *(boolean)*: True if the action is consumed
### set_repeat
@@ -102,22 +104,22 @@ hotkey:set_repeat(is_enabled_repeated)
If true, the callback will be triggered on action.repeated
- **Parameters:**
- - `is_enabled_repeated` *(bool)*: The flag value
+ - `is_enabled_repeated` *(boolean)*: The flag value
- **Returns:**
- - `` *(druid.hotkey)*:
+ - `self` *(druid.hotkey)*: Current instance
## Fields
-- **on_hotkey_pressed** (_event_)
+- **on_hotkey_pressed** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is pressed
-- **on_hotkey_released** (_event_)
+- **on_hotkey_released** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is released
-- **style** (_druid.hotkey.style_)
+- **style** (_druid.hotkey.style_): The style of the hotkey component
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
diff --git a/api/components/extended/input_api.md b/api/components/extended/input_api.md
index 4fb3405..738498c 100644
--- a/api/components/extended/input_api.md
+++ b/api/components/extended/input_api.md
@@ -2,11 +2,11 @@
> at /druid/extended/input.lua
+The component used for managing input fields in basic way
+
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
-- [on_input](#on_input)
- [on_focus_lost](#on_focus_lost)
- [on_input_interrupt](#on_input_interrupt)
- [get_text_selected](#get_text_selected)
@@ -66,30 +66,6 @@ input:init(click_node, text_node, [keyboard_type])
- `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]` *(number|nil)*: Gui keyboard type for input field
-### on_style_change
-
----
-```lua
-input:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.input.style)*:
-
-### on_input
-
----
-```lua
-input:on_input([action_id], [action])
-```
-
-- **Parameters:**
- - `[action_id]` *(any)*:
- - `[action]` *(any)*:
-
-- **Returns:**
- - `` *(boolean)*:
-
### on_focus_lost
---
@@ -127,7 +103,7 @@ Replace selected text with new text
- `text` *(string)*: The text to replace selected text
- **Returns:**
- - `New` *(string)*: input text
+ - `new_text` *(string)*: New input text
### set_text
@@ -169,7 +145,7 @@ input:get_text()
Return current input field text
- **Returns:**
- - `The` *(string)*: current input field text
+ - `text` *(string)*: The current input field text
### set_max_length
@@ -185,7 +161,7 @@ Set maximum length for input field.
- `max_length` *(number)*: Maximum length for input text field
- **Returns:**
- - `Current` *(druid.input)*: input instance
+ - `self` *(druid.input)*: Current input instance
### set_allowed_characters
@@ -202,7 +178,7 @@ Set allowed charaters for input field.
- `characters` *(string)*: Regulax exp. for validate user input
- **Returns:**
- - `Current` *(druid.input)*: input instance
+ - `self` *(druid.input)*: Current input instance
### reset_changes
@@ -214,7 +190,7 @@ input:reset_changes()
Reset current input selection and return previous value
- **Returns:**
- - `Current` *(druid.input)*: input instance
+ - `self` *(druid.input)*: Current input instance
### select_cursor
@@ -231,7 +207,7 @@ Set cursor position in input field
- `[end_index]` *(number|nil)*: End index for cursor position, if nil - will be set to the start_index
- **Returns:**
- - `Current` *(druid.input)*: input instance
+ - `self` *(druid.input)*: Current input instance
### move_selection
@@ -247,40 +223,43 @@ Change cursor position by delta
- `is_add_to_selection` *(boolean)*: (Shift key)
- `is_move_to_end` *(boolean)*: (Ctrl key)
+- **Returns:**
+ - `self` *(druid.input)*: Current input instance
+
## Fields
-- **on_input_select** (_event_)
+- **on_input_select** (_event_): fun(self: druid.input, input: druid.input) The event triggered when the input field is selected
-- **on_input_unselect** (_event_)
+- **on_input_unselect** (_event_): fun(self: druid.input, text: string, input: druid.input) The event triggered when the input field is unselected
-- **on_input_text** (_event_)
+- **on_input_text** (_event_): fun(self: druid.input) The event triggered when the input field is changed
-- **on_input_empty** (_event_)
+- **on_input_empty** (_event_): fun(self: druid.input) The event triggered when the input field is empty
-- **on_input_full** (_event_)
+- **on_input_full** (_event_): fun(self: druid.input) The event triggered when the input field is full
-- **on_input_wrong** (_event_)
+- **on_input_wrong** (_event_): fun(self: druid.input) The event triggered when the input field is wrong
-- **on_select_cursor_change** (_event_)
+- **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
-- **style** (_table_)
+- **style** (_druid.input.style_): The style of the input component
-- **text** (_druid.text_)
+- **text** (_druid.text_): The text component
- **ALLOWED_ACTIONS** (_table_)
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
- **is_selected** (_boolean_)
diff --git a/api/components/extended/lang_text_api.md b/api/components/extended/lang_text_api.md
index b1da258..8bd9b10 100644
--- a/api/components/extended/lang_text_api.md
+++ b/api/components/extended/lang_text_api.md
@@ -2,6 +2,8 @@
> at /druid/extended/lang_text.lua
+The component used for displaying localized text, can automatically update text when locale is changed
+
## Functions
- [init](#init)
@@ -55,7 +57,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node
- **Returns:**
- - `Current` *(druid.lang_text)*: instance
+ - `self` *(druid.lang_text)*: Current instance
### set_text
@@ -70,7 +72,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node
- **Returns:**
- - `Current` *(druid.lang_text)*: instance
+ - `self` *(druid.lang_text)*: Current instance
### translate
@@ -86,7 +88,7 @@ Translate the text by locale_id
- `...` *(...)*: vararg
- **Returns:**
- - `Current` *(druid.lang_text)*: instance
+ - `self` *(druid.lang_text)*: Current instance
### format
@@ -101,19 +103,19 @@ Format string with new text params on localized text
- `...` *(...)*: vararg
- **Returns:**
- - `Current` *(druid.lang_text)*: instance
+ - `self` *(druid.lang_text)*: Current instance
## Fields
-- **text** (_druid.text_)
+- **text** (_druid.text_): The text component
-- **node** (_node_)
+- **node** (_node_): The node of the text component
-- **on_change** (_event_)
+- **on_change** (_event_): The event triggered when the text is changed
-- **druid** (_druid.instance_)
+- **druid** (_druid.instance_): The Druid Factory used to create components
diff --git a/api/components/extended/layout_api.md b/api/components/extended/layout_api.md
index 02051f7..470ac7c 100644
--- a/api/components/extended/layout_api.md
+++ b/api/components/extended/layout_api.md
@@ -2,6 +2,8 @@
> at /druid/extended/layout.lua
+The component used for managing the layout of nodes, placing them inside the node size with respect to the size and pivot of each node
+
## Functions
- [init](#init)
@@ -57,7 +59,7 @@ layout_type:
- **Parameters:**
- `node_or_node_id` *(string|node)*:
- - `layout_type` *(druid.layout.mode)*:
+ - `layout_type` *("horizontal"|"horizontal_wrap"|"vertical")*:
### update
@@ -74,18 +76,21 @@ layout:get_entities()
```
- **Returns:**
- - `` *(node[])*:
+ - `entities` *(node[])*: The entities to manage the layout of
### set_node_index
---
```lua
-layout:set_node_index([node], [index])
+layout:set_node_index(node, index)
```
- **Parameters:**
- - `[node]` *(any)*:
- - `[index]` *(any)*:
+ - `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
@@ -94,12 +99,14 @@ layout:set_node_index([node], [index])
layout:set_margin([margin_x], [margin_y])
```
+Set the margin of the layout
+
- **Parameters:**
- - `[margin_x]` *(number|nil)*:
- - `[margin_y]` *(number|nil)*:
+ - `[margin_x]` *(number|nil)*: The margin x
+ - `[margin_y]` *(number|nil)*: The margin y
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### set_padding
@@ -109,13 +116,13 @@ layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
```
- **Parameters:**
- - `[padding_x]` *(number|nil)*:
- - `[padding_y]` *(number|nil)*:
- - `[padding_z]` *(number|nil)*:
- - `[padding_w]` *(number|nil)*:
+ - `[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:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### set_dirty
@@ -125,7 +132,7 @@ layout:set_dirty()
```
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### set_justify
@@ -138,7 +145,7 @@ layout:set_justify(is_justify)
- `is_justify` *(boolean)*:
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### set_type
@@ -151,7 +158,7 @@ layout:set_type(type)
- `type` *(string)*: The layout type: "horizontal", "vertical", "horizontal_wrap"
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### set_hug_content
@@ -165,7 +172,7 @@ layout:set_hug_content(is_hug_width, is_hug_height)
- `is_hug_height` *(boolean)*:
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### add
@@ -180,7 +187,7 @@ Add node to layout
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### remove
@@ -226,7 +233,7 @@ layout:refresh_layout()
```
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### clear_layout
@@ -236,7 +243,7 @@ layout:clear_layout()
```
- **Returns:**
- - `` *(druid.layout)*:
+ - `self` *(druid.layout)*: Current layout instance
### get_node_size
@@ -249,8 +256,8 @@ layout:get_node_size(node)
- `node` *(node)*:
- **Returns:**
- - `` *(number)*:
- - `` *(number)*:
+ - `width` *(number)*: The width of the node
+ - `height` *(number)*: The height of the node
### calculate_rows_data
@@ -282,7 +289,7 @@ layout:set_node_position(node, x, y)
## Fields
-- **node** (_node_)
+- **node** (_node_): The node to manage the layout of
- **rows_data** (_druid.layout.rows_data_): Last calculated rows data
@@ -291,28 +298,28 @@ layout:set_node_position(node, x, y)
- **is_dirty** (_boolean_)
-- **entities** (_node[]_)
+- **entities** (_node[]_): The entities to manage the layout of
-- **margin** (_{ x: number, y: number }_)
+- **margin** (_{ x: number, y: number }_): The margin of the layout
-- **padding** (_vector4_)
+- **padding** (_vector4_): The padding of the layout
-- **type** (_string_)
+- **type** (_string_): The type of the layout
-- **is_resize_width** (_boolean_)
+- **is_resize_width** (_boolean_): True if the layout should resize the width of the node
-- **is_resize_height** (_boolean_)
+- **is_resize_height** (_boolean_): True if the layout should resize the height of the node
-- **is_justify** (_boolean_)
+- **is_justify** (_boolean_): True if the layout should justify the nodes
-- **on_size_changed** (_event.on_size_changed_)
+- **on_size_changed** (_event.on_size_changed_): The event triggered when the size of the layout is changed
- **size** (_unknown_)
diff --git a/api/components/extended/progress_api.md b/api/components/extended/progress_api.md
index c5e1e7e..e14f5a1 100644
--- a/api/components/extended/progress_api.md
+++ b/api/components/extended/progress_api.md
@@ -2,6 +2,8 @@
> at /druid/extended/progress.lua
+The component used to manage a node as a progress bar, changing the size and scale of the node
+
## Functions
- [init](#init)
@@ -46,7 +48,7 @@ progress:init(node, key, [init_value])
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- - `key` *(string)*: Progress bar direction: const.SIDE.X or const.SIDE.Y
+ - `key` *(string)*: Progress bar direction: "x" or "y"
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
### on_style_change
@@ -90,7 +92,10 @@ progress:update(dt)
progress:fill()
```
-Fill a progress bar and stop progress animation
+Fill the progress bar
+
+- **Returns:**
+ - `self` *(druid.progress)*: Current progress instance
### empty
@@ -99,7 +104,10 @@ Fill a progress bar and stop progress animation
progress:empty()
```
-Empty a progress bar
+Empty the progress bar
+
+- **Returns:**
+ - `self` *(druid.progress)*: Current progress instance
### set_to
@@ -113,6 +121,9 @@ Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
+- **Returns:**
+ - `self` *(druid.progress)*: Current progress instance
+
### get
---
@@ -120,10 +131,10 @@ Instant fill progress bar to value
progress:get()
```
-Return current progress bar value
+Return the current value of the progress bar
- **Returns:**
- - `` *(number)*:
+ - `value` *(number)*: The current value of the progress bar
### set_steps
@@ -138,6 +149,9 @@ Set points on progress bar to fire the callback
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
+- **Returns:**
+ - `self` *(druid.progress)*: Current progress instance
+
### to
---
@@ -151,6 +165,9 @@ Start animation of a progress bar
- `to` *(number)*: value between 0..1
- `[callback]` *(function|nil)*: Callback on animation ends
+- **Returns:**
+ - `self` *(druid.progress)*: Current progress instance
+
### set_max_size
---
@@ -164,7 +181,7 @@ Set progress bar max node size
- `max_size` *(vector3)*: The new node maximum (full) size
- **Returns:**
- - `Progress` *(druid.progress)*:
+ - `self` *(druid.progress)*: Current progress instance
## Fields
diff --git a/api/components/extended/slider_api.md b/api/components/extended/slider_api.md
index c5e1e7e..1d74989 100644
--- a/api/components/extended/slider_api.md
+++ b/api/components/extended/slider_api.md
@@ -1,39 +1,27 @@
-# druid.progress API
+# druid.slider API
-> at /druid/extended/progress.lua
+> at /druid/extended/slider.lua
+
+The component to make a draggable node over a line with a progress report
## Functions
- [init](#init)
-- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [on_remove](#on_remove)
-- [update](#update)
-- [fill](#fill)
-- [empty](#empty)
-- [set_to](#set_to)
-- [get](#get)
+- [on_window_resized](#on_window_resized)
+- [on_input](#on_input)
+- [set](#set)
- [set_steps](#set_steps)
-- [to](#to)
-- [set_max_size](#set_max_size)
+- [set_input_node](#set_input_node)
+- [set_enabled](#set_enabled)
+- [is_enabled](#is_enabled)
## Fields
- [node](#node)
-- [on_change](#on_change)
+- [on_change_value](#on_change_value)
- [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)
@@ -41,175 +29,136 @@
---
```lua
-progress:init(node, key, [init_value])
+slider:init(node, end_pos, [callback])
```
-- **Parameters:**
- - `node` *(string|node)*: Node name or GUI Node itself.
- - `key` *(string)*: Progress bar direction: const.SIDE.X or const.SIDE.Y
- - `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
-
-### on_style_change
-
----
-```lua
-progress:on_style_change(style)
-```
+The Slider constructor
- **Parameters:**
- - `style` *(druid.progress.style)*:
+ - `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
### on_layout_change
---
```lua
-progress:on_layout_change()
+slider:on_layout_change()
```
### on_remove
---
```lua
-progress:on_remove()
+slider:on_remove()
```
-### update
+### on_window_resized
---
```lua
-progress:update(dt)
+slider:on_window_resized()
+```
+
+### on_input
+
+---
+```lua
+slider:on_input(action_id, action)
```
- **Parameters:**
- - `dt` *(number)*: Delta time
-
-### fill
-
----
-```lua
-progress:fill()
-```
-
-Fill a progress bar and stop progress animation
-
-### empty
-
----
-```lua
-progress:empty()
-```
-
-Empty a progress bar
-
-### set_to
-
----
-```lua
-progress:set_to(to)
-```
-
-Instant fill progress bar to value
-
-- **Parameters:**
- - `to` *(number)*: Progress bar value, from 0 to 1
-
-### get
-
----
-```lua
-progress:get()
-```
-
-Return current progress bar value
+ - `action_id` *(number)*: The action id
+ - `action` *(action)*: The action table
- **Returns:**
- - `` *(number)*:
+ - `is_consumed` *(boolean)*: True if the input was consumed
+
+### 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
-progress:set_steps(steps, callback)
+slider:set_steps(steps)
```
-Set points on progress bar to fire the callback
+Set slider steps. Pin node will
+apply closest step position
- **Parameters:**
- - `steps` *(number[])*: Array of progress bar values
- - `callback` *(function)*: Callback on intersect step value
-
-### 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
-
-### 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
+ - `steps` *(number[])*: Array of steps
- **Returns:**
- - `Progress` *(druid.progress)*:
+ - `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
-- **node** (_node_)
+- **node** (_node_): The node to manage the slider
-
-- **on_change** (_event_)
+
+- **on_change_value** (_event_): The event triggered when the slider value changes
-- **style** (_druid.progress.style_)
-
-
-- **key** (_string_)
-
-
-- **prop** (_hash_)
-
-
-- **scale** (_unknown_)
-
-
-- **size** (_unknown_)
-
-
-- **max_size** (_unknown_)
-
-
-- **slice** (_unknown_)
-
-
-- **last_value** (_number_)
-
-
-- **slice_size** (_unknown_)
-
-
-- **target** (_nil_)
-
-
-- **steps** (_number[]_)
-
-
-- **step_callback** (_function_)
-
-
-- **target_callback** (_function|nil_)
+- **style** (_table_): The style of the slider
diff --git a/api/components/extended/swipe_api.md b/api/components/extended/swipe_api.md
index cea448f..0ecb1cb 100644
--- a/api/components/extended/swipe_api.md
+++ b/api/components/extended/swipe_api.md
@@ -2,13 +2,11 @@
> at /druid/extended/swipe.lua
+The component to manage swipe events over a node
+
## Functions
- [init](#init)
-- [on_late_init](#on_late_init)
-- [on_style_change](#on_style_change)
-- [on_input](#on_input)
-- [on_input_interrupt](#on_input_interrupt)
- [set_click_zone](#set_click_zone)
@@ -31,44 +29,6 @@ swipe:init(node_or_node_id, on_swipe_callback)
- `node_or_node_id` *(string|node)*:
- `on_swipe_callback` *(function)*:
-### on_late_init
-
----
-```lua
-swipe:on_late_init()
-```
-
-### on_style_change
-
----
-```lua
-swipe:on_style_change(style)
-```
-
-- **Parameters:**
- - `style` *(druid.swipe.style)*:
-
-### on_input
-
----
-```lua
-swipe:on_input(action_id, action)
-```
-
-- **Parameters:**
- - `action_id` *(hash)*:
- - `action` *(action)*:
-
-- **Returns:**
- - `` *(boolean)*:
-
-### on_input_interrupt
-
----
-```lua
-swipe:on_input_interrupt()
-```
-
### set_click_zone
---
@@ -76,8 +36,7 @@ swipe:on_input_interrupt()
swipe:set_click_zone([zone])
```
-Strict swipe click area. Useful for
-restrict events outside stencil node
+Set the click zone for the swipe, useful for restricting events outside stencil node
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
@@ -85,14 +44,14 @@ restrict events outside stencil node
## Fields
-- **node** (_node_)
+- **node** (_node_): The node to manage the swipe
-- **on_swipe** (_event_): function(side, dist, dt), side - "left", "right", "up", "down"
+- **on_swipe** (_event_): fun(context, side, dist, dt) The event triggered when a swipe is detected
-- **style** (_table_)
+- **style** (_druid.swipe.style_): The style of the swipe
-- **click_zone** (_node_)
+- **click_zone** (_node_): The click zone of the swipe
diff --git a/api/components/extended/timer_api.md b/api/components/extended/timer_api.md
index 46b7e93..e483443 100644
--- a/api/components/extended/timer_api.md
+++ b/api/components/extended/timer_api.md
@@ -2,11 +2,11 @@
> at /druid/extended/timer.lua
+The component that handles a text to display a seconds timer
+
## Functions
- [init](#init)
-- [update](#update)
-- [on_layout_change](#on_layout_change)
- [set_to](#set_to)
- [set_state](#set_state)
- [set_interval](#set_interval)
@@ -42,23 +42,6 @@ timer:init(node, [seconds_from], [seconds_to], [callback])
- **Returns:**
- `` *(druid.timer)*:
-### update
-
----
-```lua
-timer:update([dt])
-```
-
-- **Parameters:**
- - `[dt]` *(any)*:
-
-### on_layout_change
-
----
-```lua
-timer:on_layout_change()
-```
-
### set_to
---
@@ -66,11 +49,13 @@ timer:on_layout_change()
timer:set_to(set_to)
```
+Set the timer to a specific value
+
- **Parameters:**
- `set_to` *(number)*: Value in seconds
- **Returns:**
- - `self` *(druid.timer)*:
+ - `self` *(druid.timer)*: Current timer instance
### set_state
@@ -79,11 +64,13 @@ timer:set_to(set_to)
timer:set_state([is_on])
```
+Set the timer to a specific value
+
- **Parameters:**
- `[is_on]` *(boolean|nil)*: Timer enable state
- **Returns:**
- - `self` *(druid.timer)*:
+ - `self` *(druid.timer)*: Current timer instance
### set_interval
@@ -92,38 +79,40 @@ timer:set_state([is_on])
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)*:
+ - `self` *(druid.timer)*: Current timer instance
## Fields
-- **on_tick** (_event_)
+- **on_tick** (_event_): fun(context, value) The event triggered when the timer ticks
-- **on_set_enabled** (_event_)
+- **on_set_enabled** (_event_): fun(context, is_on) The event triggered when the timer is enabled
-- **on_timer_end** (_event_)
+- **on_timer_end** (_event_): fun(context) The event triggered when the timer ends
-- **node** (_node_)
+- **node** (_node_): The node to display the timer
-- **from** (_number_)
+- **from** (_number_): The start time of the timer
-- **target** (_number_)
+- **target** (_number_): The target time of the timer
-- **value** (_number_)
+- **value** (_number_): The current value of the timer
-- **is_on** (_boolean_)
+- **is_on** (_boolean_): True if the timer is on
- **temp** (_unknown_)
diff --git a/api/druid_helper_api.md b/api/druid_helper_api.md
index c57ea36..98ba510 100644
--- a/api/druid_helper_api.md
+++ b/api/druid_helper_api.md
@@ -37,6 +37,7 @@ You can use these functions in your projects as well.
- [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)
## Fields
@@ -516,3 +517,32 @@ Get full position of node in the GUI tree
- **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)*:
+
+
+## Fields
+
+- **PROP_SIZE_X** (_unknown_)
+
+
+- **PROP_SIZE_Y** (_unknown_)
+
+
+- **PROP_SCALE_X** (_unknown_)
+
+
+- **PROP_SCALE_Y** (_unknown_)
+
diff --git a/api/druid_instance_api.md b/api/druid_instance_api.md
index d8aa296..6055c93 100644
--- a/api/druid_instance_api.md
+++ b/api/druid_instance_api.md
@@ -2,13 +2,19 @@
> 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)
@@ -34,6 +40,12 @@
- [new_rich_input](#new_rich_input)
+## Fields
+- [components_all](#components_all)
+- [components_interest](#components_interest)
+
+
+
### create_druid_instance
---
@@ -60,11 +72,11 @@ instance:new(component, ...)
Create new Druid component instance
- **Parameters:**
- - `component` *()*:
+ - `component` *()*: The component class to create
- `...` *(...)*: vararg
- **Returns:**
- - `` *()*:
+ - `instance` *()*: The new ready to use component
### final
@@ -89,7 +101,7 @@ Remove created component from Druid instance.
- `component` *()*: Component instance
- **Returns:**
- - `True` *(boolean)*: if component was removed
+ - `is_removed` *(boolean)*: True if component was removed
### update
@@ -117,7 +129,7 @@ Call this in gui_script on_input function.
- `action` *(table)*: Action from on_input
- **Returns:**
- - `The` *(boolean)*: boolean value is input was consumed
+ - `is_input_consumed` *(boolean)*: The boolean value is input was consumed
### on_message
@@ -137,11 +149,13 @@ Call this in gui_script on_message function.
---
```lua
-instance:on_window_event([window_event])
+instance:on_window_event(window_event)
```
+Called when the window event occurs
+
- **Parameters:**
- - `[window_event]` *(any)*:
+ - `window_event` *(number)*: The window event
### set_whitelist
@@ -158,7 +172,7 @@ component will be not processed on input step
- `whitelist_components` *(table|druid.component[])*: The array of component to whitelist
- **Returns:**
- - `` *(druid.instance)*:
+ - `self` *(druid.instance)*: The Druid instance
### set_blacklist
@@ -175,7 +189,7 @@ component will be not processed on input step DruidInstance
- `blacklist_components` *(table|druid.component[])*: The array of component to blacklist
- **Returns:**
- - `` *(druid.instance)*:
+ - `self` *(druid.instance)*: The Druid instance
### new_widget
@@ -187,13 +201,13 @@ instance:new_widget(widget, [template], [nodes], ...)
Create new Druid widget instance
- **Parameters:**
- - `widget` *()*:
+ - `widget` *()*: The widget class to create
- `[template]` *(string|nil)*: The template name used by widget
- `[nodes]` *(node|table|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone
- `...` *(...)*: vararg
- **Returns:**
- - `` *()*:
+ - `widget` *()*: The new ready to use widget
### new_button
@@ -211,7 +225,7 @@ Create Button component
- `[anim_node]` *(string|node|nil)*: Button anim node (node, if not provided)
- **Returns:**
- - `Button` *(druid.button)*: component
+ - `button` *(druid.button)*: The new button component
### new_blocker
@@ -226,7 +240,7 @@ Create Blocker component
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- - `component` *(druid.blocker)*: Blocker component
+ - `blocker` *(druid.blocker)*: The new blocker component
### new_back_handler
@@ -242,7 +256,7 @@ Create BackHandler component
- `[params]` *(any)*: Callback argument
- **Returns:**
- - `component` *(druid.back_handler)*: BackHandler component
+ - `back_handler` *(druid.back_handler)*: The new back handler component
### new_hover
@@ -259,7 +273,7 @@ Create Hover component
- `[on_mouse_hover_callback]` *(function|nil)*: Mouse hover callback
- **Returns:**
- - `component` *(druid.hover)*: Hover component
+ - `hover` *(druid.hover)*: The new hover component
### new_text
@@ -276,7 +290,7 @@ Create Text component
- `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
- **Returns:**
- - `component` *(druid.text)*: Text component
+ - `text` *(druid.text)*: The new text component
### new_grid
@@ -293,7 +307,7 @@ Create Grid component
- `[in_row]` *(number|nil)*: How many nodes in row can be placed
- **Returns:**
- - `component` *(druid.grid)*: Grid component
+ - `grid` *(druid.grid)*: The new grid component
### new_scroll
@@ -309,7 +323,7 @@ Create Scroll component
- `content_node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node.
- **Returns:**
- - `component` *(druid.scroll)*: Scroll component
+ - `scroll` *(druid.scroll)*: The new scroll component
### new_drag
@@ -325,7 +339,7 @@ Create Drag component
- `[on_drag_callback]` *(function|nil)*: Callback for on_drag_event(self, dx, dy)
- **Returns:**
- - `component` *(druid.drag)*: Drag component
+ - `drag` *(druid.drag)*: The new drag component
### new_swipe
@@ -341,7 +355,7 @@ Create Swipe component
- `[on_swipe_callback]` *(function|nil)*: Swipe callback for on_swipe_end event
- **Returns:**
- - `component` *(druid.swipe)*: Swipe component
+ - `swipe` *(druid.swipe)*: The new swipe component
### new_lang_text
@@ -358,7 +372,7 @@ Create LangText component
- `[adjust_type]` *(string|nil)*: Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE
- **Returns:**
- - `component` *(druid.lang_text)*: LangText component
+ - `lang_text` *(druid.lang_text)*: The new lang text component
### new_slider
@@ -375,7 +389,7 @@ Create Slider component
- `[callback]` *(function|nil)*: On slider change callback
- **Returns:**
- - `component` *(druid.slider)*: Slider component
+ - `slider` *(druid.slider)*: The new slider component
### new_input
@@ -392,7 +406,7 @@ Create Input component
- `[keyboard_type]` *(number|nil)*: Gui keyboard type for input field
- **Returns:**
- - `component` *(druid.input)*: Input component
+ - `input` *(druid.input)*: The new input component
### new_data_list
@@ -409,7 +423,7 @@ Create DataList component
- `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
- **Returns:**
- - `component` *(druid.data_list)*: DataList component
+ - `data_list` *(druid.data_list)*: The new data list component
### new_timer
@@ -427,7 +441,7 @@ Create Timer component
- `[callback]` *(function|nil)*: Function on timer end
- **Returns:**
- - `component` *(druid.timer)*: Timer component
+ - `timer` *(druid.timer)*: The new timer component
### new_progress
@@ -444,7 +458,7 @@ Create Progress component
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
- **Returns:**
- - `component` *(druid.progress)*: Progress component
+ - `progress` *(druid.progress)*: The new progress component
### new_layout
@@ -460,7 +474,7 @@ Create Layout component
- `[mode]` *(string|nil)*: vertical|horizontal|horizontal_wrap. Default: horizontal
- **Returns:**
- - `component` *(druid.layout)*: Layout component
+ - `layout` *(druid.layout)*: The new layout component
### new_container
@@ -477,7 +491,7 @@ Create Container component
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
- **Returns:**
- - `container` *(druid.container)*: component
+ - `container` *(druid.container)*: The new container component
### new_hotkey
@@ -490,11 +504,11 @@ 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|nil)*: The callback function
+ - `[callback]` *(function|event|nil)*: The callback function
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- - `component` *(druid.hotkey)*: Hotkey component
+ - `hotkey` *(druid.hotkey)*: The new hotkey component
### new_rich_text
@@ -510,7 +524,7 @@ Create RichText component.
- `[value]` *(string|nil)*: The initial text value. Default will be gui.get_text(text_node)
- **Returns:**
- - `component` *(druid.rich_text)*: RichText component
+ - `rich_text` *(druid.rich_text)*: The new rich text component
### new_rich_input
@@ -527,4 +541,13 @@ Create RichInput component.
- `[nodes]` *(table|nil)*: Nodes table from gui.clone_tree
- **Returns:**
- - `component` *(druid.rich_input)*: RichInput component
+ - `rich_input` *(druid.rich_input)*: The new rich input component
+
+
+## Fields
+
+- **components_all** (_druid.component[]_): All created components
+
+
+- **components_interest** (_table_): All components sorted by interest
+
diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua
index b244004..8ee70b6 100644
--- a/druid/custom/rich_input/rich_input.lua
+++ b/druid/custom/rich_input/rich_input.lua
@@ -223,6 +223,8 @@ function M:on_input(action_id, action)
return true
end
end
+
+ return false
end
diff --git a/druid/custom/rich_text/module/rt.lua b/druid/custom/rich_text/module/rt.lua
index 721cca4..e688f43 100755
--- a/druid/custom/rich_text/module/rt.lua
+++ b/druid/custom/rich_text/module/rt.lua
@@ -1,3 +1,4 @@
+---@diagnostic disable: inject-field
-- Source: https://github.com/britzl/defold-richtext version 5.19.0
-- Author: Britzl
-- Modified by: Insality
diff --git a/druid/custom/rich_text/module/rt_tags.lua b/druid/custom/rich_text/module/rt_tags.lua
index 00f1eb9..f061954 100644
--- a/druid/custom/rich_text/module/rt_tags.lua
+++ b/druid/custom/rich_text/module/rt_tags.lua
@@ -27,10 +27,10 @@ end
---Split string at first occurrence of token
----@param s string The string to split
+---@param s string? The string to split
---@param token string The token to split string on
----@return string before The string before the token or the whole string if token doesn't exist
----@return string after The string after the token or nil
+---@return string? before The string before the token or the whole string if token doesn't exist
+---@return string? after The string after the token or nil
local function split(s, token)
if not s then return nil, nil end
local before, after = s:match("(.-)" .. token .. "(.*)")
diff --git a/druid/custom/rich_text/rich_text.lua b/druid/custom/rich_text/rich_text.lua
index b5d5183..1863e5e 100644
--- a/druid/custom/rich_text/rich_text.lua
+++ b/druid/custom/rich_text/rich_text.lua
@@ -41,6 +41,7 @@ local rich_text = require("druid.custom.rich_text.module.rt")
---@field image druid.rich_text.word.image
---@field br boolean
---@field nobr boolean
+---@field tags table
---@class druid.rich_text.word.image
---@field texture string
diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua
index 0d17d05..acdd51f 100644
--- a/druid/extended/hotkey.lua
+++ b/druid/extended/hotkey.lua
@@ -63,6 +63,7 @@ function M:add_hotkey(keys, callback_argument)
local modificators = {}
local key = nil
+ ---@cast keys string[]
for index = 1, #keys do
local key_hash = hash(keys[index])
if #keys > 1 and helper.contains(self.style.MODIFICATORS, key_hash) then
@@ -84,8 +85,9 @@ function M:add_hotkey(keys, callback_argument)
})
-- Current hotkey status
- for index = 1, #self.style.MODIFICATORS do
- local modificator = hash(self.style.MODIFICATORS[index])
+ local mods = self.style.MODIFICATORS ---@type string[]
+ for index = 1, #mods do
+ local modificator = hash(mods[index])
self._modificators[modificator] = self._modificators[modificator] or false
end
diff --git a/druid/extended/input.lua b/druid/extended/input.lua
index 1ee1a2e..57c9c86 100755
--- a/druid/extended/input.lua
+++ b/druid/extended/input.lua
@@ -23,9 +23,9 @@ local utf8 = utf8 or utf8_lua
---@field on_input_wrong event fun(self: druid.input) The event triggered when the input field is wrong
---@field 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
---@field style druid.input.style The style of the input component
----@field text druid.text The text component
local M = component.create("input")
+---@private
M.ALLOWED_ACTIONS = {
[const.ACTION_TOUCH] = true,
[const.ACTION_TEXT] = true,
@@ -61,7 +61,7 @@ end
---@param click_node node Node to enabled input component
---@param text_node node|druid.text Text node what will be changed on user input. You can pass text component instead of text node name Text
----@param keyboard_type number|nil Gui keyboard type for input field
+---@param keyboard_type constant|nil Gui keyboard type for input field
function M:init(click_node, text_node, keyboard_type)
self.druid = self:get_druid()
@@ -269,7 +269,7 @@ end
---Set text for input field
----@param input_text string The string to apply for input field
+---@param input_text string? The string to apply for input field, if nil - will be set to empty string
function M:set_text(input_text)
input_text = tostring(input_text or "")
@@ -370,7 +370,7 @@ end
---Set maximum length for input field.
--- Pass nil to make input field unliminted (by default)
+---Pass nil to make input field unliminted (by default)
---@param max_length number Maximum length for input text field
---@return druid.input self Current input instance
function M:set_max_length(max_length)
@@ -380,9 +380,11 @@ end
---Set allowed charaters for input field.
--- See: https://defold.com/ref/stable/string/
--- ex: [%a%d] for alpha and numeric
----@param characters string Regulax exp. for validate user input
+---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
+---@param characters string Regular expression for validate user input
---@return druid.input self Current input instance
function M:set_allowed_characters(characters)
self.allowed_characters = characters
@@ -481,6 +483,8 @@ function M:move_selection(delta, is_add_to_selection, is_move_to_end)
end
self:select_cursor(cursor_index, start_index, end_index)
+
+ return self
end
diff --git a/druid/system/druid_annotations.lua b/druid/system/druid_annotations.lua
index 889ef7b..e8457f9 100644
--- a/druid/system/druid_annotations.lua
+++ b/druid/system/druid_annotations.lua
@@ -49,6 +49,7 @@
---@field screen_dy number The change in screen space y value of a pointer device, if present.
---@field gamepad number The index of the gamepad device that provided the input.
---@field touch touch[] List of touch input, one element per finger, if present. See table below about touch input
+---@field text string The text input.
---@class touch
---@field id number A number identifying the touch input during its duration.
diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua
index 5757f56..18304e0 100755
--- a/druid/system/druid_instance.lua
+++ b/druid/system/druid_instance.lua
@@ -558,7 +558,7 @@ end
local text = require("druid.base.text")
---Create Text component
----@param node string|node The node_id or gui.get_node(node_id)
+---@param node string|node|druid.text The node_id or gui.get_node(node_id)
---@param value string|nil Initial text. Default value is node text from GUI scene.
---@param adjust_type string|nil Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
---@return druid.text text The new text component
diff --git a/game.project b/game.project
index a00b8f5..673dd68 100644
--- a/game.project
+++ b/game.project
@@ -1,5 +1,5 @@
[bootstrap]
-main_collection = /example/druid.collectionc
+main_collection = /example/other/go_bindings/go_bindings.collectionc
[script]
shared_state = 1
@@ -58,7 +58,7 @@ cssfile = /builtins/manifests/web/dark_theme.css
show_console_banner = 0
[native_extension]
-app_manifest =
+app_manifest =
[graphics]
texture_profiles = /builtins/graphics/default.texture_profiles