From b198e095603443b11977ea9f13b07912dc19e210 Mon Sep 17 00:00:00 2001 From: Insality Date: Sat, 22 Feb 2020 14:44:01 +0300 Subject: [PATCH] Add functions stubs --- README.md | 2 +- alpha_todo.txt | 37 +++++++++++++++++++---------- druid/base/button.lua | 42 +++++++++++++++++++++++++++++---- druid/base/input.lua | 15 ++++++++++++ druid/system/druid_instance.lua | 2 +- 5 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 druid/base/input.lua diff --git a/README.md b/README.md index da5806f..298b34e 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ function on_message(self, message_id, message, sender) end function on_input(self, action_id, action) - self.druid:on_input(action_id, action) + return self.druid:on_input(action_id, action) end ``` diff --git a/alpha_todo.txt b/alpha_todo.txt index 6073ea5..65da880 100644 --- a/alpha_todo.txt +++ b/alpha_todo.txt @@ -1,22 +1,33 @@ -Simple to-do for Druid Alpha 2.0 +Simple to-do for Druid Alpha 0.2.0 -- custom input settings (name of touch, text, etc) -- refactor on_swipe. To on_scroll? Add input priority + +-- High - remove button event and match_event from druid -- add docs for all components -- button polish, actions -- ability to relocalize all locale text nodes +- add hover component +- add druid events/triggers? better callback system - better name for locale component? lang? lang_text? - better scroll size management, check different cases. So implicit now - better grid + scroll management +- button polish, actions +- button add key trigger +- add text component for alpha release +- refactor on_swipe. To on_scroll? Add input priority - add druid settings (add auto_focus input and other stuff) -- better default style, add template for custom style -- add template for user components -- add good examples with template and/or nodes (basic component no use any of them) -- add docs folder for every component with gifs? Solutions - add init/remove stuff for every style in component. How to set custom sprites for button states? - better callbacks for every components -- separate custom data and predefined fields in components? -- try use final druid in real project (FI uses custom druid) +- better default style, add template for custom style +- add docs for all components +- add docs folder for every component with gifs? Solutions - better name for slider component? -- add text component for alpha release \ No newline at end of file +- separate custom data and predefined fields in components? +- unify component api (get/set/to and other general stuff) +- compare with gooey + + +-- Low +- add code template and example for user components +- custom input settings (name of touch, text, etc) +- ability to relocalize all locale text nodes +- add good examples with template and/or nodes (basic component no use any of them) +- try use final druid in real project (FI uses custom druid) (use in 4321?) +- Druid store assest - separate repository with rich components diff --git a/druid/base/button.lua b/druid/base/button.lua index 5367a57..95add22 100644 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -1,11 +1,6 @@ --- Component to handle basic GUI button -- @module druid.button --- TODO: Add button mode: --- Long tap --- Repeated tap --- Double tap? - local const = require("druid.const") local helper = require("druid.helper") local component = require("druid.component") @@ -148,4 +143,41 @@ function M.set_click_zone(self, zone) end +-- TODO: implement them all! +--- Set key-code to trigger this button +function M.set_key_trigger(self, key) + +end + + +--- Get key-code to trigger this button +function M.get_key_trigger(self) + +end + + +--- Set usual button callback +function M.set_callback(self, callback) + +end + + +--- Repeat callback always, while holding button +function M.set_hold_callback(self, callback) + +end + + +--- Get doubletap callback on this button +function M.set_double_tap_callback(self, callback) + +end + + +--- Single callbacka after long_tap. No usual callback invoked +function M.set_long_tap_callback(self, callback) + +end + + return M diff --git a/druid/base/input.lua b/druid/base/input.lua new file mode 100644 index 0000000..3b05fb8 --- /dev/null +++ b/druid/base/input.lua @@ -0,0 +1,15 @@ +--- Druid input text component +-- @local unimplemented +-- @module druid.input + +local component = require("druid.component") + +local M = component.create("input") + + +function M.init(self, node, callback, click_node) + self.style = self:get_style() +end + + +return M diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 4a524fe..d3800ae 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -33,7 +33,7 @@ local slider = require("druid.base.slider") local checkbox = require("druid.base.checkbox") local checkbox_group = require("druid.base.checkbox_group") local radio_group = require("druid.base.radio_group") --- local input - require("druid.base.input") +local input - require("druid.base.input") -- local infinity_scroll = require("druid.base.infinity_scroll") local progress_rich = require("druid.rich.progress_rich")