From a846adf97b5d63f291c6ac06b46b745a481a547d Mon Sep 17 00:00:00 2001 From: Insality Date: Tue, 8 Mar 2022 18:38:17 +0200 Subject: [PATCH] Update docs --- druid/base/back_handler.lua | 2 +- druid/base/blocker.lua | 2 +- druid/base/button.lua | 3 ++- druid/base/drag.lua | 2 +- druid/base/hover.lua | 2 +- druid/base/scroll.lua | 2 +- druid/base/static_grid.lua | 10 +++++----- druid/base/swipe.lua | 2 +- druid/base/text.lua | 2 +- druid/component.lua | 2 +- druid/const.lua | 2 +- druid/druid.lua | 2 +- druid/event.lua | 4 ++-- druid/extended/checkbox.lua | 2 +- druid/extended/checkbox_group.lua | 2 +- druid/extended/component.template.lua | 2 +- druid/extended/data_list.lua | 2 +- druid/extended/dynamic_grid.lua | 6 +++--- druid/extended/input.lua | 2 +- druid/extended/lang_text.lua | 18 +++++++++++++++--- druid/extended/progress.lua | 2 +- druid/extended/radio_group.lua | 2 +- druid/extended/slider.lua | 2 +- druid/extended/timer.lua | 2 +- druid/helper.lua | 7 ++++--- druid/helper/druid_input.lua | 2 +- druid/helper/formats.lua | 2 +- druid/styles/default/anims.lua | 2 +- druid/styles/default/style.lua | 2 +- druid/styles/empty/style.lua | 2 +- druid/styles/sprites/style.lua | 2 +- druid/system/druid_instance.lua | 13 +++++++------ druid/system/settings.lua | 2 +- 33 files changed, 64 insertions(+), 49 deletions(-) diff --git a/druid/base/back_handler.lua b/druid/base/back_handler.lua index e0af15c..0f47fa4 100644 --- a/druid/base/back_handler.lua +++ b/druid/base/back_handler.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle back key (android, backspace) -- @module BackHandler diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua index d6aee61..13074b3 100644 --- a/druid/base/blocker.lua +++ b/druid/base/blocker.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to block input on specify zone by node -- @module Blocker diff --git a/druid/base/button.lua b/druid/base/button.lua index 14f647b..a5222b8 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle basic GUI button -- @module Button @@ -392,6 +392,7 @@ 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 what will be called on button click, if check function return false -- @treturn Button Current button instance diff --git a/druid/base/drag.lua b/druid/base/drag.lua index 18cf4f9..021fcf3 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle drag action on node. -- Drag have correct handling for multitouch and swap diff --git a/druid/base/hover.lua b/druid/base/hover.lua index e1b56f0..decda06 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle hover node interaction -- @module Hover diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 8134c46..3092c3a 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle scroll content. -- Scroll consist from two nodes: scroll parent and scroll input diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index ed67407..26e3de7 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle placing components by row and columns. -- Grid can anchor your elements, get content size and other @@ -181,10 +181,10 @@ end --- Add new item to the grid -- @tparam StaticGrid self --- @tparam node item Gui node +-- @tparam node item Gui node -- @tparam[opt] number 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_instance If true, update node positions instantly +-- @tparam[opt=false] boolean is_instant If true, update node positions instantly function StaticGrid.add(self, item, index, shift_policy, is_instant) shift_policy = shift_policy or const.SHIFT.RIGHT index = index or ((self.last_index or 0) + 1) @@ -222,7 +222,7 @@ end -- @tparam StaticGrid self -- @tparam number index The grid node index to remove -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT --- @tparam[opt=false] boolean is_instance If true, update node positions instantly +-- @tparam[opt=false] boolean is_instant If true, update node positions instantly -- @treturn Node The deleted gui node from grid function StaticGrid.remove(self, index, shift_policy, is_instant) shift_policy = shift_policy or const.SHIFT.RIGHT @@ -357,7 +357,7 @@ end -- @tparam StaticGrid self -- @tparam number in_row The new in_row value -- @treturn druid.static_grid Current grid instance -function StaticGrid:set_in_row(in_row) +function StaticGrid.set_in_row(self, in_row) self.in_row = in_row self._grid_horizonal_offset = self.node_size.x * (self.in_row - 1) * self.anchor.x self:_update(true) diff --git a/druid/base/swipe.lua b/druid/base/swipe.lua index f4fbbcd..b744fc3 100644 --- a/druid/base/swipe.lua +++ b/druid/base/swipe.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle swipe gestures on node. -- Swipe will be triggered, if swipe was started and diff --git a/druid/base/text.lua b/druid/base/text.lua index c53df2d..59eee39 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle all GUI texts. -- Druid text can adjust itself for text node size diff --git a/druid/component.lua b/druid/component.lua index b18e1a0..be97f84 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Basic class for all Druid components. -- To create you component, use `component.create` diff --git a/druid/const.lua b/druid/const.lua index c04896c..c40fc58 100755 --- a/druid/const.lua +++ b/druid/const.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid constants -- @local diff --git a/druid/druid.lua b/druid/druid.lua index a8204c3..ed5303f 100644 --- a/druid/druid.lua +++ b/druid/druid.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid UI Library. -- Powerful Defold component based UI library. Use standart diff --git a/druid/event.lua b/druid/event.lua index 0a3373a..cda2181 100644 --- a/druid/event.lua +++ b/druid/event.lua @@ -1,6 +1,6 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license ---- Lua event small library +--- Druid lua event library -- @module DruidEvent -- @alias druid_event diff --git a/druid/extended/checkbox.lua b/druid/extended/checkbox.lua index 6ce29a1..08012a2 100755 --- a/druid/extended/checkbox.lua +++ b/druid/extended/checkbox.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid checkbox component -- @module Checkbox diff --git a/druid/extended/checkbox_group.lua b/druid/extended/checkbox_group.lua index a9fbefe..f87d721 100644 --- a/druid/extended/checkbox_group.lua +++ b/druid/extended/checkbox_group.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Checkbox group module -- @module CheckboxGroup diff --git a/druid/extended/component.template.lua b/druid/extended/component.template.lua index 2d0c8ed..66aace7 100644 --- a/druid/extended/component.template.lua +++ b/druid/extended/component.template.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid component template -- @module druid.component diff --git a/druid/extended/data_list.lua b/druid/extended/data_list.lua index 2f9f736..69549a3 100644 --- a/druid/extended/data_list.lua +++ b/druid/extended/data_list.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to manage data for huge dataset in scroll. -- It requires Druid Scroll and Druid Grid (Static or Dynamic) components diff --git a/druid/extended/dynamic_grid.lua b/druid/extended/dynamic_grid.lua index f22b564..ccb14b0 100644 --- a/druid/extended/dynamic_grid.lua +++ b/druid/extended/dynamic_grid.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle placing components in row -- @module DynamicGrid @@ -140,7 +140,7 @@ end -- @tparam node node Gui node -- @tparam[opt] number 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_instance If true, update node positions instantly +-- @tparam[opt=false] boolean is_instant If true, update node positions instantly function DynamicGrid.add(self, node, index, shift_policy, is_instant) shift_policy = shift_policy or const.SHIFT.RIGHT local delta = shift_policy -- -1 or 1 or 0 @@ -182,7 +182,7 @@ end -- @tparam DynamicGrid self -- @tparam number index The grid node index to remove -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT --- @tparam[opt=false] boolean is_instance If true, update node positions instantly +-- @tparam[opt=false] boolean is_instant If true, update node positions instantly -- @treturn Node The deleted gui node from grid function DynamicGrid.remove(self, index, shift_policy, is_instant) shift_policy = shift_policy or const.SHIFT.RIGHT diff --git a/druid/extended/input.lua b/druid/extended/input.lua index e1cc2fa..be94d23 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid input text component. -- Carry on user text input diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index b801890..f5c0353 100755 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle all GUI texts -- Good working with localization system @@ -63,7 +63,13 @@ end --- Translate the text by locale_id -- @tparam LangText self -- @tparam string locale_id Locale id --- @tparam string ... Locale arguments to pass in text function +-- @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 -- @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 } @@ -76,7 +82,13 @@ end --- Format string with new text params on localized text -- @tparam LangText self --- @tparam string ... Locale arguments to pass in text function +-- @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 -- @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/progress.lua b/druid/extended/progress.lua index e1ddaf0..d186f43 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Basic progress bar component. -- For correct progress bar init it should be in max size from gui diff --git a/druid/extended/radio_group.lua b/druid/extended/radio_group.lua index 7ff0a4d..abad338 100644 --- a/druid/extended/radio_group.lua +++ b/druid/extended/radio_group.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Radio group module -- @module RadioGroup diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index b5a3198..a810663 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid slider component -- @module Slider diff --git a/druid/extended/timer.lua b/druid/extended/timer.lua index 307e7c0..f721dfa 100644 --- a/druid/extended/timer.lua +++ b/druid/extended/timer.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle GUI timers. -- Timer updating by game delta time. If game is not focused - diff --git a/druid/helper.lua b/druid/helper.lua index 38e2b36..a79a6a5 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -1,7 +1,8 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid helper module for gui layouts --- @module helper +--- Druid helper module for gui layouts +-- @module Helper +-- @alias druid.helper local const = require("druid.const") diff --git a/druid/helper/druid_input.lua b/druid/helper/druid_input.lua index 3d9f710..deb64f1 100644 --- a/druid/helper/druid_input.lua +++ b/druid/helper/druid_input.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid inner module to acquire/release input -- @module helper.input diff --git a/druid/helper/formats.lua b/druid/helper/formats.lua index 44ba2f6..9d00cf4 100644 --- a/druid/helper/formats.lua +++ b/druid/helper/formats.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid module with utils on string formats -- @local diff --git a/druid/styles/default/anims.lua b/druid/styles/default/anims.lua index 7c07b39..6f13a30 100644 --- a/druid/styles/default/anims.lua +++ b/druid/styles/default/anims.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license local M = {} diff --git a/druid/styles/default/style.lua b/druid/styles/default/style.lua index 2588636..bd18a78 100644 --- a/druid/styles/default/style.lua +++ b/druid/styles/default/style.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license local const = require("druid.const") local settings = require("druid.system.settings") diff --git a/druid/styles/empty/style.lua b/druid/styles/empty/style.lua index fa863e0..2eec3ee 100644 --- a/druid/styles/empty/style.lua +++ b/druid/styles/empty/style.lua @@ -1,3 +1,3 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license return {} diff --git a/druid/styles/sprites/style.lua b/druid/styles/sprites/style.lua index 932d7a1..260ff2d 100644 --- a/druid/styles/sprites/style.lua +++ b/druid/styles/sprites/style.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license local M = {} diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 024cfa9..e52f191 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Instance of Druid. Make one instance per gui_script with next code: -- @@ -401,6 +401,7 @@ end --- Druid on focus gained interest function. -- This one called by on_window_callback by global window listener +-- @function druid_instance.on_focus_gained -- @tparam DruidInstance self function DruidInstance.on_focus_gained(self) local components = self.components_interest[base_component.ON_FOCUS_GAINED] @@ -413,8 +414,8 @@ end --- Druid on language change. -- This one called by global gruid.on_language_change, but can be -- call manualy to update all translations +-- @function druid_instance.on_language_change -- @tparam DruidInstance self --- @function druid.on_language_change function DruidInstance.on_language_change(self) local components = self.components_interest[base_component.ON_LANGUAGE_CHANGE] for i = 1, #components do @@ -426,9 +427,9 @@ 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 +-- @function druid_instance.set_whitelist -- @tparam DruidInstance self -- @tparam[opt=nil] table|Component whitelist_components The array of component to whitelist --- @function druid.set_whitelist function DruidInstance.set_whitelist(self, whitelist_components) if whitelist_components and whitelist_components.isInstanceOf then whitelist_components = { whitelist_components } @@ -449,9 +450,9 @@ 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 +-- @function druid_instance.set_blacklist -- @tparam DruidInstance self -- @tparam[opt=nil] table|Component blacklist_components The array of component to blacklist --- @function druid.set_blacklist function DruidInstance.set_blacklist(self, blacklist_components) if blacklist_components and blacklist_components.isInstanceOf then blacklist_components = { blacklist_components } @@ -648,8 +649,8 @@ end --- Create data list basic component -- @function druid:new_data_list --- @tparam druid.scroll druid_scroll The Scroll instance for Data List component --- @tparam druid.grid druid_grid The Grid instance for Data List component +-- @tparam Scroll druid_scroll The Scroll instance for Data List component +-- @tparam Grid druid_grid The Grid instance for Data List component -- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component]) -- @treturn DataList data_list component function DruidInstance.new_data_list(self, druid_scroll, druid_grid, create_function) diff --git a/druid/system/settings.lua b/druid/system/settings.lua index 1ac9763..cc7064a 100755 --- a/druid/system/settings.lua +++ b/druid/system/settings.lua @@ -1,4 +1,4 @@ --- Copyright (c) 2021 Maxim Tuprikov . This code is licensed under MIT license +-- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Druid settings file -- @module settings