Update docs

This commit is contained in:
Insality 2020-03-28 16:48:30 +03:00
parent 7821c031dd
commit d24107550a
3 changed files with 17 additions and 5 deletions

View File

@ -1,5 +1,6 @@
[![](media/druid_logo.png)](https://insality.github.io/druid/)
**Druid** - powerful defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games.
@ -20,8 +21,8 @@ Or point to the ZIP file of a [specific release](https://github.com/Insality/dr
For **Druid** to work requires next input bindings:
- Mouse trigger - `Button 1` -> `touch` _For basic input components_
- Key trigger - `Backspace` -> `backspace` _For back_handler component_
- Key trigger - `Back` -> `text` _For back_handler component, Android back button_
- Key trigger - `Backspace` -> `back` _For back_handler component_
- Key trigger - `Back` -> `back` _For back_handler component, Android back button_
![](media/input_binding.png)
@ -127,7 +128,7 @@ end
## Druid Events
Any **Druid** components as callbacks uses Druid Events. In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe on this events by next API:
Any **Druid** components as callbacks uses [Druid Events](https://insality.github.io/druid/modules/druid_event.html). In component API ([button example](https://insality.github.io/druid/modules/druid.button.html#Events)) pointed list of component events. You can manually subscribe on this events by next API:
- **event:subscribe**(callback)

View File

@ -1,3 +1,4 @@
# Druid components
@ -9,11 +10,12 @@ Basic Druid input component
- **self** - Druid self context
- **params** - Additional params, specified on button creating
- **button_instance** - button itself
- You can set _params_ on button callback on button creating: `druid:new_button("node_name", callback, params)`. This _params_ will pass in callback as second argument
- Button have next events:
- **on_click** - basic button callback
- **on_repeated_click** - repeated click callback, while holding the button, don't trigger if callback is empty
- **on_long_click** - callback on long button tap, don't trigger if callback is empty
- **on_hold_callback** - hold callback, before long_click trigger, don't trigger if callback is empty
- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone
- Button can have key trigger to use then by key: `button:set_key_trigger`
@ -23,7 +25,7 @@ Basic Druid input component
Basic Druid text component
- Text component by default have auto adjust text sizing. Text never will be more, than text size, which you can setup in gui scene. It can be disabled on component creating
- Text component by default have auto adjust text sizing. Text never will be bigger, than text node size, which you can setup in GUI scene. It can be disabled on component creating by settings argument `is_no_adjust` to _true_
![](../media/text_autosize.png)
@ -53,8 +55,11 @@ Component to handle back button
It works on Android back button and Backspace. Key triggers in `input.binding` should be setup
Setup callback on back button with `druid:new_back_handler(callback)`
## Lang text
Wrap on Text component to handle localization
- This is text druid component, using druid get_text_function to set text by it's id
## Scroll
Basic Druid scroll component
@ -64,6 +69,7 @@ Basic Druid progress bar component
## Slider
Basic Druid slider component
- You can setup points of interests on slider via `slider:set_steps`. If steps are exist, slider values will be only from this steps (notched slider)
## Input
Basic Druid text input component (unimplemented)

View File

@ -38,6 +38,11 @@ end
function M.on_layout_change(self)
end
-- Call, if input was capturing before this component
-- Example: scroll is start scrolling, so you need unhover button
function M.on_input_interrupt(self)
end
return M
```