Module druid
Druid UI Library.
Powerful Defold component based UI library. Use standart components or make your own game-specific components to make amazing GUI in your games.
Contains the several basic components and examples to how to do your custom complex components to separate UI game logic to small files
require("druid.druid") function init(self) self.druid = druid.new(self) end
Functions
register(name, module) | Register external druid component. |
new(context[, style]) | Create Druid instance. |
set_default_style(style) | Set new default style. |
set_text_function(callback) | Set text function. |
set_sound_function(callback) | Set sound function. |
on_window_callback(event) | Callback on global window event. |
on_layout_change() | Callback on global layout change event. |
on_language_change() | Callback on global language change event. |
Functions
- register(name, module)
-
Register external druid component.
After register you can create the component with
druidinstance:new{name}. For example
druid:new_button(...)
Parameters:
- new(context[, style])
-
Create Druid instance.
Parameters:
Returns:
-
druid_instance
Druid instance
- set_default_style(style)
-
Set new default style.
Parameters:
- style table Druid style module
- set_text_function(callback)
-
Set text function.
Druid locale component will call this function
to get translated text. After settextfuntion
all existing locale component will be updated
Parameters:
- callback function Get localized text function
- set_sound_function(callback)
-
Set sound function.
Component will call this function to
play sound by sound_id
Parameters:
- callback function Sound play callback
- on_window_callback(event)
-
Callback on global window event.
Used to trigger onfocuslost and onfocusgain
Parameters:
- event string Event param from window listener
- on_layout_change()
- Callback on global layout change event.
- on_language_change()
- Callback on global language change event. Use to update all lang texts