From d650c2393b661fb57ba134374a6da447aa813d0c Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 22 Mar 2020 12:55:17 +0300 Subject: [PATCH] Update ldoc --- docs/index.html | 2 +- docs/modules/component.html | 2 +- docs/modules/druid.back_handler.html | 2 +- docs/modules/druid.blocker.html | 2 +- docs/modules/druid.button.html | 2 +- docs/modules/druid.checkbox.html | 2 +- docs/modules/druid.checkbox_group.html | 2 +- docs/modules/druid.grid.html | 2 +- docs/modules/druid.helper.html | 2 +- docs/modules/druid.hover.html | 2 +- docs/modules/druid.html | 2 +- docs/modules/druid.input.html | 2 +- docs/modules/druid.lang_text.html | 2 +- docs/modules/druid.progress.html | 2 +- docs/modules/druid.radio_group.html | 2 +- docs/modules/druid.scroll.html | 2 +- docs/modules/druid.slider.html | 2 +- docs/modules/druid.text.html | 2 +- docs/modules/druid.timer.html | 2 +- docs/modules/druid_event.html | 2 +- docs/modules/druid_instance.html | 2 +- docs/topics/01-components.md.html | 55 +++++++++- .../02-creating_custom_components.md.html | 21 +++- docs/topics/03-styles.md.html | 2 +- docs/topics/04-druid_assets.md.html | 2 +- docs/topics/05-examples.md.html | 2 +- docs/topics/README.md.html | 103 ++++++++++++++---- 27 files changed, 167 insertions(+), 60 deletions(-) diff --git a/docs/index.html b/docs/index.html index 0b8f119..7d3b373 100644 --- a/docs/index.html +++ b/docs/index.html @@ -185,7 +185,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/component.html b/docs/modules/component.html index f3a81e9..c703735 100644 --- a/docs/modules/component.html +++ b/docs/modules/component.html @@ -406,7 +406,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.back_handler.html b/docs/modules/druid.back_handler.html index eaa9c22..061853f 100644 --- a/docs/modules/druid.back_handler.html +++ b/docs/modules/druid.back_handler.html @@ -215,7 +215,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.blocker.html b/docs/modules/druid.blocker.html index d821b0d..bf2dcfb 100644 --- a/docs/modules/druid.blocker.html +++ b/docs/modules/druid.blocker.html @@ -234,7 +234,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.button.html b/docs/modules/druid.button.html index 33d7a61..9273823 100644 --- a/docs/modules/druid.button.html +++ b/docs/modules/druid.button.html @@ -405,7 +405,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.checkbox.html b/docs/modules/druid.checkbox.html index eb4d359..0d56299 100644 --- a/docs/modules/druid.checkbox.html +++ b/docs/modules/druid.checkbox.html @@ -277,7 +277,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.checkbox_group.html b/docs/modules/druid.checkbox_group.html index f546f95..1636a4b 100644 --- a/docs/modules/druid.checkbox_group.html +++ b/docs/modules/druid.checkbox_group.html @@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.grid.html b/docs/modules/druid.grid.html index 026b001..85fc6c0 100644 --- a/docs/modules/druid.grid.html +++ b/docs/modules/druid.grid.html @@ -370,7 +370,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.helper.html b/docs/modules/druid.helper.html index f89fcdb..d4f4125 100644 --- a/docs/modules/druid.helper.html +++ b/docs/modules/druid.helper.html @@ -236,7 +236,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.hover.html b/docs/modules/druid.hover.html index 7114a9a..39a0670 100644 --- a/docs/modules/druid.hover.html +++ b/docs/modules/druid.hover.html @@ -211,7 +211,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.html b/docs/modules/druid.html index e1661a0..b7c0412 100644 --- a/docs/modules/druid.html +++ b/docs/modules/druid.html @@ -181,7 +181,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.input.html b/docs/modules/druid.input.html index d44bd0b..7847d31 100644 --- a/docs/modules/druid.input.html +++ b/docs/modules/druid.input.html @@ -86,7 +86,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.lang_text.html b/docs/modules/druid.lang_text.html index 19324ec..79e417c 100644 --- a/docs/modules/druid.lang_text.html +++ b/docs/modules/druid.lang_text.html @@ -240,7 +240,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.progress.html b/docs/modules/druid.progress.html index 98444fd..30ecee2 100644 --- a/docs/modules/druid.progress.html +++ b/docs/modules/druid.progress.html @@ -378,7 +378,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.radio_group.html b/docs/modules/druid.radio_group.html index 7daa804..c0d19cf 100644 --- a/docs/modules/druid.radio_group.html +++ b/docs/modules/druid.radio_group.html @@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.scroll.html b/docs/modules/druid.scroll.html index 83bf1f9..8bf1938 100644 --- a/docs/modules/druid.scroll.html +++ b/docs/modules/druid.scroll.html @@ -507,7 +507,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.slider.html b/docs/modules/druid.slider.html index e1ee7ff..c2f9507 100644 --- a/docs/modules/druid.slider.html +++ b/docs/modules/druid.slider.html @@ -278,7 +278,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.text.html b/docs/modules/druid.text.html index 78ac2f2..3e5a60a 100644 --- a/docs/modules/druid.text.html +++ b/docs/modules/druid.text.html @@ -352,7 +352,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid.timer.html b/docs/modules/druid.timer.html index ce0ba1d..610f4d2 100644 --- a/docs/modules/druid.timer.html +++ b/docs/modules/druid.timer.html @@ -307,7 +307,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid_event.html b/docs/modules/druid_event.html index 2e568e6..dbcf349 100644 --- a/docs/modules/druid_event.html +++ b/docs/modules/druid_event.html @@ -239,7 +239,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/modules/druid_instance.html b/docs/modules/druid_instance.html index 9f5def3..73f99bf 100644 --- a/docs/modules/druid_instance.html +++ b/docs/modules/druid_instance.html @@ -750,7 +750,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/topics/01-components.md.html b/docs/topics/01-components.md.html index f0b9fbc..61c39ad 100644 --- a/docs/topics/01-components.md.html +++ b/docs/topics/01-components.md.html @@ -92,23 +92,66 @@

Button

-

Basic game button

+

Basic Druid input component

+ +

Text

-

Wrap on text node with text size adjusting

+

Basic Druid text component

+ +

Blocker

-

Block input in node zone

+

Druid component for block input

+ +

It can be used for block input in special zone.

+ +

Example: +

+ +

Blue zone is button with close_window callback

+ +

Yellow zone is blocker with window content

+ +

So you can do the safe zones, when you have the big buttons

Back Handler

-

Handle back button (Android, backspace)

+

Component to handle back button

+ +

It works on Android back button and Backspace. Key triggers in input.binding should be setup

Locale

-

Text component with handle localization system

+

Wrap on Druid text component to handle localization

Timer

@@ -155,7 +198,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
diff --git a/docs/topics/02-creating_custom_components.md.html b/docs/topics/02-creating_custom_components.md.html index ad82742..242991d 100644 --- a/docs/topics/02-creating_custom_components.md.html +++ b/docs/topics/02-creating_custom_components.md.html @@ -35,6 +35,7 @@
  • Overview
  • Custom components
  • Best practice on custom components
  • +
  • Power of using templates
  • @@ -80,18 +81,20 @@

    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")
    +local M = component.create("name_your_component")
     
     -- Component constructor
     function M.init(self, ...)
    @@ -150,7 +153,7 @@ There is next interests in druid:
     
     

    Best practice on custom components

    -

    On each component recomended describe component scheme in next way:

    +

    On each component recommended describe component scheme in next way:

    @@ -160,9 +163,9 @@ There is next interests in druid:
     local M = component.create("your_component")
     
     local SCHEME = {
    -    ROOT = "/root",
    -    ITEM = "/item",
    -    TITLE = "/title"
    +    ROOT = "root",
    +    ITEM = "item",
    +    TITLE = "title"
     }
     
     function M.init(self, template_name, node_table)
    @@ -189,11 +192,17 @@ There is next interests in druid:
     
     
     
    +

    +

    Power of using templates

    + +

    You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.

    + +
    generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
    diff --git a/docs/topics/03-styles.md.html b/docs/topics/03-styles.md.html index 2cda9d2..b4eb753 100644 --- a/docs/topics/03-styles.md.html +++ b/docs/topics/03-styles.md.html @@ -138,7 +138,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
    diff --git a/docs/topics/04-druid_assets.md.html b/docs/topics/04-druid_assets.md.html index d1b551b..f75ffee 100644 --- a/docs/topics/04-druid_assets.md.html +++ b/docs/topics/04-druid_assets.md.html @@ -89,7 +89,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
    diff --git a/docs/topics/05-examples.md.html b/docs/topics/05-examples.md.html index 5c7839a..b62e37b 100644 --- a/docs/topics/05-examples.md.html +++ b/docs/topics/05-examples.md.html @@ -87,7 +87,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11
    diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index bb9eeb2..78e9d71 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -34,7 +34,9 @@
    • Setup
    • Components
    • -
    • Creating components
    • +
    • Basic usage
    • +
    • Druid Events
    • +
    • Features
    • Examples
    • Documentation
    • Games powered by Druid
    • @@ -83,9 +85,7 @@

      -

      GitHub release (latest by date)

      - -

      Druid - powerful defold component UI library. Use basic druid components or make your own game-specific components to make amazing GUI in your games.

      +

      Druid - powerful defold component UI library. Use basic Druid components or make your own game-specific components to make amazing GUI in your games.

      @@ -93,7 +93,7 @@

      Dependency

      -

      You can use the druid extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

      +

      You can use the Druid extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

      https://github.com/Insality/druid/archive/master.zip

      @@ -101,18 +101,42 @@

      Or point to the ZIP file of a specific release.

      +

      Input bindings

      -

      Code

      +

      For Druid to work requires next input bindings:

      -

      Adjust druid settings, if needed:

      +
        +
      • Mouse trigger - Button 1 -> touch For basic input components
      • +
      • Key trigger - Backspace -> backspace For backhandler component_
      • +
      • Key trigger - Back -> text For backhandler component, Android back button_
      • +
      + +

      + + +

      Input capturing [optional]

      + +

      By default, Druid will auto-capture input focus, if any input component will be created. So you don't need to call msg.post(".", "acquire_input_focus)"

      + +

      If you not need this behaviour, you can disable it by settings druid.no_auto_input field in game.project:

      +
       [druid]
      + no_auto_input = 1
      +
      + + +

      Code [optional]

      + +

      Adjust Druid settings, if needed:

       local druid = require("druid.druid")
       
       -- Used for button component and custom components
      +-- Callback should play sound by name
       druid.set_sound_function(callback)
       
       -- Used for lang_text component
      +-- Callback should return localized string by locale id
       druid.set_text_function(callback)
       
       -- Used for change default druid style
      @@ -124,7 +148,7 @@
       

      Components

      -

      Druid provides next basic components: +

      Druid provides next basic components: - Button - Basic game button

        @@ -147,18 +171,26 @@

        Full info see on components.md

        -

        -

        Creating components

        +

        +

        Basic usage

        + +

        For using Druid, first you should create Druid instance to spawn components. Pass to new Druid instance main engine functions: update, *onmessage* and *oninput*

        + +

        All Druid components as arguments can apply node name string, you can don't do gui.get_node() before

        + +

        All Druid and component methods calling with : like self.druid:new_button()

        -

        Any components creating via druid:

         local druid = require("druid.druid")
         
        +local function button_callback(self)
        +    print("Button was clicked!")
        +end
        +
         local function init(self)
             self.druid = druid.new(self)
        -    local button = self.druid:new_button(node_name, callback)
        -    local text = self.druid:new_text(node_text_name)
        +    self.druid:new_button("button_node_name", button_callback)
         end
         
         function update(self, dt)
        @@ -170,16 +202,36 @@
         end
         
         function on_input(self, action_id, action)
        -    self.druid:on_input(action_id, action)
        +    return self.druid:on_input(action_id, action)
         end
         
        +

        +

        Druid Events

        + +

        Any Druid components as callbacks uses Druid Events. In component API (button example) pointed list of component events. You can manually subscribe on this events by next API:

        + +
          +
        • event:subscribe(callback)

        • +
        • event:unsubscribe(callback)

        • +
        • event:clear()

        • +
        + +

        Any events can handle several callbacks, if needed.

        + +

        +

        Features

        + +
          +
        • Druid input goes as stack. Last created button will checked first. So create your GUI from back
        • +
        • Don't forget about return in on_input: return self.druid:on_input(). It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
        • +

        Examples

        -

        See the example folder for examples of how to use Druid

        +

        See the example folder for examples of how to use Druid

        See the druid-assets repository for examples of how to create custom components and styles

        @@ -189,13 +241,13 @@

        Documentation

        -

        To learn druid better, read next documentation: -- Druid components -- Create custom components -- Druid asset store -- Druid Styles

        +

        To learn Druid better, read next documentation: +- Druid components +- Create custom components +- Druid styles +- Druid asset store

        -

        Full druid documentation you can find here: +

        Full Druid documentation you can find here: https://insality.github.io/druid/

        @@ -211,7 +263,8 @@ https://insality.github.io/druid/

        • Basic input component

        • Add onlayoutchange support (to keep gui data between layout change)

        • -
        • Add onchangelanguage support (call single function to update all druid instance)

        • +
        • Add onchangelanguage support (call single function to update all Druid instance)

        • +
        • Unit tests

        • Better documentation and examples

        • Add more comfortable gamepad support for GUI (ability to select button with DPAD and other stuff)

        @@ -224,19 +277,21 @@ https://insality.github.io/druid/

        Developed and supporting by Insality

        +

        Assets from Kenney

        +

        MIT License

        Issues and suggestions

        -

        If you have any issues, questions or suggestions please create an issue or contact me: insality@gmail.com +

        If you have any issues, questions or suggestions please create an issue or contact me: insality@gmail.com

        generated by LDoc 1.4.6 -Last updated 2020-03-22 02:23:51 +Last updated 2020-03-22 12:55:11