# 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 Druid locale component will call this function to get translated text.
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 druid_instance:new_{name}. For example `druid:new_button(...)`

  ### Parameters:

  - name string module name
  - module table lua table with component
new(context[, style])
  Create Druid instance.

  ### Parameters:

  - context table Druid context. Usually it is self of script
  - style table Druid style module (optional)

  ### 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 set_text_funtion 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 on_focus_lost and on_focus_gain

  ### 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

generated by LDoc 1.4.6 Last updated 2022-02-12 17:16:44