Test new markdown api generator

This commit is contained in:
Insality
2025-03-14 20:29:05 +02:00
parent 11aeb377c2
commit b30cf9109e
74 changed files with 5581 additions and 2656 deletions

View File

@@ -0,0 +1,382 @@
# druid.container API
> at /druid/extended/container.lua
## Functions
- [init](#init)
- [on_late_init](#on_late_init)
- [on_remove](#on_remove)
- [refresh_origins](#refresh_origins)
- [set_pivot](#set_pivot)
- [on_style_change](#on_style_change)
- [set_size](#set_size)
- [get_position](#get_position)
- [set_position](#set_position)
- [get_size](#get_size)
- [get_scale](#get_scale)
- [fit_into_size](#fit_into_size)
- [fit_into_window](#fit_into_window)
- [on_window_resized](#on_window_resized)
- [add_container](#add_container)
- [remove_container_by_node](#remove_container_by_node)
- [set_parent_container](#set_parent_container)
- [refresh](#refresh)
- [refresh_scale](#refresh_scale)
- [update_child_containers](#update_child_containers)
- [create_draggable_corners](#create_draggable_corners)
- [clear_draggable_corners](#clear_draggable_corners)
- [fit_into_node](#fit_into_node)
- [set_min_size](#set_min_size)
## Fields
- [node](#node)
- [druid](#druid)
- [node_offset](#node_offset)
- [origin_size](#origin_size)
- [size](#size)
- [origin_position](#origin_position)
- [position](#position)
- [pivot_offset](#pivot_offset)
- [center_offset](#center_offset)
- [mode](#mode)
- [fit_size](#fit_size)
- [min_size_x](#min_size_x)
- [min_size_y](#min_size_y)
- [on_size_changed](#on_size_changed)
- [node_fill_x](#node_fill_x)
- [node_fill_y](#node_fill_y)
- [x_koef](#x_koef)
- [y_koef](#y_koef)
- [x_anchor](#x_anchor)
- [y_anchor](#y_anchor)
- [style](#style)
### init
---
```lua
container:init(node, mode, [callback])
```
- **Parameters:**
- `node` *(node)*: Gui node
- `mode` *(string)*: Layout mode
- `[callback]` *(fun(self: druid.container, size: vector3)|nil)*: Callback on size changed
### on_late_init
---
```lua
container:on_late_init()
```
### on_remove
---
```lua
container:on_remove()
```
### refresh_origins
---
```lua
container:refresh_origins()
```
### set_pivot
---
```lua
container:set_pivot(pivot)
```
- **Parameters:**
- `pivot` *(constant)*:
### on_style_change
---
```lua
container:on_style_change(style)
```
- **Parameters:**
- `style` *(druid.container.style)*:
### set_size
---
```lua
container:set_size([width], [height], [anchor_pivot])
```
Set new size of layout node
- **Parameters:**
- `[width]` *(number|nil)*:
- `[height]` *(number|nil)*:
- `[anchor_pivot]` *(constant|nil)*: If set will keep the corner possition relative to the new size
- **Returns:**
- `Container` *(druid.container)*:
### get_position
---
```lua
container:get_position()
```
- **Returns:**
- `` *(unknown)*:
### set_position
---
```lua
container:set_position(pos_x, pos_y)
```
- **Parameters:**
- `pos_x` *(number)*:
- `pos_y` *(number)*:
### get_size
---
```lua
container:get_size()
```
Get current size of layout node
- **Returns:**
- `size` *(vector3)*:
### get_scale
---
```lua
container:get_scale()
```
Get current scale of layout node
- **Returns:**
- `scale` *(vector3)*:
### fit_into_size
---
```lua
container:fit_into_size(target_size)
```
Set size for layout node to fit inside it
- **Parameters:**
- `target_size` *(vector3)*:
- **Returns:**
- `Container` *(druid.container)*:
### fit_into_window
---
```lua
container:fit_into_window()
```
Set current size for layout node to fit inside it
- **Returns:**
- `Container` *(druid.container)*:
### on_window_resized
---
```lua
container:on_window_resized()
```
### add_container
---
```lua
container:add_container(node_or_container, [mode], [on_resize_callback])
```
- **Parameters:**
- `node_or_container` *(string|table|druid.container|node)*:
- `[mode]` *(string|nil)*: stretch, fit, stretch_x, stretch_y. Default: Pick from node, "fit" or "stretch"
- `[on_resize_callback]` *(fun(self: userdata, size: vector3)|nil)*:
- **Returns:**
- `Container` *(druid.container)*: New created layout instance
### remove_container_by_node
---
```lua
container:remove_container_by_node([node])
```
- **Parameters:**
- `[node]` *(any)*:
- **Returns:**
- `` *(druid.container|nil)*:
### set_parent_container
---
```lua
container:set_parent_container([parent_container])
```
- **Parameters:**
- `[parent_container]` *(druid.container|nil)*:
### refresh
---
```lua
container:refresh()
```
Glossary
Center Offset - vector from node position to visual center of node
### refresh_scale
---
```lua
container:refresh_scale()
```
### update_child_containers
---
```lua
container:update_child_containers()
```
### create_draggable_corners
---
```lua
container:create_draggable_corners()
```
- **Returns:**
- `Container` *(druid.container)*:
### clear_draggable_corners
---
```lua
container:clear_draggable_corners()
```
- **Returns:**
- `Container` *(druid.container)*:
### fit_into_node
---
```lua
container:fit_into_node(node)
```
Set node for layout node to fit inside it. Pass nil to reset
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- **Returns:**
- `Layout` *(druid.container)*:
### set_min_size
---
```lua
container:set_min_size([min_size_x], [min_size_y])
```
- **Parameters:**
- `[min_size_x]` *(number|nil)*:
- `[min_size_y]` *(number|nil)*:
- **Returns:**
- `` *(druid.container)*:
## Fields
<a name="node"></a>
- **node** (_node_)
<a name="druid"></a>
- **druid** (_druid.instance_)
<a name="node_offset"></a>
- **node_offset** (_vector4_)
<a name="origin_size"></a>
- **origin_size** (_vector3_)
<a name="size"></a>
- **size** (_vector3_)
<a name="origin_position"></a>
- **origin_position** (_vector3_)
<a name="position"></a>
- **position** (_vector3_)
<a name="pivot_offset"></a>
- **pivot_offset** (_vector3_)
<a name="center_offset"></a>
- **center_offset** (_vector3_)
<a name="mode"></a>
- **mode** (_string_)
<a name="fit_size"></a>
- **fit_size** (_vector3_)
<a name="min_size_x"></a>
- **min_size_x** (_number_)
<a name="min_size_y"></a>
- **min_size_y** (_number_)
<a name="on_size_changed"></a>
- **on_size_changed** (_event_): fun(self: druid.container, size: vector3)
<a name="node_fill_x"></a>
- **node_fill_x** (_nil_)
<a name="node_fill_y"></a>
- **node_fill_y** (_nil_)
<a name="x_koef"></a>
- **x_koef** (_number_)
<a name="y_koef"></a>
- **y_koef** (_number_)
<a name="x_anchor"></a>
- **x_anchor** (_unknown_)
<a name="y_anchor"></a>
- **y_anchor** (_unknown_)
<a name="style"></a>
- **style** (_table_)

View File

@@ -0,0 +1,222 @@
# druid.data_list API
> at /druid/extended/data_list.lua
## Functions
- [init](#init)
- [on_remove](#on_remove)
- [set_use_cache](#set_use_cache)
- [set_data](#set_data)
- [get_data](#get_data)
- [add](#add)
- [remove](#remove)
- [remove_by_data](#remove_by_data)
- [clear](#clear)
- [get_index](#get_index)
- [get_created_nodes](#get_created_nodes)
- [get_created_components](#get_created_components)
- [scroll_to_index](#scroll_to_index)
## Fields
- [scroll](#scroll)
- [grid](#grid)
- [on_scroll_progress_change](#on_scroll_progress_change)
- [on_element_add](#on_element_add)
- [on_element_remove](#on_element_remove)
- [top_index](#top_index)
- [last_index](#last_index)
- [scroll_progress](#scroll_progress)
### init
---
```lua
data_list:init(scroll, grid, create_function)
```
- **Parameters:**
- `scroll` *(druid.scroll)*: The Scroll instance for Data List component
- `grid` *(druid.grid)*: The StaticGrid} or @{DynamicGrid instance for Data List component
- `create_function` *(function)*: The create function callback(self, data, index, data_list). Function should return (node, [component])
### on_remove
---
```lua
data_list:on_remove()
```
Druid System on_remove function
### set_use_cache
---
```lua
data_list:set_use_cache(is_use_cache)
```
Set refresh function for DataList component
- **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
- **Returns:**
- `Current` *(druid.data_list)*: DataList instance
### set_data
---
```lua
data_list:set_data(data)
```
Set new data set for DataList component
- **Parameters:**
- `data` *(table)*: The new data array
- **Returns:**
- `Current` *(druid.data_list)*: DataList instance
### get_data
---
```lua
data_list:get_data()
```
Return current data from DataList component
- **Returns:**
- `The` *(table)*: current data array
### add
---
```lua
data_list:add(data, [index], [shift_policy])
```
Add element to DataList. Currenly untested
- **Parameters:**
- `data` *(table)*:
- `[index]` *(number|nil)*:
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
### remove
---
```lua
data_list:remove([index], [shift_policy])
```
Remove element from DataList. Currenly untested
- **Parameters:**
- `[index]` *(number|nil)*:
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
### remove_by_data
---
```lua
data_list:remove_by_data(data, [shift_policy])
```
Remove element from DataList by data value. Currenly untested
- **Parameters:**
- `data` *(table)*:
- `[shift_policy]` *(number|nil)*: The constant from const.SHIFT.*
### clear
---
```lua
data_list:clear()
```
Clear the DataList and refresh visuals
### get_index
---
```lua
data_list:get_index(data)
```
Return index for data value
- **Parameters:**
- `data` *(table)*:
- **Returns:**
- `` *(unknown|nil)*:
### get_created_nodes
---
```lua
data_list:get_created_nodes()
```
Return all currenly created nodes in DataList
- **Returns:**
- `List` *(node[])*: of created nodes
### get_created_components
---
```lua
data_list:get_created_components()
```
Return all currenly created components in DataList
- **Returns:**
- `List` *(druid.component[])*: of created nodes
### scroll_to_index
---
```lua
data_list:scroll_to_index(index)
```
Instant scroll to element with passed index
- **Parameters:**
- `index` *(number)*:
## Fields
<a name="scroll"></a>
- **scroll** (_druid.scroll_)
<a name="grid"></a>
- **grid** (_druid.grid_)
<a name="on_scroll_progress_change"></a>
- **on_scroll_progress_change** (_event_)
<a name="on_element_add"></a>
- **on_element_add** (_event_)
<a name="on_element_remove"></a>
- **on_element_remove** (_event_)
<a name="top_index"></a>
- **top_index** (_number_)
<a name="last_index"></a>
- **last_index** (_number_)
<a name="scroll_progress"></a>
- **scroll_progress** (_number_)

View File

@@ -0,0 +1,123 @@
# druid.hotkey API
> at /druid/extended/hotkey.lua
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [add_hotkey](#add_hotkey)
- [is_processing](#is_processing)
- [on_focus_gained](#on_focus_gained)
- [on_input](#on_input)
- [set_repeat](#set_repeat)
## Fields
- [on_hotkey_pressed](#on_hotkey_pressed)
- [on_hotkey_released](#on_hotkey_released)
- [style](#style)
- [druid](#druid)
### init
---
```lua
hotkey:init(keys, callback, [callback_argument])
```
The Hotkey constructor
- **Parameters:**
- `keys` *(string|string[])*: The keys to be pressed for trigger callback. Should contains one key and any modificator keys
- `callback` *(function)*: The callback function
- `[callback_argument]` *(any)*: The argument to pass into the callback function
### on_style_change
---
```lua
hotkey:on_style_change(style)
```
- **Parameters:**
- `style` *(druid.hotkey.style)*:
### add_hotkey
---
```lua
hotkey:add_hotkey(keys, [callback_argument])
```
Add hotkey for component callback
- **Parameters:**
- `keys` *(string|hash|hash[]|string[])*: that have to be pressed before key pressed to activate
- `[callback_argument]` *(any)*: The argument to pass into the callback function
- **Returns:**
- `Current` *(druid.hotkey)*: instance
### is_processing
---
```lua
hotkey:is_processing()
```
- **Returns:**
- `` *(boolean)*:
### on_focus_gained
---
```lua
hotkey:on_focus_gained()
```
### on_input
---
```lua
hotkey:on_input([action_id], action)
```
- **Parameters:**
- `[action_id]` *(hash|nil)*:
- `action` *(action)*:
- **Returns:**
- `` *(boolean)*:
### set_repeat
---
```lua
hotkey:set_repeat(is_enabled_repeated)
```
If true, the callback will be triggered on action.repeated
- **Parameters:**
- `is_enabled_repeated` *(bool)*: The flag value
- **Returns:**
- `` *(druid.hotkey)*:
## Fields
<a name="on_hotkey_pressed"></a>
- **on_hotkey_pressed** (_event_)
<a name="on_hotkey_released"></a>
- **on_hotkey_released** (_event_)
<a name="style"></a>
- **style** (_druid.hotkey.style_)
<a name="druid"></a>
- **druid** (_druid.instance_)

View File

@@ -0,0 +1,335 @@
# druid.input API
> at /druid/extended/input.lua
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [on_input](#on_input)
- [on_focus_lost](#on_focus_lost)
- [on_input_interrupt](#on_input_interrupt)
- [get_text_selected](#get_text_selected)
- [get_text_selected_replaced](#get_text_selected_replaced)
- [set_text](#set_text)
- [select](#select)
- [unselect](#unselect)
- [get_text](#get_text)
- [set_max_length](#set_max_length)
- [set_allowed_characters](#set_allowed_characters)
- [reset_changes](#reset_changes)
- [select_cursor](#select_cursor)
- [move_selection](#move_selection)
## Fields
- [on_input_select](#on_input_select)
- [on_input_unselect](#on_input_unselect)
- [on_input_text](#on_input_text)
- [on_input_empty](#on_input_empty)
- [on_input_full](#on_input_full)
- [on_input_wrong](#on_input_wrong)
- [on_select_cursor_change](#on_select_cursor_change)
- [style](#style)
- [text](#text)
- [ALLOWED_ACTIONS](#ALLOWED_ACTIONS)
- [druid](#druid)
- [is_selected](#is_selected)
- [value](#value)
- [previous_value](#previous_value)
- [current_value](#current_value)
- [marked_value](#marked_value)
- [is_empty](#is_empty)
- [text_width](#text_width)
- [market_text_width](#market_text_width)
- [total_width](#total_width)
- [cursor_index](#cursor_index)
- [start_index](#start_index)
- [end_index](#end_index)
- [max_length](#max_length)
- [allowed_characters](#allowed_characters)
- [keyboard_type](#keyboard_type)
- [button](#button)
- [marked_text_width](#marked_text_width)
### init
---
```lua
input:init(click_node, text_node, [keyboard_type])
```
- **Parameters:**
- `click_node` *(node)*: Node to enabled input component
- `text_node` *(druid.text|node)*: Text node what will be changed on user input. You can pass text component instead of text node name Text
- `[keyboard_type]` *(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
---
```lua
input:on_focus_lost()
```
### on_input_interrupt
---
```lua
input:on_input_interrupt()
```
### get_text_selected
---
```lua
input:get_text_selected()
```
- **Returns:**
- `` *(string|unknown)*:
### get_text_selected_replaced
---
```lua
input:get_text_selected_replaced(text)
```
Replace selected text with new text
- **Parameters:**
- `text` *(string)*: The text to replace selected text
- **Returns:**
- `New` *(string)*: input text
### set_text
---
```lua
input:set_text(input_text)
```
Set text for input field
- **Parameters:**
- `input_text` *(string)*: The string to apply for input field
### select
---
```lua
input:select()
```
Select input field. It will show the keyboard and trigger on_select events
### unselect
---
```lua
input:unselect()
```
Remove selection from input. It will hide the keyboard and trigger on_unselect events
### get_text
---
```lua
input:get_text()
```
Return current input field text
- **Returns:**
- `The` *(string)*: current input field text
### set_max_length
---
```lua
input:set_max_length(max_length)
```
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
- **Parameters:**
- `max_length` *(number)*: Maximum length for input text field
- **Returns:**
- `Current` *(druid.input)*: input instance
### set_allowed_characters
---
```lua
input:set_allowed_characters(characters)
```
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
- **Parameters:**
- `characters` *(string)*: Regulax exp. for validate user input
- **Returns:**
- `Current` *(druid.input)*: input instance
### reset_changes
---
```lua
input:reset_changes()
```
Reset current input selection and return previous value
- **Returns:**
- `Current` *(druid.input)*: input instance
### select_cursor
---
```lua
input:select_cursor([cursor_index], [start_index], [end_index])
```
Set cursor position in input field
- **Parameters:**
- `[cursor_index]` *(number|nil)*: Cursor index for cursor position, if nil - will be set to the end of the text
- `[start_index]` *(number|nil)*: Start index for cursor position, if nil - will be set to the end of the text
- `[end_index]` *(number|nil)*: End index for cursor position, if nil - will be set to the start_index
- **Returns:**
- `Current` *(druid.input)*: input instance
### move_selection
---
```lua
input:move_selection(delta, is_add_to_selection, is_move_to_end)
```
Change cursor position by delta
- **Parameters:**
- `delta` *(number)*: side for cursor position, -1 for left, 1 for right
- `is_add_to_selection` *(boolean)*: (Shift key)
- `is_move_to_end` *(boolean)*: (Ctrl key)
## Fields
<a name="on_input_select"></a>
- **on_input_select** (_event_)
<a name="on_input_unselect"></a>
- **on_input_unselect** (_event_)
<a name="on_input_text"></a>
- **on_input_text** (_event_)
<a name="on_input_empty"></a>
- **on_input_empty** (_event_)
<a name="on_input_full"></a>
- **on_input_full** (_event_)
<a name="on_input_wrong"></a>
- **on_input_wrong** (_event_)
<a name="on_select_cursor_change"></a>
- **on_select_cursor_change** (_event_)
<a name="style"></a>
- **style** (_table_)
<a name="text"></a>
- **text** (_druid.text_)
<a name="ALLOWED_ACTIONS"></a>
- **ALLOWED_ACTIONS** (_table_)
<a name="druid"></a>
- **druid** (_druid.instance_)
<a name="is_selected"></a>
- **is_selected** (_boolean_)
<a name="value"></a>
- **value** (_unknown_)
<a name="previous_value"></a>
- **previous_value** (_unknown_)
<a name="current_value"></a>
- **current_value** (_unknown_)
<a name="marked_value"></a>
- **marked_value** (_string_)
<a name="is_empty"></a>
- **is_empty** (_boolean_)
<a name="text_width"></a>
- **text_width** (_integer_)
<a name="market_text_width"></a>
- **market_text_width** (_integer_)
<a name="total_width"></a>
- **total_width** (_integer_)
<a name="cursor_index"></a>
- **cursor_index** (_integer_)
<a name="start_index"></a>
- **start_index** (_number_)
<a name="end_index"></a>
- **end_index** (_number_)
<a name="max_length"></a>
- **max_length** (_nil_)
<a name="allowed_characters"></a>
- **allowed_characters** (_nil_)
<a name="keyboard_type"></a>
- **keyboard_type** (_number_)
<a name="button"></a>
- **button** (_druid.button_): Druid component to make clickable node with various interaction callbacks
<a name="marked_text_width"></a>
- **marked_text_width** (_number_)

View File

@@ -0,0 +1,119 @@
# druid.lang_text API
> at /druid/extended/lang_text.lua
## Functions
- [init](#init)
- [on_language_change](#on_language_change)
- [set_to](#set_to)
- [set_text](#set_text)
- [translate](#translate)
- [format](#format)
## Fields
- [text](#text)
- [node](#node)
- [on_change](#on_change)
- [druid](#druid)
### init
---
```lua
lang_text:init(node, [locale_id], [adjust_type])
```
- **Parameters:**
- `node` *(string|node)*: The node_id or gui.get_node(node_id)
- `[locale_id]` *(string|nil)*: Default locale id or text from node as default
- `[adjust_type]` *(string|nil)*: Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
- **Returns:**
- `` *(druid.lang_text)*:
### on_language_change
---
```lua
lang_text:on_language_change()
```
### set_to
---
```lua
lang_text:set_to(text)
```
Setup raw text to lang_text component
- **Parameters:**
- `text` *(string)*: Text for text node
- **Returns:**
- `Current` *(druid.lang_text)*: instance
### set_text
---
```lua
lang_text:set_text(text)
```
Setup raw text to lang_text component
- **Parameters:**
- `text` *(string)*: Text for text node
- **Returns:**
- `Current` *(druid.lang_text)*: instance
### translate
---
```lua
lang_text:translate(locale_id, ...)
```
Translate the text by locale_id
- **Parameters:**
- `locale_id` *(string)*: Locale id
- `...` *(...)*: vararg
- **Returns:**
- `Current` *(druid.lang_text)*: instance
### format
---
```lua
lang_text:format(...)
```
Format string with new text params on localized text
- **Parameters:**
- `...` *(...)*: vararg
- **Returns:**
- `Current` *(druid.lang_text)*: instance
## Fields
<a name="text"></a>
- **text** (_druid.text_)
<a name="node"></a>
- **node** (_node_)
<a name="on_change"></a>
- **on_change** (_event_)
<a name="druid"></a>
- **druid** (_druid.instance_)

View File

@@ -0,0 +1,319 @@
# druid.layout API
> at /druid/extended/layout.lua
## Functions
- [init](#init)
- [update](#update)
- [get_entities](#get_entities)
- [set_node_index](#set_node_index)
- [set_margin](#set_margin)
- [set_padding](#set_padding)
- [set_dirty](#set_dirty)
- [set_justify](#set_justify)
- [set_type](#set_type)
- [set_hug_content](#set_hug_content)
- [add](#add)
- [remove](#remove)
- [get_size](#get_size)
- [get_content_size](#get_content_size)
- [refresh_layout](#refresh_layout)
- [clear_layout](#clear_layout)
- [get_node_size](#get_node_size)
- [calculate_rows_data](#calculate_rows_data)
- [set_node_position](#set_node_position)
## Fields
- [node](#node)
- [rows_data](#rows_data)
- [is_dirty](#is_dirty)
- [entities](#entities)
- [margin](#margin)
- [padding](#padding)
- [type](#type)
- [is_resize_width](#is_resize_width)
- [is_resize_height](#is_resize_height)
- [is_justify](#is_justify)
- [on_size_changed](#on_size_changed)
- [size](#size)
### init
---
```lua
layout:init(node_or_node_id, layout_type)
```
```lua
layout_type:
| "horizontal"
| "vertical"
| "horizontal_wrap"
```
- **Parameters:**
- `node_or_node_id` *(string|node)*:
- `layout_type` *(druid.layout.mode)*:
### update
---
```lua
layout:update()
```
### get_entities
---
```lua
layout:get_entities()
```
- **Returns:**
- `` *(node[])*:
### set_node_index
---
```lua
layout:set_node_index([node], [index])
```
- **Parameters:**
- `[node]` *(any)*:
- `[index]` *(any)*:
### set_margin
---
```lua
layout:set_margin([margin_x], [margin_y])
```
- **Parameters:**
- `[margin_x]` *(number|nil)*:
- `[margin_y]` *(number|nil)*:
- **Returns:**
- `` *(druid.layout)*:
### set_padding
---
```lua
layout:set_padding([padding_x], [padding_y], [padding_z], [padding_w])
```
- **Parameters:**
- `[padding_x]` *(number|nil)*:
- `[padding_y]` *(number|nil)*:
- `[padding_z]` *(number|nil)*:
- `[padding_w]` *(number|nil)*:
- **Returns:**
- `` *(druid.layout)*:
### set_dirty
---
```lua
layout:set_dirty()
```
- **Returns:**
- `` *(druid.layout)*:
### set_justify
---
```lua
layout:set_justify(is_justify)
```
- **Parameters:**
- `is_justify` *(boolean)*:
- **Returns:**
- `` *(druid.layout)*:
### set_type
---
```lua
layout:set_type(type)
```
- **Parameters:**
- `type` *(string)*: The layout type: "horizontal", "vertical", "horizontal_wrap"
- **Returns:**
- `` *(druid.layout)*:
### set_hug_content
---
```lua
layout:set_hug_content(is_hug_width, is_hug_height)
```
- **Parameters:**
- `is_hug_width` *(boolean)*:
- `is_hug_height` *(boolean)*:
- **Returns:**
- `` *(druid.layout)*:
### add
---
```lua
layout:add(node_or_node_id)
```
Add node to layout
- **Parameters:**
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- `` *(druid.layout)*:
### remove
---
```lua
layout:remove(node_or_node_id)
```
Remove node from layout
- **Parameters:**
- `node_or_node_id` *(string|node)*: node_or_node_id
- **Returns:**
- `self` *(druid.layout)*: for chaining
### get_size
---
```lua
layout:get_size()
```
- **Returns:**
- `` *(vector3)*:
### get_content_size
---
```lua
layout:get_content_size()
```
- **Returns:**
- `` *(number)*:
- `` *(number)*:
### refresh_layout
---
```lua
layout:refresh_layout()
```
- **Returns:**
- `` *(druid.layout)*:
### clear_layout
---
```lua
layout:clear_layout()
```
- **Returns:**
- `` *(druid.layout)*:
### get_node_size
---
```lua
layout:get_node_size(node)
```
- **Parameters:**
- `node` *(node)*:
- **Returns:**
- `` *(number)*:
- `` *(number)*:
### calculate_rows_data
---
```lua
layout:calculate_rows_data()
```
Calculate rows data for layout. Contains total width, height and rows info (width, height, count of elements in row)
- **Returns:**
- `` *(druid.layout.rows_data)*:
### set_node_position
---
```lua
layout:set_node_position(node, x, y)
```
- **Parameters:**
- `node` *(node)*:
- `x` *(number)*:
- `y` *(number)*:
- **Returns:**
- `` *(node)*:
## Fields
<a name="node"></a>
- **node** (_node_)
<a name="rows_data"></a>
- **rows_data** (_druid.layout.rows_data_): Last calculated rows data
<a name="is_dirty"></a>
- **is_dirty** (_boolean_)
<a name="entities"></a>
- **entities** (_node[]_)
<a name="margin"></a>
- **margin** (_{ x: number, y: number }_)
<a name="padding"></a>
- **padding** (_vector4_)
<a name="type"></a>
- **type** (_string_)
<a name="is_resize_width"></a>
- **is_resize_width** (_boolean_)
<a name="is_resize_height"></a>
- **is_resize_height** (_boolean_)
<a name="is_justify"></a>
- **is_justify** (_boolean_)
<a name="on_size_changed"></a>
- **on_size_changed** (_event.on_size_changed_)
<a name="size"></a>
- **size** (_unknown_)

View File

@@ -0,0 +1,215 @@
# druid.progress API
> at /druid/extended/progress.lua
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [on_remove](#on_remove)
- [update](#update)
- [fill](#fill)
- [empty](#empty)
- [set_to](#set_to)
- [get](#get)
- [set_steps](#set_steps)
- [to](#to)
- [set_max_size](#set_max_size)
## Fields
- [node](#node)
- [on_change](#on_change)
- [style](#style)
- [key](#key)
- [prop](#prop)
- [scale](#scale)
- [size](#size)
- [max_size](#max_size)
- [slice](#slice)
- [last_value](#last_value)
- [slice_size](#slice_size)
- [target](#target)
- [steps](#steps)
- [step_callback](#step_callback)
- [target_callback](#target_callback)
### init
---
```lua
progress:init(node, key, [init_value])
```
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- `key` *(string)*: Progress bar direction: 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:**
- `style` *(druid.progress.style)*:
### on_layout_change
---
```lua
progress:on_layout_change()
```
### on_remove
---
```lua
progress:on_remove()
```
### update
---
```lua
progress:update(dt)
```
- **Parameters:**
- `dt` *(number)*: Delta time
### fill
---
```lua
progress:fill()
```
Fill a progress bar and stop progress animation
### empty
---
```lua
progress:empty()
```
Empty a progress bar
### set_to
---
```lua
progress:set_to(to)
```
Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
### get
---
```lua
progress:get()
```
Return current progress bar value
- **Returns:**
- `` *(number)*:
### set_steps
---
```lua
progress:set_steps(steps, callback)
```
Set points on progress bar to fire the callback
- **Parameters:**
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
### 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:**
- `Progress` *(druid.progress)*:
## Fields
<a name="node"></a>
- **node** (_node_)
<a name="on_change"></a>
- **on_change** (_event_)
<a name="style"></a>
- **style** (_druid.progress.style_)
<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

@@ -0,0 +1,215 @@
# druid.progress API
> at /druid/extended/progress.lua
## Functions
- [init](#init)
- [on_style_change](#on_style_change)
- [on_layout_change](#on_layout_change)
- [on_remove](#on_remove)
- [update](#update)
- [fill](#fill)
- [empty](#empty)
- [set_to](#set_to)
- [get](#get)
- [set_steps](#set_steps)
- [to](#to)
- [set_max_size](#set_max_size)
## Fields
- [node](#node)
- [on_change](#on_change)
- [style](#style)
- [key](#key)
- [prop](#prop)
- [scale](#scale)
- [size](#size)
- [max_size](#max_size)
- [slice](#slice)
- [last_value](#last_value)
- [slice_size](#slice_size)
- [target](#target)
- [steps](#steps)
- [step_callback](#step_callback)
- [target_callback](#target_callback)
### init
---
```lua
progress:init(node, key, [init_value])
```
- **Parameters:**
- `node` *(string|node)*: Node name or GUI Node itself.
- `key` *(string)*: Progress bar direction: 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:**
- `style` *(druid.progress.style)*:
### on_layout_change
---
```lua
progress:on_layout_change()
```
### on_remove
---
```lua
progress:on_remove()
```
### update
---
```lua
progress:update(dt)
```
- **Parameters:**
- `dt` *(number)*: Delta time
### fill
---
```lua
progress:fill()
```
Fill a progress bar and stop progress animation
### empty
---
```lua
progress:empty()
```
Empty a progress bar
### set_to
---
```lua
progress:set_to(to)
```
Instant fill progress bar to value
- **Parameters:**
- `to` *(number)*: Progress bar value, from 0 to 1
### get
---
```lua
progress:get()
```
Return current progress bar value
- **Returns:**
- `` *(number)*:
### set_steps
---
```lua
progress:set_steps(steps, callback)
```
Set points on progress bar to fire the callback
- **Parameters:**
- `steps` *(number[])*: Array of progress bar values
- `callback` *(function)*: Callback on intersect step value
### 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:**
- `Progress` *(druid.progress)*:
## Fields
<a name="node"></a>
- **node** (_node_)
<a name="on_change"></a>
- **on_change** (_event_)
<a name="style"></a>
- **style** (_druid.progress.style_)
<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

@@ -0,0 +1,98 @@
# druid.swipe API
> at /druid/extended/swipe.lua
## Functions
- [init](#init)
- [on_late_init](#on_late_init)
- [on_style_change](#on_style_change)
- [on_input](#on_input)
- [on_input_interrupt](#on_input_interrupt)
- [set_click_zone](#set_click_zone)
## Fields
- [node](#node)
- [on_swipe](#on_swipe)
- [style](#style)
- [click_zone](#click_zone)
### init
---
```lua
swipe:init(node_or_node_id, on_swipe_callback)
```
- **Parameters:**
- `node_or_node_id` *(string|node)*:
- `on_swipe_callback` *(function)*:
### 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
---
```lua
swipe:set_click_zone([zone])
```
Strict swipe click area. Useful for
restrict events outside stencil node
- **Parameters:**
- `[zone]` *(string|node|nil)*: Gui node
## Fields
<a name="node"></a>
- **node** (_node_)
<a name="on_swipe"></a>
- **on_swipe** (_event_): function(side, dist, dt), side - "left", "right", "up", "down"
<a name="style"></a>
- **style** (_table_)
<a name="click_zone"></a>
- **click_zone** (_node_)

View File

@@ -0,0 +1,133 @@
# druid.timer API
> at /druid/extended/timer.lua
## Functions
- [init](#init)
- [update](#update)
- [on_layout_change](#on_layout_change)
- [set_to](#set_to)
- [set_state](#set_state)
- [set_interval](#set_interval)
## Fields
- [on_tick](#on_tick)
- [on_set_enabled](#on_set_enabled)
- [on_timer_end](#on_timer_end)
- [node](#node)
- [from](#from)
- [target](#target)
- [value](#value)
- [is_on](#is_on)
- [temp](#temp)
- [last_value](#last_value)
### init
---
```lua
timer:init(node, [seconds_from], [seconds_to], [callback])
```
- **Parameters:**
- `node` *(node)*: Gui text node
- `[seconds_from]` *(number|nil)*: Start timer value in seconds
- `[seconds_to]` *(number|nil)*: End timer value in seconds
- `[callback]` *(function|nil)*: Function on timer end
- **Returns:**
- `` *(druid.timer)*:
### update
---
```lua
timer:update([dt])
```
- **Parameters:**
- `[dt]` *(any)*:
### on_layout_change
---
```lua
timer:on_layout_change()
```
### set_to
---
```lua
timer:set_to(set_to)
```
- **Parameters:**
- `set_to` *(number)*: Value in seconds
- **Returns:**
- `self` *(druid.timer)*:
### set_state
---
```lua
timer:set_state([is_on])
```
- **Parameters:**
- `[is_on]` *(boolean|nil)*: Timer enable state
- **Returns:**
- `self` *(druid.timer)*:
### set_interval
---
```lua
timer:set_interval(from, to)
```
- **Parameters:**
- `from` *(number)*: Start time in seconds
- `to` *(number)*: Target time in seconds
- **Returns:**
- `self` *(druid.timer)*:
## Fields
<a name="on_tick"></a>
- **on_tick** (_event_)
<a name="on_set_enabled"></a>
- **on_set_enabled** (_event_)
<a name="on_timer_end"></a>
- **on_timer_end** (_event_)
<a name="node"></a>
- **node** (_node_)
<a name="from"></a>
- **from** (_number_)
<a name="target"></a>
- **target** (_number_)
<a name="value"></a>
- **value** (_number_)
<a name="is_on"></a>
- **is_on** (_boolean_)
<a name="temp"></a>
- **temp** (_unknown_)
<a name="last_value"></a>
- **last_value** (_number_)