diff --git a/config.ld b/config.ld index 0eea5d5..1a295b1 100644 --- a/config.ld +++ b/config.ld @@ -1,6 +1,6 @@ project='Druid' -title='Defold Druid UI Library' -description='Documentation for Druid Library' +title='Defold Druid UI Framework' +description='Documentation for Druid Framework' file={"./druid", exclude = { "./druid/styles/", diff --git a/druid/base/back_handler.lua b/druid/base/back_handler.lua index 7dbb158..227103e 100644 --- a/druid/base/back_handler.lua +++ b/druid/base/back_handler.lua @@ -1,6 +1,6 @@ -- Copyright (c) 2023 Maksim Tuprikov . This code is licensed under MIT license ---- Component with event on back or backspace button. +--- Component with event on back and backspace button. -- # Overview # -- -- Back Handler is recommended to put in every game window to close it diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index ea916d9..81d5e46 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -457,7 +457,6 @@ function Scroll.bind_grid(self, grid) local size = grid:get_size() local offset = grid:get_offset() self:set_size(size, offset) - self:log_message("Change size from grid", { size = size, offset = offset }) end) self:set_size(grid:get_size(), grid:get_offset()) diff --git a/druid/component.lua b/druid/component.lua index eaf52f1..0dfe0f9 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -13,7 +13,6 @@ local const = require("druid.const") local class = require("druid.system.middleclass") local helper = require("druid.helper") - local BaseComponent = class("druid.component") local INTERESTS = {} -- Cache interests by component class in runtime diff --git a/druid/extended/data_list.lua b/druid/extended/data_list.lua index f8cb091..2c1b011 100644 --- a/druid/extended/data_list.lua +++ b/druid/extended/data_list.lua @@ -118,8 +118,6 @@ function DataList.add(self, data, index, shift_policy) helper.insert_with_shift(self._data, data, index, shift_policy) self:_update_data_info() self:_check_elements() - - self:log_message("Add element", { index = index }) end @@ -133,8 +131,6 @@ function DataList.remove(self, index, shift_policy) helper.remove_with_shift(self._data, index, shift_policy) self:_update_data_info() - - self:log_message("Remove element", { index = index }) end @@ -255,7 +251,6 @@ function DataList._add_at(self, index) component = instance } - self:log_message("Add element at", { index = index }) self.on_element_add:trigger(self:get_context(), index, node, instance) end @@ -276,7 +271,6 @@ function DataList._remove_at(self, index) end self._data_visual[index] = nil - self:log_message("Remove element at", { index = index }) self.on_element_remove:trigger(self:get_context(), index) end @@ -322,8 +316,6 @@ function DataList._check_elements(self) progress = 0 end - self:log_message("Check elements", { top_index = self.top_index, last_index = self.last_index, progress = progress }) - if self.scroll_progress ~= progress then self.scroll_progress = progress self.on_scroll_progress_change:trigger(self:get_context(), progress) diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index be43e0d..e8aefb6 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -5,6 +5,24 @@ -- # Component List # -- -- See all component list in "See Also" section. +-- +-- # Notes # +-- +-- Take a look on the next API pages: +-- +-- - @{Helper} - Useful pack of functions to work with GUI nodes like centrate nodes +-- +-- - @{DruidEvent} - The core event system in Druid. See how to subscribe on any event +-- +-- - @{BaseComponent} - the parent of all Druid components, you can see all default component methods there +-- +-- Other things: +-- +-- - To use Druid, first you should create a Druid instance to spawn components and add Druids main engine functions: update, final, on_message and on_input. +-- +-- - All Druid components take node name string as arguments, don't do gui.get_node() before. +-- +-- - All Druid and component methods are called with : like self.druid:new_button(). -- @usage -- local druid = require("druid.druid") -- @@ -75,32 +93,27 @@ local text = require("druid.base.text") -- local data_list = require("druid.extended.data_list") -- local swipe = require("druid.extended.swipe") - local DruidInstance = class("druid.druid_instance") -local IS_NO_AUTO_INPUT = sys.get_config("druid.no_auto_input") == "1" +local IS_NO_AUTO_INPUT = sys.get_config_int("druid.no_auto_input", 0) == 1 local function input_init(self) - if IS_NO_AUTO_INPUT then + if IS_NO_AUTO_INPUT or self.input_inited then return end - if not self.input_inited then - self.input_inited = true - druid_input.focus() - end + self.input_inited = true + druid_input.focus() end local function input_release(self) - if IS_NO_AUTO_INPUT then + if IS_NO_AUTO_INPUT or not self.input_inited then return end - if self.input_inited then - self.input_inited = false - druid_input.remove() - end + self.input_inited = false + druid_input.remove() end @@ -290,8 +303,6 @@ function DruidInstance.final(self) self._deleted = true input_release(self) - - self:log_message("Druid final") end @@ -336,8 +347,6 @@ function DruidInstance.remove(self, component) end end end - - self:log_message("Remove", { name = component:get_name(), parent = component:get_parent_name() }) end @@ -437,8 +446,6 @@ function DruidInstance.on_focus_lost(self) for i = 1, #components do components[i]:on_focus_lost() end - - self:log_message("On focus lost") end @@ -451,8 +458,6 @@ function DruidInstance.on_focus_gained(self) for i = 1, #components do components[i]:on_focus_gained() end - - self:log_message("On focus gained") end @@ -466,8 +471,6 @@ function DruidInstance.on_language_change(self) for i = 1, #components do components[i]:on_language_change() end - - self:log_message("On language change") end @@ -671,7 +674,7 @@ end -- @tparam bool no_adjust If true, will not correct text size -- @treturn LangText lang_text component function DruidInstance.new_lang_text(self, node, locale_id, no_adjust) - return helper.extended_component("lang_text") + return helper.extended_component("lang_text") end diff --git a/druid/system/middleclass.lua b/druid/system/middleclass.lua index 9df1a84..e0ef598 100644 --- a/druid/system/middleclass.lua +++ b/druid/system/middleclass.lua @@ -1,32 +1,5 @@ -local middleclass = { - _VERSION = 'middleclass v4.1.1', - _DESCRIPTION = 'Object Orientation for Lua', - _URL = 'https://github.com/kikito/middleclass', - _LICENSE = [[ - MIT LICENSE - - Copyright (c) 2011 Enrique GarcĂ­a Cota - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ]] -} +-- Source: https://github.com/kikito/middleclass +local middleclass = {} local function _createIndexWrapper(aClass, f) if f == nil then