Reimport docs

This commit is contained in:
Insality 2025-03-18 22:00:51 +02:00
parent 3c063313de
commit 44b735adda
31 changed files with 617 additions and 869 deletions

View File

@ -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 ```lua
back_handler:init([callback], [params]) 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
<a name="on_back"></a>
- **on_back** (_event_): Trigger on back handler action, fun(self, params)
<a name="params"></a>
- **params** (_any_): Custom args to pass in the callback

View File

@ -5,7 +5,6 @@
## Functions ## Functions
- [init](#init) - [init](#init)
- [on_input](#on_input)
- [set_enabled](#set_enabled) - [set_enabled](#set_enabled)
- [is_enabled](#is_enabled) - [is_enabled](#is_enabled)
@ -23,21 +22,7 @@ blocker:init(node)
``` ```
- **Parameters:** - **Parameters:**
- `node` *(node)*: - `node` *(string|node)*: The node to use as a blocker
### on_input
---
```lua
blocker:on_input(action_id, action)
```
- **Parameters:**
- `action_id` *(string)*:
- `action` *(table)*:
- **Returns:**
- `` *(boolean)*:
### set_enabled ### set_enabled
@ -49,10 +34,10 @@ blocker:set_enabled(state)
Set blocker enabled state Set blocker enabled state
- **Parameters:** - **Parameters:**
- `state` *(boolean)*: - `state` *(boolean)*: The new enabled state
- **Returns:** - **Returns:**
- `self` *(druid.blocker)*: - `self` *(druid.blocker)*: The blocker instance
### is_enabled ### is_enabled
@ -64,7 +49,7 @@ blocker:is_enabled()
Get blocker enabled state Get blocker enabled state
- **Returns:** - **Returns:**
- `` *(boolean)*: - `is_enabled` *(boolean)*: True if the blocker is enabled
## Fields ## Fields

View File

@ -7,10 +7,7 @@ Druid component to make clickable node with various interaction callbacks
## Functions ## Functions
- [init](#init) - [init](#init)
- [on_style_change](#on_style_change) - [set_animations_disabled](#set_animations_disabled)
- [on_late_init](#on_late_init)
- [on_input](#on_input)
- [on_input_interrupt](#on_input_interrupt)
- [set_enabled](#set_enabled) - [set_enabled](#set_enabled)
- [is_enabled](#is_enabled) - [is_enabled](#is_enabled)
- [set_click_zone](#set_click_zone) - [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]) button:init(node_or_node_id, [callback], [custom_args], [anim_node])
``` ```
The constructor for the button component
- **Parameters:** - **Parameters:**
- `node_or_node_id` *(string|node)*: Node name or GUI Node itself - `node_or_node_id` *(string|node)*: Node name or GUI Node itself
- `[callback]` *(fun()|nil)*: Callback on button click - `[callback]` *(fun()|nil)*: Callback on button click
- `[custom_args]` *(any)*: Custom args for any Button event - `[custom_args]` *(any)*: Custom args for any Button event
- `[anim_node]` *(string|node|nil)*: Node to animate instead of trigger node - `[anim_node]` *(string|node|nil)*: Node to animate instead of trigger node
### on_style_change ### set_animations_disabled
--- ---
```lua ```lua
button:on_style_change(style) button:set_animations_disabled()
``` ```
- **Parameters:** Remove default button style animations
- `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)*:
- **Returns:** - **Returns:**
- `` *(boolean)*: - `self` *(druid.button)*: The current button instance
### on_input_interrupt
---
```lua
button:on_input_interrupt()
```
### set_enabled ### set_enabled
@ -115,7 +87,7 @@ Disabled button is not clickable.
- `[state]` *(boolean|nil)*: Enabled state - `[state]` *(boolean|nil)*: Enabled state
- **Returns:** - **Returns:**
- `self` *(druid.button)*: - `self` *(druid.button)*: The current button instance
### is_enabled ### 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 - `[zone]` *(string|node|nil)*: Gui node
- **Returns:** - **Returns:**
- `self` *(druid.button)*: - `self` *(druid.button)*: The current button instance
### set_key_trigger ### 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" - `key` *(string|hash)*: The action_id of the input key. Example: "key_space"
- **Returns:** - **Returns:**
- `self` *(druid.button)*: - `self` *(druid.button)*: The current button instance
### get_key_trigger ### 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 - `[failure_callback]` *(function|nil)*: Function will be called on button click, if check function return false
- **Returns:** - **Returns:**
- `self` *(druid.button)*: - `self` *(druid.button)*: The current button instance
### set_web_user_interaction ### 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 - `[is_web_mode]` *(boolean|nil)*: If true - button will be called inside html5 callback
- **Returns:** - **Returns:**
- `self` *(druid.button)*: - `self` *(druid.button)*: The current button instance
## Fields ## Fields
@ -265,7 +237,7 @@ If the game is not HTML, html mode will be not enabled
- **style** (_table_): Style for this button - **style** (_table_): Style for this button
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_repeated_started"></a> <a name="is_repeated_started"></a>
- **is_repeated_started** (_boolean_) - **is_repeated_started** (_boolean_)

View File

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

View File

@ -2,13 +2,11 @@
> at /druid/base/hover.lua > at /druid/base/hover.lua
The component for handling hover events on a node
## Functions ## Functions
- [init](#init) - [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) - [set_hover](#set_hover)
- [is_hovered](#is_hovered) - [is_hovered](#is_hovered)
- [set_mouse_hover](#set_mouse_hover) - [set_mouse_hover](#set_mouse_hover)
@ -34,49 +32,13 @@
hover:init(node, on_hover_callback, on_mouse_hover) hover:init(node, on_hover_callback, on_mouse_hover)
``` ```
The constructor for the hover component
- **Parameters:** - **Parameters:**
- `node` *(node)*: Gui node - `node` *(node)*: Gui node
- `on_hover_callback` *(function)*: Hover callback - `on_hover_callback` *(function)*: Hover callback
- `on_mouse_hover` *(function)*: On mouse 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 ### set_hover
--- ---
@ -166,17 +128,17 @@ Return current hover enabled state
## Fields ## Fields
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): Gui node
<a name="on_hover"></a> <a name="on_hover"></a>
- **on_hover** (_event_) - **on_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Hover event
<a name="on_mouse_hover"></a> <a name="on_mouse_hover"></a>
- **on_mouse_hover** (_event_) - **on_mouse_hover** (_event_): fun(self: druid.hover, is_hover: boolean) Mouse hover event
<a name="style"></a> <a name="style"></a>
- **style** (_druid.hover.style_) - **style** (_druid.hover.style_): Style of the hover component
<a name="click_zone"></a> <a name="click_zone"></a>
- **click_zone** (_node_) - **click_zone** (_node_): Click zone of the hover component

View File

@ -5,12 +5,6 @@
## Functions ## Functions
- [init](#init) - [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](#scroll_to)
- [scroll_to_index](#scroll_to_index) - [scroll_to_index](#scroll_to_index)
- [scroll_to_percent](#scroll_to_percent) - [scroll_to_percent](#scroll_to_percent)
@ -69,61 +63,6 @@ The Scroll constructor
- `view_node` *(string|node)*: GUI view scroll node - `view_node` *(string|node)*: GUI view scroll node
- `content_node` *(string|node)*: GUI content 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 ### scroll_to
--- ---
@ -191,7 +130,7 @@ Set scroll content size.
- `[offset]` *(vector3|nil)*: Offset value to set, where content is starts - `[offset]` *(vector3|nil)*: Offset value to set, where content is starts
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### set_view_size ### 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 - `size` *(vector3)*: The new size for view node
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### update_view_size ### update_view_size
@ -215,10 +154,10 @@ Set new scroll view size in case the node size was changed.
scroll:update_view_size() scroll:update_view_size()
``` ```
Refresh scroll view size Refresh scroll view size, used when view node size is changed
- **Returns:** - **Returns:**
- `` *(druid.scroll)*: - `self` *(druid.scroll)*: Current scroll instance
### set_inert ### set_inert
@ -235,7 +174,7 @@ Enable or disable scroll inert
- `state` *(boolean)*: Inert scroll state - `state` *(boolean)*: Inert scroll state
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### is_inert ### is_inert
@ -263,7 +202,7 @@ Set extra size for scroll stretching
- `[stretch_size]` *(number|nil)*: Size in pixels of additional scroll area - `[stretch_size]` *(number|nil)*: Size in pixels of additional scroll area
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### get_scroll_size ### get_scroll_size
@ -291,7 +230,7 @@ Set points of interest.
- `points` *(table)*: Array of vector3 points - `points` *(table)*: Array of vector3 points
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### set_horizontal_scroll ### set_horizontal_scroll
@ -306,7 +245,7 @@ Lock or unlock horizontal scroll
- `state` *(boolean)*: True, if horizontal scroll is enabled - `state` *(boolean)*: True, if horizontal scroll is enabled
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### set_vertical_scroll ### set_vertical_scroll
@ -321,7 +260,7 @@ Lock or unlock vertical scroll
- `state` *(boolean)*: True, if vertical scroll is enabled - `state` *(boolean)*: True, if vertical scroll is enabled
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### is_node_in_view ### is_node_in_view
@ -353,7 +292,7 @@ Bind the grid component (Static or Dynamic) to recalculate
- `[grid]` *(druid.grid|nil)*: Druid grid component - `[grid]` *(druid.grid|nil)*: Druid grid component
- **Returns:** - **Returns:**
- `Current` *(druid.scroll)*: scroll instance - `self` *(druid.scroll)*: Current scroll instance
### set_click_zone ### set_click_zone
@ -422,10 +361,10 @@ Strict drag scroll area. Useful for
- **style** (_druid.scroll.style_): Component style parameters - **style** (_druid.scroll.style_): Component style parameters
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components
<a name="hover"></a> <a name="hover"></a>
- **hover** (_druid.hover_) - **hover** (_druid.hover_): The component for handling hover events on a node
<a name="points"></a> <a name="points"></a>
- **points** (_table_) - **points** (_table_)

View File

@ -2,14 +2,14 @@
> at /druid/base/static_grid.lua > at /druid/base/static_grid.lua
The component for manage the nodes position in the grid with various options
## Functions ## Functions
- [init](#init) - [init](#init)
- [on_style_change](#on_style_change)
- [get_pos](#get_pos) - [get_pos](#get_pos)
- [get_index](#get_index) - [get_index](#get_index)
- [get_index_by_node](#get_index_by_node) - [get_index_by_node](#get_index_by_node)
- [on_layout_change](#on_layout_change)
- [set_anchor](#set_anchor) - [set_anchor](#set_anchor)
- [refresh](#refresh) - [refresh](#refresh)
- [set_pivot](#set_pivot) - [set_pivot](#set_pivot)
@ -55,21 +55,13 @@
grid:init(parent, element, [in_row]) grid:init(parent, element, [in_row])
``` ```
The constructor for the grid component
- **Parameters:** - **Parameters:**
- `parent` *(string|node)*: The GUI Node container, where grid's items will be placed - `parent` *(string|node)*: The GUI Node container, where grid's items will be placed
- `element` *(node)*: Element prefab. Need to get it size - `element` *(node)*: Element prefab. Need to get it size
- `[in_row]` *(number|nil)*: How many nodes in row can be placed. By default 1 - `[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 ### get_pos
--- ---
@ -92,13 +84,13 @@ Return pos for grid node index
grid:get_index(pos) grid:get_index(pos)
``` ```
Return index for grid pos Return grid index by position
- **Parameters:** - **Parameters:**
- `pos` *(vector3)*: The node position in the grid - `pos` *(vector3)*: The node position in the grid
- **Returns:** - **Returns:**
- `The` *(number)*: node index - `index` *(number)*: The node index
### get_index_by_node ### get_index_by_node
@ -115,13 +107,6 @@ Return grid index by node
- **Returns:** - **Returns:**
- `index` *(number|nil)*: The node index - `index` *(number|nil)*: The node index
### on_layout_change
---
```lua
grid:on_layout_change()
```
### set_anchor ### set_anchor
--- ---
@ -141,17 +126,25 @@ Set grid anchor. Default anchor is equal to anchor of grid parent node
grid:refresh() grid:refresh()
``` ```
Update grid content Instantly update the grid content
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_pivot ### set_pivot
--- ---
```lua ```lua
grid:set_pivot([pivot]) grid:set_pivot(pivot)
``` ```
Set grid pivot
- **Parameters:** - **Parameters:**
- `[pivot]` *(any)*: - `pivot` *(constant)*: The new pivot
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### add ### add
@ -168,6 +161,9 @@ Add new item to the grid
- `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT - `[shift_policy]` *(number|nil)*: How shift nodes, if required. Default: const.SHIFT.RIGHT
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly - `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### set_items ### set_items
--- ---
@ -181,6 +177,9 @@ Set new items to the grid. All previous items will be removed
- `nodes` *(node[])*: The new grid nodes - `nodes` *(node[])*: The new grid nodes
- `[is_instant]` *(boolean|nil)*: If true, update node positions instantly - `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:**
- `self` *(druid.grid)*: Current grid instance
### remove ### 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 - `[is_instant]` *(boolean|nil)*: If true, update node positions instantly
- **Returns:** - **Returns:**
- `The` *(node)*: deleted gui node from grid - `node` *(node)*: The deleted gui node from grid
### get_size ### get_size
@ -208,17 +207,22 @@ grid:get_size()
Return grid content size Return grid content size
- **Returns:** - **Returns:**
- `The` *(vector3)*: grid content size - `size` *(vector3)*: The grid content size
### get_size_for ### get_size_for
--- ---
```lua ```lua
grid:get_size_for([count]) grid:get_size_for(count)
``` ```
Return grid content size for given count of nodes
- **Parameters:** - **Parameters:**
- `[count]` *(any)*: - `count` *(number)*: The count of nodes
- **Returns:**
- `size` *(vector3)*: The grid content size
### get_borders ### get_borders
@ -230,7 +234,7 @@ grid:get_borders()
Return grid content borders Return grid content borders
- **Returns:** - **Returns:**
- `The` *(vector4)*: grid content borders - `borders` *(vector4)*: The grid content borders
### get_all_pos ### get_all_pos
@ -242,7 +246,7 @@ grid:get_all_pos()
Return array of all node positions Return array of all node positions
- **Returns:** - **Returns:**
- `All` *(vector3[])*: grid node positions - `positions` *(vector3[])*: All grid node positions
### set_position_function ### 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 - `callback` *(function)*: Function on node set position
- **Returns:** - **Returns:**
- `Current` *(druid.grid)*: grid instance - `self` *(druid.grid)*: Current grid instance
### clear ### 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 If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
- **Returns:** - **Returns:**
- `Current` *(druid.grid)*: grid instance - `self` *(druid.grid)*: Current grid instance
### get_offset ### get_offset
@ -283,7 +287,7 @@ grid:get_offset()
Return StaticGrid offset, where StaticGrid content starts. Return StaticGrid offset, where StaticGrid content starts.
- **Returns:** - **Returns:**
- `The` *(vector3)*: StaticGrid offset - `offset` *(vector3)*: The StaticGrid offset
### set_in_row ### set_in_row
@ -298,7 +302,7 @@ Set new in_row elements for grid
- `in_row` *(number)*: The new in_row value - `in_row` *(number)*: The new in_row value
- **Returns:** - **Returns:**
- `Current` *(druid.grid)*: grid instance - `self` *(druid.grid)*: Current grid instance
### set_item_size ### set_item_size
@ -314,7 +318,7 @@ Set new node size for grid
- `[height]` *(number|nil)*: The new node height - `[height]` *(number|nil)*: The new node height
- **Returns:** - **Returns:**
- `Current` *(druid.grid)*: grid instance - `self` *(druid.grid)*: Current grid instance
### sort_nodes ### sort_nodes
@ -334,49 +338,49 @@ Sort grid nodes by custom comparator function
## Fields ## Fields
<a name="on_add_item"></a> <a name="on_add_item"></a>
- **on_add_item** (_event_) - **on_add_item** (_event_): Trigger on add item event, fun(self, item, index)
<a name="on_remove_item"></a> <a name="on_remove_item"></a>
- **on_remove_item** (_event_) - **on_remove_item** (_event_): Trigger on remove item event, fun(self, index)
<a name="on_change_items"></a> <a name="on_change_items"></a>
- **on_change_items** (_event_) - **on_change_items** (_event_): Trigger on change items event, fun(self, index)
<a name="on_clear"></a> <a name="on_clear"></a>
- **on_clear** (_event_) - **on_clear** (_event_): Trigger on clear event, fun(self)
<a name="on_update_positions"></a> <a name="on_update_positions"></a>
- **on_update_positions** (_event_) - **on_update_positions** (_event_): Trigger on update positions event, fun(self)
<a name="parent"></a> <a name="parent"></a>
- **parent** (_node_) - **parent** (_node_): Parent node
<a name="nodes"></a> <a name="nodes"></a>
- **nodes** (_node[]_) - **nodes** (_node[]_): Nodes array
<a name="first_index"></a> <a name="first_index"></a>
- **first_index** (_number_) - **first_index** (_number_): First index
<a name="last_index"></a> <a name="last_index"></a>
- **last_index** (_number_) - **last_index** (_number_): Last index
<a name="anchor"></a> <a name="anchor"></a>
- **anchor** (_vector3_) - **anchor** (_vector3_): Anchor
<a name="pivot"></a> <a name="pivot"></a>
- **pivot** (_vector3_) - **pivot** (_vector3_): Pivot
<a name="node_size"></a> <a name="node_size"></a>
- **node_size** (_vector3_) - **node_size** (_vector3_): Node size
<a name="border"></a> <a name="border"></a>
- **border** (_vector4_) - **border** (_vector4_): Border
<a name="in_row"></a> <a name="in_row"></a>
- **in_row** (_number_) - **in_row** (_number_): In row
<a name="style"></a> <a name="style"></a>
- **style** (_table_) - **style** (_druid.grid.style_): Style
<a name="node_pivot"></a> <a name="node_pivot"></a>
- **node_pivot** (_unknown_) - **node_pivot** (_unknown_)

View File

@ -2,11 +2,11 @@
> at /druid/base/text.lua > 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 ## Functions
- [init](#init) - [init](#init)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [get_text_size](#get_text_size) - [get_text_size](#get_text_size)
- [get_text_index_by_width](#get_text_index_by_width) - [get_text_index_by_width](#get_text_index_by_width)
- [set_to](#set_to) - [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 - `[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 - `[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 ### get_text_size
--- ---
@ -84,11 +64,11 @@ text:get_text_size([text])
Calculate text width with font with respect to trailing space Calculate text width with font with respect to trailing space
- **Parameters:** - **Parameters:**
- `[text]` *(string|nil)*: - `[text]` *(string|nil)*: The text to calculate the size of, if nil - use current text
- **Returns:** - **Returns:**
- `Width` *(number)*: - `width` *(number)*: The text width
- `Height` *(number)*: - `height` *(number)*: The text height
### get_text_index_by_width ### get_text_index_by_width
@ -100,10 +80,10 @@ text:get_text_index_by_width(width)
Get chars count by width Get chars count by width
- **Parameters:** - **Parameters:**
- `width` *(number)*: - `width` *(number)*: The width to get the chars count of
- **Returns:** - **Returns:**
- `Chars` *(number)*: count - `index` *(number)*: The chars count
### set_to ### set_to
@ -118,7 +98,7 @@ Set text to text field
- `set_to` *(string)*: Text for node - `set_to` *(string)*: Text for node
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### set_text ### set_text
@ -171,7 +151,7 @@ Set color
- `color` *(vector4)*: Color for node - `color` *(vector4)*: Color for node
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### set_alpha ### set_alpha
@ -186,7 +166,7 @@ Set alpha
- `alpha` *(number)*: Alpha for node - `alpha` *(number)*: Alpha for node
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### set_scale ### set_scale
@ -201,7 +181,7 @@ Set scale
- `scale` *(vector3)*: Scale for node - `scale` *(vector3)*: Scale for node
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### set_pivot ### set_pivot
@ -216,7 +196,7 @@ Set text pivot. Text will re-anchor inside text area
- `pivot` *(userdata)*: The gui.PIVOT_* constant - `pivot` *(userdata)*: The gui.PIVOT_* constant
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### is_multiline ### 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 - `minimal_scale` *(number)*: If pass nil - not use minimal scale
- **Returns:** - **Returns:**
- `Current` *(druid.text)*: text instance - `self` *(druid.text)*: Current text instance
### get_text_adjust ### get_text_adjust

View File

@ -2,6 +2,8 @@
> at /druid/custom/rich_input/rich_input.lua > 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 ## Functions
- [init](#init) - [init](#init)
@ -68,7 +70,7 @@ Set placeholder text
- `placeholder_text` *(string)*: The placeholder text - `placeholder_text` *(string)*: The placeholder text
- **Returns:** - **Returns:**
- `` *(druid.rich_input)*: - `self` *(druid.rich_input)*: Current instance
### select ### select
@ -79,6 +81,9 @@ rich_input:select()
Select input field Select input field
- **Returns:**
- `self` *(druid.rich_input)*: Current instance
### set_text ### set_text
--- ---
@ -136,27 +141,27 @@ Set allowed charaters for input field.
- `characters` *(string)*: Regulax exp. for validate user input - `characters` *(string)*: Regulax exp. for validate user input
- **Returns:** - **Returns:**
- `Current` *(druid.rich_input)*: instance - `self` *(druid.rich_input)*: Current instance
## Fields ## Fields
<a name="root"></a> <a name="root"></a>
- **root** (_node_) - **root** (_node_): The root node of the rich input
<a name="input"></a> <a name="input"></a>
- **input** (_druid.input_) - **input** (_druid.input_): The input component
<a name="cursor"></a> <a name="cursor"></a>
- **cursor** (_node_) - **cursor** (_node_): The cursor node
<a name="cursor_text"></a> <a name="cursor_text"></a>
- **cursor_text** (_node_) - **cursor_text** (_node_): The cursor text node
<a name="cursor_position"></a> <a name="cursor_position"></a>
- **cursor_position** (_vector3_) - **cursor_position** (_vector3_): The position of the cursor
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_lshift"></a> <a name="is_lshift"></a>
- **is_lshift** (_boolean_) - **is_lshift** (_boolean_)
@ -168,10 +173,10 @@ Set allowed charaters for input field.
- **is_button_input_enabled** (_unknown_) - **is_button_input_enabled** (_unknown_)
<a name="drag"></a> <a name="drag"></a>
- **drag** (_druid.drag_) - **drag** (_druid.drag_): A component that allows you to subscribe to drag events over a node
<a name="placeholder"></a> <a name="placeholder"></a>
- **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
<a name="text_position"></a> <a name="text_position"></a>
- **text_position** (_unknown_) - **text_position** (_unknown_)

View File

@ -2,17 +2,15 @@
> at /druid/custom/rich_text/rich_text.lua > 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 ## Functions
- [init](#init) - [init](#init)
- [on_layout_change](#on_layout_change)
- [on_style_change](#on_style_change)
- [set_text](#set_text) - [set_text](#set_text)
- [get_text](#get_text) - [get_text](#get_text)
- [on_remove](#on_remove)
- [clear](#clear) - [clear](#clear)
- [tagged](#tagged) - [tagged](#tagged)
- [characters](#characters)
- [get_words](#get_words) - [get_words](#get_words)
- [get_line_metric](#get_line_metric) - [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 - `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) - `[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 ### set_text
--- ---
@ -98,17 +79,10 @@ rich_text:set_text("img=texture:image,width,heightDisplay image with width
rich_text:get_text() rich_text:get_text()
``` ```
Get current text Get the current text of the rich text
- **Returns:** - **Returns:**
- `text` *(string)*: - `text` *(string)*: The current text of the rich text
### on_remove
---
```lua
rich_text:on_remove()
```
### clear ### clear
@ -129,25 +103,10 @@ rich_text:tagged(tag)
Get all words, which has a passed tag. Get all words, which has a passed tag.
- **Parameters:** - **Parameters:**
- `tag` *(string)*: - `tag` *(string)*: The tag to get the words for
- **Returns:** - **Returns:**
- `words` *(druid.rich_text.word[])*: - `words` *(druid.rich_text.word[])*: The words with the passed tag
### 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[])*:
### get_words ### get_words
@ -156,7 +115,7 @@ Split a word into it's characters
rich_text:get_words() 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:** - **Returns:**
- `` *(druid.rich_text.word[])*: - `` *(druid.rich_text.word[])*:
@ -168,19 +127,18 @@ Get all current words.
rich_text:get_line_metric() rich_text:get_line_metric()
``` ```
Get current line metrics Get the current line metrics
-@return druid.rich_text.lines_metrics
- **Returns:** - **Returns:**
- `` *(druid.rich_text.lines_metrics)*: - `lines_metrics` *(druid.rich_text.lines_metrics)*: The line metrics of the rich text
## Fields ## Fields
<a name="root"></a> <a name="root"></a>
- **root** (_node_) - **root** (_node_): The root node of the rich text
<a name="text_prefab"></a> <a name="text_prefab"></a>
- **text_prefab** (_node_) - **text_prefab** (_node_): The text prefab node
<a name="style"></a> <a name="style"></a>
- **style** (_table_) - **style** (_table_)

View File

@ -2,14 +2,13 @@
> at /druid/extended/container.lua > at /druid/extended/container.lua
The component used for managing the size and positions with other containers relations to create a adaptable layouts
## Functions ## Functions
- [init](#init) - [init](#init)
- [on_late_init](#on_late_init)
- [on_remove](#on_remove)
- [refresh_origins](#refresh_origins) - [refresh_origins](#refresh_origins)
- [set_pivot](#set_pivot) - [set_pivot](#set_pivot)
- [on_style_change](#on_style_change)
- [set_size](#set_size) - [set_size](#set_size)
- [get_position](#get_position) - [get_position](#get_position)
- [set_position](#set_position) - [set_position](#set_position)
@ -17,7 +16,6 @@
- [get_scale](#get_scale) - [get_scale](#get_scale)
- [fit_into_size](#fit_into_size) - [fit_into_size](#fit_into_size)
- [fit_into_window](#fit_into_window) - [fit_into_window](#fit_into_window)
- [on_window_resized](#on_window_resized)
- [add_container](#add_container) - [add_container](#add_container)
- [remove_container_by_node](#remove_container_by_node) - [remove_container_by_node](#remove_container_by_node)
- [set_parent_container](#set_parent_container) - [set_parent_container](#set_parent_container)
@ -67,20 +65,6 @@ container:init(node, mode, [callback])
- `mode` *(string)*: Layout mode - `mode` *(string)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed - `[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 ### refresh_origins
--- ---
@ -88,6 +72,8 @@ container:on_remove()
container:refresh_origins() container:refresh_origins()
``` ```
Refresh the origins of the container, origins is the size and position of the container when it was created
### set_pivot ### set_pivot
--- ---
@ -95,18 +81,10 @@ container:refresh_origins()
container:set_pivot(pivot) container:set_pivot(pivot)
``` ```
- **Parameters:** Set the pivot of the container
- `pivot` *(constant)*:
### on_style_change
---
```lua
container:on_style_change(style)
```
- **Parameters:** - **Parameters:**
- `style` *(druid.container.style)*: - `pivot` *(constant)*: The pivot to set
### set_size ### set_size
@ -118,8 +96,8 @@ container:set_size([width], [height], [anchor_pivot])
Set new size of layout node Set new size of layout node
- **Parameters:** - **Parameters:**
- `[width]` *(number|nil)*: - `[width]` *(number|nil)*: The width to set
- `[height]` *(number|nil)*: - `[height]` *(number|nil)*: The height to set
- `[anchor_pivot]` *(constant|nil)*: If set will keep the corner possition relative to the new size - `[anchor_pivot]` *(constant|nil)*: If set will keep the corner possition relative to the new size
- **Returns:** - **Returns:**
@ -132,8 +110,10 @@ Set new size of layout node
container:get_position() container:get_position()
``` ```
Get the position of the container
- **Returns:** - **Returns:**
- `` *(unknown)*: - `position` *(vector3)*: The position of the container
### set_position ### set_position
@ -142,9 +122,11 @@ container:get_position()
container:set_position(pos_x, pos_y) container:set_position(pos_x, pos_y)
``` ```
Set the position of the container
- **Parameters:** - **Parameters:**
- `pos_x` *(number)*: - `pos_x` *(number)*: The x position to set
- `pos_y` *(number)*: - `pos_y` *(number)*: The y position to set
### get_size ### get_size
@ -153,10 +135,10 @@ container:set_position(pos_x, pos_y)
container:get_size() container:get_size()
``` ```
Get current size of layout node Get the current size of the layout node
- **Returns:** - **Returns:**
- `size` *(vector3)*: - `size` *(vector3)*: The current size of the layout node
### get_scale ### get_scale
@ -165,10 +147,10 @@ Get current size of layout node
container:get_scale() container:get_scale()
``` ```
Get current scale of layout node Get the current scale of the layout node
- **Returns:** - **Returns:**
- `scale` *(vector3)*: - `scale` *(vector3)*: The current scale of the layout node
### fit_into_size ### fit_into_size
@ -180,10 +162,10 @@ container:fit_into_size(target_size)
Set size for layout node to fit inside it Set size for layout node to fit inside it
- **Parameters:** - **Parameters:**
- `target_size` *(vector3)*: - `target_size` *(vector3)*: The target size to fit into
- **Returns:** - **Returns:**
- `Container` *(druid.container)*: - `self` *(druid.container)*: Current container instance
### fit_into_window ### fit_into_window
@ -195,14 +177,7 @@ container:fit_into_window()
Set current size for layout node to fit inside it Set current size for layout node to fit inside it
- **Returns:** - **Returns:**
- `Container` *(druid.container)*: - `self` *(druid.container)*: Current container instance
### on_window_resized
---
```lua
container:on_window_resized()
```
### add_container ### add_container
@ -212,7 +187,7 @@ container:add_container(node_or_container, [mode], [on_resize_callback])
``` ```
- **Parameters:** - **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" - `[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)*: - `[on_resize_callback]` *(fun(self: userdata, size: vector3)|nil)*:
@ -240,7 +215,7 @@ container:set_parent_container([parent_container])
``` ```
- **Parameters:** - **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 ### refresh
@ -274,7 +249,7 @@ container:create_draggable_corners()
``` ```
- **Returns:** - **Returns:**
- `Container` *(druid.container)*: - `self` *(druid.container)*: Current container instance
### clear_draggable_corners ### clear_draggable_corners
@ -284,7 +259,7 @@ container:clear_draggable_corners()
``` ```
- **Returns:** - **Returns:**
- `Container` *(druid.container)*: - `self` *(druid.container)*: Current container instance
### fit_into_node ### 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) - `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:** - **Returns:**
- `Layout` *(druid.container)*: - `self` *(druid.container)*: Current container instance
### set_min_size ### 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]) container:set_min_size([min_size_x], [min_size_y])
``` ```
Set the minimum size of the container
- **Parameters:** - **Parameters:**
- `[min_size_x]` *(number|nil)*: - `[min_size_x]` *(number|nil)*: The minimum size x
- `[min_size_y]` *(number|nil)*: - `[min_size_y]` *(number|nil)*: The minimum size y
- **Returns:** - **Returns:**
- `` *(druid.container)*: - `self` *(druid.container)*: Current container instance
## Fields ## Fields
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The gui node
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The druid instance
<a name="node_offset"></a> <a name="node_offset"></a>
- **node_offset** (_vector4_) - **node_offset** (_vector4_): The node offset
<a name="origin_size"></a> <a name="origin_size"></a>
- **origin_size** (_vector3_) - **origin_size** (_vector3_): The origin size
<a name="size"></a> <a name="size"></a>
- **size** (_vector3_) - **size** (_vector3_): The current size
<a name="origin_position"></a> <a name="origin_position"></a>
- **origin_position** (_vector3_) - **origin_position** (_vector3_): The origin position
<a name="position"></a> <a name="position"></a>
- **position** (_vector3_) - **position** (_vector3_): The current position
<a name="pivot_offset"></a> <a name="pivot_offset"></a>
- **pivot_offset** (_vector3_) - **pivot_offset** (_vector3_): The pivot offset
<a name="center_offset"></a> <a name="center_offset"></a>
- **center_offset** (_vector3_) - **center_offset** (_vector3_): The center offset
<a name="mode"></a> <a name="mode"></a>
- **mode** (_string_) - **mode** (_string_): The layout mode
<a name="fit_size"></a> <a name="fit_size"></a>
- **fit_size** (_vector3_) - **fit_size** (_vector3_): The fit size
<a name="min_size_x"></a> <a name="min_size_x"></a>
- **min_size_x** (_number_) - **min_size_x** (_number_): The minimum size x
<a name="min_size_y"></a> <a name="min_size_y"></a>
- **min_size_y** (_number_) - **min_size_y** (_number_): The minimum size y
<a name="on_size_changed"></a> <a name="on_size_changed"></a>
- **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
<a name="node_fill_x"></a> <a name="node_fill_x"></a>
- **node_fill_x** (_nil_) - **node_fill_x** (_nil_)

View File

@ -2,6 +2,8 @@
> at /druid/extended/data_list.lua > 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 ## Functions
- [init](#init) - [init](#init)
@ -40,7 +42,7 @@ data_list:init(scroll, grid, create_function)
- **Parameters:** - **Parameters:**
- `scroll` *(druid.scroll)*: The Scroll instance for Data List component - `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]) - `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
### on_remove ### on_remove
@ -59,13 +61,13 @@ Druid System on_remove function
data_list:set_use_cache(is_use_cache) 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:** - **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:** - **Returns:**
- `Current` *(druid.data_list)*: DataList instance - `self` *(druid.data_list)*: Current DataList instance
### set_data ### set_data
@ -80,7 +82,7 @@ Set new data set for DataList component
- `data` *(table)*: The new data array - `data` *(table)*: The new data array
- **Returns:** - **Returns:**
- `Current` *(druid.data_list)*: DataList instance - `self` *(druid.data_list)*: Current DataList instance
### get_data ### get_data
@ -92,7 +94,7 @@ data_list:get_data()
Return current data from DataList component Return current data from DataList component
- **Returns:** - **Returns:**
- `The` *(table)*: current data array - `data` *(table)*: The current data array
### add ### add
@ -101,13 +103,16 @@ Return current data from DataList component
data_list:add(data, [index], [shift_policy]) data_list:add(data, [index], [shift_policy])
``` ```
Add element to DataList. Currenly untested Add element to DataList
- **Parameters:** - **Parameters:**
- `data` *(table)*: - `data` *(table)*: The data to add
- `[index]` *(number|nil)*: - `[index]` *(number|nil)*: The index to add the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.* - `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove ### remove
--- ---
@ -115,12 +120,15 @@ Add element to DataList. Currenly untested
data_list:remove([index], [shift_policy]) data_list:remove([index], [shift_policy])
``` ```
Remove element from DataList. Currenly untested Remove element from DataList
- **Parameters:** - **Parameters:**
- `[index]` *(number|nil)*: - `[index]` *(number|nil)*: The index to remove the data at
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.* - `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### remove_by_data ### remove_by_data
--- ---
@ -128,12 +136,15 @@ Remove element from DataList. Currenly untested
data_list:remove_by_data(data, [shift_policy]) 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:** - **Parameters:**
- `data` *(table)*: - `data` *(table)*: The data to remove
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.* - `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### clear ### clear
--- ---
@ -143,6 +154,9 @@ data_list:clear()
Clear the DataList and refresh visuals Clear the DataList and refresh visuals
- **Returns:**
- `self` *(druid.data_list)*: Current DataList instance
### get_index ### get_index
--- ---
@ -180,7 +194,7 @@ data_list:get_created_components()
Return all currenly created components in DataList Return all currenly created components in DataList
- **Returns:** - **Returns:**
- `List` *(druid.component[])*: of created nodes - `components` *(druid.component[])*: List of created components
### scroll_to_index ### scroll_to_index
@ -192,31 +206,31 @@ data_list:scroll_to_index(index)
Instant scroll to element with passed index Instant scroll to element with passed index
- **Parameters:** - **Parameters:**
- `index` *(number)*: - `index` *(number)*: The index to scroll to
## Fields ## Fields
<a name="scroll"></a> <a name="scroll"></a>
- **scroll** (_druid.scroll_) - **scroll** (_druid.scroll_): The scroll instance for Data List component
<a name="grid"></a> <a name="grid"></a>
- **grid** (_druid.grid_) - **grid** (_druid.grid_): The StaticGrid or DynamicGrid instance for Data List component
<a name="on_scroll_progress_change"></a> <a name="on_scroll_progress_change"></a>
- **on_scroll_progress_change** (_event_) - **on_scroll_progress_change** (_event_): The event triggered when the scroll progress changes
<a name="on_element_add"></a> <a name="on_element_add"></a>
- **on_element_add** (_event_) - **on_element_add** (_event_): The event triggered when a new element is added
<a name="on_element_remove"></a> <a name="on_element_remove"></a>
- **on_element_remove** (_event_) - **on_element_remove** (_event_): The event triggered when an element is removed
<a name="top_index"></a> <a name="top_index"></a>
- **top_index** (_number_) - **top_index** (_number_): The top index of the visible elements
<a name="last_index"></a> <a name="last_index"></a>
- **last_index** (_number_) - **last_index** (_number_): The last index of the visible elements
<a name="scroll_progress"></a> <a name="scroll_progress"></a>
- **scroll_progress** (_number_) - **scroll_progress** (_number_): The scroll progress

View File

@ -2,6 +2,8 @@
> at /druid/extended/hotkey.lua > at /druid/extended/hotkey.lua
The component used for managing hotkeys and trigger callbacks when hotkeys are pressed
## Functions ## Functions
- [init](#init) - [init](#init)
@ -59,7 +61,7 @@ Add hotkey for component callback
- `[callback_argument]` *(any)*: The argument to pass into the callback function - `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:** - **Returns:**
- `Current` *(druid.hotkey)*: instance - `self` *(druid.hotkey)*: Current instance
### is_processing ### is_processing
@ -86,11 +88,11 @@ hotkey:on_input([action_id], action)
``` ```
- **Parameters:** - **Parameters:**
- `[action_id]` *(hash|nil)*: - `[action_id]` *(hash|nil)*: The action id
- `action` *(action)*: - `action` *(action)*: The action
- **Returns:** - **Returns:**
- `` *(boolean)*: - `is_consume` *(boolean)*: True if the action is consumed
### set_repeat ### set_repeat
@ -102,22 +104,22 @@ hotkey:set_repeat(is_enabled_repeated)
If true, the callback will be triggered on action.repeated If true, the callback will be triggered on action.repeated
- **Parameters:** - **Parameters:**
- `is_enabled_repeated` *(bool)*: The flag value - `is_enabled_repeated` *(boolean)*: The flag value
- **Returns:** - **Returns:**
- `` *(druid.hotkey)*: - `self` *(druid.hotkey)*: Current instance
## Fields ## Fields
<a name="on_hotkey_pressed"></a> <a name="on_hotkey_pressed"></a>
- **on_hotkey_pressed** (_event_) - **on_hotkey_pressed** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is pressed
<a name="on_hotkey_released"></a> <a name="on_hotkey_released"></a>
- **on_hotkey_released** (_event_) - **on_hotkey_released** (_event_): fun(self, context, callback_argument) The event triggered when a hotkey is released
<a name="style"></a> <a name="style"></a>
- **style** (_druid.hotkey.style_) - **style** (_druid.hotkey.style_): The style of the hotkey component
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components

View File

@ -2,11 +2,11 @@
> at /druid/extended/input.lua > at /druid/extended/input.lua
The component used for managing input fields in basic way
## Functions ## Functions
- [init](#init) - [init](#init)
- [on_style_change](#on_style_change)
- [on_input](#on_input)
- [on_focus_lost](#on_focus_lost) - [on_focus_lost](#on_focus_lost)
- [on_input_interrupt](#on_input_interrupt) - [on_input_interrupt](#on_input_interrupt)
- [get_text_selected](#get_text_selected) - [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 - `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 - `[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 ### on_focus_lost
--- ---
@ -127,7 +103,7 @@ Replace selected text with new text
- `text` *(string)*: The text to replace selected text - `text` *(string)*: The text to replace selected text
- **Returns:** - **Returns:**
- `New` *(string)*: input text - `new_text` *(string)*: New input text
### set_text ### set_text
@ -169,7 +145,7 @@ input:get_text()
Return current input field text Return current input field text
- **Returns:** - **Returns:**
- `The` *(string)*: current input field text - `text` *(string)*: The current input field text
### set_max_length ### set_max_length
@ -185,7 +161,7 @@ Set maximum length for input field.
- `max_length` *(number)*: Maximum length for input text field - `max_length` *(number)*: Maximum length for input text field
- **Returns:** - **Returns:**
- `Current` *(druid.input)*: input instance - `self` *(druid.input)*: Current input instance
### set_allowed_characters ### set_allowed_characters
@ -202,7 +178,7 @@ Set allowed charaters for input field.
- `characters` *(string)*: Regulax exp. for validate user input - `characters` *(string)*: Regulax exp. for validate user input
- **Returns:** - **Returns:**
- `Current` *(druid.input)*: input instance - `self` *(druid.input)*: Current input instance
### reset_changes ### reset_changes
@ -214,7 +190,7 @@ input:reset_changes()
Reset current input selection and return previous value Reset current input selection and return previous value
- **Returns:** - **Returns:**
- `Current` *(druid.input)*: input instance - `self` *(druid.input)*: Current input instance
### select_cursor ### 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 - `[end_index]` *(number|nil)*: End index for cursor position, if nil - will be set to the start_index
- **Returns:** - **Returns:**
- `Current` *(druid.input)*: input instance - `self` *(druid.input)*: Current input instance
### move_selection ### move_selection
@ -247,40 +223,43 @@ Change cursor position by delta
- `is_add_to_selection` *(boolean)*: (Shift key) - `is_add_to_selection` *(boolean)*: (Shift key)
- `is_move_to_end` *(boolean)*: (Ctrl key) - `is_move_to_end` *(boolean)*: (Ctrl key)
- **Returns:**
- `self` *(druid.input)*: Current input instance
## Fields ## Fields
<a name="on_input_select"></a> <a name="on_input_select"></a>
- **on_input_select** (_event_) - **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> <a name="on_input_unselect"></a>
- **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
<a name="on_input_text"></a> <a name="on_input_text"></a>
- **on_input_text** (_event_) - **on_input_text** (_event_): fun(self: druid.input) The event triggered when the input field is changed
<a name="on_input_empty"></a> <a name="on_input_empty"></a>
- **on_input_empty** (_event_) - **on_input_empty** (_event_): fun(self: druid.input) The event triggered when the input field is empty
<a name="on_input_full"></a> <a name="on_input_full"></a>
- **on_input_full** (_event_) - **on_input_full** (_event_): fun(self: druid.input) The event triggered when the input field is full
<a name="on_input_wrong"></a> <a name="on_input_wrong"></a>
- **on_input_wrong** (_event_) - **on_input_wrong** (_event_): fun(self: druid.input) The event triggered when the input field is wrong
<a name="on_select_cursor_change"></a> <a name="on_select_cursor_change"></a>
- **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
<a name="style"></a> <a name="style"></a>
- **style** (_table_) - **style** (_druid.input.style_): The style of the input component
<a name="text"></a> <a name="text"></a>
- **text** (_druid.text_) - **text** (_druid.text_): The text component
<a name="ALLOWED_ACTIONS"></a> <a name="ALLOWED_ACTIONS"></a>
- **ALLOWED_ACTIONS** (_table_) - **ALLOWED_ACTIONS** (_table_)
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components
<a name="is_selected"></a> <a name="is_selected"></a>
- **is_selected** (_boolean_) - **is_selected** (_boolean_)

View File

@ -2,6 +2,8 @@
> at /druid/extended/lang_text.lua > at /druid/extended/lang_text.lua
The component used for displaying localized text, can automatically update text when locale is changed
## Functions ## Functions
- [init](#init) - [init](#init)
@ -55,7 +57,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node - `text` *(string)*: Text for text node
- **Returns:** - **Returns:**
- `Current` *(druid.lang_text)*: instance - `self` *(druid.lang_text)*: Current instance
### set_text ### set_text
@ -70,7 +72,7 @@ Setup raw text to lang_text component
- `text` *(string)*: Text for text node - `text` *(string)*: Text for text node
- **Returns:** - **Returns:**
- `Current` *(druid.lang_text)*: instance - `self` *(druid.lang_text)*: Current instance
### translate ### translate
@ -86,7 +88,7 @@ Translate the text by locale_id
- `...` *(...)*: vararg - `...` *(...)*: vararg
- **Returns:** - **Returns:**
- `Current` *(druid.lang_text)*: instance - `self` *(druid.lang_text)*: Current instance
### format ### format
@ -101,19 +103,19 @@ Format string with new text params on localized text
- `...` *(...)*: vararg - `...` *(...)*: vararg
- **Returns:** - **Returns:**
- `Current` *(druid.lang_text)*: instance - `self` *(druid.lang_text)*: Current instance
## Fields ## Fields
<a name="text"></a> <a name="text"></a>
- **text** (_druid.text_) - **text** (_druid.text_): The text component
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The node of the text component
<a name="on_change"></a> <a name="on_change"></a>
- **on_change** (_event_) - **on_change** (_event_): The event triggered when the text is changed
<a name="druid"></a> <a name="druid"></a>
- **druid** (_druid.instance_) - **druid** (_druid.instance_): The Druid Factory used to create components

View File

@ -2,6 +2,8 @@
> at /druid/extended/layout.lua > 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 ## Functions
- [init](#init) - [init](#init)
@ -57,7 +59,7 @@ layout_type:
- **Parameters:** - **Parameters:**
- `node_or_node_id` *(string|node)*: - `node_or_node_id` *(string|node)*:
- `layout_type` *(druid.layout.mode)*: - `layout_type` *("horizontal"|"horizontal_wrap"|"vertical")*:
### update ### update
@ -74,18 +76,21 @@ layout:get_entities()
``` ```
- **Returns:** - **Returns:**
- `` *(node[])*: - `entities` *(node[])*: The entities to manage the layout of
### set_node_index ### set_node_index
--- ---
```lua ```lua
layout:set_node_index([node], [index]) layout:set_node_index(node, index)
``` ```
- **Parameters:** - **Parameters:**
- `[node]` *(any)*: - `node` *(node)*: The node to set the index of
- `[index]` *(any)*: - `index` *(number)*: The index to set the node to
- **Returns:**
- `self` *(druid.layout)*: for chaining
### set_margin ### set_margin
@ -94,12 +99,14 @@ layout:set_node_index([node], [index])
layout:set_margin([margin_x], [margin_y]) layout:set_margin([margin_x], [margin_y])
``` ```
Set the margin of the layout
- **Parameters:** - **Parameters:**
- `[margin_x]` *(number|nil)*: - `[margin_x]` *(number|nil)*: The margin x
- `[margin_y]` *(number|nil)*: - `[margin_y]` *(number|nil)*: The margin y
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### set_padding ### set_padding
@ -109,13 +116,13 @@ layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
``` ```
- **Parameters:** - **Parameters:**
- `[padding_x]` *(number|nil)*: - `[padding_x]` *(number|nil)*: The padding x
- `[padding_y]` *(number|nil)*: - `[padding_y]` *(number|nil)*: The padding y
- `[padding_z]` *(number|nil)*: - `[padding_z]` *(number|nil)*: The padding z
- `[padding_w]` *(number|nil)*: - `[padding_w]` *(number|nil)*: The padding w
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### set_dirty ### set_dirty
@ -125,7 +132,7 @@ layout:set_dirty()
``` ```
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### set_justify ### set_justify
@ -138,7 +145,7 @@ layout:set_justify(is_justify)
- `is_justify` *(boolean)*: - `is_justify` *(boolean)*:
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### set_type ### set_type
@ -151,7 +158,7 @@ layout:set_type(type)
- `type` *(string)*: The layout type: "horizontal", "vertical", "horizontal_wrap" - `type` *(string)*: The layout type: "horizontal", "vertical", "horizontal_wrap"
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### set_hug_content ### set_hug_content
@ -165,7 +172,7 @@ layout:set_hug_content(is_hug_width, is_hug_height)
- `is_hug_height` *(boolean)*: - `is_hug_height` *(boolean)*:
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### add ### add
@ -180,7 +187,7 @@ Add node to layout
- `node_or_node_id` *(string|node)*: node_or_node_id - `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### remove ### remove
@ -226,7 +233,7 @@ layout:refresh_layout()
``` ```
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### clear_layout ### clear_layout
@ -236,7 +243,7 @@ layout:clear_layout()
``` ```
- **Returns:** - **Returns:**
- `` *(druid.layout)*: - `self` *(druid.layout)*: Current layout instance
### get_node_size ### get_node_size
@ -249,8 +256,8 @@ layout:get_node_size(node)
- `node` *(node)*: - `node` *(node)*:
- **Returns:** - **Returns:**
- `` *(number)*: - `width` *(number)*: The width of the node
- `` *(number)*: - `height` *(number)*: The height of the node
### calculate_rows_data ### calculate_rows_data
@ -282,7 +289,7 @@ layout:set_node_position(node, x, y)
## Fields ## Fields
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The node to manage the layout of
<a name="rows_data"></a> <a name="rows_data"></a>
- **rows_data** (_druid.layout.rows_data_): Last calculated rows data - **rows_data** (_druid.layout.rows_data_): Last calculated rows data
@ -291,28 +298,28 @@ layout:set_node_position(node, x, y)
- **is_dirty** (_boolean_) - **is_dirty** (_boolean_)
<a name="entities"></a> <a name="entities"></a>
- **entities** (_node[]_) - **entities** (_node[]_): The entities to manage the layout of
<a name="margin"></a> <a name="margin"></a>
- **margin** (_{ x: number, y: number }_) - **margin** (_{ x: number, y: number }_): The margin of the layout
<a name="padding"></a> <a name="padding"></a>
- **padding** (_vector4_) - **padding** (_vector4_): The padding of the layout
<a name="type"></a> <a name="type"></a>
- **type** (_string_) - **type** (_string_): The type of the layout
<a name="is_resize_width"></a> <a name="is_resize_width"></a>
- **is_resize_width** (_boolean_) - **is_resize_width** (_boolean_): True if the layout should resize the width of the node
<a name="is_resize_height"></a> <a name="is_resize_height"></a>
- **is_resize_height** (_boolean_) - **is_resize_height** (_boolean_): True if the layout should resize the height of the node
<a name="is_justify"></a> <a name="is_justify"></a>
- **is_justify** (_boolean_) - **is_justify** (_boolean_): True if the layout should justify the nodes
<a name="on_size_changed"></a> <a name="on_size_changed"></a>
- **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
<a name="size"></a> <a name="size"></a>
- **size** (_unknown_) - **size** (_unknown_)

View File

@ -2,6 +2,8 @@
> at /druid/extended/progress.lua > 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 ## Functions
- [init](#init) - [init](#init)
@ -46,7 +48,7 @@ progress:init(node, key, [init_value])
- **Parameters:** - **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself. - `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 - `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
### on_style_change ### on_style_change
@ -90,7 +92,10 @@ progress:update(dt)
progress:fill() progress:fill()
``` ```
Fill a progress bar and stop progress animation Fill the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### empty ### empty
@ -99,7 +104,10 @@ Fill a progress bar and stop progress animation
progress:empty() progress:empty()
``` ```
Empty a progress bar Empty the progress bar
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_to ### set_to
@ -113,6 +121,9 @@ Instant fill progress bar to value
- **Parameters:** - **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1 - `to` *(number)*: Progress bar value, from 0 to 1
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### get ### get
--- ---
@ -120,10 +131,10 @@ Instant fill progress bar to value
progress:get() progress:get()
``` ```
Return current progress bar value Return the current value of the progress bar
- **Returns:** - **Returns:**
- `` *(number)*: - `value` *(number)*: The current value of the progress bar
### set_steps ### set_steps
@ -138,6 +149,9 @@ Set points on progress bar to fire the callback
- `steps` *(number[])*: Array of progress bar values - `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value - `callback` *(function)*: Callback on intersect step value
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### to ### to
--- ---
@ -151,6 +165,9 @@ Start animation of a progress bar
- `to` *(number)*: value between 0..1 - `to` *(number)*: value between 0..1
- `[callback]` *(function|nil)*: Callback on animation ends - `[callback]` *(function|nil)*: Callback on animation ends
- **Returns:**
- `self` *(druid.progress)*: Current progress instance
### set_max_size ### set_max_size
--- ---
@ -164,7 +181,7 @@ Set progress bar max node size
- `max_size` *(vector3)*: The new node maximum (full) size - `max_size` *(vector3)*: The new node maximum (full) size
- **Returns:** - **Returns:**
- `Progress` *(druid.progress)*: - `self` *(druid.progress)*: Current progress instance
## Fields ## Fields

View File

@ -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 ## Functions
- [init](#init) - [init](#init)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change) - [on_layout_change](#on_layout_change)
- [on_remove](#on_remove) - [on_remove](#on_remove)
- [update](#update) - [on_window_resized](#on_window_resized)
- [fill](#fill) - [on_input](#on_input)
- [empty](#empty) - [set](#set)
- [set_to](#set_to)
- [get](#get)
- [set_steps](#set_steps) - [set_steps](#set_steps)
- [to](#to) - [set_input_node](#set_input_node)
- [set_max_size](#set_max_size) - [set_enabled](#set_enabled)
- [is_enabled](#is_enabled)
## Fields ## Fields
- [node](#node) - [node](#node)
- [on_change](#on_change) - [on_change_value](#on_change_value)
- [style](#style) - [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 ```lua
progress:init(node, key, [init_value]) slider:init(node, end_pos, [callback])
``` ```
- **Parameters:** The Slider constructor
- `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)
```
- **Parameters:** - **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 ### on_layout_change
--- ---
```lua ```lua
progress:on_layout_change() slider:on_layout_change()
``` ```
### on_remove ### on_remove
--- ---
```lua ```lua
progress:on_remove() slider:on_remove()
``` ```
### update ### on_window_resized
--- ---
```lua ```lua
progress:update(dt) slider:on_window_resized()
```
### on_input
---
```lua
slider:on_input(action_id, action)
``` ```
- **Parameters:** - **Parameters:**
- `dt` *(number)*: Delta time - `action_id` *(number)*: The action id
- `action` *(action)*: The action table
### 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
- **Returns:** - **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 ### set_steps
--- ---
```lua ```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:** - **Parameters:**
- `steps` *(number[])*: Array of progress bar values - `steps` *(number[])*: Array of steps
- `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
- **Returns:** - **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 ## Fields
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The node to manage the slider
<a name="on_change"></a> <a name="on_change_value"></a>
- **on_change** (_event_) - **on_change_value** (_event_): The event triggered when the slider value changes
<a name="style"></a> <a name="style"></a>
- **style** (_druid.progress.style_) - **style** (_table_): The style of the slider
<a name="key"></a>
- **key** (_string_)
<a name="prop"></a>
- **prop** (_hash_)
<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

@ -2,13 +2,11 @@
> at /druid/extended/swipe.lua > at /druid/extended/swipe.lua
The component to manage swipe events over a node
## Functions ## Functions
- [init](#init) - [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) - [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)*: - `node_or_node_id` *(string|node)*:
- `on_swipe_callback` *(function)*: - `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 ### set_click_zone
--- ---
@ -76,8 +36,7 @@ swipe:on_input_interrupt()
swipe:set_click_zone([zone]) swipe:set_click_zone([zone])
``` ```
Strict swipe click area. Useful for Set the click zone for the swipe, useful for restricting events outside stencil node
restrict events outside stencil node
- **Parameters:** - **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node - `[zone]` *(string|node|nil)*: Gui node
@ -85,14 +44,14 @@ restrict events outside stencil node
## Fields ## Fields
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The node to manage the swipe
<a name="on_swipe"></a> <a name="on_swipe"></a>
- **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
<a name="style"></a> <a name="style"></a>
- **style** (_table_) - **style** (_druid.swipe.style_): The style of the swipe
<a name="click_zone"></a> <a name="click_zone"></a>
- **click_zone** (_node_) - **click_zone** (_node_): The click zone of the swipe

View File

@ -2,11 +2,11 @@
> at /druid/extended/timer.lua > at /druid/extended/timer.lua
The component that handles a text to display a seconds timer
## Functions ## Functions
- [init](#init) - [init](#init)
- [update](#update)
- [on_layout_change](#on_layout_change)
- [set_to](#set_to) - [set_to](#set_to)
- [set_state](#set_state) - [set_state](#set_state)
- [set_interval](#set_interval) - [set_interval](#set_interval)
@ -42,23 +42,6 @@ timer:init(node, [seconds_from], [seconds_to], [callback])
- **Returns:** - **Returns:**
- `` *(druid.timer)*: - `` *(druid.timer)*:
### update
---
```lua
timer:update([dt])
```
- **Parameters:**
- `[dt]` *(any)*:
### on_layout_change
---
```lua
timer:on_layout_change()
```
### set_to ### set_to
--- ---
@ -66,11 +49,13 @@ timer:on_layout_change()
timer:set_to(set_to) timer:set_to(set_to)
``` ```
Set the timer to a specific value
- **Parameters:** - **Parameters:**
- `set_to` *(number)*: Value in seconds - `set_to` *(number)*: Value in seconds
- **Returns:** - **Returns:**
- `self` *(druid.timer)*: - `self` *(druid.timer)*: Current timer instance
### set_state ### set_state
@ -79,11 +64,13 @@ timer:set_to(set_to)
timer:set_state([is_on]) timer:set_state([is_on])
``` ```
Set the timer to a specific value
- **Parameters:** - **Parameters:**
- `[is_on]` *(boolean|nil)*: Timer enable state - `[is_on]` *(boolean|nil)*: Timer enable state
- **Returns:** - **Returns:**
- `self` *(druid.timer)*: - `self` *(druid.timer)*: Current timer instance
### set_interval ### set_interval
@ -92,38 +79,40 @@ timer:set_state([is_on])
timer:set_interval(from, to) timer:set_interval(from, to)
``` ```
Set the timer interval
- **Parameters:** - **Parameters:**
- `from` *(number)*: Start time in seconds - `from` *(number)*: Start time in seconds
- `to` *(number)*: Target time in seconds - `to` *(number)*: Target time in seconds
- **Returns:** - **Returns:**
- `self` *(druid.timer)*: - `self` *(druid.timer)*: Current timer instance
## Fields ## Fields
<a name="on_tick"></a> <a name="on_tick"></a>
- **on_tick** (_event_) - **on_tick** (_event_): fun(context, value) The event triggered when the timer ticks
<a name="on_set_enabled"></a> <a name="on_set_enabled"></a>
- **on_set_enabled** (_event_) - **on_set_enabled** (_event_): fun(context, is_on) The event triggered when the timer is enabled
<a name="on_timer_end"></a> <a name="on_timer_end"></a>
- **on_timer_end** (_event_) - **on_timer_end** (_event_): fun(context) The event triggered when the timer ends
<a name="node"></a> <a name="node"></a>
- **node** (_node_) - **node** (_node_): The node to display the timer
<a name="from"></a> <a name="from"></a>
- **from** (_number_) - **from** (_number_): The start time of the timer
<a name="target"></a> <a name="target"></a>
- **target** (_number_) - **target** (_number_): The target time of the timer
<a name="value"></a> <a name="value"></a>
- **value** (_number_) - **value** (_number_): The current value of the timer
<a name="is_on"></a> <a name="is_on"></a>
- **is_on** (_boolean_) - **is_on** (_boolean_): True if the timer is on
<a name="temp"></a> <a name="temp"></a>
- **temp** (_unknown_) - **temp** (_unknown_)

View File

@ -37,6 +37,7 @@ You can use these functions in your projects as well.
- [insert_with_shift](#insert_with_shift) - [insert_with_shift](#insert_with_shift)
- [remove_with_shift](#remove_with_shift) - [remove_with_shift](#remove_with_shift)
- [get_full_position](#get_full_position) - [get_full_position](#get_full_position)
- [get_animation_data_from_node](#get_animation_data_from_node)
## Fields ## Fields
@ -516,3 +517,32 @@ Get full position of node in the GUI tree
- **Returns:** - **Returns:**
- `` *(unknown)*: - `` *(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
<a name="PROP_SIZE_X"></a>
- **PROP_SIZE_X** (_unknown_)
<a name="PROP_SIZE_Y"></a>
- **PROP_SIZE_Y** (_unknown_)
<a name="PROP_SCALE_X"></a>
- **PROP_SCALE_X** (_unknown_)
<a name="PROP_SCALE_Y"></a>
- **PROP_SCALE_Y** (_unknown_)

View File

@ -2,13 +2,19 @@
> at /druid/system/druid_instance.lua > at /druid/system/druid_instance.lua
The Druid Factory used to create components
## Functions ## Functions
- [create_druid_instance](#create_druid_instance)
- [new](#new) - [new](#new)
- [final](#final) - [final](#final)
- [remove](#remove) - [remove](#remove)
- [update](#update) - [update](#update)
- [on_input](#on_input) - [on_input](#on_input)
- [on_message](#on_message) - [on_message](#on_message)
- [on_window_event](#on_window_event)
- [set_whitelist](#set_whitelist) - [set_whitelist](#set_whitelist)
- [set_blacklist](#set_blacklist) - [set_blacklist](#set_blacklist)
- [new_widget](#new_widget) - [new_widget](#new_widget)
@ -34,6 +40,12 @@
- [new_rich_input](#new_rich_input) - [new_rich_input](#new_rich_input)
## Fields
- [components_all](#components_all)
- [components_interest](#components_interest)
### create_druid_instance ### create_druid_instance
--- ---
@ -60,11 +72,11 @@ instance:new(component, ...)
Create new Druid component instance Create new Druid component instance
- **Parameters:** - **Parameters:**
- `component` *(<T:druid.component>)*: - `component` *(<T:druid.component>)*: The component class to create
- `...` *(...)*: vararg - `...` *(...)*: vararg
- **Returns:** - **Returns:**
- `` *(<T:druid.component>)*: - `instance` *(<T:druid.component>)*: The new ready to use component
### final ### final
@ -89,7 +101,7 @@ Remove created component from Druid instance.
- `component` *(<T:druid.component>)*: Component instance - `component` *(<T:druid.component>)*: Component instance
- **Returns:** - **Returns:**
- `True` *(boolean)*: if component was removed - `is_removed` *(boolean)*: True if component was removed
### update ### update
@ -117,7 +129,7 @@ Call this in gui_script on_input function.
- `action` *(table)*: Action from on_input - `action` *(table)*: Action from on_input
- **Returns:** - **Returns:**
- `The` *(boolean)*: boolean value is input was consumed - `is_input_consumed` *(boolean)*: The boolean value is input was consumed
### on_message ### on_message
@ -137,11 +149,13 @@ Call this in gui_script on_message function.
--- ---
```lua ```lua
instance:on_window_event([window_event]) instance:on_window_event(window_event)
``` ```
Called when the window event occurs
- **Parameters:** - **Parameters:**
- `[window_event]` *(any)*: - `window_event` *(number)*: The window event
### set_whitelist ### 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 - `whitelist_components` *(table|druid.component[])*: The array of component to whitelist
- **Returns:** - **Returns:**
- `` *(druid.instance)*: - `self` *(druid.instance)*: The Druid instance
### set_blacklist ### 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 - `blacklist_components` *(table|druid.component[])*: The array of component to blacklist
- **Returns:** - **Returns:**
- `` *(druid.instance)*: - `self` *(druid.instance)*: The Druid instance
### new_widget ### new_widget
@ -187,13 +201,13 @@ instance:new_widget(widget, [template], [nodes], ...)
Create new Druid widget instance Create new Druid widget instance
- **Parameters:** - **Parameters:**
- `widget` *(<T:druid.component>)*: - `widget` *(<T:druid.component>)*: The widget class to create
- `[template]` *(string|nil)*: The template name used by widget - `[template]` *(string|nil)*: The template name used by widget
- `[nodes]` *(node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone - `[nodes]` *(node|table<hash, node>|nil)*: The nodes table from gui.clone_tree or prefab node to use for clone
- `...` *(...)*: vararg - `...` *(...)*: vararg
- **Returns:** - **Returns:**
- `` *(<T:druid.component>)*: - `widget` *(<T:druid.component>)*: The new ready to use widget
### new_button ### new_button
@ -211,7 +225,7 @@ Create Button component
- `[anim_node]` *(string|node|nil)*: Button anim node (node, if not provided) - `[anim_node]` *(string|node|nil)*: Button anim node (node, if not provided)
- **Returns:** - **Returns:**
- `Button` *(druid.button)*: component - `button` *(druid.button)*: The new button component
### new_blocker ### new_blocker
@ -226,7 +240,7 @@ Create Blocker component
- `node` *(string|node)*: The node_id or gui.get_node(node_id) - `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:** - **Returns:**
- `component` *(druid.blocker)*: Blocker component - `blocker` *(druid.blocker)*: The new blocker component
### new_back_handler ### new_back_handler
@ -242,7 +256,7 @@ Create BackHandler component
- `[params]` *(any)*: Callback argument - `[params]` *(any)*: Callback argument
- **Returns:** - **Returns:**
- `component` *(druid.back_handler)*: BackHandler component - `back_handler` *(druid.back_handler)*: The new back handler component
### new_hover ### new_hover
@ -259,7 +273,7 @@ Create Hover component
- `[on_mouse_hover_callback]` *(function|nil)*: Mouse hover callback - `[on_mouse_hover_callback]` *(function|nil)*: Mouse hover callback
- **Returns:** - **Returns:**
- `component` *(druid.hover)*: Hover component - `hover` *(druid.hover)*: The new hover component
### new_text ### 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 - `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
- **Returns:** - **Returns:**
- `component` *(druid.text)*: Text component - `text` *(druid.text)*: The new text component
### new_grid ### new_grid
@ -293,7 +307,7 @@ Create Grid component
- `[in_row]` *(number|nil)*: How many nodes in row can be placed - `[in_row]` *(number|nil)*: How many nodes in row can be placed
- **Returns:** - **Returns:**
- `component` *(druid.grid)*: Grid component - `grid` *(druid.grid)*: The new grid component
### new_scroll ### 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. - `content_node` *(string|node)*: The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node.
- **Returns:** - **Returns:**
- `component` *(druid.scroll)*: Scroll component - `scroll` *(druid.scroll)*: The new scroll component
### new_drag ### new_drag
@ -325,7 +339,7 @@ Create Drag component
- `[on_drag_callback]` *(function|nil)*: Callback for on_drag_event(self, dx, dy) - `[on_drag_callback]` *(function|nil)*: Callback for on_drag_event(self, dx, dy)
- **Returns:** - **Returns:**
- `component` *(druid.drag)*: Drag component - `drag` *(druid.drag)*: The new drag component
### new_swipe ### new_swipe
@ -341,7 +355,7 @@ Create Swipe component
- `[on_swipe_callback]` *(function|nil)*: Swipe callback for on_swipe_end event - `[on_swipe_callback]` *(function|nil)*: Swipe callback for on_swipe_end event
- **Returns:** - **Returns:**
- `component` *(druid.swipe)*: Swipe component - `swipe` *(druid.swipe)*: The new swipe component
### new_lang_text ### new_lang_text
@ -358,7 +372,7 @@ Create LangText component
- `[adjust_type]` *(string|nil)*: Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE - `[adjust_type]` *(string|nil)*: Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE
- **Returns:** - **Returns:**
- `component` *(druid.lang_text)*: LangText component - `lang_text` *(druid.lang_text)*: The new lang text component
### new_slider ### new_slider
@ -375,7 +389,7 @@ Create Slider component
- `[callback]` *(function|nil)*: On slider change callback - `[callback]` *(function|nil)*: On slider change callback
- **Returns:** - **Returns:**
- `component` *(druid.slider)*: Slider component - `slider` *(druid.slider)*: The new slider component
### new_input ### new_input
@ -392,7 +406,7 @@ Create Input component
- `[keyboard_type]` *(number|nil)*: Gui keyboard type for input field - `[keyboard_type]` *(number|nil)*: Gui keyboard type for input field
- **Returns:** - **Returns:**
- `component` *(druid.input)*: Input component - `input` *(druid.input)*: The new input component
### new_data_list ### 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]) - `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
- **Returns:** - **Returns:**
- `component` *(druid.data_list)*: DataList component - `data_list` *(druid.data_list)*: The new data list component
### new_timer ### new_timer
@ -427,7 +441,7 @@ Create Timer component
- `[callback]` *(function|nil)*: Function on timer end - `[callback]` *(function|nil)*: Function on timer end
- **Returns:** - **Returns:**
- `component` *(druid.timer)*: Timer component - `timer` *(druid.timer)*: The new timer component
### new_progress ### new_progress
@ -444,7 +458,7 @@ Create Progress component
- `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1 - `[init_value]` *(number|nil)*: Initial value of progress bar. Default: 1
- **Returns:** - **Returns:**
- `component` *(druid.progress)*: Progress component - `progress` *(druid.progress)*: The new progress component
### new_layout ### new_layout
@ -460,7 +474,7 @@ Create Layout component
- `[mode]` *(string|nil)*: vertical|horizontal|horizontal_wrap. Default: horizontal - `[mode]` *(string|nil)*: vertical|horizontal|horizontal_wrap. Default: horizontal
- **Returns:** - **Returns:**
- `component` *(druid.layout)*: Layout component - `layout` *(druid.layout)*: The new layout component
### new_container ### new_container
@ -477,7 +491,7 @@ Create Container component
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed - `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
- **Returns:** - **Returns:**
- `container` *(druid.container)*: component - `container` *(druid.container)*: The new container component
### new_hotkey ### new_hotkey
@ -490,11 +504,11 @@ Create Hotkey component
- **Parameters:** - **Parameters:**
- `keys_array` *(string|string[])*: Keys for trigger action. Should contains one action key and any amount of modificator keys - `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 - `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:** - **Returns:**
- `component` *(druid.hotkey)*: Hotkey component - `hotkey` *(druid.hotkey)*: The new hotkey component
### new_rich_text ### 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) - `[value]` *(string|nil)*: The initial text value. Default will be gui.get_text(text_node)
- **Returns:** - **Returns:**
- `component` *(druid.rich_text)*: RichText component - `rich_text` *(druid.rich_text)*: The new rich text component
### new_rich_input ### new_rich_input
@ -527,4 +541,13 @@ Create RichInput component.
- `[nodes]` *(table|nil)*: Nodes table from gui.clone_tree - `[nodes]` *(table|nil)*: Nodes table from gui.clone_tree
- **Returns:** - **Returns:**
- `component` *(druid.rich_input)*: RichInput component - `rich_input` *(druid.rich_input)*: The new rich input component
## Fields
<a name="components_all"></a>
- **components_all** (_druid.component[]_): All created components
<a name="components_interest"></a>
- **components_interest** (_table<string, druid.component[]>_): All components sorted by interest

View File

@ -223,6 +223,8 @@ function M:on_input(action_id, action)
return true return true
end end
end end
return false
end end

View File

@ -1,3 +1,4 @@
---@diagnostic disable: inject-field
-- Source: https://github.com/britzl/defold-richtext version 5.19.0 -- Source: https://github.com/britzl/defold-richtext version 5.19.0
-- Author: Britzl -- Author: Britzl
-- Modified by: Insality -- Modified by: Insality

View File

@ -27,10 +27,10 @@ end
---Split string at first occurrence of token ---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 ---@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? 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? after The string after the token or nil
local function split(s, token) local function split(s, token)
if not s then return nil, nil end if not s then return nil, nil end
local before, after = s:match("(.-)" .. token .. "(.*)") local before, after = s:match("(.-)" .. token .. "(.*)")

View File

@ -41,6 +41,7 @@ local rich_text = require("druid.custom.rich_text.module.rt")
---@field image druid.rich_text.word.image ---@field image druid.rich_text.word.image
---@field br boolean ---@field br boolean
---@field nobr boolean ---@field nobr boolean
---@field tags table<string, boolean>
---@class druid.rich_text.word.image ---@class druid.rich_text.word.image
---@field texture string ---@field texture string

View File

@ -63,6 +63,7 @@ function M:add_hotkey(keys, callback_argument)
local modificators = {} local modificators = {}
local key = nil local key = nil
---@cast keys string[]
for index = 1, #keys do for index = 1, #keys do
local key_hash = hash(keys[index]) local key_hash = hash(keys[index])
if #keys > 1 and helper.contains(self.style.MODIFICATORS, key_hash) then 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 -- Current hotkey status
for index = 1, #self.style.MODIFICATORS do local mods = self.style.MODIFICATORS ---@type string[]
local modificator = hash(self.style.MODIFICATORS[index]) for index = 1, #mods do
local modificator = hash(mods[index])
self._modificators[modificator] = self._modificators[modificator] or false self._modificators[modificator] = self._modificators[modificator] or false
end end

View File

@ -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_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 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 style druid.input.style The style of the input component
---@field text druid.text The text component
local M = component.create("input") local M = component.create("input")
---@private
M.ALLOWED_ACTIONS = { M.ALLOWED_ACTIONS = {
[const.ACTION_TOUCH] = true, [const.ACTION_TOUCH] = true,
[const.ACTION_TEXT] = true, [const.ACTION_TEXT] = true,
@ -61,7 +61,7 @@ end
---@param click_node node Node to enabled input component ---@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 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) function M:init(click_node, text_node, keyboard_type)
self.druid = self:get_druid() self.druid = self:get_druid()
@ -269,7 +269,7 @@ end
---Set text for input field ---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) function M:set_text(input_text)
input_text = tostring(input_text or "") input_text = tostring(input_text or "")
@ -370,7 +370,7 @@ end
---Set maximum length for input field. ---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 ---@param max_length number Maximum length for input text field
---@return druid.input self Current input instance ---@return druid.input self Current input instance
function M:set_max_length(max_length) function M:set_max_length(max_length)
@ -380,9 +380,11 @@ end
---Set allowed charaters for input field. ---Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/ ---See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric ---ex: [%a%d] for alpha and numeric
---@param characters string Regulax exp. for validate user input ---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 ---@return druid.input self Current input instance
function M:set_allowed_characters(characters) function M:set_allowed_characters(characters)
self.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 end
self:select_cursor(cursor_index, start_index, end_index) self:select_cursor(cursor_index, start_index, end_index)
return self
end end

View File

@ -49,6 +49,7 @@
---@field screen_dy number The change in screen space y value of a pointer device, if present. ---@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 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 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 ---@class touch
---@field id number A number identifying the touch input during its duration. ---@field id number A number identifying the touch input during its duration.

View File

@ -558,7 +558,7 @@ end
local text = require("druid.base.text") local text = require("druid.base.text")
---Create Text component ---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 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 ---@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 ---@return druid.text text The new text component

View File

@ -1,5 +1,5 @@
[bootstrap] [bootstrap]
main_collection = /example/druid.collectionc main_collection = /example/other/go_bindings/go_bindings.collectionc
[script] [script]
shared_state = 1 shared_state = 1