diff --git a/docs/index.html b/docs/index.html index c3f84fb..f7def12 100644 --- a/docs/index.html +++ b/docs/index.html @@ -54,11 +54,11 @@

Topics

@@ -156,23 +156,23 @@

Topics

- + - + - + - + - + @@ -185,7 +185,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/component.html b/docs/modules/component.html index ef4bc84..e9f0b71 100644 --- a/docs/modules/component.html +++ b/docs/modules/component.html @@ -61,11 +61,11 @@

Topics

@@ -406,7 +406,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.back_handler.html b/docs/modules/druid.back_handler.html index f430074..b487db4 100644 --- a/docs/modules/druid.back_handler.html +++ b/docs/modules/druid.back_handler.html @@ -62,11 +62,11 @@

Topics

@@ -215,7 +215,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.blocker.html b/docs/modules/druid.blocker.html index 51202b1..c8bd528 100644 --- a/docs/modules/druid.blocker.html +++ b/docs/modules/druid.blocker.html @@ -62,11 +62,11 @@

Topics

@@ -234,7 +234,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.button.html b/docs/modules/druid.button.html index 9bc583a..6d560f4 100644 --- a/docs/modules/druid.button.html +++ b/docs/modules/druid.button.html @@ -62,11 +62,11 @@

Topics

@@ -405,7 +405,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.checkbox.html b/docs/modules/druid.checkbox.html index 950cbaa..8caabca 100644 --- a/docs/modules/druid.checkbox.html +++ b/docs/modules/druid.checkbox.html @@ -62,11 +62,11 @@

Topics

@@ -277,7 +277,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.checkbox_group.html b/docs/modules/druid.checkbox_group.html index 25b2c0e..da08531 100644 --- a/docs/modules/druid.checkbox_group.html +++ b/docs/modules/druid.checkbox_group.html @@ -62,11 +62,11 @@

Topics

@@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.grid.html b/docs/modules/druid.grid.html index 34b19ac..a094522 100644 --- a/docs/modules/druid.grid.html +++ b/docs/modules/druid.grid.html @@ -62,11 +62,11 @@

Topics

@@ -370,7 +370,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.helper.html b/docs/modules/druid.helper.html index 7e0d187..3134d44 100644 --- a/docs/modules/druid.helper.html +++ b/docs/modules/druid.helper.html @@ -61,11 +61,11 @@

Topics

@@ -236,7 +236,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.hover.html b/docs/modules/druid.hover.html index 3aacad3..d69f516 100644 --- a/docs/modules/druid.hover.html +++ b/docs/modules/druid.hover.html @@ -62,11 +62,11 @@

Topics

@@ -211,7 +211,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.html b/docs/modules/druid.html index 39e0d48..9129bfd 100644 --- a/docs/modules/druid.html +++ b/docs/modules/druid.html @@ -61,11 +61,11 @@

Topics

@@ -181,7 +181,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.input.html b/docs/modules/druid.input.html index 3db5add..db50406 100644 --- a/docs/modules/druid.input.html +++ b/docs/modules/druid.input.html @@ -57,11 +57,11 @@

Topics

@@ -86,7 +86,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.lang_text.html b/docs/modules/druid.lang_text.html index 7930f45..590e5a0 100644 --- a/docs/modules/druid.lang_text.html +++ b/docs/modules/druid.lang_text.html @@ -62,11 +62,11 @@

Topics

@@ -240,7 +240,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.progress.html b/docs/modules/druid.progress.html index b0750f0..afb9377 100644 --- a/docs/modules/druid.progress.html +++ b/docs/modules/druid.progress.html @@ -62,11 +62,11 @@

Topics

@@ -378,7 +378,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.radio_group.html b/docs/modules/druid.radio_group.html index d12b79e..266bc39 100644 --- a/docs/modules/druid.radio_group.html +++ b/docs/modules/druid.radio_group.html @@ -62,11 +62,11 @@

Topics

@@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.scroll.html b/docs/modules/druid.scroll.html index bcdbe27..e77c055 100644 --- a/docs/modules/druid.scroll.html +++ b/docs/modules/druid.scroll.html @@ -62,11 +62,11 @@

Topics

@@ -507,7 +507,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.slider.html b/docs/modules/druid.slider.html index 309e95b..93d3935 100644 --- a/docs/modules/druid.slider.html +++ b/docs/modules/druid.slider.html @@ -62,11 +62,11 @@

Topics

@@ -248,7 +248,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.text.html b/docs/modules/druid.text.html index 25ae2f4..7c5064a 100644 --- a/docs/modules/druid.text.html +++ b/docs/modules/druid.text.html @@ -62,11 +62,11 @@

Topics

@@ -352,7 +352,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid.timer.html b/docs/modules/druid.timer.html index a65a18c..eb6a6bd 100644 --- a/docs/modules/druid.timer.html +++ b/docs/modules/druid.timer.html @@ -62,11 +62,11 @@

Topics

@@ -307,7 +307,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid_event.html b/docs/modules/druid_event.html index 88500c8..da1e7f0 100644 --- a/docs/modules/druid_event.html +++ b/docs/modules/druid_event.html @@ -61,11 +61,11 @@

Topics

@@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/modules/druid_instance.html b/docs/modules/druid_instance.html index 6269911..f727193 100644 --- a/docs/modules/druid_instance.html +++ b/docs/modules/druid_instance.html @@ -61,11 +61,11 @@

Topics

@@ -750,7 +750,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs/topics/01-components.md.html b/docs/topics/01-components.md.html new file mode 100644 index 0000000..abbd860 --- /dev/null +++ b/docs/topics/01-components.md.html @@ -0,0 +1,162 @@ + + + + + Defold Druid UI Library + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Druid components

+ +

+

Button

+

Basic game button

+ +

+

Text

+

Wrap on text node with text size adjusting

+ +

+

Blocker

+

Block input in node zone

+ +

+

Back Handler

+

Handle back button (Android, backspace)

+ +

+

Locale

+

Text component with handle localization system

+ +

+

Timer

+

Run timer on text node

+ +

+

Progress

+

Basic progress bar

+ +

+

Scroll

+

Basic scroll component

+ +

+

Grid

+

Component for manage node positions

+ +

+

Slider

+

Basic slider component

+ +

+

Checkbox

+

Basic checkbox component

+ +

+

Checkbox group

+

Several checkboxes in one group

+ +

+

Radio group

+

Several checkboxes in one group with single choice

+ +

+

Hover

+

Trigger component for check node hover state

+ +

+

Input

+

Component to process user text input

+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2020-03-21 23:23:01 +
+
+ + diff --git a/docs/topics/02-creating_custom_components.md.html b/docs/topics/02-creating_custom_components.md.html new file mode 100644 index 0000000..17e7286 --- /dev/null +++ b/docs/topics/02-creating_custom_components.md.html @@ -0,0 +1,200 @@ + + + + + Defold Druid UI Library + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Creating custom components

+ +

+

Overview

+

Druid allows you to create your custom components from druid basic components or other custom components

+ + +

+

Custom components

+

Basic custom component template looks like this:

+ +
+local const = require("druid.const")
+local component = require("druid.component")
+
+local M = component.create("your_component")
+
+-- Component constructor
+function M.init(self, ...)
+end
+
+-- Call only if exist interest: const.ON_UPDATE
+function M.update(self, dt)
+end
+
+-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH
+function M.on_input(self, action_id, action)
+end
+
+-- Call only if exist interest: const.ON_MESSAGE
+function M.on_message(self, message_id, message, sender)
+end
+
+-- Call only if component with ON_CHANGE_LANGUAGE interest
+function M.on_change_language(self)
+end
+
+-- Call only if component with ON_LAYOUT_CHANGE interest
+function M.on_layout_change(self)
+end
+
+return M
+
+ + + +

Add your custom component to druid via druid.register

+ +
+local druid = require("druid.druid")
+local my_component = require("my.amazing.component")
+
+local function init(self)
+    druid.register("my_component", my_component)
+end
+
+ + +

Interest

+

Interest - is a way to indicate what events your component will respond to. +There is next interests in druid: +- ON_MESSAGE - component will receive messages from on_message

+ +
    +
  • ON_UPDATE - component will be updated from update

  • +
  • ONINPUTHIGH - component will receive input from oninput, before other components with ONINPUT

  • +
  • ON_INPUT - component will receive input from oninput, after other components with ONINPUT_HIGH

  • +
  • ONCHANGELANGUAGE - will call onchangelanguage function on language change trigger

  • +
  • ONLAYOUTCHANGED will call onlayoutchange function on layout change trigger

  • +
+ + +

+

Best practice on custom components

+

On each component recomended describe component scheme in next way:

+ + +
+-- Component module
+local component = require("druid.component")
+
+local M = component.create("your_component")
+
+local SCHEME = {
+    ROOT = "/root",
+    ITEM = "/item",
+    TITLE = "/title"
+}
+
+function M.init(self, template_name, node_table)
+    -- If component use template, setup it:
+ self:set_template(template_name)
+
+    -- If component was cloned with gui.clone_tree, pass his nodes
+ self:set_nodes(node_table)
+
+    -- helper can get node from gui/template/table
+ local root = self:get_node(SCHEME.ROOT)
+
+    -- This component can spawn another druid components:
+ local druid = self:get_druid()
+
+    -- Button self on callback is self of _this_ component
+ local button = druid:new_button(...)
+
+    -- helper can return you the component style for current component
+ -- It return by component name from
+ local my_style = self:get_style()
+end
+
+ + + +
+
+
+generated by LDoc 1.4.6 +Last updated 2020-03-21 23:23:01 +
+
+ + diff --git a/docs/topics/03-styles.md.html b/docs/topics/03-styles.md.html new file mode 100644 index 0000000..e8ad5fc --- /dev/null +++ b/docs/topics/03-styles.md.html @@ -0,0 +1,145 @@ + + + + + Defold Druid UI Library + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Styles

+ +

+

Overview

+

Styles - set of functions and parameters for components to customize their behavior.

+ +

Styles is a table, where key is name of component, and value is style table for this component.

+ +

In component API documentation, you can find the style API for this component. Or just lookup for existing styles and modify them.

+ +

+

Usage

+

Setup default druid style for all druid instances via druid.set_default_style

+ +
+local druid = require("druid.druid")
+local my_style = require("my.amazing.style")
+
+local function init(self)
+    druid.set_default_style(my_style)
+end
+
+ + +

Setup custom style to specific druid instance:

+ +
+local druid = require("druid.druid")
+local my_style = require("my.amazing.style")
+
+local function init(self)
+    -- This druid instance will be use my_style as default
+ self.druid = druid.new(self, my_style)
+end
+
+ + +

Change component style with setstyle_ function

+ +
+local druid = require("druid.druid")
+local my_style = require("my.amazing.style")
+
+local function init(self)
+    self.druid = druid.new(self)
+    self.button = self.druid:new_button(self, "node")
+    -- Setup custom style for specific component
+ self.button:set_style(my_style)
+end
+
+ + +

+

Create custom components

+

Styles is just lua table, so it can be described in just one single file +TODO

+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2020-03-21 23:23:01 +
+
+ + diff --git a/docs/topics/04-druid_assets.md.html b/docs/topics/04-druid_assets.md.html new file mode 100644 index 0000000..7e13f65 --- /dev/null +++ b/docs/topics/04-druid_assets.md.html @@ -0,0 +1,96 @@ + + + + + Defold Druid UI Library + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Druid assets

+ +

+

Overview

+

I've created druid-assets repository to make a marketplace with custom styles and components.

+ +

Any of druid users can push their own components and styles to share it with the other users

+ +

Also, this marketplace is great example to how you can create your custom components

+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2020-03-21 23:23:01 +
+
+ + diff --git a/docs/topics/05-examples.md.html b/docs/topics/05-examples.md.html new file mode 100644 index 0000000..96e1a7a --- /dev/null +++ b/docs/topics/05-examples.md.html @@ -0,0 +1,94 @@ + + + + + Defold Druid UI Library + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Examples

+ +

+

Overview

+

See the example folder for examples of how to use Druid

+ +

Try the HTML5 version of the example app

+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2020-03-21 23:23:01 +
+
+ + diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 8f1bc1d..7682aa5 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -46,11 +46,11 @@

Topics

Modules

@@ -234,7 +234,7 @@ https://insality.github.io/druid/

generated by LDoc 1.4.6 -Last updated 2020-03-21 22:59:46 +Last updated 2020-03-21 23:23:01
diff --git a/docs_md/components.md b/docs_md/01-components.md similarity index 100% rename from docs_md/components.md rename to docs_md/01-components.md diff --git a/docs_md/creating_custom_components.md b/docs_md/02-creating_custom_components.md similarity index 100% rename from docs_md/creating_custom_components.md rename to docs_md/02-creating_custom_components.md diff --git a/docs_md/styles.md b/docs_md/03-styles.md similarity index 100% rename from docs_md/styles.md rename to docs_md/03-styles.md diff --git a/docs_md/druid_assets.md b/docs_md/04-druid_assets.md similarity index 100% rename from docs_md/druid_assets.md rename to docs_md/04-druid_assets.md diff --git a/docs_md/examples.md b/docs_md/05-examples.md similarity index 100% rename from docs_md/examples.md rename to docs_md/05-examples.md
components.md01-components.md
creating_custom_components.md02-creating_custom_components.md
druid_assets.md03-styles.md
examples.md04-druid_assets.md
styles.md05-examples.md