# Defold Druid UI Library

# 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

new(context[, style]) | Create Druid instance.
on_language_change() | Callback on global language change event.
on_window_callback(event) | Callback on global window event.
register(name, module) | Register external druid component.
set_default_style(style) | Set new default style.
set_sound_function(callback) | Set sound function.
set_text_function(callback) | Set text function Druid locale component will call this function to get translated text.

## Functions

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
on_language_change()
  Callback on global language change event. Use to update all lang texts
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
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
set_default_style(style)
  Set new default style.

  ### Parameters:

  - style table Druid style module
set_sound_function(callback)
  Set sound function. Component will call this function to play sound by sound_id

  ### Parameters:

  - callback function Sound play callback
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

generated by LDoc TESTING Last updated 2015-01-01 12:00:00