mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update documentation
This commit is contained in:
@@ -164,8 +164,17 @@ Pin node (node_name in params) should be placed in zero position (initial). It w
|
||||
Basic Druid text input component (unimplemented)
|
||||
|
||||
### Setup
|
||||
Create input component with druid: `input = druid:new_input(button_node_name, text_node_name, keyboard_type)`
|
||||
|
||||
### Notes
|
||||
- Input component handle user text input. Input contains from button and text components. Button needed for selecting/unselecting input field
|
||||
- Long click on input field for clear and select input field (clearing can be disable via styles)
|
||||
- Click outside of button to unselect input field
|
||||
- On focus lost (game minimized) input field will be unselected
|
||||
- You can setup max length of the text
|
||||
- You can setup allowed characters. On add not allowed characters `on_input_wrong` will be called. By default it cause simple shake animation
|
||||
- The keyboard for input will not show on mobile HTML5. So input field in mobile HTML5 is not working now
|
||||
- To make work different keyboard type, make sure value in game.project Android:InputMethod set to HidderInputField (https://defold.com/manuals/project-settings/#input-method)
|
||||
|
||||
|
||||
## Checkbox
|
||||
|
@@ -32,8 +32,8 @@ end
|
||||
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)
|
||||
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
||||
function M.on_language_change(self)
|
||||
end
|
||||
|
||||
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||
@@ -45,6 +45,14 @@ end
|
||||
function M.on_input_interrupt(self)
|
||||
end
|
||||
|
||||
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
|
||||
function M.on_focus_lost(self)
|
||||
end
|
||||
|
||||
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
|
||||
function M.on_focus_gained(self)
|
||||
end
|
||||
|
||||
-- Call on component remove or on druid:final
|
||||
function M.on_remove(self)
|
||||
end
|
||||
@@ -92,10 +100,13 @@ There is next interests in druid:
|
||||
|
||||
- **ON_INPUT** - component will receive input from on_input, after other components with ON_INPUT_HIGH
|
||||
|
||||
- **ON_CHANGE_LANGUAGE** - will call _on_change_language_ function on language change trigger
|
||||
- **ON_LANGUAGE_CHANGE** - will call _on_language_change_ function on language change trigger
|
||||
|
||||
- **ON_LAYOUT_CHANGED** will call _on_layout_change_ function on layout change trigger
|
||||
- **ON_LAYOUT_CHANGE** will call _on_layout_change_ function on layout change trigger
|
||||
|
||||
- **ON_FOCUS_LOST** will call _on_focust_lost_ function in on focus lost event. You need to pass window_callback to global `druid:on_window_callback`
|
||||
|
||||
- **ON_FOCUS_GAINED** will call _on_focust_gained_ function in on focus gained event. You need to pass window_callback to global `druid:on_window_callback`
|
||||
|
||||
## Best practice on custom components
|
||||
On each component recommended describe component scheme in next way:
|
||||
|
@@ -41,7 +41,3 @@ local function init(self)
|
||||
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__
|
||||
|
Reference in New Issue
Block a user