mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Update docs
This commit is contained in:
parent
7821c031dd
commit
d24107550a
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[](https://insality.github.io/druid/)
|
[](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.
|
**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:
|
For **Druid** to work requires next input bindings:
|
||||||
|
|
||||||
- Mouse trigger - `Button 1` -> `touch` _For basic input components_
|
- Mouse trigger - `Button 1` -> `touch` _For basic input components_
|
||||||
- Key trigger - `Backspace` -> `backspace` _For back_handler component_
|
- Key trigger - `Backspace` -> `back` _For back_handler component_
|
||||||
- Key trigger - `Back` -> `text` _For back_handler component, Android back button_
|
- Key trigger - `Back` -> `back` _For back_handler component, Android back button_
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -127,7 +128,7 @@ end
|
|||||||
|
|
||||||
## Druid Events
|
## 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)
|
- **event:subscribe**(callback)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# Druid components
|
# Druid components
|
||||||
|
|
||||||
|
|
||||||
@ -9,11 +10,12 @@ Basic Druid input component
|
|||||||
- **self** - Druid self context
|
- **self** - Druid self context
|
||||||
- **params** - Additional params, specified on button creating
|
- **params** - Additional params, specified on button creating
|
||||||
- **button_instance** - button itself
|
- **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:
|
- Button have next events:
|
||||||
- **on_click** - basic button callback
|
- **on_click** - basic button callback
|
||||||
- **on_repeated_click** - repeated click callback, while holding the button, don't trigger if callback is empty
|
- **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_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
|
- **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
|
- 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`
|
- 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
|
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_
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -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
|
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
|
## Lang text
|
||||||
Wrap on Text component to handle localization
|
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
|
## Scroll
|
||||||
Basic Druid scroll component
|
Basic Druid scroll component
|
||||||
@ -64,6 +69,7 @@ Basic Druid progress bar component
|
|||||||
|
|
||||||
## Slider
|
## Slider
|
||||||
Basic Druid slider component
|
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
|
## Input
|
||||||
Basic Druid text input component (unimplemented)
|
Basic Druid text input component (unimplemented)
|
||||||
|
@ -38,6 +38,11 @@ end
|
|||||||
function M.on_layout_change(self)
|
function M.on_layout_change(self)
|
||||||
end
|
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
|
return M
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user