diff --git a/docs/modules/BaseComponent.html b/docs/modules/BaseComponent.html index b05ce5a..52c4c3c 100644 --- a/docs/modules/BaseComponent.html +++ b/docs/modules/BaseComponent.html @@ -492,7 +492,7 @@ return AwesomeComponent BaseComponent
  • state - boolean + boolean or nil The component input state
  • @@ -527,7 +527,7 @@ return AwesomeComponent The new input priority value
  • is_temporary - boolean + boolean or nil If true, the reset input priority will return to previous value
  • diff --git a/docs/modules/Blocker.html b/docs/modules/Blocker.html index de139c1..00ed7cd 100644 --- a/docs/modules/Blocker.html +++ b/docs/modules/Blocker.html @@ -189,7 +189,7 @@ local blocker = self.druid:new_blocker(node) Blocker
  • state - boolean + boolean or nil Enabled state
  • diff --git a/docs/modules/Button.html b/docs/modules/Button.html index 72b228b..d710ac9 100644 --- a/docs/modules/Button.html +++ b/docs/modules/Button.html @@ -110,7 +110,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Get current key name to trigger this button. - init(self, node, callback[, custom_args[, anim_node]]) + init(self, node, callback, custom_args, anim_node) The Button constructor @@ -118,7 +118,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Get button enabled state. - set_check_function(self[, check_function[, failure_callback]]) + set_check_function(self, check_function, failure_callback) Set function for additional check for button click availability @@ -134,7 +134,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Set key name to trigger this button by keyboard. - set_web_user_interaction(self[, is_web_mode]) + set_web_user_interaction(self, is_web_mode) Set Button mode to work inside user HTML5 interaction event. @@ -241,7 +241,7 @@ local button = self.druid:new_button("button_name", on_button_click, c
    - init(self, node, callback[, custom_args[, anim_node]]) + init(self, node, callback, custom_args, anim_node)
    The Button constructor @@ -255,21 +255,19 @@ local button = self.druid:new_button("button_name", on_button_click, c
  • node string or node - Node name or GUI Node itself + The node_id or gui.get_node(node_id)
  • callback function On click button callback
  • custom_args - any + any or nil Button events custom arguments - (optional)
  • anim_node - string or node + string, node or nil Node to animate instead of trigger node. - (optional)
  • @@ -312,7 +310,7 @@ local button = self.druid:new_button("button_name", on_button_click, c
    - set_check_function(self[, check_function[, failure_callback]]) + set_check_function(self, check_function, failure_callback)
    Set function for additional check for button click availability @@ -325,14 +323,12 @@ local button = self.druid:new_button("button_name", on_button_click, c
  • check_function - function + function or nil Should return true or false. If true - button can be pressed. - (optional)
  • failure_callback - function + function or nil Function will be called on button click, if check function return false - (optional)
  • @@ -401,7 +397,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Button
  • state - boolean + boolean or nil Enabled state
  • @@ -459,7 +455,7 @@ button:set_enabled(true)
    - set_web_user_interaction(self[, is_web_mode]) + set_web_user_interaction(self, is_web_mode)
    Set Button mode to work inside user HTML5 interaction event. @@ -475,9 +471,8 @@ button:set_enabled(true)
  • is_web_mode - boolean + boolean or nil If true - button will be called inside html5 callback - (optional)
  • diff --git a/docs/modules/Checkbox.html b/docs/modules/Checkbox.html index ba5f545..8ac33c6 100644 --- a/docs/modules/Checkbox.html +++ b/docs/modules/Checkbox.html @@ -210,15 +210,15 @@ Checkbox
  • state - boolean + boolean or nil Checkbox state
  • is_silent - boolean + boolean or nil Don't trigger on_change_state if true
  • is_instant - boolean + boolean or nil If instant checkbox change
  • diff --git a/docs/modules/CheckboxGroup.html b/docs/modules/CheckboxGroup.html index 726759c..8551324 100644 --- a/docs/modules/CheckboxGroup.html +++ b/docs/modules/CheckboxGroup.html @@ -193,7 +193,7 @@ Array of checkbox state
  • is_instant - boolean + boolean or nil If instant state change
  • diff --git a/docs/modules/Drag.html b/docs/modules/Drag.html index 7cec624..b6ce635 100644 --- a/docs/modules/Drag.html +++ b/docs/modules/Drag.html @@ -266,7 +266,7 @@ Drag
  • is_enabled - boolean + boolean or nil
  • diff --git a/docs/modules/Druid.html b/docs/modules/Druid.html index 0b5f5d6..cd3aad3 100644 --- a/docs/modules/Druid.html +++ b/docs/modules/Druid.html @@ -120,7 +120,7 @@ end

    Functions

    - + @@ -158,7 +158,7 @@ end
    - druid.new(context[, style]) + druid.new(context, style)
    Create a new Druid instance for creating GUI components. @@ -171,9 +171,8 @@ end The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks.
  • style - table + table or nil The Druid style table to override style parameters for this Druid instance. - (optional)
  • diff --git a/docs/modules/DruidEvent.html b/docs/modules/DruidEvent.html index bd16b36..6a00780 100644 --- a/docs/modules/DruidEvent.html +++ b/docs/modules/DruidEvent.html @@ -87,7 +87,7 @@
    - + @@ -95,7 +95,7 @@ - + @@ -103,7 +103,7 @@ - +
    druid.new(context[, style])druid.new(context, style) Create a new Druid instance for creating GUI components.
    Clear the all event handlers
    initialize(self[, initial_callback])initialize(self, initial_callback) DruidEvent constructor
    Return true, if event have at lease one handler
    subscribe(self, callback[, context])subscribe(self, callback, context) Subscribe callback on event
    Trigger the event and call all subscribed callbacks
    unsubscribe(self, callback[, context])unsubscribe(self, callback, context) Unsubscribe callback on event
    @@ -142,7 +142,7 @@
    - initialize(self[, initial_callback]) + initialize(self, initial_callback)
    DruidEvent constructor @@ -155,9 +155,8 @@ DruidEvent
  • initial_callback - function + function or nil Subscribe the callback on new event, if callback exist - (optional)
  • @@ -205,7 +204,7 @@
    - subscribe(self, callback[, context]) + subscribe(self, callback, context)
    Subscribe callback on event @@ -222,9 +221,8 @@ Callback itself
  • context - any + any or nil Additional context as first param to callback call, usually it's self - (optional)
  • @@ -276,7 +274,7 @@ event:trigger("Param1", "Param2
    - unsubscribe(self, callback[, context]) + unsubscribe(self, callback, context)
    Unsubscribe callback on event @@ -293,9 +291,8 @@ event:trigger("Param1", "Param2 Callback itself
  • context - any + any or nil Additional context as first param to callback call - (optional)
  • diff --git a/docs/modules/DruidInstance.html b/docs/modules/DruidInstance.html index b50afa3..1924ddd 100644 --- a/docs/modules/DruidInstance.html +++ b/docs/modules/DruidInstance.html @@ -146,7 +146,7 @@ end Create new component. - new_back_handler(self, callback[, params]) + new_back_handler(self, callback, params) Create BackHandler component @@ -154,7 +154,7 @@ end Create Blocker component - new_button(self, node, callback[, params[, anim_node]]) + new_button(self, node, callback, params, anim_node) Create Button component @@ -174,11 +174,11 @@ end Create Drag component - new_dynamic_grid(self, parent) + new_dynamic_grid(self, parent_node) Create DynamicGrid component - new_hotkey(self, keys_array, callback[, callback_argument]) + new_hotkey(self, keys_array, callback, callback_argument) Create Hotkey component @@ -186,11 +186,11 @@ end Create Hover component - new_input(self, click_node, text_node[, keyboard_type]) + new_input(self, click_node, text_node, keyboard_type) Create Input component - new_lang_text(self, node, locale_id, no_adjust) + new_lang_text(self, node, locale_id, adjust_type) Create LangText component @@ -206,7 +206,7 @@ end Create RadioGroup component - new_rich_text(self[, template[, nodes]]) + new_rich_text(self, template, nodes) Create RichText component. @@ -214,11 +214,11 @@ end Create Scroll component - new_slider(self, node, end_pos[, callback]) + new_slider(self, pin_node, end_pos, callback) Create Slider component - new_static_grid(self, parent, element[, in_row=1]) + new_static_grid(self, parent_node, element[, in_row=1]) Create StaticGrid component @@ -226,11 +226,11 @@ end Create Swipe component - new_text(self, node[, value[, no_adjust]]) + new_text(self, node, value, no_adjust) Create Text component - new_timer(self, node, seconds_from[, seconds_to=0[, callback]]) + new_timer(self, node, seconds_from[, seconds_to=0], callback) Create Timer component @@ -318,7 +318,7 @@ end
    - new_back_handler(self, callback[, params]) + new_back_handler(self, callback, params)
    Create BackHandler component @@ -335,9 +335,8 @@ end @The callback(self, custom_args) to call on back event
  • params - any + any or nil Callback argument - (optional)
  • @@ -367,8 +366,8 @@ end
  • node - node - Gui node + string or node + The node_id or gui.get_node(node_id)
  • @@ -385,7 +384,7 @@ end
    - new_button(self, node, callback[, params[, anim_node]]) + new_button(self, node, callback, params, anim_node)
    Create Button component @@ -398,22 +397,20 @@ end
  • node - node - GUI node + string or node + The node_id or gui.get_node(node_id)
  • callback function Button callback
  • params - table + table or nil Button callback params - (optional)
  • anim_node - node + node or nil Button anim node (node, if not provided) - (optional)
  • @@ -443,8 +440,8 @@ end
  • node - node - Gui node + string or node + The_node id or gui.get_node(node_id).
  • callback function @@ -567,8 +564,8 @@ end
  • node - node - GUI node to detect dragging + string or node + The node_id or gui.get_node(node_id). Will used as user input node.
  • on_drag_callback function @@ -589,7 +586,7 @@ end
  • - new_dynamic_grid(self, parent) + new_dynamic_grid(self, parent_node)
    Create DynamicGrid component @@ -601,9 +598,9 @@ end DruidInstance -
  • parent - node - The gui node parent, where items will be placed +
  • parent_node + string or node + The node_id or gui.get_node(node_id). Parent of all Grid items.
  • @@ -620,7 +617,7 @@ end
    - new_hotkey(self, keys_array, callback[, callback_argument]) + new_hotkey(self, keys_array, callback, callback_argument)
    Create Hotkey component @@ -641,9 +638,8 @@ end The callback function
  • callback_argument - any + any or nil The argument to pass into the callback function - (optional)
  • @@ -673,8 +669,8 @@ end
  • node - node - Gui node + string or node + The node_id or gui.get_node(node_id)
  • on_hover_callback function @@ -695,7 +691,7 @@ end
  • - new_input(self, click_node, text_node[, keyboard_type]) + new_input(self, click_node, text_node, keyboard_type)
    Create Input component @@ -708,17 +704,16 @@ end
  • click_node - node + string or node Button node to enabled input component
  • text_node - node + string or node Text node what will be changed on user input
  • keyboard_type - number + number or nil Gui keyboard type for input field - (optional)
  • @@ -735,7 +730,7 @@ end
    - new_lang_text(self, node, locale_id, no_adjust) + new_lang_text(self, node, locale_id, adjust_type)
    Create LangText component @@ -748,16 +743,16 @@ end
  • node - node - The text node + string or node + The_node id or gui.get_node(node_id)
  • locale_id - string - Default locale id + string or nil + Default locale id or text from node as default
  • -
  • no_adjust - boolean - If true, will not correct text size +
  • adjust_type + string or nil + Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE
  • @@ -788,7 +783,7 @@ end
  • node string or node - Layout node + The_node id or gui.get_node(node_id).
  • mode string @@ -889,7 +884,7 @@ end
  • - new_rich_text(self[, template[, nodes]]) + new_rich_text(self, template, nodes)
    Create RichText component. @@ -903,14 +898,12 @@ end
  • template - string + string or nil Template name if used - (optional)
  • nodes - table + table or nil Nodes table from gui.clone_tree - (optional)
  • @@ -940,12 +933,12 @@ end
  • view_node - node - GUI view scroll node + string or node + The node_id or gui.get_node(node_id). Will used as user input node.
  • content_node - node - GUI content scroll node + string or node + The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node.
  • @@ -962,7 +955,7 @@ end
    - new_slider(self, node, end_pos[, callback]) + new_slider(self, pin_node, end_pos, callback)
    Create Slider component @@ -974,18 +967,17 @@ end DruidInstance -
  • node - node - Gui pin node +
  • pin_node + string or node + The_node id or gui.get_node(node_id).
  • end_pos vector3 The end position of slider
  • callback - function + function or nil On slider change callback - (optional)
  • @@ -1002,7 +994,7 @@ end
    - new_static_grid(self, parent, element[, in_row=1]) + new_static_grid(self, parent_node, element[, in_row=1])
    Create StaticGrid component @@ -1014,9 +1006,9 @@ end DruidInstance -
  • parent - node - The gui node parent, where items will be placed +
  • parent_node + string or node + The node_id or gui.get_node(node_id). Parent of all Grid items.
  • element node @@ -1055,8 +1047,8 @@ end
  • node - node - Gui node + string or node + The node_id or gui.get_node(node_id). Will used as user input node.
  • on_swipe_callback function @@ -1077,7 +1069,7 @@ end
  • - new_text(self, node[, value[, no_adjust]]) + new_text(self, node, value, no_adjust)
    Create Text component @@ -1090,18 +1082,16 @@ end
  • node - node - Gui text node + string or node + The node_id or gui.get_node(node_id)
  • value - string + string or nil Initial text. Default value is node text from GUI scene. - (optional)
  • no_adjust - boolean + boolean or nil If true, text will be not auto-adjust size - (optional)
  • @@ -1118,7 +1108,7 @@ end
    - new_timer(self, node, seconds_from[, seconds_to=0[, callback]]) + new_timer(self, node, seconds_from[, seconds_to=0], callback)
    Create Timer component @@ -1131,7 +1121,7 @@ end
  • node - node + string or node Gui text node
  • seconds_from @@ -1144,9 +1134,8 @@ end (default 0)
  • callback - function + function or nil Function on timer end - (optional)
  • diff --git a/docs/modules/DynamicGrid.html b/docs/modules/DynamicGrid.html index 748e674..331e65b 100644 --- a/docs/modules/DynamicGrid.html +++ b/docs/modules/DynamicGrid.html @@ -86,7 +86,7 @@ Return side vector to correct node shifting - add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]]) + add(self, node, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]) Add new node to the grid @@ -110,7 +110,7 @@ Return DynamicGrid offset, where DynamicGrid content starts. - get_pos(self, index, node[, origin_index]) + get_pos(self, index, node, origin_index) Return pos for grid node index @@ -213,7 +213,7 @@
    - add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]]) + add(self, node, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])
    Add new node to the grid @@ -230,9 +230,8 @@ Gui node
  • index - number + number or nil The node position. By default add as last node - (optional)
  • shift_policy number @@ -393,7 +392,7 @@
  • - get_pos(self, index, node[, origin_index]) + get_pos(self, index, node, origin_index)
    Return pos for grid node index @@ -414,9 +413,8 @@ The node to be placed
  • origin_index - number + number or nil Index of nearby node - (optional)
  • diff --git a/docs/modules/Helper.html b/docs/modules/Helper.html index 8999078..de4b48a 100644 --- a/docs/modules/Helper.html +++ b/docs/modules/Helper.html @@ -87,7 +87,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Functions

    - + @@ -111,7 +111,7 @@ helper.centrate_nodes(0, node_1, node_2) - + @@ -143,7 +143,7 @@ helper.centrate_nodes(0, node_1, node_2) - + @@ -159,7 +159,7 @@ helper.centrate_nodes(0, node_1, node_2) - + @@ -189,7 +189,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - helper.add_array(target[, source]) + helper.add_array(target, source)
    Add all elements from source array to the target array @@ -202,9 +202,8 @@ helper.centrate_nodes(0, node_1, node_2) Array to put elements from source
  • source - any[] + any[] or nil The source array to get elements from - (optional)
  • @@ -379,7 +378,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - helper.get_border(node[, offset]) + helper.get_border(node, offset)
    Distance from node position to his borders @@ -392,9 +391,8 @@ helper.centrate_nodes(0, node_1, node_2) GUI node
  • offset - vector3 + vector3 or nil Offset from node position. Pass current node position to get non relative border values - (optional)
  • @@ -529,7 +527,7 @@ helper.centrate_nodes(0, node_1, node_2) Gui node
  • include_passed_node_scale - boolean + boolean or nil True if add current node scale to result
  • @@ -606,7 +604,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - helper.insert_with_shift(array, any[, index[, shift_policy]]) + helper.insert_with_shift(array, any, index, shift_policy)
    Add value to array with shift policy Shift policy can be: left, right, no_shift @@ -622,14 +620,12 @@ helper.centrate_nodes(0, node_1, node_2) Item to insert
  • index - number + number or nil Index to insert. If nil, item will be inserted at the end of array - (optional)
  • shift_policy - number + number or nil The druid_const.SHIFT.* constant - (optional)
  • @@ -721,7 +717,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - helper.remove_with_shift(array[, index[, shift_policy]]) + helper.remove_with_shift(array, index, shift_policy)
    Remove value from array with shift policy Shift policy can be: left, right, no_shift @@ -734,14 +730,12 @@ helper.centrate_nodes(0, node_1, node_2) Array
  • index - number + number or nil Index to remove. If nil, item will be removed from the end of array - (optional)
  • shift_policy - number + number or nil The druid_const.SHIFT.* constant - (optional)
  • diff --git a/docs/modules/Hotkey.html b/docs/modules/Hotkey.html index 3621846..d33df50 100644 --- a/docs/modules/Hotkey.html +++ b/docs/modules/Hotkey.html @@ -83,11 +83,11 @@

    Functions

    helper.add_array(target[, source])helper.add_array(target, source) Add all elements from source array to the target array
    Calculate distance between two points
    helper.get_border(node[, offset])helper.get_border(node, offset) Distance from node position to his borders
    Get text metric from GUI node.
    helper.insert_with_shift(array, any[, index[, shift_policy]])helper.insert_with_shift(array, any, index, shift_policy) Add value to array with shift policy
    Lerp between two values
    helper.remove_with_shift(array[, index[, shift_policy]])helper.remove_with_shift(array, index, shift_policy) Remove value from array with shift policy
    - + - +
    add_hotkey(self, keys[, callback_argument])add_hotkey(self, keys, callback_argument) Add hotkey for component callback
    init(self, keys, callback[, callback_argument])init(self, keys, callback, callback_argument) The Hotkey constructor
    @@ -127,7 +127,7 @@
    - add_hotkey(self, keys[, callback_argument]) + add_hotkey(self, keys, callback_argument)
    Add hotkey for component callback @@ -144,9 +144,8 @@ that have to be pressed before key pressed to activate
  • callback_argument - any + any or nil The argument to pass into the callback function - (optional)
  • @@ -157,7 +156,7 @@
    - init(self, keys, callback[, callback_argument]) + init(self, keys, callback, callback_argument)
    The Hotkey constructor @@ -178,9 +177,8 @@ The callback function
  • callback_argument - any + any or nil The argument to pass into the callback function - (optional)
  • diff --git a/docs/modules/Hover.html b/docs/modules/Hover.html index ef2d206..1623346 100644 --- a/docs/modules/Hover.html +++ b/docs/modules/Hover.html @@ -286,7 +286,7 @@ Hover
  • state - boolean + boolean or nil The hover enabled state
  • @@ -311,7 +311,7 @@ Hover
  • state - boolean + boolean or nil The hover state
  • @@ -336,7 +336,7 @@ Hover
  • state - boolean + boolean or nil The mouse hover state
  • diff --git a/docs/modules/Input.html b/docs/modules/Input.html index 092cd07..14e605b 100644 --- a/docs/modules/Input.html +++ b/docs/modules/Input.html @@ -93,7 +93,7 @@ Return current input field text - init(self, click_node, text_node[, keyboard_type]) + init(self, click_node, text_node, keyboard_type) The Input constructor @@ -220,7 +220,7 @@
    - init(self, click_node, text_node[, keyboard_type]) + init(self, click_node, text_node, keyboard_type)
    The Input constructor @@ -241,9 +241,8 @@ Text node what will be changed on user input. You can pass text component instead of text node name Text
  • keyboard_type - number + number or nil Gui keyboard type for input field - (optional)
  • diff --git a/docs/modules/LangText.html b/docs/modules/LangText.html index c705e58..71b5e66 100644 --- a/docs/modules/LangText.html +++ b/docs/modules/LangText.html @@ -89,11 +89,11 @@

    Functions

    - + - + @@ -101,7 +101,7 @@ - +
    format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])format(self, a, b, c, d, e, f, g) Format string with new text params on localized text
    init(self, node, locale_id[, adjust_type=downscale])init(self, node[, locale_id=node_text[, adjust_type=downscale]]) The LangText constructor
    Setup raw text to lang_text component
    translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])translate(self, locale_id, a, b, c, d, e, f, g) Translate the text by locale_id
    @@ -126,7 +126,7 @@
    - format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]]) + format(self, a, b, c, d, e, f, g)
    Format string with new text params on localized text @@ -139,39 +139,32 @@ LangText
  • a - string + string or nil Optional param to string.format - (optional)
  • b - string + string or nil Optional param to string.format - (optional)
  • c - string + string or nil Optional param to string.format - (optional)
  • d - string + string or nil Optional param to string.format - (optional)
  • e - string + string or nil Optional param to string.format - (optional)
  • f - string + string or nil Optional param to string.format - (optional)
  • g - string + string or nil Optional param to string.format - (optional)
  • @@ -188,7 +181,7 @@
    - init(self, node, locale_id[, adjust_type=downscale]) + init(self, node[, locale_id=node_text[, adjust_type=downscale]])
    The LangText constructor @@ -202,11 +195,12 @@
  • node string or node - Node name or GUI Text Node itself + The node_id or gui.get_node(node_id)
  • locale_id string Default locale id or text from node as default + (default node_text)
  • adjust_type string @@ -253,7 +247,7 @@
  • - translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]]) + translate(self, locale_id, a, b, c, d, e, f, g)
    Translate the text by locale_id @@ -270,39 +264,32 @@ Locale id
  • a - string + string or nil Optional param to string.format - (optional)
  • b - string + string or nil Optional param to string.format - (optional)
  • c - string + string or nil Optional param to string.format - (optional)
  • d - string + string or nil Optional param to string.format - (optional)
  • e - string + string or nil Optional param to string.format - (optional)
  • f - string + string or nil Optional param to string.format - (optional)
  • g - string + string or nil Optional param to string.format - (optional)
  • diff --git a/docs/modules/Layout.html b/docs/modules/Layout.html index a19a24e..edad2b6 100644 --- a/docs/modules/Layout.html +++ b/docs/modules/Layout.html @@ -82,7 +82,7 @@

    Functions

    - + @@ -94,7 +94,7 @@ - + @@ -143,7 +143,7 @@
    - fit_into_node(self[, node]) + fit_into_node(self, node)
    Set node for layout node to fit inside it. Pass nil to reset @@ -156,9 +156,8 @@ Layout
  • node - node + node or nil - (optional)
  • @@ -233,7 +232,7 @@
    - init(self, node, mode[, on_size_changed_callback]) + init(self, node, mode, on_size_changed_callback)
    The Layout constructor @@ -254,9 +253,8 @@ The layout mode (from const.LAYOUT_MODE)
  • on_size_changed_callback - function + function or nil The callback on window resize - (optional)
  • diff --git a/docs/modules/Progress.html b/docs/modules/Progress.html index 0f490b7..b72ba4f 100644 --- a/docs/modules/Progress.html +++ b/docs/modules/Progress.html @@ -119,7 +119,7 @@
    - +
    fit_into_node(self[, node])fit_into_node(self, node) Set node for layout node to fit inside it.
    Set current size for layout node to fit inside it
    init(self, node, mode[, on_size_changed_callback])init(self, node, mode, on_size_changed_callback) The Layout constructor
    Instant fill progress bar to value
    to(self, to[, callback])to(self, to, callback) Start animation of a progress bar
    @@ -357,7 +357,7 @@
    - to(self, to[, callback]) + to(self, to, callback)
    Start animation of a progress bar @@ -374,9 +374,8 @@ value between 0..1
  • callback - function + function or nil Callback on animation ends - (optional)
  • diff --git a/docs/modules/RadioGroup.html b/docs/modules/RadioGroup.html index c08c25c..95b3e24 100644 --- a/docs/modules/RadioGroup.html +++ b/docs/modules/RadioGroup.html @@ -193,7 +193,7 @@ Index in radio group
  • is_instant - boolean + boolean or nil If is instant state change
  • diff --git a/docs/modules/Scroll.html b/docs/modules/Scroll.html index 2ab3fb0..e0ca1d1 100644 --- a/docs/modules/Scroll.html +++ b/docs/modules/Scroll.html @@ -128,15 +128,15 @@ Check node if it visible now on scroll. - scroll_to(self, point[, is_instant]) + scroll_to(self, point, is_instant) Start scroll to target point. - scroll_to_index(self, index[, skip_cb]) + scroll_to_index(self, index, skip_cb) Scroll to item in scroll by point index. - scroll_to_percent(self, percent[, is_instant]) + scroll_to_percent(self, percent, is_instant) Start scroll to target scroll percent @@ -415,7 +415,7 @@
    - scroll_to(self, point[, is_instant]) + scroll_to(self, point, is_instant)
    Start scroll to target point. @@ -432,9 +432,8 @@ Target point
  • is_instant - boolean + boolean or nil Instant scroll flag - (optional)
  • @@ -450,7 +449,7 @@
    - scroll_to_index(self, index[, skip_cb]) + scroll_to_index(self, index, skip_cb)
    Scroll to item in scroll by point index. @@ -467,9 +466,8 @@ Point index
  • skip_cb - boolean + boolean or nil If true, skip the point callback - (optional)
  • @@ -480,7 +478,7 @@
    - scroll_to_percent(self, percent[, is_instant]) + scroll_to_percent(self, percent, is_instant)
    Start scroll to target scroll percent @@ -497,9 +495,8 @@ target percent
  • is_instant - boolean + boolean or nil instant scroll flag - (optional)
  • @@ -586,7 +583,7 @@ Scroll
  • state - boolean + boolean or nil True, if horizontal scroll is enabled
  • @@ -619,7 +616,7 @@ Scroll
  • state - boolean + boolean or nil Inert scroll state
  • @@ -718,7 +715,7 @@ Scroll
  • state - boolean + boolean or nil True, if vertical scroll is enabled
  • diff --git a/docs/modules/Slider.html b/docs/modules/Slider.html index b30fe11..3fdf8fe 100644 --- a/docs/modules/Slider.html +++ b/docs/modules/Slider.html @@ -82,11 +82,11 @@

    Functions

    - + - + @@ -147,7 +147,7 @@
    - init(self, node, end_pos[, callback]) + init(self, node, end_pos, callback)
    The Slider constructor @@ -168,9 +168,8 @@ The end position of slider
  • callback - function + function or nil On slider change callback - (optional)
  • @@ -181,7 +180,7 @@
    - set(self, value[, is_silent]) + set(self, value, is_silent)
    Set value for slider @@ -198,9 +197,8 @@ Value from 0 to 1
  • is_silent - boolean + boolean or nil Don't trigger event if true - (optional)
  • diff --git a/docs/modules/StaticGrid.html b/docs/modules/StaticGrid.html index 986f9ca..d7ad168 100644 --- a/docs/modules/StaticGrid.html +++ b/docs/modules/StaticGrid.html @@ -102,7 +102,7 @@

    Functions

    init(self, node, end_pos[, callback])init(self, node, end_pos, callback) The Slider constructor
    set(self, value[, is_silent])set(self, value, is_silent) Set value for slider
    - + @@ -230,7 +230,7 @@
    - add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]]) + add(self, item, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])
    Add new item to the grid @@ -247,9 +247,8 @@ Gui node
  • index - number + number or nil The item position. By default add as last item - (optional)
  • shift_policy number diff --git a/docs/modules/Swipe.html b/docs/modules/Swipe.html index 7dc7d10..3b68b0d 100644 --- a/docs/modules/Swipe.html +++ b/docs/modules/Swipe.html @@ -231,9 +231,8 @@
    • click_zone - node + node or nil - (optional)
    diff --git a/docs/modules/Text.html b/docs/modules/Text.html index d14822a..aa91505 100644 --- a/docs/modules/Text.html +++ b/docs/modules/Text.html @@ -105,11 +105,11 @@
  • - + - + @@ -137,7 +137,7 @@ - + @@ -242,7 +242,7 @@
    - get_text_size(self[, text]) + get_text_size(self, text)
    Calculate text width with font with respect to trailing space @@ -255,9 +255,8 @@ Text
  • text - string + string or nil - (optional)
  • @@ -277,7 +276,7 @@
    - init(self, node[, value[, adjust_type=downscale]]) + init(self, node, value[, adjust_type=downscale])
    The Text constructor @@ -294,9 +293,8 @@ Node name or GUI Text Node itself
  • value - string + string or nil Initial text. Default value is node text from GUI scene. - (optional)
  • adjust_type string @@ -494,7 +492,7 @@
  • - set_text_adjust(self[, adjust_type[, minimal_scale]]) + set_text_adjust(self, adjust_type, minimal_scale)
    Set text adjust, refresh the current text visuals, if needed @@ -507,14 +505,12 @@ Text
  • adjust_type - number + number or nil See const.TEXT_ADJUST. If pass nil - use current adjust type - (optional)
  • minimal_scale - number + number or nil If pass nil - not use minimal scale - (optional)
  • diff --git a/docs/modules/Timer.html b/docs/modules/Timer.html index 958899f..bd27865 100644 --- a/docs/modules/Timer.html +++ b/docs/modules/Timer.html @@ -84,7 +84,7 @@

    Functions

    add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])add(self, item, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]) Add new item to the grid
    Return current text adjust type
    get_text_size(self[, text])get_text_size(self, text) Calculate text width with font with respect to trailing space
    init(self, node[, value[, adjust_type=downscale]])init(self, node, value[, adjust_type=downscale]) The Text constructor
    Set scale
    set_text_adjust(self[, adjust_type[, minimal_scale]])set_text_adjust(self, adjust_type, minimal_scale) Set text adjust, refresh the current text visuals, if needed
    - + @@ -141,7 +141,7 @@
    - init(self, node, seconds_from[, seconds_to=0[, callback]]) + init(self, node, seconds_from[, seconds_to=0], callback)
    The Timer constructor @@ -167,9 +167,8 @@ (default 0)
  • callback - function + function or nil Function on timer end - (optional)
  • @@ -222,7 +221,7 @@ Timer
  • is_on - boolean + boolean or nil Timer enable state
  • diff --git a/druid/annotations.lua b/druid/annotations.lua index f053e8a..6852727 100644 --- a/druid/annotations.lua +++ b/druid/annotations.lua @@ -1,1853 +1 @@ --- luacheck: ignore ----@diagnostic disable: lowercase-global ----@diagnostic disable: missing-return ----@diagnostic disable: duplicate-doc-param ----@diagnostic disable: duplicate-set-field - ----@class druid -local druid = {} - ---- Create a new Druid instance for creating GUI components. ----@param context table The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks. ----@param style table The Druid style table to override style parameters for this Druid instance. ----@return druid_instance The Druid instance @{DruidInstance}. -function druid.new(context, style) end - ---- Call this function when the game language changes. ---- This function will translate all current LangText components. -function druid.on_language_change() end - ---- Set the window callback to enable on_focus_gain and on_focus_lost functions. ---- This is used to trigger the on_focus_lost and on_focus_gain functions in Druid components. ----@param event string Event param from window listener -function druid.on_window_callback(event) end - ---- Register a new external Druid component. ---- You can register your own components to make new alias: the druid:new_{name} function. For example, if you want to register a component called "my_component", you can create it using druid:new_my_component(...). This can be useful if you have your own "basic" components that you don't want to re-create each time. ----@param name string module name ----@param module table lua table with component -function druid.register(name, module) end - ---- Set your own default style for all Druid instances. ---- To create your own style file, copy the default style file and make changes to it. Register the new style before creating your Druid instances. ----@param style table Druid style module -function druid.set_default_style(style) end - ---- Set the Druid sound function to play UI sounds if used. ---- Set a function to play a sound given a sound_id. This function is used for button clicks to play the "click" sound. It can also be used to play sounds in your custom components (see the default Druid style file for an example). ----@param callback function Sound play callback -function druid.set_sound_function(callback) end - ---- Set the text function for the LangText component. ---- The Druid locale component will call this function to get translated text. After setting the text function, all existing locale components will be updated. ----@param callback function Get localized text function -function druid.set_text_function(callback) end - - ----@class druid.back_handler : druid.base_component ----@field on_back druid.event The @{DruidEvent} Event on back handler action. ----@field params any Custom args to pass in the callback -local druid__back_handler = {} - - ----@class druid.base_component -local druid__base_component = {} - ---- Return all children components, recursive ----@param self druid.base_component @{BaseComponent} ----@return table Array of childrens if the Druid component instance -function druid__base_component.get_childrens(self) end - ---- Context used as first arg in all Druid events ---- Context is usually self of gui_script. ----@param self druid.base_component @{BaseComponent} ----@return table BaseComponent context -function druid__base_component.get_context(self) end - ---- Get Druid instance for inner component creation. ----@param self druid.base_component @{BaseComponent} ----@return druid_instance Druid instance with component context -function druid__base_component.get_druid(self) end - ---- Return component input priority ----@param self druid.base_component @{BaseComponent} ----@return number The component input priority -function druid__base_component.get_input_priority(self) end - ---- Return component name ----@param self druid.base_component @{BaseComponent} ----@return string The component name -function druid__base_component.get_name(self) end - ---- Get component node by name. ---- If component has nodes, node_or_name should be string It autopick node by template name or from nodes by gui.clone_tree if they was setup via component:set_nodes, component:set_template. If node is not found, the exception will fired ----@param self druid.base_component @{BaseComponent} ----@param node_or_name string|node Node name or node itself ----@return node Gui node -function druid__base_component.get_node(self, node_or_name) end - ---- Return the parent component if exist ----@param self druid.base_component @{BaseComponent} ----@return druid.base_component|nil The druid component instance or nil -function druid__base_component.get_parent_component(self) end - ---- Return parent component name ----@param self druid.base_component @{BaseComponent} ----@return string|nil The parent component name if exist or bil -function druid__base_component.get_parent_name(self) end - ---- Get current component template name. ----@param self druid.base_component @{BaseComponent} ----@return string Component full template name -function druid__base_component.get_template(self) end - ---- Return component UID. ---- UID generated in component creation order. ----@param self druid.base_component @{BaseComponent} ----@return number The component uid -function druid__base_component.get_uid(self) end - ---- Reset component input priority to default value ----@param self druid.base_component @{BaseComponent} ----@return number The component input priority -function druid__base_component.reset_input_priority(self) end - ---- Set component input state. ---- By default it enabled If input is disabled, the component will not receive input events ----@param self druid.base_component @{BaseComponent} ----@param state boolean The component input state ----@return druid.base_component BaseComponent itself -function druid__base_component.set_input_enabled(self, state) end - ---- Set component input priority ---- Default value: 10 ----@param self druid.base_component @{BaseComponent} ----@param value number The new input priority value ----@param is_temporary boolean If true, the reset input priority will return to previous value ----@return number The component input priority -function druid__base_component.set_input_priority(self, value, is_temporary) end - ---- Set current component nodes. ---- Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree. ----@param self druid.base_component @{BaseComponent} ----@param nodes table BaseComponent nodes table ----@return druid.base_component @{BaseComponent} -function druid__base_component.set_nodes(self, nodes) end - ---- Set current component style table. ---- Invoke `on_style_change` on component, if exist. Component should handle their style changing and store all style params ----@param self druid.base_component @{BaseComponent} ----@param druid_style table Druid style module ----@return druid.base_component @{BaseComponent} -function druid__base_component.set_style(self, druid_style) end - ---- Set component template name. ---- Use on all your custom components with GUI layouts used as templates. It will check parent template name to build full template name in self:get_node() ----@param self druid.base_component @{BaseComponent} ----@param template string BaseComponent template name ----@return druid.base_component @{BaseComponent} -function druid__base_component.set_template(self, template) end - - ----@class druid.blocker : druid.base_component ----@field node node Blocker node -local druid__blocker = {} - ---- The @{Blocker} constructor ----@param self druid.blocker @{Blocker} ----@param node node Gui node -function druid__blocker.init(self, node) end - ---- Return blocker enabled state ----@param self druid.blocker @{Blocker} ----@return boolean @True, if blocker is enabled -function druid__blocker.is_enabled(self) end - ---- Set enabled blocker component state. ---- Don't change node enabled state itself. ----@param self druid.blocker @{Blocker} ----@param state boolean Enabled state -function druid__blocker.set_enabled(self, state) end - - ----@class druid.button : druid.base_component ----@field anim_node node Button animation node. ----@field click_zone node Additional button click area, defined by another GUI Node ----@field hover druid.hover The @{Hover}: Button Hover component ----@field node node Button trigger node ----@field node_id hash The GUI node id from button node ----@field on_click druid.event The @{DruidEvent}: Event on successful release action over button. ----@field on_click_outside druid.event The @{DruidEvent}: Event calls if click event was outside of button. ----@field on_double_click druid.event The @{DruidEvent}: Event on double tap action over button. ----@field on_hold_callback druid.event The @{DruidEvent}: Event calls every frame before on_long_click event. ----@field on_long_click druid.event The @{DruidEvent}: Event on long tap action over button. ----@field on_pressed druid.event The @{DruidEvent}: Event triggered if button was pressed by user. ----@field on_repeated_click druid.event The @{DruidEvent}: Event on repeated action over button. ----@field params any Custom args for any Button event. ----@field style druid.button.style Component style params. -local druid__button = {} - ---- Get current key name to trigger this button. ----@param self druid.button ----@return hash The action_id of the input key -function druid__button.get_key_trigger(self) end - ---- The @{Button} constructor ----@param self druid.button @{Button} ----@param node string|node Node name or GUI Node itself ----@param callback function On click button callback ----@param custom_args any Button events custom arguments ----@param anim_node string|node Node to animate instead of trigger node. -function druid__button.init(self, node, callback, custom_args, anim_node) end - ---- Get button enabled state. ---- By default all Buttons is enabled on creating. ----@param self druid.button @{Button} ----@return boolean @True, if button is enabled now, False overwise -function druid__button.is_enabled(self) end - ---- Set function for additional check for button click availability ----@param self druid.button ----@param check_function function Should return true or false. If true - button can be pressed. ----@param failure_callback function Function will be called on button click, if check function return false ----@return druid.button Current button instance -function druid__button.set_check_function(self, check_function, failure_callback) end - ---- Set additional button click area. ---- Useful to restrict click outside out stencil node or scrollable content. This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check ----@param self druid.button @{Button} ----@param zone node Gui node ----@return druid.button Current button instance -function druid__button.set_click_zone(self, zone) end - ---- Set button enabled state. ---- The style.on_set_enabled will be triggered. Disabled button is not clickable. ----@param self druid.button @{Button} ----@param state boolean Enabled state ----@return druid.button Current button instance -function druid__button.set_enabled(self, state) end - ---- Set key name to trigger this button by keyboard. ----@param self druid.button @{Button} ----@param key hash The action_id of the input key ----@return druid.button Current button instance -function druid__button.set_key_trigger(self, key) end - ---- Set Button mode to work inside user HTML5 interaction event. ---- It's required to make protected things like copy & paste text, show mobile keyboard, etc The HTML5 button's doesn't call any events except on_click event. If the game is not HTML, html mode will be not enabled ----@param self druid.button ----@param is_web_mode boolean If true - button will be called inside html5 callback ----@return druid.button Current button instance -function druid__button.set_web_user_interaction(self, is_web_mode) end - - ----@class druid.button.style ----@field AUTOHOLD_TRIGGER number Maximum hold time to trigger button release while holding ----@field DOUBLETAP_TIME number Time between double taps ----@field LONGTAP_TIME number Minimum time to trigger on_hold_callback ----@field on_click function function(self, node) ----@field on_click_disabled function function(self, node) ----@field on_hover function function(self, node, hover_state) ----@field on_mouse_hover function function(self, node, hover_state) ----@field on_set_enabled function function(self, node, enabled_state) -local druid__button__style = {} - - ----@class druid.checkbox : druid.base_component ----@field button druid.button Button component from click_node ----@field click_node node Button trigger node ----@field node node Visual node ----@field on_change_state druid.event On change state callback(self, state) ----@field style druid.checkbox.style Component style params. -local druid__checkbox = {} - ---- Return checkbox state ----@param self druid.checkbox @{Checkbox} ----@return boolean Checkbox state -function druid__checkbox.get_state(self) end - ---- The @{Checkbox} constructor ----@param self druid.checkbox @{Checkbox} ----@param node node Gui node ----@param callback function Checkbox callback ----@param click_node node Trigger node, by default equals to node ----@param initial_state boolean The initial state of checkbox, default - false -function druid__checkbox.init(self, node, callback, click_node, initial_state) end - ---- Set checkbox state ----@param self druid.checkbox @{Checkbox} ----@param state boolean Checkbox state ----@param is_silent boolean Don't trigger on_change_state if true ----@param is_instant boolean If instant checkbox change -function druid__checkbox.set_state(self, state, is_silent, is_instant) end - - ----@class druid.checkbox.style ----@field on_change_state function (self, node, state) -local druid__checkbox__style = {} - - ----@class druid.checkbox_group : druid.base_component ----@field checkboxes table Array of checkbox components ----@field on_checkbox_click druid.event On any checkbox click callback(self, index) -local druid__checkbox_group = {} - ---- Return checkbox group state ----@param self druid.checkbox_group @{CheckboxGroup} ----@return boolean[] Array if checkboxes state -function druid__checkbox_group.get_state(self) end - ---- The @{CheckboxGroup} constructor ----@param self druid.checkbox_group @{CheckboxGroup} ----@param nodes node[] Array of gui node ----@param callback function Checkbox callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes -function druid__checkbox_group.init(self, nodes, callback, click_nodes) end - ---- Set checkbox group state ----@param self druid.checkbox_group @{CheckboxGroup} ----@param indexes boolean[] Array of checkbox state ----@param is_instant boolean If instant state change -function druid__checkbox_group.set_state(self, indexes, is_instant) end - - ----@class druid.data_list : druid.base_component ----@field grid druid.static_grid|druid.dynamic_grid The Druid Grid component ----@field last_index number The current visual last data index ----@field on_element_add druid.event On DataList visual element created Event callback(self, index, node, instance) ----@field on_element_remove druid.event On DataList visual element created Event callback(self, index) ----@field on_scroll_progress_change druid.event Event triggered when scroll progress is changed; event(self, progress_value) ----@field scroll druid.scroll The Druid scroll component ----@field scroll_progress number The current progress of scroll posititon ----@field top_index number The current visual top data index -local druid__data_list = {} - ---- Clear the DataList and refresh visuals ----@param self druid.data_list @{DataList} -function druid__data_list.clear(self) end - ---- Return all currenly created components in DataList ----@param self druid.data_list @{DataList} ----@return druid.base_component[] List of created nodes -function druid__data_list.get_created_components(self) end - ---- Return all currenly created nodes in DataList ----@param self druid.data_list @{DataList} ----@return node[] List of created nodes -function druid__data_list.get_created_nodes(self) end - ---- Return current data from DataList component ----@param self druid.data_list @{DataList} ----@return table The current data array -function druid__data_list.get_data(self) end - ---- Return first index from data. ---- It not always equals to 1 ----@param self druid.data_list @{DataList} -function druid__data_list.get_first_index(self) end - ---- Return index for data value ----@param self druid.data_list @{DataList} ----@param data table -function druid__data_list.get_index(self, data) end - ---- Return last index from data ----@param self druid.data_list @{DataList} -function druid__data_list.get_last_index(self) end - ---- Return amount of data ----@param self druid.data_list @{DataList} -function druid__data_list.get_length(self) end - ---- The @{DataList} constructor ----@param self druid.data_list @{DataList} ----@param scroll druid.scroll The @{Scroll} instance for Data List component ----@param grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component ----@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component]) -function druid__data_list.init(self, scroll, grid, create_function) end - ---- Druid System on_remove function ----@param self druid.data_list @{DataList} -function druid__data_list.on_remove(self) end - ---- Instant scroll to element with passed index ----@param self druid.data_list @{DataList} ----@param index number -function druid__data_list.scroll_to_index(self, index) end - ---- Set new data set for DataList component ----@param self druid.data_list @{DataList} ----@param data table The new data array ----@return druid.data_list Current DataList instance -function druid__data_list.set_data(self, data) end - - ----@class druid.drag : druid.base_component ----@field can_x boolean Is drag component process vertical dragging. ----@field can_y boolean Is drag component process horizontal. ----@field is_drag boolean Is component now dragging ----@field is_touch boolean Is component now touching ----@field on_drag druid.event on drag progress callback(self, dx, dy, total_x, total_y) ----@field on_drag_end druid.event Event on drag end callback(self, total_x, total_y) ----@field on_drag_start druid.event Event on drag start callback(self) ----@field on_touch_end druid.event Event on touch end callback(self) ----@field on_touch_start druid.event Event on touch start callback(self) ----@field style druid.drag.style Component style params. ----@field touch_start_pos vector3 Touch start position ----@field x number Current touch x position ----@field y number Current touch y position -local druid__drag = {} - ---- The @{Drag} constructor ----@param self druid.drag @{Drag} ----@param node node GUI node to detect dragging ----@param on_drag_callback function Callback for on_drag_event(self, dx, dy) -function druid__drag.init(self, node, on_drag_callback) end - ---- Check if Drag component is enabled ----@param self druid.drag @{Drag} ----@return boolean -function druid__drag.is_enabled(self) end - ---- Strict drag click area. ---- Useful for restrict events outside stencil node ----@param self druid.drag @{Drag} ----@param node node Gui node -function druid__drag.set_click_zone(self, node) end - ---- Set Drag input enabled or disabled ----@param self druid.drag @{Drag} ----@param is_enabled boolean -function druid__drag.set_enabled(self, is_enabled) end - - ----@class druid.drag.style ----@field DRAG_DEADZONE number Distance in pixels to start dragging ----@field NO_USE_SCREEN_KOEF boolean If screen aspect ratio affects on drag values -local druid__drag__style = {} - - ----@class druid.dynamic_grid : druid.base_component ----@field border vector4 The size of item content ----@field first_index number The first index of node in grid ----@field last_index number The last index of node in grid ----@field node_size vector3 Item size ----@field nodes node[] List of all grid elements. ----@field on_add_item druid.event On item add callback(self, node, index) ----@field on_change_items druid.event On item add or remove callback(self, index) ----@field on_clear druid.event On grid clear callback(self) ----@field on_remove_item druid.event On item remove callback(self, index) ----@field on_update_positions druid.event On update item positions callback(self) ----@field parent node Parent gui node -local druid__dynamic_grid = {} - ---- Return side vector to correct node shifting ----@param self unknown ----@param side unknown ----@param is_forward unknown -function druid__dynamic_grid._get_side_vector(self, side, is_forward) end - ---- Add new node to the grid ----@param self druid.dynamic_grid @{DynamicGrid} ----@param node node Gui node ----@param index number The node position. By default add as last node ----@param shift_policy number How shift nodes, if required. See const.SHIFT ----@param is_instant boolean If true, update node positions instantly -function druid__dynamic_grid.add(self, node, index, shift_policy, is_instant) end - ---- Clear grid nodes array. ---- GUI nodes will be not deleted! If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear ----@param self druid.dynamic_grid @{DynamicGrid} ----@return druid.dynamic_grid Current grid instance -function druid__dynamic_grid.clear(self) end - ---- Return array of all node positions ----@param self druid.dynamic_grid @{DynamicGrid} ----@return vector3[] All grid node positions -function druid__dynamic_grid.get_all_pos(self) end - ---- Return grid content borders ----@param self druid.dynamic_grid @{DynamicGrid} ----@return vector3 The grid content borders -function druid__dynamic_grid.get_borders(self) end - ---- Return grid index by node ----@param self druid.dynamic_grid @{DynamicGrid} ----@param node node The gui node in the grid ----@return number The node index -function druid__dynamic_grid.get_index_by_node(self, node) end - ---- Return DynamicGrid offset, where DynamicGrid content starts. ----@param self druid.dynamic_grid @{DynamicGrid} The DynamicGrid instance ----@return vector3 The DynamicGrid offset -function druid__dynamic_grid.get_offset(self) end - ---- Return pos for grid node index ----@param self druid.dynamic_grid @{DynamicGrid} ----@param index number The grid element index ----@param node node The node to be placed ----@param origin_index number Index of nearby node ----@return vector3 Node position -function druid__dynamic_grid.get_pos(self, index, node, origin_index) end - ---- Return grid content size ----@param self druid.dynamic_grid @{DynamicGrid} ----@param border vector3 ----@return vector3 The grid content size -function druid__dynamic_grid.get_size(self, border) end - ---- The @{DynamicGrid} constructor ----@param self druid.dynamic_grid @{DynamicGrid} ----@param parent node The gui node parent, where items will be placed -function druid__dynamic_grid.init(self, parent) end - ---- Remove the item from the grid. ---- Note that gui node will be not deleted ----@param self druid.dynamic_grid @{DynamicGrid} ----@param index number The grid node index to remove ----@param shift_policy number How shift nodes, if required. See const.SHIFT ----@param is_instant boolean If true, update node positions instantly ----@return node The deleted gui node from grid -function druid__dynamic_grid.remove(self, index, shift_policy, is_instant) end - ---- Change set position function for grid nodes. ---- It will call on update poses on grid elements. Default: gui.set_position ----@param self druid.dynamic_grid @{DynamicGrid} ----@param callback function Function on node set position ----@return druid.dynamic_grid Current grid instance -function druid__dynamic_grid.set_position_function(self, callback) end - - ----@class druid.event -local druid__event = {} - ---- Clear the all event handlers ----@param self druid.event @{DruidEvent} -function druid__event.clear(self) end - ---- DruidEvent constructor ----@param self druid.event @{DruidEvent} ----@param initial_callback function Subscribe the callback on new event, if callback exist -function druid__event.initialize(self, initial_callback) end - ---- Return true, if event have at lease one handler ----@param self druid.event @{DruidEvent} ----@return boolean True if event have handlers -function druid__event.is_exist(self) end - ---- Subscribe callback on event ----@param self druid.event @{DruidEvent} ----@param callback function Callback itself ----@param context any Additional context as first param to callback call, usually it's self -function druid__event.subscribe(self, callback, context) end - ---- Trigger the event and call all subscribed callbacks ----@param self druid.event @{DruidEvent} ----@param ... any All event params -function druid__event.trigger(self, ...) end - ---- Unsubscribe callback on event ----@param self druid.event @{DruidEvent} ----@param callback function Callback itself ----@param context any Additional context as first param to callback call -function druid__event.unsubscribe(self, callback, context) end - - ----@class druid.hotkey : druid.base_component ----@field button druid.button Button component from click_node ----@field click_node node Button trigger node ----@field node node Visual node ----@field on_change_state druid.event On change state callback(self, state) ----@field style druid.hotkey.style Component style params. -local druid__hotkey = {} - ---- Add hotkey for component callback ----@param self druid.hotkey @{Hotkey} ----@param keys string[]|hash[]|string|hash that have to be pressed before key pressed to activate ----@param callback_argument any The argument to pass into the callback function -function druid__hotkey.add_hotkey(self, keys, callback_argument) end - ---- The @{Hotkey} constructor ----@param self druid.hotkey @{Hotkey} ----@param keys string[]|string The keys to be pressed for trigger callback. Should contains one key and any modificator keys ----@param callback function The callback function ----@param callback_argument any The argument to pass into the callback function -function druid__hotkey.init(self, keys, callback, callback_argument) end - - ----@class druid.hotkey.style ----@field MODIFICATORS string[] The list of action_id as hotkey modificators -local druid__hotkey__style = {} - - ----@class druid.hover : druid.base_component ----@field on_hover druid.event On hover callback(self, state, hover_instance) ----@field on_mouse_hover druid.event On mouse hover callback(self, state, hover_instance) -local druid__hover = {} - ---- The @{Hover} constructor ----@param self druid.hover @{Hover} ----@param node node Gui node ----@param on_hover_callback function Hover callback -function druid__hover.init(self, node, on_hover_callback) end - ---- Return current hover enabled state ----@param self druid.hover @{Hover} ----@return boolean The hover enabled state -function druid__hover.is_enabled(self) end - ---- Return current hover state. ---- True if touch action was on the node at current time ----@param self druid.hover @{Hover} ----@return boolean The current hovered state -function druid__hover.is_hovered(self) end - ---- Return current hover state. ---- True if nil action_id (usually desktop mouse) was on the node at current time ----@param self druid.hover @{Hover} ----@return boolean The current hovered state -function druid__hover.is_mouse_hovered(self) end - ---- Strict hover click area. ---- Useful for no click events outside stencil node ----@param self druid.hover @{Hover} ----@param zone node Gui node -function druid__hover.set_click_zone(self, zone) end - ---- Set enable state of hover component. ---- If hover is not enabled, it will not generate any hover events ----@param self druid.hover @{Hover} ----@param state boolean The hover enabled state -function druid__hover.set_enabled(self, state) end - ---- Set hover state ----@param self druid.hover @{Hover} ----@param state boolean The hover state -function druid__hover.set_hover(self, state) end - ---- Set mouse hover state ----@param self druid.hover @{Hover} ----@param state boolean The mouse hover state -function druid__hover.set_mouse_hover(self, state) end - - ----@class druid.input : druid.base_component ----@field allowerd_characters string Pattern matching for user input ----@field button druid.button Button component ----@field is_empty boolean Is current input is empty now ----@field is_selected boolean Is current input selected now ----@field keyboard_type number Gui keyboard type for input field ----@field max_length number Max length for input text ----@field on_input_empty druid.event On input field text change to empty string callback(self, input_text) ----@field on_input_full druid.event On input field text change to max length string callback(self, input_text) ----@field on_input_select druid.event On input field select callback(self, button_node) ----@field on_input_text druid.event On input field text change callback(self, input_text) ----@field on_input_unselect druid.event On input field unselect callback(self, input_text) ----@field on_input_wrong druid.event On trying user input with not allowed character callback(self, params, button_instance) ----@field style druid.input.style Component style params. ----@field text druid.text Text component -local druid__input = {} - ---- Return current input field text ----@param self druid.input @{Input} ----@return string The current input field text -function druid__input.get_text(self) end - ---- The @{Input} constructor ----@param self druid.input @{Input} ----@param click_node node Node to enabled input component ----@param text_node node|druid.text Text node what will be changed on user input. You can pass text component instead of text node name @{Text} ----@param keyboard_type number Gui keyboard type for input field -function druid__input.init(self, click_node, text_node, keyboard_type) end - ---- Reset current input selection and return previous value ----@param self druid.input @{Input} -function druid__input.reset_changes(self) end - ---- Select input field. ---- It will show the keyboard and trigger on_select events ----@param self druid.input @{Input} -function druid__input.select(self) end - ---- Set allowed charaters for input field. ---- See: https://defold.com/ref/stable/string/ ex: [%a%d] for alpha and numeric ----@param self druid.input @{Input} ----@param characters string Regulax exp. for validate user input ----@return druid.input Current input instance -function druid__input.set_allowed_characters(self, characters) end - ---- Set maximum length for input field. ---- Pass nil to make input field unliminted (by default) ----@param self druid.input @{Input} ----@param max_length number Maximum length for input text field ----@return druid.input Current input instance -function druid__input.set_max_length(self, max_length) end - ---- Set text for input field ----@param self druid.input @{Input} ----@param input_text string The string to apply for input field -function druid__input.set_text(self, input_text) end - ---- Remove selection from input. ---- It will hide the keyboard and trigger on_unselect events ----@param self druid.input @{Input} -function druid__input.unselect(self) end - - ----@class druid.input.style ----@field IS_LONGTAP_ERASE boolean Is long tap will erase current input data ----@field IS_UNSELECT_ON_RESELECT boolean If true, call unselect on select selected input ----@field MASK_DEFAULT_CHAR string Default character mask for password input ----@field NO_CONSUME_INPUT_WHILE_SELECTED boolean If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) ----@field button_style table Custom button style for input node ----@field on_input_wrong function (self, button_node) Callback on wrong user input ----@field on_select function (self, button_node) Callback on input field selecting ----@field on_unselect function (self, button_node) Callback on input field unselecting -local druid__input__style = {} - - ----@class druid.lang_text : druid.base_component ----@field on_change druid.event On change text callback ----@field text druid.text The text component -local druid__lang_text = {} - ---- Format string with new text params on localized text ----@param self druid.lang_text @{LangText} ----@param a string Optional param to string.format ----@param b string Optional param to string.format ----@param c string Optional param to string.format ----@param d string Optional param to string.format ----@param e string Optional param to string.format ----@param f string Optional param to string.format ----@param g string Optional param to string.format ----@return druid.lang_text Current instance -function druid__lang_text.format(self, a, b, c, d, e, f, g) end - ---- The @{LangText} constructor ----@param self druid.lang_text @{LangText} ----@param node string|node Node name or GUI Text Node itself ----@param locale_id string Default locale id or text from node as default ----@param adjust_type string Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference -function druid__lang_text.init(self, node, locale_id, adjust_type) end - ---- Setup raw text to lang_text component ----@param self druid.lang_text @{LangText} ----@param text string Text for text node ----@return druid.lang_text Current instance -function druid__lang_text.set_to(self, text) end - ---- Translate the text by locale_id ----@param self druid.lang_text @{LangText} ----@param locale_id string Locale id ----@param a string Optional param to string.format ----@param b string Optional param to string.format ----@param c string Optional param to string.format ----@param d string Optional param to string.format ----@param e string Optional param to string.format ----@param f string Optional param to string.format ----@param g string Optional param to string.format ----@return druid.lang_text Current instance -function druid__lang_text.translate(self, locale_id, a, b, c, d, e, f, g) end - - ----@class druid.layout : druid.base_component ----@field mode string Current layout mode ----@field node node Layout node ----@field on_size_changed druid.event On window resize callback(self, new_size) -local druid__layout = {} - ---- Set node for layout node to fit inside it. ---- Pass nil to reset ----@param self druid.layout @{Layout} ----@param node node ----@return druid.layout @{Layout} -function druid__layout.fit_into_node(self, node) end - ---- Set size for layout node to fit inside it ----@param self druid.layout @{Layout} ----@param target_size vector3 ----@return druid.layout @{Layout} -function druid__layout.fit_into_size(self, target_size) end - ---- Set current size for layout node to fit inside it ----@param self druid.layout @{Layout} ----@return druid.layout @{Layout} -function druid__layout.fit_into_window(self) end - ---- The @{Layout} constructor ----@param self druid.layout @{Layout} ----@param node node Gui node ----@param mode string The layout mode (from const.LAYOUT_MODE) ----@param on_size_changed_callback function The callback on window resize -function druid__layout.init(self, node, mode, on_size_changed_callback) end - ---- Set max gui upscale for FIT adjust mode (or side). ---- It happens on bigger render gui screen ----@param self druid.layout @{Layout} ----@param max_gui_upscale number ----@return druid.layout @{Layout} -function druid__layout.set_max_gui_upscale(self, max_gui_upscale) end - ---- Set maximum size of layout node ----@param self druid.layout @{Layout} ----@param max_size vector3 ----@return druid.layout @{Layout} -function druid__layout.set_max_size(self, max_size) end - ---- Set minimal size of layout node ----@param self druid.layout @{Layout} ----@param min_size vector3 ----@return druid.layout @{Layout} -function druid__layout.set_min_size(self, min_size) end - ---- Set new origin position of layout node. ---- You should apply this on node movement ----@param self druid.layout @{Layout} ----@param new_origin_position vector3 ----@return druid.layout @{Layout} -function druid__layout.set_origin_position(self, new_origin_position) end - ---- Set new origin size of layout node. ---- You should apply this on node manual size change ----@param self druid.layout @{Layout} ----@param new_origin_size vector3 ----@return druid.layout @{Layout} -function druid__layout.set_origin_size(self, new_origin_size) end - - ----@class druid.pin_knob : druid.base_component ----@field druid druid_instance The component druid instance ----@field is_drag boolean Is currently under user control ----@field node node The pin node -local druid__pin_knob = {} - ---- The @{PinKnob} constructor ----@param self druid.pin_knob @{PinKnob} ----@param callback function Callback(self, value) on value changed ----@param template string The template string name ----@param nodes table Nodes table from gui.clone_tree -function druid__pin_knob.init(self, callback, template, nodes) end - ---- Set current and min/max angles for component ----@param self druid.pin_knob @{PinKnob} ----@param cur_value number The new value for pin knob ----@param min number The minimum value for pin knob ----@param max number The maximum value for pin knob ----@return druid.pin_knob @{PinKnob} -function druid__pin_knob.set_angle(self, cur_value, min, max) end - ---- Set current and min/max angles for component ----@param self druid.pin_knob @{PinKnob} ----@param value number The spin speed multiplier ----@return druid.pin_knob @{PinKnob} -function druid__pin_knob.set_friction(self, value) end - - ----@class druid.progress : druid.base_component ----@field key string The progress bar direction. ----@field max_size number Maximum size of progress bar ----@field node node Progress bar fill node ----@field on_change druid.event On progress bar change callback(self, new_value) ----@field scale vector3 Current progress bar scale ----@field size vector3 Current progress bar size ----@field slice vector4 Progress bar slice9 settings ----@field style druid.progress.style Component style params. -local druid__progress = {} - ---- Empty a progress bar ----@param self druid.progress @{Progress} -function druid__progress.empty(self) end - ---- Fill a progress bar and stop progress animation ----@param self druid.progress @{Progress} -function druid__progress.fill(self) end - ---- Return current progress bar value ----@param self druid.progress @{Progress} -function druid__progress.get(self) end - ---- The @{Progress} constructor ----@param self druid.progress @{Progress} ----@param node string|node Node name or GUI Node itself. ----@param key string Progress bar direction: const.SIDE.X or const.SIDE.Y ----@param init_value number Initial value of progress bar -function druid__progress.init(self, node, key, init_value) end - ---- Set progress bar max node size ----@param self druid.progress @{Progress} ----@param max_size vector3 The new node maximum (full) size ----@return druid.progress @{Progress} -function druid__progress.set_max_size(self, max_size) end - ---- Set points on progress bar to fire the callback ----@param self druid.progress @{Progress} ----@param steps number[] Array of progress bar values ----@param callback function Callback on intersect step value -function druid__progress.set_steps(self, steps, callback) end - ---- Instant fill progress bar to value ----@param self druid.progress @{Progress} ----@param to number Progress bar value, from 0 to 1 -function druid__progress.set_to(self, to) end - ---- Start animation of a progress bar ----@param self druid.progress @{Progress} ----@param to number value between 0..1 ----@param callback function Callback on animation ends -function druid__progress.to(self, to, callback) end - - ----@class druid.progress.style ----@field MIN_DELTA number Minimum step to fill progress bar ----@field SPEED number Progress bas fill rate. More -> faster -local druid__progress__style = {} - - ----@class druid.radio_group : druid.base_component ----@field checkboxes druid.checkbox[] Array of checkbox components ----@field on_radio_click druid.event On any checkbox click -local druid__radio_group = {} - ---- Return radio group state ----@param self druid.radio_group @{RadioGroup} ----@return number Index in radio group -function druid__radio_group.get_state(self) end - ---- The @{RadioGroup} constructor ----@param self druid.radio_group @{RadioGroup} ----@param nodes node[] Array of gui node ----@param callback function Radio callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes -function druid__radio_group.init(self, nodes, callback, click_nodes) end - ---- Set radio group state ----@param self druid.radio_group @{RadioGroup} ----@param index number Index in radio group ----@param is_instant boolean If is instant state change -function druid__radio_group.set_state(self, index, is_instant) end - - ----@class druid.rich_input : druid.input ----@field cursor node On input field text change to empty string callback(self, input_text) ----@field druid druid_instance The component druid instance ----@field input druid.input On input field text change callback(self, input_text) ----@field placeholder druid.text On input field text change to max length string callback(self, input_text) -local druid__rich_input = {} - ---- The @{RichInput} constructor ----@param self druid.rich_input @{RichInput} ----@param template string The template string name ----@param nodes table Nodes table from gui.clone_tree -function druid__rich_input.init(self, template, nodes) end - ---- Set placeholder text ----@param self druid.rich_input @{RichInput} ----@param placeholder_text string The placeholder text -function druid__rich_input.set_placeholder(self, placeholder_text) end - - ----@class druid.rich_text : druid.base_component ----@field druid druid_instance The component druid instance ----@field style druid.rich_text.style Component style params. -local druid__rich_text = {} - ---- Clear all created words. -function druid__rich_text.clear() end - ---- Get current line metrics ----@return druid.rich_text.lines_metrics -function druid__rich_text.get_line_metric() end - ---- Get all current words. ----@return table druid.rich_text.word[] -function druid__rich_text.get_words() end - ---- The @{RichText} constructor ----@param self druid.rich_text @{RichText} ----@param template string The Rich Text template name ----@param nodes table The node table, if prefab was copied by gui.clone_tree() -function druid__rich_text.init(self, template, nodes) end - ---- Set text for Rich Text ----@param self druid.rich_text @{RichText} ----@param text string The text to set ----@return druid.rich_text.word[] words ----@return druid.rich_text.lines_metrics line_metrics -function druid__rich_text.set_text(self, text) end - ---- Get all words, which has a passed tag. ----@param tag string ----@return druid.rich_text.word[] words -function druid__rich_text.tagged(tag) end - - ----@class druid.rich_text.style ----@field ADJUST_SCALE_DELTA number Scale step on each height adjust step ----@field ADJUST_STEPS number Amount steps of attemps text adjust by height ----@field COLORS table Rich Text color aliases -local druid__rich_text__style = {} - - ----@class druid.scroll : druid.base_component ----@field available_pos vector4 Available position for content node: (min_x, max_y, max_x, min_y) ----@field available_size vector3 Size of available positions: (width, height, 0) ----@field content_node node Scroll content node ----@field drag druid.drag Drag Druid component ----@field inertion vector3 Current inert speed ----@field is_animate boolean Flag, if scroll now animating by gui.animate ----@field on_point_scroll druid.event On scroll_to_index function callback(self, index, point) ----@field on_scroll druid.event On scroll move callback(self, position) ----@field on_scroll_to druid.event On scroll_to function callback(self, target, is_instant) ----@field position vector3 Current scroll posisition ----@field selected number Current index of points of interests ----@field style druid.scroll.style Component style params. ----@field target_position vector3 Current scroll target position ----@field view_node node Scroll view node -local druid__scroll = {} - ---- Bind the grid component (Static or Dynamic) to recalculate scroll size on grid changes ----@param self druid.scroll @{Scroll} ----@param grid druid.static_grid|druid.dynamic_grid Druid grid component ----@return druid.scroll Current scroll instance -function druid__scroll.bind_grid(self, grid) end - ---- Return current scroll progress status. ---- Values will be in [0..1] interval ----@param self druid.scroll @{Scroll} ----@return vector3 New vector with scroll progress values -function druid__scroll.get_percent(self) end - ---- Return vector of scroll size with width and height. ----@param self druid.scroll @{Scroll} ----@return vector3 Available scroll size -function druid__scroll.get_scroll_size(self) end - ---- The @{Scroll} constructor ----@param self druid.scroll @{Scroll} ----@param view_node string|node GUI view scroll node ----@param content_node string|node GUI content scroll node -function druid__scroll.init(self, view_node, content_node) end - ---- Return if scroll have inertion. ----@param self druid.scroll @{Scroll} ----@return boolean @If scroll have inertion -function druid__scroll.is_inert(self) end - ---- Check node if it visible now on scroll. ---- Extra border is not affected. Return true for elements in extra scroll zone ----@param self druid.scroll @{Scroll} ----@param node node The node to check ----@return boolean True if node in visible scroll area -function druid__scroll.is_node_in_view(self, node) end - ---- Start scroll to target point. ----@param self druid.scroll @{Scroll} ----@param point vector3 Target point ----@param is_instant boolean Instant scroll flag -function druid__scroll.scroll_to(self, point, is_instant) end - ---- Scroll to item in scroll by point index. ----@param self druid.scroll @{Scroll} ----@param index number Point index ----@param skip_cb boolean If true, skip the point callback -function druid__scroll.scroll_to_index(self, index, skip_cb) end - ---- Start scroll to target scroll percent ----@param self druid.scroll @{Scroll} ----@param percent vector3 target percent ----@param is_instant boolean instant scroll flag -function druid__scroll.scroll_to_percent(self, percent, is_instant) end - ---- Strict drag scroll area. ---- Useful for restrict events outside stencil node ----@param self druid.drag ----@param node node Gui node -function druid__scroll.set_click_zone(self, node) end - ---- Set extra size for scroll stretching. ---- Set 0 to disable stretching effect ----@param self druid.scroll @{Scroll} ----@param stretch_size number Size in pixels of additional scroll area ----@return druid.scroll Current scroll instance -function druid__scroll.set_extra_stretch_size(self, stretch_size) end - ---- Lock or unlock horizontal scroll ----@param self druid.scroll @{Scroll} ----@param state boolean True, if horizontal scroll is enabled ----@return druid.scroll Current scroll instance -function druid__scroll.set_horizontal_scroll(self, state) end - ---- Enable or disable scroll inert. ---- If disabled, scroll through points (if exist) If no points, just simple drag without inertion ----@param self druid.scroll @{Scroll} ----@param state boolean Inert scroll state ----@return druid.scroll Current scroll instance -function druid__scroll.set_inert(self, state) end - ---- Set points of interest. ---- Scroll will always centered on closer points ----@param self druid.scroll @{Scroll} ----@param points table Array of vector3 points ----@return druid.scroll Current scroll instance -function druid__scroll.set_points(self, points) end - ---- Set scroll content size. ---- It will change content gui node size ----@param self druid.scroll @{Scroll} ----@param size vector3 The new size for content node ----@param offset vector3 Offset value to set, where content is starts ----@return druid.scroll Current scroll instance -function druid__scroll.set_size(self, size, offset) end - ---- Lock or unlock vertical scroll ----@param self druid.scroll @{Scroll} ----@param state boolean True, if vertical scroll is enabled ----@return druid.scroll Current scroll instance -function druid__scroll.set_vertical_scroll(self, state) end - - ----@class druid.scroll.style ----@field ANIM_SPEED number Scroll gui.animation speed for scroll_to function ----@field BACK_SPEED number Scroll back returning lerp speed ----@field EXTRA_STRETCH_SIZE number extra size in pixels outside of scroll (stretch effect) ----@field FRICT number Multiplier for free inertion ----@field FRICT_HOLD number Multiplier for inertion, while touching ----@field INERT_SPEED number Multiplier for inertion speed ----@field INERT_THRESHOLD number Scroll speed to stop inertion ----@field POINTS_DEADZONE number Speed to check points of interests in no_inertion mode ----@field SMALL_CONTENT_SCROLL boolean If true, content node with size less than view node size can be scrolled ----@field WHEEL_SCROLL_BY_INERTION boolean If true, wheel will add inertion to scroll. Direct set position otherwise. ----@field WHEEL_SCROLL_INVERTED boolean If true, invert direction for touchpad and mouse wheel scroll ----@field WHEEL_SCROLL_SPEED boolean The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling -local druid__scroll__style = {} - - ----@class druid.slider : druid.base_component ----@field dist number Length between start and end position ----@field end_pos vector3 End pin node position ----@field is_drag boolean Current drag state ----@field node node Slider pin node ----@field on_change_value druid.event On change value callback(self, value) ----@field pos vector3 Current pin node position ----@field start_pos vector3 Start pin node position ----@field target_pos vector3 Targer pin node position ----@field value number Current slider value -local druid__slider = {} - ---- The @{Slider} constructor ----@param self druid.slider @{Slider} ----@param node node Gui pin node ----@param end_pos vector3 The end position of slider ----@param callback function On slider change callback -function druid__slider.init(self, node, end_pos, callback) end - ---- Set value for slider ----@param self druid.slider @{Slider} ----@param value number Value from 0 to 1 ----@param is_silent boolean Don't trigger event if true -function druid__slider.set(self, value, is_silent) end - ---- 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+ ----@param self druid.slider @{Slider} ----@param input_node node ----@return druid.slider @{Slider} -function druid__slider.set_input_node(self, input_node) end - ---- Set slider steps. ---- Pin node will apply closest step position ----@param self druid.slider @{Slider} ----@param steps number[] Array of steps ----@return druid.slider @{Slider} -function druid__slider.set_steps(self, steps) end - - ----@class druid.static_grid : druid.base_component ----@field anchor vector3 Item anchor [0..1] ----@field border vector4 The size of item content ----@field first_index number The first index of node in grid ----@field last_index number The last index of node in grid ----@field node_size vector3 Item size ----@field nodes node[] List of all grid nodes ----@field on_add_item druid.event On item add callback(self, node, index) ----@field on_change_items druid.event On item add, remove or change in_row callback(self, index|nil) ----@field on_clear druid.event On grid clear callback(self) ----@field on_remove_item druid.event On item remove callback(self, index) ----@field on_update_positions druid.event On update item positions callback(self) ----@field parent node Parent gui node ----@field pivot vector3 Item pivot [-0.5..0.5] ----@field style druid.static_grid.style Component style params. -local druid__static_grid = {} - ---- Add new item to the grid ----@param self druid.static_grid @{StaticGrid} ----@param item node Gui node ----@param index number The item position. By default add as last item ----@param shift_policy number How shift nodes, if required. See const.SHIFT ----@param is_instant boolean If true, update node positions instantly -function druid__static_grid.add(self, item, index, shift_policy, is_instant) end - ---- 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 ----@param self druid.static_grid @{StaticGrid} ----@return druid.static_grid Current grid instance -function druid__static_grid.clear(self) end - ---- Return array of all node positions ----@param self druid.static_grid @{StaticGrid} ----@return vector3[] All grid node positions -function druid__static_grid.get_all_pos(self) end - ---- Return grid content borders ----@param self druid.static_grid @{StaticGrid} ----@return vector3 The grid content borders -function druid__static_grid.get_borders(self) end - ---- Return index for grid pos ----@param self druid.static_grid @{StaticGrid} ----@param pos vector3 The node position in the grid ----@return number The node index -function druid__static_grid.get_index(self, pos) end - ---- Return grid index by node ----@param self druid.static_grid @{StaticGrid} ----@param node node The gui node in the grid ----@return number The node index -function druid__static_grid.get_index_by_node(self, node) end - ---- Return StaticGrid offset, where StaticGrid content starts. ----@param self druid.static_grid @{StaticGrid} The StaticGrid instance ----@return vector3 The StaticGrid offset -function druid__static_grid.get_offset(self) end - ---- Return pos for grid node index ----@param self druid.static_grid @{StaticGrid} ----@param index number The grid element index ----@return vector3 @Node position -function druid__static_grid.get_pos(self, index) end - ---- Return grid content size ----@param self druid.static_grid @{StaticGrid} ----@return vector3 The grid content size -function druid__static_grid.get_size(self) end - ---- The @{StaticGrid} constructor ----@param self druid.static_grid @{StaticGrid} ----@param parent string|node The GUI Node container, where grid's items will be placed ----@param element node Element prefab. Need to get it size ----@param in_row number How many nodes in row can be placed -function druid__static_grid.init(self, parent, element, in_row) end - ---- Remove the item from the grid. ---- Note that gui node will be not deleted ----@param self druid.static_grid @{StaticGrid} ----@param index number The grid node index to remove ----@param shift_policy number How shift nodes, if required. See const.SHIFT ----@param is_instant boolean If true, update node positions instantly ----@return node The deleted gui node from grid -function druid__static_grid.remove(self, index, shift_policy, is_instant) end - ---- Set grid anchor. ---- Default anchor is equal to anchor of grid parent node ----@param self druid.static_grid @{StaticGrid} ----@param anchor vector3 Anchor -function druid__static_grid.set_anchor(self, anchor) end - ---- Set new in_row elements for grid ----@param self druid.static_grid @{StaticGrid} ----@param in_row number The new in_row value ----@return druid.static_grid Current grid instance -function druid__static_grid.set_in_row(self, in_row) end - ---- Change set position function for grid nodes. ---- It will call on update poses on grid elements. Default: gui.set_position ----@param self druid.static_grid @{StaticGrid} ----@param callback function Function on node set position ----@return druid.static_grid Current grid instance -function druid__static_grid.set_position_function(self, callback) end - - ----@class druid.static_grid.style ----@field IS_ALIGN_LAST_ROW boolean If true, always align last row of the grid as grid pivot sets ----@field IS_DYNAMIC_NODE_POSES boolean If true, always center grid content as grid pivot sets -local druid__static_grid__style = {} - - ----@class druid.swipe : druid.base_component ----@field click_zone node Restriction zone ----@field node node Swipe node ----@field on_swipe druid.event Trigger on swipe event(self, swipe_side, dist, delta_time) ----@field style druid.swipe.style Component style params. -local druid__swipe = {} - ---- The @{Swipe} constructor ----@param self druid.swipe @{Swipe} ----@param node node Gui node ----@param on_swipe_callback function Swipe callback for on_swipe_end event -function druid__swipe.init(self, node, on_swipe_callback) end - ---- Strict swipe click area. ---- Useful for restrict events outside stencil node ----@param self druid.swipe @{Swipe} ----@param zone node Gui node -function druid__swipe.set_click_zone(self, zone) end - - ----@class druid.swipe.style ----@field SWIPE_THRESHOLD number Minimum distance for swipe trigger ----@field SWIPE_TIME number Maximum time for swipe trigger ----@field SWIPE_TRIGGER_ON_MOVE boolean If true, trigger on swipe moving, not only release action -local druid__swipe__style = {} - - ----@class druid.text : druid.base_component ----@field adjust_type number Current text size adjust settings ----@field color vector3 Current text color ----@field node node Text node ----@field node_id hash The node id of text node ----@field on_set_pivot druid.event On change pivot callback(self, pivot) ----@field on_set_text druid.event On set text callback(self, text) ----@field on_update_text_scale druid.event On adjust text size callback(self, new_scale, text_metrics) ----@field pos vector3 Current text position ----@field scale vector3 Current text node scale ----@field start_scale vector3 Initial text node scale ----@field start_size vector3 Initial text node size ----@field style druid.text.style Component style params. ----@field text_area vector3 Current text node available are -local druid__text = {} - ---- Return current text adjust type ----@param self unknown ----@param adjust_type unknown ----@return number The current text adjust type -function druid__text.get_text_adjust(self, adjust_type) end - ---- Calculate text width with font with respect to trailing space ----@param self druid.text @{Text} ----@param text string ----@return number Width ----@return number Height -function druid__text.get_text_size(self, text) end - ---- The @{Text} constructor ----@param self druid.text @{Text} ----@param node string|node Node name or GUI Text Node itself ----@param value string Initial text. Default value is node text from GUI scene. ----@param adjust_type string Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference -function druid__text.init(self, node, value, adjust_type) end - ---- Return true, if text with line break ----@param self druid.text @{Text} ----@return boolean Is text node with line break -function druid__text.is_multiline(self) end - ---- Set alpha ----@param self druid.text @{Text} ----@param alpha number Alpha for node ----@return druid.text Current text instance -function druid__text.set_alpha(self, alpha) end - ---- Set color ----@param self druid.text @{Text} ----@param color vector4 Color for node ----@return druid.text Current text instance -function druid__text.set_color(self, color) end - ---- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types ----@param self druid.text @{Text} ----@param minimal_scale number If pass nil - not use minimal scale ----@return druid.text Current text instance -function druid__text.set_minimal_scale(self, minimal_scale) end - ---- Set text pivot. ---- Text will re-anchor inside text area ----@param self druid.text @{Text} ----@param pivot number The gui.PIVOT_* constant ----@return druid.text Current text instance -function druid__text.set_pivot(self, pivot) end - ---- Set scale ----@param self druid.text @{Text} ----@param scale vector3 Scale for node ----@return druid.text Current text instance -function druid__text.set_scale(self, scale) end - ---- Set text adjust, refresh the current text visuals, if needed ----@param self druid.text @{Text} ----@param adjust_type number See const.TEXT_ADJUST. If pass nil - use current adjust type ----@param minimal_scale number If pass nil - not use minimal scale ----@return druid.text Current text instance -function druid__text.set_text_adjust(self, adjust_type, minimal_scale) end - ---- Set text to text field ----@param self druid.text @{Text} ----@param set_to string Text for node ----@return druid.text Current text instance -function druid__text.set_to(self, set_to) end - - ----@class druid.text.style ----@field DEFAULT_ADJUST string The default adjust type for any text component ----@field TRIM_POSTFIX string The postfix for TRIM adjust type -local druid__text__style = {} - - ----@class druid.timer : druid.base_component ----@field from number Initial timer value ----@field node node Trigger node ----@field on_set_enabled druid.event On timer change enabled state callback(self, is_enabled) ----@field on_tick druid.event On timer tick. ----@field on_timer_end druid.event On timer end callback ----@field target number Target timer value ----@field value number Current timer value -local druid__timer = {} - ---- The @{Timer} constructor ----@param self druid.timer @{Timer} ----@param node node Gui text node ----@param seconds_from number Start timer value in seconds ----@param seconds_to number End timer value in seconds ----@param callback function Function on timer end -function druid__timer.init(self, node, seconds_from, seconds_to, callback) end - ---- Set time interval ----@param self druid.timer @{Timer} ----@param from number Start time in seconds ----@param to number Target time in seconds -function druid__timer.set_interval(self, from, to) end - ---- Called when update ----@param self druid.timer @{Timer} ----@param is_on boolean Timer enable state -function druid__timer.set_state(self, is_on) end - ---- Set text to text field ----@param self druid.timer @{Timer} ----@param set_to number Value in seconds -function druid__timer.set_to(self, set_to) end - - ----@class druid_instance -local druid_instance = {} - ---- Call this in gui_script final function. ----@param self druid_instance -function druid_instance.final(self) end - ---- Create new component. ----@param self druid_instance ----@param component druid.base_component Component module ----@param ... any Other component params to pass it to component:init function -function druid_instance.new(self, component, ...) end - ---- Create @{BackHandler} component ----@param self druid_instance ----@param callback function @The callback(self, custom_args) to call on back event ----@param params any Callback argument ----@return druid.back_handler @{BackHandler} component -function druid_instance.new_back_handler(self, callback, params) end - ---- Create @{Blocker} component ----@param self druid_instance ----@param node node Gui node ----@return druid.blocker @{Blocker} component -function druid_instance.new_blocker(self, node) end - ---- Create @{Button} component ----@param self druid_instance ----@param node node GUI node ----@param callback function Button callback ----@param params table Button callback params ----@param anim_node node Button anim node (node, if not provided) ----@return druid.button @{Button} component -function druid_instance.new_button(self, node, callback, params, anim_node) end - ---- Create @{Checkbox} component ----@param self druid_instance ----@param node node Gui node ----@param callback function Checkbox callback ----@param click_node node Trigger node, by default equals to node ----@param initial_state boolean The initial state of checkbox, default - false ----@return druid.checkbox @{Checkbox} component -function druid_instance.new_checkbox(self, node, callback, click_node, initial_state) end - ---- Create @{CheckboxGroup} component ----@param self druid_instance ----@param nodes node[] Array of gui node ----@param callback function Checkbox callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes ----@return druid.checkbox_group @{CheckboxGroup} component -function druid_instance.new_checkbox_group(self, nodes, callback, click_nodes) end - ---- Create @{DataList} component ----@param self druid_instance ----@param druid_scroll druid.scroll The Scroll instance for Data List component ----@param druid_grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component ----@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component]) ----@return druid.data_list @{DataList} component -function druid_instance.new_data_list(self, druid_scroll, druid_grid, create_function) end - ---- Create @{Drag} component ----@param self druid_instance ----@param node node GUI node to detect dragging ----@param on_drag_callback function Callback for on_drag_event(self, dx, dy) ----@return druid.drag @{Drag} component -function druid_instance.new_drag(self, node, on_drag_callback) end - ---- Create @{DynamicGrid} component ----@param self druid_instance ----@param parent node The gui node parent, where items will be placed ----@return druid.dynamic_grid @{DynamicGrid} component -function druid_instance.new_dynamic_grid(self, parent) end - ---- Create @{Hotkey} component ----@param self druid_instance ----@param keys_array string|string[] Keys for trigger action. Should contains one action key and any amount of modificator keys ----@param callback function The callback function ----@param callback_argument any The argument to pass into the callback function ----@return druid.hotkey @{Hotkey} component -function druid_instance.new_hotkey(self, keys_array, callback, callback_argument) end - ---- Create @{Hover} component ----@param self druid_instance ----@param node node Gui node ----@param on_hover_callback function Hover callback ----@return druid.hover @{Hover} component -function druid_instance.new_hover(self, node, on_hover_callback) end - ---- Create @{Input} component ----@param self druid_instance ----@param click_node node Button node to enabled input component ----@param text_node node Text node what will be changed on user input ----@param keyboard_type number Gui keyboard type for input field ----@return druid.input @{Input} component -function druid_instance.new_input(self, click_node, text_node, keyboard_type) end - ---- Create @{LangText} component ----@param self druid_instance ----@param node node The text node ----@param locale_id string Default locale id ----@param no_adjust boolean If true, will not correct text size ----@return druid.lang_text @{LangText} component -function druid_instance.new_lang_text(self, node, locale_id, no_adjust) end - ---- Create @{Layout} component ----@param self druid_instance ----@param node string|node Layout node ----@param mode string The layout mode ----@return druid.layout @{Layout} component -function druid_instance.new_layout(self, node, mode) end - ---- Create @{Progress} component ----@param self druid_instance ----@param node string|node Progress bar fill node or node name ----@param key string Progress bar direction: const.SIDE.X or const.SIDE.Y ----@param init_value number Initial value of progress bar ----@return druid.progress @{Progress} component -function druid_instance.new_progress(self, node, key, init_value) end - ---- Create @{RadioGroup} component ----@param self druid_instance ----@param nodes node[] Array of gui node ----@param callback function Radio callback ----@param click_nodes node[] Array of trigger nodes, by default equals to nodes ----@return druid.radio_group @{RadioGroup} component -function druid_instance.new_radio_group(self, nodes, callback, click_nodes) end - ---- Create @{RichText} component. ---- As a template please check rich_text.gui layout. ----@param self druid_instance ----@param template string Template name if used ----@param nodes table Nodes table from gui.clone_tree ----@return druid.rich_text @{RichText} component -function druid_instance.new_rich_text(self, template, nodes) end - ---- Create @{Scroll} component ----@param self druid_instance ----@param view_node node GUI view scroll node ----@param content_node node GUI content scroll node ----@return druid.scroll @{Scroll} component -function druid_instance.new_scroll(self, view_node, content_node) end - ---- Create @{Slider} component ----@param self druid_instance ----@param node node Gui pin node ----@param end_pos vector3 The end position of slider ----@param callback function On slider change callback ----@return druid.slider @{Slider} component -function druid_instance.new_slider(self, node, end_pos, callback) end - ---- Create @{StaticGrid} component ----@param self druid_instance ----@param parent node The gui node parent, where items will be placed ----@param element node Element prefab. Need to get it size ----@param in_row number How many nodes in row can be placed ----@return druid.static_grid @{StaticGrid} component -function druid_instance.new_static_grid(self, parent, element, in_row) end - ---- Create @{Swipe} component ----@param self druid_instance ----@param node node Gui node ----@param on_swipe_callback function Swipe callback for on_swipe_end event ----@return druid.swipe @{Swipe} component -function druid_instance.new_swipe(self, node, on_swipe_callback) end - ---- Create @{Text} component ----@param self druid_instance ----@param node node Gui text node ----@param value string Initial text. Default value is node text from GUI scene. ----@param no_adjust boolean If true, text will be not auto-adjust size ----@return druid.text @{Text} component -function druid_instance.new_text(self, node, value, no_adjust) end - ---- Create @{Timer} component ----@param self druid_instance ----@param node node Gui text node ----@param seconds_from number Start timer value in seconds ----@param seconds_to number End timer value in seconds ----@param callback function Function on timer end ----@return druid.timer @{Timer} component -function druid_instance.new_timer(self, node, seconds_from, seconds_to, callback) end - ---- Call this in gui_script on_input function. ---- Used for almost all components ----@param self druid_instance ----@param action_id hash Action_id from on_input ----@param action table Action from on_input ----@return boolean The boolean value is input was consumed -function druid_instance.on_input(self, action_id, action) end - ---- Call this in gui_script on_message function. ---- Used for special actions. See SPECIFIC_UI_MESSAGES table ----@param self druid_instance ----@param message_id hash Message_id from on_message ----@param message table Message from on_message ----@param sender hash Sender from on_message -function druid_instance.on_message(self, message_id, message, sender) end - ---- Remove created component from Druid instance. ---- Component `on_remove` function will be invoked, if exist. ----@param self druid_instance ----@param component druid.base_component Component instance -function druid_instance.remove(self, component) end - ---- Set blacklist components for input processing. ---- If blacklist is not empty and component contains in this list, component will be not processed on input step ----@param self druid_instance @{DruidInstance} ----@param blacklist_components table|druid.base_component The array of component to blacklist ----@return self @{DruidInstance} -function druid_instance.set_blacklist(self, blacklist_components) end - ---- Set whitelist components for input processing. ---- If whitelist is not empty and component not contains in this list, component will be not processed on input step ----@param self druid_instance ----@param whitelist_components table|druid.base_component The array of component to whitelist ----@return self @{DruidInstance} -function druid_instance.set_whitelist(self, whitelist_components) end - ---- Call this in gui_script update function. ---- Used for: scroll, progress, timer components ----@param self druid_instance ----@param dt number Delta time -function druid_instance.update(self, dt) end - - ----@class helper -local helper = {} - ---- Add all elements from source array to the target array ----@param target any[] Array to put elements from source ----@param source any[] The source array to get elements from ----@return any[] The target array -function helper.add_array(target, source) end - ---- Centerate nodes by x position with margin. ---- This functions calculate total width of nodes and set position for each node. The centrate will be around 0 x position. ----@param margin number Offset between nodes ----@param ... unknown Gui nodes -function helper.centrate_nodes(margin, ...) end - ---- Clamp value between min and max ----@param a number Value ----@param min number Min value ----@param max number Max value ----@return number Clamped value -function helper.clamp(a, min, max) end - ---- Check if value is in array and return index of it ----@param t table Array ----@param value unknown Value ----@return number|nil Index of value or nil -function helper.contains(t, value) end - ---- Make a copy table with all nested tables ----@param orig_table table Original table ----@return table Copy of original table -function helper.deepcopy(orig_table) end - ---- Calculate distance between two points ----@param x1 number First point x ----@param y1 number First point y ----@param x2 number Second point x ----@param y2 number Second point y ----@return number Distance -function helper.distance(x1, y1, x2, y2) end - ---- Distance from node position to his borders ----@param node node GUI node ----@param offset vector3 Offset from node position. Pass current node position to get non relative border values ----@return vector4 Vector4 with border values (left, top, right, down) -function helper.get_border(node, offset) end - ---- Return closest non inverted clipping parent node for given node ----@param node node GUI node ----@return node|nil The closest stencil node or nil -function helper.get_closest_stencil_node(node) end - ---- Get current GUI scale for each side ----@return number scale_x ----@return number scale_y -function helper.get_gui_scale() end - ---- Get node offset for given GUI pivot. ---- Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top. ----@param pivot number The gui.PIVOT_* constant ----@return vector3 Vector offset with [-0.5..0.5] values -function helper.get_pivot_offset(pivot) end - ---- Get node size adjusted by scale ----@param node node GUI node ----@return vector3 Scaled size -function helper.get_scaled_size(node) end - ---- Get cumulative parent's node scale ----@param node node Gui node ----@param include_passed_node_scale boolean True if add current node scale to result ----@return vector3 The scene node scale -function helper.get_scene_scale(node, include_passed_node_scale) end - ---- Get current screen stretch multiplier for each side ----@return number stretch_x ----@return number stretch_y -function helper.get_screen_aspect_koef() end - ---- Get text metric from GUI node. ----@param text_node node ----@return GUITextMetrics -function helper.get_text_metrics_from_node(text_node) end - ---- Add value to array with shift policy ---- Shift policy can be: left, right, no_shift ----@param array table Array ----@param any unknown Item to insert ----@param index number Index to insert. If nil, item will be inserted at the end of array ----@param shift_policy number The druid_const.SHIFT.* constant ----@return any Inserted item -function helper.insert_with_shift(array, any, index, shift_policy) end - ---- Check if device is native mobile (Android or iOS) ----@return boolean Is mobile -function helper.is_mobile() end - ---- Check if device is HTML5 ----@return boolean Is web -function helper.is_web() end - ---- Lerp between two values ----@param a number First value ----@param b number Second value ----@param t number Lerp amount ----@return number Lerped value -function helper.lerp(a, b, t) end - ---- Remove value from array with shift policy ---- Shift policy can be: left, right, no_shift ----@param array table Array ----@param index number Index to remove. If nil, item will be removed from the end of array ----@param shift_policy number The druid_const.SHIFT.* constant ----@return any Removed item -function helper.remove_with_shift(array, index, shift_policy) end - ---- Round number to specified decimal places ----@param num number Number ----@param num_decimal_places number Decimal places ----@return number Rounded number -function helper.round(num, num_decimal_places) end - ---- Return sign of value (-1, 0, 1) ----@param val number Value ----@return number Sign -function helper.sign(val) end - ---- Move value from current to target value with step amount ----@param current number Current value ----@param target number Target value ----@param step number Step amount ----@return number New value -function helper.step(current, target, step) end - ---- Simple table to one-line string converter ----@param t table ----@return string -function helper.table_to_string(t) end - - --- Manual Annotations -- - ----@class druid.rich_text.metrics ----@field width number ----@field height number ----@field offset_x number|nil ----@field offset_y number|nil ----@field node_size vector3|nil @For images only - ----@class druid.rich_text.lines_metrics ----@field text_width number ----@field text_height number ----@field lines table - ----@class druid.rich_text.word ----@field node node ----@field relative_scale number ----@field color vector4 ----@field position vector3 ----@field offset vector3 ----@field scale vector3 ----@field size vector3 ----@field metrics druid.rich_text.metrics ----@field pivot number @ The gui.PIVOT_* constant ----@field text string ----@field shadow vector4 ----@field outline vector4 ----@field font string ----@field image druid.rich_text.image ----@field default_animation string ----@field anchor number ----@field br boolean ----@field nobr boolean - ----@class druid.rich_text.image ----@field texture string ----@field anim string ----@field width number ----@field height number - ----@class druid.rich_text.settings ----@field parent node ----@field size number ----@field fonts table ----@field color vector4 ----@field shadow vector4 ----@field outline vector4 ----@field position vector3 ----@field image_pixel_grid_snap boolean ----@field combine_words boolean ----@field default_animation string ----@field node_prefab node ----@field text_prefab node - ----@class GUITextMetrics ----@field width number ----@field height number ----@field max_ascent number ----@field max_descent number +-- @tparam string|node node The_node id or gui.get_node(node_id). diff --git a/druid/base/back_handler.lua b/druid/base/back_handler.lua index cb9a7af..4c2f2af 100644 --- a/druid/base/back_handler.lua +++ b/druid/base/back_handler.lua @@ -46,7 +46,7 @@ local BackHandler = component.create("back_handler") --- The @{BackHandler} constructor -- @tparam BackHandler self @{BackHandler} -- @tparam function callback @The callback(self, custom_args) to call on back event --- @tparam[opt] any custom_args Button events custom arguments +-- @tparam any|nil custom_args Button events custom arguments -- @local function BackHandler.init(self, callback, custom_args) self.params = custom_args diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua index 6645913..82fe72c 100644 --- a/druid/base/blocker.lua +++ b/druid/base/blocker.lua @@ -71,7 +71,7 @@ end -- -- Don't change node enabled state itself. -- @tparam Blocker self @{Blocker} --- @tparam boolean state Enabled state +-- @tparam boolean|nil state Enabled state function Blocker.set_enabled(self, state) self._is_enabled = state end diff --git a/druid/base/button.lua b/druid/base/button.lua index 024a1b8..08dc4b9 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -282,10 +282,10 @@ end --- The @{Button} constructor -- @tparam Button self @{Button} --- @tparam string|node node Node name or GUI Node itself +-- @tparam string|node node The node_id or gui.get_node(node_id) -- @tparam function callback On click button callback --- @tparam[opt] any custom_args Button events custom arguments --- @tparam[opt] string|node anim_node Node to animate instead of trigger node. +-- @tparam any|nil custom_args Button events custom arguments +-- @tparam string|node|nil anim_node Node to animate instead of trigger node. function Button.init(self, node, callback, custom_args, anim_node) self.druid = self:get_druid() self.node = self:get_node(node) @@ -447,7 +447,7 @@ end -- The style.on_set_enabled will be triggered. -- Disabled button is not clickable. -- @tparam Button self @{Button} --- @tparam boolean state Enabled state +-- @tparam boolean|nil state Enabled state -- @treturn Button Current button instance -- @usage -- button:set_enabled(false) @@ -515,8 +515,8 @@ end --- Set function for additional check for button click availability -- @tparam Button self --- @tparam[opt] function check_function Should return true or false. If true - button can be pressed. --- @tparam[opt] function failure_callback Function will be called on button click, if check function return false +-- @tparam function|nil check_function Should return true or false. If true - button can be pressed. +-- @tparam function|nil failure_callback Function will be called on button click, if check function return false -- @treturn Button Current button instance function Button.set_check_function(self, check_function, failure_callback) self._check_function = check_function @@ -531,7 +531,7 @@ end -- -- If the game is not HTML, html mode will be not enabled -- @tparam Button self --- @tparam[opt] boolean is_web_mode If true - button will be called inside html5 callback +-- @tparam boolean|nil is_web_mode If true - button will be called inside html5 callback -- @treturn Button Current button instance -- @usage -- button:set_web_user_interaction(true) diff --git a/druid/base/drag.lua b/druid/base/drag.lua index 2b12a16..c7f3457 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -313,7 +313,7 @@ end --- Set Drag input enabled or disabled -- @tparam Drag self @{Drag} --- @tparam boolean is_enabled +-- @tparam boolean|nil is_enabled function Drag.set_enabled(self, is_enabled) self._is_enabled = is_enabled end diff --git a/druid/base/hover.lua b/druid/base/hover.lua index 90bf904..f2a2517 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -89,7 +89,7 @@ end --- Set hover state -- @tparam Hover self @{Hover} --- @tparam boolean state The hover state +-- @tparam boolean|nil state The hover state function Hover.set_hover(self, state) if self._is_hovered ~= state then self._is_hovered = state @@ -108,7 +108,7 @@ end --- Set mouse hover state -- @tparam Hover self @{Hover} --- @tparam boolean state The mouse hover state +-- @tparam boolean|nil state The mouse hover state function Hover.set_mouse_hover(self, state) if self._is_mouse_hovered ~= state then self._is_mouse_hovered = state @@ -138,7 +138,7 @@ end -- If hover is not enabled, it will not generate -- any hover events -- @tparam Hover self @{Hover} --- @tparam boolean state The hover enabled state +-- @tparam boolean|nil state The hover enabled state function Hover.set_enabled(self, state) self._is_enabled = state diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 0aaeabd..97c6352 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -234,7 +234,7 @@ end --- Start scroll to target point. -- @tparam Scroll self @{Scroll} -- @tparam vector3 point Target point --- @tparam[opt] boolean is_instant Instant scroll flag +-- @tparam boolean|nil is_instant Instant scroll flag -- @usage scroll:scroll_to(vmath.vector3(0, 50, 0)) -- @usage scroll:scroll_to(vmath.vector3(0), true) function Scroll.scroll_to(self, point, is_instant) @@ -268,7 +268,7 @@ end --- Scroll to item in scroll by point index. -- @tparam Scroll self @{Scroll} -- @tparam number index Point index --- @tparam[opt] boolean skip_cb If true, skip the point callback +-- @tparam boolean|nil skip_cb If true, skip the point callback function Scroll.scroll_to_index(self, index, skip_cb) if not self.points then return @@ -291,7 +291,7 @@ end --- Start scroll to target scroll percent -- @tparam Scroll self @{Scroll} -- @tparam vector3 percent target percent --- @tparam[opt] boolean is_instant instant scroll flag +-- @tparam boolean|nil is_instant instant scroll flag -- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0)) function Scroll.scroll_to_percent(self, percent, is_instant) local border = self.available_pos @@ -339,7 +339,7 @@ end -- If disabled, scroll through points (if exist) -- If no points, just simple drag without inertion -- @tparam Scroll self @{Scroll} --- @tparam boolean state Inert scroll state +-- @tparam boolean|nil state Inert scroll state -- @treturn druid.scroll Current scroll instance function Scroll.set_inert(self, state) self._is_inert = state @@ -397,7 +397,7 @@ end --- Lock or unlock horizontal scroll -- @tparam Scroll self @{Scroll} --- @tparam boolean state True, if horizontal scroll is enabled +-- @tparam boolean|nil state True, if horizontal scroll is enabled -- @treturn druid.scroll Current scroll instance function Scroll.set_horizontal_scroll(self, state) self._is_horizontal_scroll = state @@ -408,7 +408,7 @@ end --- Lock or unlock vertical scroll -- @tparam Scroll self @{Scroll} --- @tparam boolean state True, if vertical scroll is enabled +-- @tparam boolean|nil state True, if vertical scroll is enabled -- @treturn druid.scroll Current scroll instance function Scroll.set_vertical_scroll(self, state) self._is_vertical_scroll = state diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index c25a4a3..6051635 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -214,7 +214,7 @@ end --- Add new item to the grid -- @tparam StaticGrid self @{StaticGrid} -- @tparam node item Gui node --- @tparam[opt] number index The item position. By default add as last item +-- @tparam number|nil index The item position. By default add as last item -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=false] boolean is_instant If true, update node positions instantly function StaticGrid.add(self, item, index, shift_policy, is_instant) @@ -379,7 +379,7 @@ end --- Update grid inner state -- @tparam StaticGrid self @{StaticGrid} --- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function StaticGrid._update(self, is_instant) self:_update_indexes() @@ -425,7 +425,7 @@ end --- Update grid nodes position -- @tparam StaticGrid self @{StaticGrid} --- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function StaticGrid._update_pos(self, is_instant) local zero_offset = self:_get_zero_offset() diff --git a/druid/base/text.lua b/druid/base/text.lua index 73dd5f8..90b7788 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -225,7 +225,7 @@ end --- The @{Text} constructor -- @tparam Text self @{Text} -- @tparam string|node node Node name or GUI Text Node itself --- @tparam[opt] string value Initial text. Default value is node text from GUI scene. +-- @tparam string|nil value Initial text. Default value is node text from GUI scene. -- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference function Text.init(self, node, value, adjust_type) self.node = self:get_node(node) @@ -273,7 +273,7 @@ end --- Calculate text width with font with respect to trailing space -- @tparam Text self @{Text} --- @tparam[opt] string text +-- @tparam string|nil text -- @treturn number Width -- @treturn number Height function Text.get_text_size(self, text) @@ -392,8 +392,8 @@ end --- Set text adjust, refresh the current text visuals, if needed -- @tparam Text self @{Text} --- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type --- @tparam[opt] number minimal_scale If pass nil - not use minimal scale +-- @tparam number|nil adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type +-- @tparam number|nil minimal_scale If pass nil - not use minimal scale -- @treturn Text Current text instance function Text.set_text_adjust(self, adjust_type, minimal_scale) self.adjust_type = adjust_type diff --git a/druid/component.lua b/druid/component.lua index 91964ed..85c8ffc 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -242,7 +242,7 @@ end -- Default value: 10 -- @tparam BaseComponent self @{BaseComponent} -- @tparam number value The new input priority value --- @tparam boolean is_temporary If true, the reset input priority will return to previous value +-- @tparam boolean|nil is_temporary If true, the reset input priority will return to previous value -- @treturn number The component input priority function BaseComponent.set_input_priority(self, value, is_temporary) assert(value) @@ -290,7 +290,7 @@ end -- -- If input is disabled, the component will not receive input events -- @tparam BaseComponent self @{BaseComponent} --- @tparam boolean state The component input state +-- @tparam boolean|nil state The component input state -- @treturn BaseComponent BaseComponent itself function BaseComponent.set_input_enabled(self, state) self._meta.input_enabled = state @@ -376,7 +376,7 @@ end --- Set debug logs for component enabled or disabled -- @tparam BaseComponent self @{BaseComponent} --- @tparam boolean is_debug +-- @tparam boolean|nil is_debug -- @local function BaseComponent.set_debug(self, is_debug) self._component.is_debug = is_debug diff --git a/druid/druid.lua b/druid/druid.lua index 4226953..811ad50 100644 --- a/druid/druid.lua +++ b/druid/druid.lua @@ -92,7 +92,7 @@ end -- -- @function druid.new -- @tparam table context The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks. --- @tparam[opt] table style The Druid style table to override style parameters for this Druid instance. +-- @tparam table|nil style The Druid style table to override style parameters for this Druid instance. -- @treturn druid_instance The Druid instance @{DruidInstance}. -- @usage -- local druid = require("druid.druid") diff --git a/druid/event.lua b/druid/event.lua index fdddbf8..208620c 100644 --- a/druid/event.lua +++ b/druid/event.lua @@ -15,7 +15,7 @@ local DruidEvent = class("druid.event") --- DruidEvent constructor -- @tparam DruidEvent self @{DruidEvent} --- @tparam[opt] function initial_callback Subscribe the callback on new event, if callback exist +-- @tparam function|nil initial_callback Subscribe the callback on new event, if callback exist -- @usage -- local Event = require("druid.event") -- ... @@ -32,7 +32,7 @@ end --- Subscribe callback on event -- @tparam DruidEvent self @{DruidEvent} -- @tparam function callback Callback itself --- @tparam[opt] any context Additional context as first param to callback call, usually it's self +-- @tparam any|nil context Additional context as first param to callback call, usually it's self -- @usage -- local function on_long_callback(self) -- print("Long click!") @@ -57,7 +57,7 @@ end --- Unsubscribe callback on event -- @tparam DruidEvent self @{DruidEvent} -- @tparam function callback Callback itself --- @tparam[opt] any context Additional context as first param to callback call +-- @tparam any|nil context Additional context as first param to callback call -- @usage -- local function on_long_callback(self) -- print("Long click!") diff --git a/druid/extended/checkbox.lua b/druid/extended/checkbox.lua index 29dfd8b..2c629e8 100755 --- a/druid/extended/checkbox.lua +++ b/druid/extended/checkbox.lua @@ -71,9 +71,9 @@ end --- Set checkbox state -- @tparam Checkbox self @{Checkbox} --- @tparam boolean state Checkbox state --- @tparam boolean is_silent Don't trigger on_change_state if true --- @tparam boolean is_instant If instant checkbox change +-- @tparam boolean|nil state Checkbox state +-- @tparam boolean|nil is_silent Don't trigger on_change_state if true +-- @tparam boolean|nil is_instant If instant checkbox change function Checkbox.set_state(self, state, is_silent, is_instant) self.state = state self.style.on_change_state(self, self.node, state, is_instant) diff --git a/druid/extended/checkbox_group.lua b/druid/extended/checkbox_group.lua index 841fd29..2dd66ba 100644 --- a/druid/extended/checkbox_group.lua +++ b/druid/extended/checkbox_group.lua @@ -46,7 +46,7 @@ end --- Set checkbox group state -- @tparam CheckboxGroup self @{CheckboxGroup} -- @tparam boolean[] indexes Array of checkbox state --- @tparam boolean is_instant If instant state change +-- @tparam boolean|nil is_instant If instant state change function CheckboxGroup.set_state(self, indexes, is_instant) for i = 1, #indexes do if self.checkboxes[i] then diff --git a/druid/extended/dynamic_grid.lua b/druid/extended/dynamic_grid.lua index db58f4c..e1fb56d 100644 --- a/druid/extended/dynamic_grid.lua +++ b/druid/extended/dynamic_grid.lua @@ -100,7 +100,7 @@ end -- @tparam DynamicGrid self @{DynamicGrid} -- @tparam number index The grid element index -- @tparam node node The node to be placed --- @tparam[opt] number origin_index Index of nearby node +-- @tparam number|nil origin_index Index of nearby node -- @treturn vector3 Node position function DynamicGrid.get_pos(self, index, node, origin_index) local origin_node = self.nodes[origin_index] @@ -140,7 +140,7 @@ end --- Add new node to the grid -- @tparam DynamicGrid self @{DynamicGrid} -- @tparam node node Gui node --- @tparam[opt] number index The node position. By default add as last node +-- @tparam number|nil index The node position. By default add as last node -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=false] boolean is_instant If true, update node positions instantly function DynamicGrid.add(self, node, index, shift_policy, is_instant) @@ -322,7 +322,7 @@ end --- Update grid inner state -- @tparam DynamicGrid self @{DynamicGrid} --- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function DynamicGrid._update(self, is_instant) self:_update_indexes() @@ -378,7 +378,7 @@ end --- Update grid nodes position -- @tparam DynamicGrid self @{DynamicGrid} --- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function DynamicGrid._update_pos(self, is_instant) for index, node in pairs(self.nodes) do diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua index d1900e4..7dd84e7 100644 --- a/druid/extended/hotkey.lua +++ b/druid/extended/hotkey.lua @@ -31,7 +31,7 @@ local Hotkey = component.create("hotkey") -- @tparam Hotkey self @{Hotkey} -- @tparam string[]|string keys The keys to be pressed for trigger callback. Should contains one key and any modificator keys -- @tparam function callback The callback function --- @tparam[opt] any callback_argument The argument to pass into the callback function +-- @tparam any|nil callback_argument The argument to pass into the callback function function Hotkey.init(self, keys, callback, callback_argument) self.druid = self:get_druid() @@ -63,7 +63,7 @@ end --- Add hotkey for component callback -- @tparam Hotkey self @{Hotkey} -- @tparam string[]|hash[]|string|hash keys that have to be pressed before key pressed to activate --- @tparam[opt] any callback_argument The argument to pass into the callback function +-- @tparam any|nil callback_argument The argument to pass into the callback function function Hotkey.add_hotkey(self, keys, callback_argument) keys = keys or {} if type(keys) == "string" then diff --git a/druid/extended/input.lua b/druid/extended/input.lua index 0496d18..a5bf991 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -119,7 +119,7 @@ end -- @tparam Input self @{Input} -- @tparam node click_node Node to enabled input component -- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text} --- @tparam[opt] number keyboard_type Gui keyboard type for input field +-- @tparam number|nil keyboard_type Gui keyboard type for input field function Input.init(self, click_node, text_node, keyboard_type) self.druid = self:get_druid(self) diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index ea776e5..95d7b40 100755 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -34,8 +34,8 @@ local LangText = component.create("lang_text") --- The @{LangText} constructor -- @tparam LangText self @{LangText} --- @tparam string|node node Node name or GUI Text Node itself --- @tparam string locale_id Default locale id or text from node as default +-- @tparam string|node node The node_id or gui.get_node(node_id) +-- @tparam[opt=node_text] string locale_id Default locale id or text from node as default -- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference function LangText.init(self, node, locale_id, adjust_type) self.druid = self:get_druid() @@ -75,13 +75,13 @@ end --- Translate the text by locale_id -- @tparam LangText self @{LangText} -- @tparam string locale_id Locale id --- @tparam[opt] string a Optional param to string.format --- @tparam[opt] string b Optional param to string.format --- @tparam[opt] string c Optional param to string.format --- @tparam[opt] string d Optional param to string.format --- @tparam[opt] string e Optional param to string.format --- @tparam[opt] string f Optional param to string.format --- @tparam[opt] string g Optional param to string.format +-- @tparam string|nil a Optional param to string.format +-- @tparam string|nil b Optional param to string.format +-- @tparam string|nil c Optional param to string.format +-- @tparam string|nil d Optional param to string.format +-- @tparam string|nil e Optional param to string.format +-- @tparam string|nil f Optional param to string.format +-- @tparam string|nil g Optional param to string.format -- @treturn LangText Current instance function LangText.translate(self, locale_id, a, b, c, d, e, f, g) self.last_locale_args = { a, b, c, d, e, f, g } @@ -94,13 +94,13 @@ end --- Format string with new text params on localized text -- @tparam LangText self @{LangText} --- @tparam[opt] string a Optional param to string.format --- @tparam[opt] string b Optional param to string.format --- @tparam[opt] string c Optional param to string.format --- @tparam[opt] string d Optional param to string.format --- @tparam[opt] string e Optional param to string.format --- @tparam[opt] string f Optional param to string.format --- @tparam[opt] string g Optional param to string.format +-- @tparam string|nil a Optional param to string.format +-- @tparam string|nil b Optional param to string.format +-- @tparam string|nil c Optional param to string.format +-- @tparam string|nil d Optional param to string.format +-- @tparam string|nil e Optional param to string.format +-- @tparam string|nil f Optional param to string.format +-- @tparam string|nil g Optional param to string.format -- @treturn LangText Current instance function LangText.format(self, a, b, c, d, e, f, g) self.last_locale_args = { a, b, c, d, e, f, g } diff --git a/druid/extended/layout.lua b/druid/extended/layout.lua index 8508790..ff24fef 100644 --- a/druid/extended/layout.lua +++ b/druid/extended/layout.lua @@ -32,7 +32,7 @@ local Layout = component.create("layout") -- @tparam Layout self @{Layout} -- @tparam node node Gui node -- @tparam string mode The layout mode (from const.LAYOUT_MODE) --- @tparam[opt] function on_size_changed_callback The callback on window resize +-- @tparam function|nil on_size_changed_callback The callback on window resize function Layout.init(self, node, mode, on_size_changed_callback) self.node = self:get_node(node) @@ -194,7 +194,7 @@ end --- Set node for layout node to fit inside it. Pass nil to reset -- @tparam Layout self @{Layout} --- @tparam[opt] node node +-- @tparam node|nil node -- @treturn Layout @{Layout} function Layout.fit_into_node(self, node) self._fit_node = node diff --git a/druid/extended/progress.lua b/druid/extended/progress.lua index 7b3e057..b5fb749 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -210,7 +210,7 @@ end --- Start animation of a progress bar -- @tparam Progress self @{Progress} -- @tparam number to value between 0..1 --- @tparam[opt] function callback Callback on animation ends +-- @tparam function|nil callback Callback on animation ends function Progress.to(self, to, callback) to = helper.clamp(to, 0, 1) -- cause of float error diff --git a/druid/extended/radio_group.lua b/druid/extended/radio_group.lua index 9f0ad06..8321c3f 100644 --- a/druid/extended/radio_group.lua +++ b/druid/extended/radio_group.lua @@ -55,7 +55,7 @@ end --- Set radio group state -- @tparam RadioGroup self @{RadioGroup} -- @tparam number index Index in radio group --- @tparam boolean is_instant If is instant state change +-- @tparam boolean|nil is_instant If is instant state change function RadioGroup.set_state(self, index, is_instant) on_checkbox_click(self, index, is_instant) end diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index d74c12a..05e9453 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -60,7 +60,7 @@ end -- @tparam Slider self @{Slider} -- @tparam node node Gui pin node -- @tparam vector3 end_pos The end position of slider --- @tparam[opt] function callback On slider change callback +-- @tparam function|nil callback On slider change callback function Slider.init(self, node, end_pos, callback) self.node = self:get_node(node) @@ -174,7 +174,7 @@ end --- Set value for slider -- @tparam Slider self @{Slider} -- @tparam number value Value from 0 to 1 --- @tparam[opt] boolean is_silent Don't trigger event if true +-- @tparam boolean|nil is_silent Don't trigger event if true function Slider.set(self, value, is_silent) value = helper.clamp(value, 0, 1) set_position(self, value) diff --git a/druid/extended/swipe.lua b/druid/extended/swipe.lua index f04c733..264805b 100644 --- a/druid/extended/swipe.lua +++ b/druid/extended/swipe.lua @@ -13,7 +13,7 @@ -- @tparam node node --- Restriction zone --- @tparam[opt] node click_zone +-- @tparam node|nil click_zone --- Trigger on swipe event(self, swipe_side, dist, delta_time) -- @tfield DruidEvent on_swipe) @{DruidEvent} diff --git a/druid/extended/timer.lua b/druid/extended/timer.lua index 299c057..b647add 100644 --- a/druid/extended/timer.lua +++ b/druid/extended/timer.lua @@ -49,7 +49,7 @@ end -- @tparam node node Gui text node -- @tparam number seconds_from Start timer value in seconds -- @tparam[opt=0] number seconds_to End timer value in seconds --- @tparam[opt] function callback Function on timer end +-- @tparam function|nil callback Function on timer end function Timer.init(self, node, seconds_from, seconds_to, callback) self.node = self:get_node(node) seconds_from = math.max(seconds_from, 0) @@ -110,7 +110,7 @@ end --- Called when update -- @tparam Timer self @{Timer} --- @tparam boolean is_on Timer enable state +-- @tparam boolean|nil is_on Timer enable state function Timer.set_state(self, is_on) self.is_on = is_on diff --git a/druid/helper.lua b/druid/helper.lua index 71afe65..9e6ab97 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -48,8 +48,8 @@ end -- Nodes will be center around 0 x position -- text_node will be first (at left side) -- @function helper.centrate_text_with_icon --- @tparam[opt] text text_node Gui text node --- @tparam[opt] box icon_node Gui box node +-- @tparam text|nil text_node Gui text node +-- @tparam box|nil icon_node Gui box node -- @tparam number margin Offset between nodes -- @local function M.centrate_text_with_icon(text_node, icon_node, margin) @@ -61,8 +61,8 @@ end -- Nodes will be center around 0 x position -- icon_node will be first (at left side) -- @function helper.centrate_icon_with_text --- @tparam[opt] box icon_node Gui box node --- @tparam[opt] text text_node Gui text node +-- @tparam box|nil icon_node Gui box node +-- @tparam text|nil text_node Gui text node -- @tparam[opt=0] number margin Offset between nodes -- @local function M.centrate_icon_with_text(icon_node, text_node, margin) @@ -256,7 +256,7 @@ end --- Add all elements from source array to the target array -- @function helper.add_array -- @tparam any[] target Array to put elements from source --- @tparam[opt] any[] source The source array to get elements from +-- @tparam any[]|nil source The source array to get elements from -- @treturn any[] The target array function M.add_array(target, source) assert(target) @@ -278,7 +278,7 @@ end -- @tparam node node -- @tparam number x -- @tparam number y --- @tparam[opt] Node node_click_area +-- @tparam node|nil node_click_area -- @local function M.pick_node(node, x, y, node_click_area) local is_pick = gui.pick_node(node, x, y) @@ -302,7 +302,7 @@ end --- Get cumulative parent's node scale -- @function helper.get_scene_scale -- @tparam node node Gui node --- @tparam boolean include_passed_node_scale True if add current node scale to result +-- @tparam boolean|nil include_passed_node_scale True if add current node scale to result -- @treturn vector3 The scene node scale function M.get_scene_scale(node, include_passed_node_scale) local scale = include_passed_node_scale and gui.get_scale(node) or vmath.vector3(1) @@ -394,7 +394,7 @@ end --- Distance from node position to his borders -- @function helper.get_border -- @tparam node node GUI node --- @tparam[opt] vector3 offset Offset from node position. Pass current node position to get non relative border values +-- @tparam vector3|nil offset Offset from node position. Pass current node position to get non relative border values -- @treturn vector4 Vector4 with border values (left, top, right, down) function M.get_border(node, offset) local pivot = gui.get_pivot(node) @@ -452,8 +452,8 @@ end -- @function helper.insert_with_shift -- @tparam table array Array -- @param any Item to insert --- @tparam[opt] number index Index to insert. If nil, item will be inserted at the end of array --- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant +-- @tparam number|nil index Index to insert. If nil, item will be inserted at the end of array +-- @tparam number|nil shift_policy The druid_const.SHIFT.* constant -- @treturn any Inserted item function M.insert_with_shift(array, item, index, shift_policy) shift_policy = shift_policy or const.SHIFT.RIGHT @@ -483,8 +483,8 @@ end -- Shift policy can be: left, right, no_shift -- @function helper.remove_with_shift -- @tparam table array Array --- @tparam[opt] number index Index to remove. If nil, item will be removed from the end of array --- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant +-- @tparam number|nil index Index to remove. If nil, item will be removed from the end of array +-- @tparam number|nil shift_policy The druid_const.SHIFT.* constant -- @treturn any Removed item function M.remove_with_shift(array, index, shift_policy) shift_policy = shift_policy or const.SHIFT.RIGHT diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 688edaf..28786ec 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -518,7 +518,7 @@ end --- Set debug mode for current Druid instance. It's enable debug log messages -- @tparam DruidInstance self @{DruidInstance} --- @tparam boolean is_debug +-- @tparam boolean|nil is_debug -- @treturn self @{DruidInstance} -- @local function DruidInstance.set_debug(self, is_debug) @@ -530,7 +530,7 @@ end --- Log message, if is_debug mode is enabled -- @tparam DruidInstance self @{DruidInstance} -- @tparam string message --- @tparam[opt] table context +-- @tparam table|nil context -- @local function DruidInstance.log_message(self, message, context) if not self._is_debug then @@ -558,10 +558,10 @@ end --- Create @{Button} component -- @tparam DruidInstance self --- @tparam node node GUI node +-- @tparam string|node node The node_id or gui.get_node(node_id) -- @tparam function callback Button callback --- @tparam[opt] table params Button callback params --- @tparam[opt] node anim_node Button anim node (node, if not provided) +-- @tparam table|nil params Button callback params +-- @tparam node|nil anim_node Button anim node (node, if not provided) -- @treturn Button @{Button} component function DruidInstance.new_button(self, node, callback, params, anim_node) return DruidInstance.new(self, button, node, callback, params, anim_node) @@ -570,7 +570,7 @@ end --- Create @{Blocker} component -- @tparam DruidInstance self --- @tparam node node Gui node +-- @tparam string|node node The node_id or gui.get_node(node_id) -- @treturn Blocker @{Blocker} component function DruidInstance.new_blocker(self, node) return DruidInstance.new(self, blocker, node) @@ -580,7 +580,7 @@ end --- Create @{BackHandler} component -- @tparam DruidInstance self -- @tparam function callback @The callback(self, custom_args) to call on back event --- @tparam[opt] any params Callback argument +-- @tparam any|nil params Callback argument -- @treturn BackHandler @{BackHandler} component function DruidInstance.new_back_handler(self, callback, params) return DruidInstance.new(self, back_handler, callback, params) @@ -589,7 +589,7 @@ end --- Create @{Hover} component -- @tparam DruidInstance self --- @tparam node node Gui node +-- @tparam string|node node The node_id or gui.get_node(node_id) -- @tparam function on_hover_callback Hover callback -- @treturn Hover @{Hover} component function DruidInstance.new_hover(self, node, on_hover_callback) @@ -599,9 +599,9 @@ end --- Create @{Text} component -- @tparam DruidInstance self --- @tparam node node Gui text node --- @tparam[opt] string value Initial text. Default value is node text from GUI scene. --- @tparam[opt] boolean no_adjust If true, text will be not auto-adjust size +-- @tparam string|node node The node_id or gui.get_node(node_id) +-- @tparam string|nil value Initial text. Default value is node text from GUI scene. +-- @tparam boolean|nil no_adjust If true, text will be not auto-adjust size -- @treturn Text @{Text} component function DruidInstance.new_text(self, node, value, no_adjust) return DruidInstance.new(self, text, node, value, no_adjust) @@ -611,32 +611,32 @@ end --- Create @{StaticGrid} component -- Deprecated -- @tparam DruidInstance self --- @tparam node parent The gui node parent, where items will be placed +-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items. -- @tparam node element Element prefab. Need to get it size -- @tparam[opt=1] number in_row How many nodes in row can be placed -- @treturn StaticGrid @{StaticGrid} component -- @local -function DruidInstance.new_grid(self, parent, element, in_row) +function DruidInstance.new_grid(self, parent_node, element, in_row) helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead") - return DruidInstance.new(self, static_grid, parent, element, in_row) + return DruidInstance.new(self, static_grid, parent_node, element, in_row) end --- Create @{StaticGrid} component -- @tparam DruidInstance self --- @tparam node parent The gui node parent, where items will be placed +-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items. -- @tparam node element Element prefab. Need to get it size -- @tparam[opt=1] number in_row How many nodes in row can be placed -- @treturn StaticGrid @{StaticGrid} component -function DruidInstance.new_static_grid(self, parent, element, in_row) - return DruidInstance.new(self, static_grid, parent, element, in_row) +function DruidInstance.new_static_grid(self, parent_node, element, in_row) + return DruidInstance.new(self, static_grid, parent_node, element, in_row) end --- Create @{Scroll} component -- @tparam DruidInstance self --- @tparam node view_node GUI view scroll node --- @tparam node content_node GUI content scroll node +-- @tparam string|node view_node The node_id or gui.get_node(node_id). Will used as user input node. +-- @tparam string|node content_node The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node. -- @treturn Scroll @{Scroll} component function DruidInstance.new_scroll(self, view_node, content_node) return DruidInstance.new(self, scroll, view_node, content_node) @@ -645,7 +645,7 @@ end --- Create @{Drag} component -- @tparam DruidInstance self --- @tparam node node GUI node to detect dragging +-- @tparam string|node node The node_id or gui.get_node(node_id). Will used as user input node. -- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy) -- @treturn Drag @{Drag} component function DruidInstance.new_drag(self, node, on_drag_callback) @@ -655,7 +655,7 @@ end --- Create @{Swipe} component -- @tparam DruidInstance self --- @tparam node node Gui node +-- @tparam string|node node The node_id or gui.get_node(node_id). Will used as user input node. -- @tparam function on_swipe_callback Swipe callback for on_swipe_end event -- @treturn Swipe @{Swipe} component function DruidInstance.new_swipe(self, node, on_swipe_callback) @@ -665,38 +665,38 @@ end --- Create @{DynamicGrid} component -- @tparam DruidInstance self --- @tparam node parent The gui node parent, where items will be placed +-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items. -- @treturn DynamicGrid @{DynamicGrid} component -function DruidInstance.new_dynamic_grid(self, parent) +function DruidInstance.new_dynamic_grid(self, parent_node) return helper.require_component_message("dynamic_grid") end --- Create @{LangText} component -- @tparam DruidInstance self --- @tparam node node The text node --- @tparam string locale_id Default locale id --- @tparam boolean no_adjust If true, will not correct text size +-- @tparam string|node node The_node id or gui.get_node(node_id) +-- @tparam string|nil locale_id Default locale id or text from node as default +-- @tparam string|nil adjust_type Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE -- @treturn LangText @{LangText} component -function DruidInstance.new_lang_text(self, node, locale_id, no_adjust) +function DruidInstance.new_lang_text(self, node, locale_id, adjust_type) return helper.require_component_message("lang_text") end --- Create @{Slider} component -- @tparam DruidInstance self --- @tparam node node Gui pin node +-- @tparam string|node pin_node The_node id or gui.get_node(node_id). -- @tparam vector3 end_pos The end position of slider --- @tparam[opt] function callback On slider change callback +-- @tparam function|nil callback On slider change callback -- @treturn Slider @{Slider} component -function DruidInstance.new_slider(self, node, end_pos, callback) +function DruidInstance.new_slider(self, pin_node, end_pos, callback) return helper.require_component_message("slider") end --- Create @{Checkbox} component -- @tparam DruidInstance self --- @tparam node node Gui node +-- @tparam string|node node The_node id or gui.get_node(node_id). -- @tparam function callback Checkbox callback -- @tparam[opt=node] node click_node Trigger node, by default equals to node -- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false @@ -708,9 +708,9 @@ end --- Create @{Input} component -- @tparam DruidInstance self --- @tparam node click_node Button node to enabled input component --- @tparam node text_node Text node what will be changed on user input --- @tparam[opt] number keyboard_type Gui keyboard type for input field +-- @tparam string|node click_node Button node to enabled input component +-- @tparam string|node text_node Text node what will be changed on user input +-- @tparam number|nil keyboard_type Gui keyboard type for input field -- @treturn Input @{Input} component function DruidInstance.new_input(self, click_node, text_node, keyboard_type) return helper.require_component_message("input") @@ -752,10 +752,10 @@ end --- Create @{Timer} component -- @tparam DruidInstance self --- @tparam node node Gui text node +-- @tparam string|node node Gui text node -- @tparam number seconds_from Start timer value in seconds -- @tparam[opt=0] number seconds_to End timer value in seconds --- @tparam[opt] function callback Function on timer end +-- @tparam function|nil callback Function on timer end -- @treturn Timer @{Timer} component function DruidInstance.new_timer(self, node, seconds_from, seconds_to, callback) return helper.require_component_message("timer") @@ -775,7 +775,7 @@ end --- Create @{Layout} component -- @tparam DruidInstance self --- @tparam string|node node Layout node +-- @tparam string|node node The_node id or gui.get_node(node_id). -- @tparam string mode The layout mode -- @treturn Layout @{Layout} component function DruidInstance.new_layout(self, node, mode) @@ -787,7 +787,7 @@ end -- @tparam DruidInstance self -- @tparam string|string[] keys_array Keys for trigger action. Should contains one action key and any amount of modificator keys -- @tparam function callback The callback function --- @tparam[opt] any callback_argument The argument to pass into the callback function +-- @tparam any|nil callback_argument The argument to pass into the callback function -- @treturn Hotkey @{Hotkey} component function DruidInstance.new_hotkey(self, keys_array, callback, callback_argument) return helper.require_component_message("hotkey") @@ -797,8 +797,8 @@ end --- Create @{RichText} component. -- As a template please check rich_text.gui layout. -- @tparam DruidInstance self --- @tparam[opt] string template Template name if used --- @tparam[opt] table nodes Nodes table from gui.clone_tree +-- @tparam string|nil template Template name if used +-- @tparam table|nil nodes Nodes table from gui.clone_tree -- @treturn RichText @{RichText} component function DruidInstance.new_rich_text(self, template, nodes) return helper.require_component_message("rich_text", "custom")
    init(self, node, seconds_from[, seconds_to=0[, callback]])init(self, node, seconds_from[, seconds_to=0], callback) The Timer constructor