diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..fac221e0 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,206 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Documentation for Druid Framework

+ +

Modules

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BackHandlerComponent with event on back and backspace button.
BlockerComponent to consume input in special zone defined by GUI node.
ButtonDruid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.
DragComponent to handle drag action on node.
HoverComponent to handle hover node interaction
ScrollComponent to handle scroll content.
StaticGridComponent to handle component's position by row and columns.
TextComponent for Wrapping GUI Text Nodes: Druid Text +

## Overview ## +

Druid Text is a component that provides various adjustment modes for text nodes.

BaseComponentBasic class for all Druid components.
PinKnobDruid pin knob custom component.
RichInputDruid Rich Input custom component.
RichTextDruid Rich Text Custom Component.
DruidDruid UI Component Framework.
DruidEventDruid Event Module +

The Event module provides a simple class for handling callbacks.

CheckboxDruid checkbox component
CheckboxGroupCheckbox group module
DataListComponent to manage data for huge dataset in scroll.
DynamicGridComponent to handle placing components in row
HotkeyDruid hotkey component
InputDruid input text component.
LangTextComponent to wrap over GUI Text nodes with localization helpers +

# Overview # +

• The initialization of druid.set_text_function is required to enable localization + using the localization ID.

LayoutLayout management on node
ProgressDruid component to handle the progress bars.
RadioGroupRadio group module
SliderDruid slider component
SwipeComponent to handle swipe gestures on node.
TimerComponent to handle GUI timers.
HelperHelper module with various usefull GUI functions.
DruidInstanceDruid Instance which you use for component creation.
+ +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/ldoc_fixed.css b/docs/ldoc_fixed.css new file mode 100644 index 00000000..e63d1918 --- /dev/null +++ b/docs/ldoc_fixed.css @@ -0,0 +1,311 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #ffffff; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color:#FFFFFF; // #f0f0f0; + border-left: 1px solid #cccccc; +} + +#navigation { + position: fixed; + top: 0; + left: 0; + float: left; + width: 14em; + vertical-align: top; + background-color:#FFFFFF; // #f0f0f0; + border-right: 2px solid #cccccc; + overflow: visible; + overflow-y: scroll; + height: 100%; + padding-left: 1em; +} + +#navigation h2 { + background-color:#FFFFFF;//:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + padding-left: 2em; + width: 900px; + border-left: 2px solid #cccccc; + // border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding-left: 1em; + margin-left: 14em; // avoid the damn sidebar! + border-top: 2px solid #cccccc; + border-left: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; ; min-width: 200px; } +table.module_list td.summary { width: 100%; } + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f6f6ff; ; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +ul.nowrap { + overflow:auto; + whitespace:nowrap; +} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/docs/modules/BackHandler.html b/docs/modules/BackHandler.html new file mode 100644 index 00000000..50d2bc53 --- /dev/null +++ b/docs/modules/BackHandler.html @@ -0,0 +1,177 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module BackHandler

+

Component with event on back and backspace button.

+

+ # Overview # +

Back Handler is recommended to put in every game window to close it + or in main screen to call settings window. +

# Notes # +

• Back Handler inheritance BaseComponent, you can use all of its methods in addition to those described here. +

• Back Handler react on release action ACTION_BACK or ACTION_BACKSPACE

+

Usage:

+
    +
    local callback = function(self, params) ... end
    +
    +local params = {}
    +local back_handler = self.druid:new_back_handler(callback, [params])
    +
    +
+ + +

Fields

+ + + + + + + + + +
on_backThe DruidEvent Event on back handler action.
paramsCustom args to pass in the callback
+ +
+
+ + +

Fields

+ +
+
+ + on_back +
+
+ The DruidEvent Event on back handler action. +

Trigger on input action ACTION_BACK or ACTION_BACKSPACE + + +

+ + + + +

Usage:

+
    +
    -- Subscribe additional callbacks:
    +back_handler.on_back:subscribe(callback)
    +
+ +
+
+ + params +
+
+ Custom args to pass in the callback + + +
    +
  • params + any + + (optional) +
  • +
+ + + + +

Usage:

+
    +
    -- Replace params on runtime:
    +back_handler.params = { ... }
    +
+ +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/BaseComponent.html b/docs/modules/BaseComponent.html new file mode 100644 index 00000000..33f3032a --- /dev/null +++ b/docs/modules/BaseComponent.html @@ -0,0 +1,661 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module BaseComponent

+

Basic class for all Druid components.

+

+ To create you custom component, use static function `component.create`

+

Usage:

+
    +
    -- Create your component:
    +local component = require("druid.component")
    +
    +local AwesomeComponent = component.create("awesome_component")
    +
    +function AwesomeComponent:init(template, nodes)
    +    self:set_template(template)
    +    self:set_nodes(nodes)
    +    self.druid = self:get_druid()
    +end
    +
    +return AwesomeComponent
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
component:get_childrens(self)Return all children components, recursive
component:get_context(self)Context used as first arg in all Druid events
component:get_druid(self)Get Druid instance for inner component creation.
component:get_input_priority(self)Return component input priority
component:get_name(self)Return component name
component:get_node(self, node_or_name)Get component node by name.
component:get_parent_component(self)Return the parent component if exist
component:get_parent_name(self)Return parent component name
component:get_template(self)Get current component template name.
component:get_uid(self)Return component UID.
component:reset_input_priority(self)Reset component input priority to default value
component:set_input_enabled(self, state)Set component input state.
component:set_input_priority(self, value, is_temporary)Set component input priority
component:set_nodes(self, nodes)Set current component nodes.
component:set_style(self, druid_style)Set current component style table.
component:set_template(self, template)Set component template name.
+ +
+
+ + +

Functions

+ +
+
+ + component:get_childrens(self) +
+
+ Return all children components, recursive + + +

Parameters:

+ + +

Returns:

+
    + + table + Array of childrens if the Druid component instance +
+ + + + +
+
+ + component:get_context(self) +
+
+ Context used as first arg in all Druid events Context is usually self of gui_script. + + +

Parameters:

+ + +

Returns:

+
    + + table + BaseComponent context +
+ + + + +
+
+ + component:get_druid(self) +
+
+ Get Druid instance for inner component creation. + + +

Parameters:

+ + +

Returns:

+
    + + Druid + Druid instance with component context +
+ + + + +
+
+ + component:get_input_priority(self) +
+
+ Return component input priority + + +

Parameters:

+ + +

Returns:

+
    + + number + The component input priority +
+ + + + +
+
+ + component:get_name(self) +
+
+ Return component name + + +

Parameters:

+ + +

Returns:

+
    + + string + The component name +
+ + + + +
+
+ + component:get_node(self, node_or_name) +
+
+ Get component node by name. +

If component has nodes, node_or_name should be string + It autopick node by template name or from nodes by gui.clone_tree + if they was setup via component:set_nodes, component:set_template. + If node is not found, the exception will fired + + +

Parameters:

+
    +
  • self + BaseComponent + BaseComponent +
  • +
  • node_or_name + string or node + Node name or node itself +
  • +
+ +

Returns:

+
    + + node + Gui node +
+ + + + +
+
+ + component:get_parent_component(self) +
+
+ Return the parent component if exist + + +

Parameters:

+ + +

Returns:

+
    + + BaseComponent or nil + The druid component instance or nil +
+ + + + +
+
+ + component:get_parent_name(self) +
+
+ Return parent component name + + +

Parameters:

+ + +

Returns:

+
    + + string or nil + The parent component name if exist or bil +
+ + + + +
+
+ + component:get_template(self) +
+
+ Get current component template name. + + +

Parameters:

+ + +

Returns:

+
    + + string + Component full template name +
+ + + + +
+
+ + component:get_uid(self) +
+
+ Return component UID. +

UID generated in component creation order. + + +

Parameters:

+ + +

Returns:

+
    + + number + The component uid +
+ + + + +
+
+ + component:reset_input_priority(self) +
+
+ Reset component input priority to default value + + +

Parameters:

+ + +

Returns:

+
    + + number + The component input priority +
+ + + + +
+
+ + component:set_input_enabled(self, state) +
+
+ Set component input state. By default it enabled +

If input is disabled, the component will not receive input events + + +

Parameters:

+
    +
  • self + BaseComponent + BaseComponent +
  • +
  • state + bool + The component input state +
  • +
+ +

Returns:

+
    + + BaseComponent + BaseComponent itself +
+ + + + +
+
+ + component:set_input_priority(self, value, is_temporary) +
+
+ Set component input priority Default value: 10 + + +

Parameters:

+
    +
  • self + BaseComponent + BaseComponent +
  • +
  • value + number + The new input priority value +
  • +
  • is_temporary + boolean + If true, the reset input priority will return to previous value +
  • +
+ +

Returns:

+
    + + number + The component input priority +
+ + + + +
+
+ + component:set_nodes(self, nodes) +
+
+ Set current component nodes. + Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree. + + +

Parameters:

+
    +
  • self + BaseComponent + BaseComponent +
  • +
  • nodes + table + BaseComponent nodes table +
  • +
+ +

Returns:

+
    + + BaseComponent + BaseComponent +
+ + + +

Usage:

+
    +
    local nodes = gui.clone_tree(self.prefab)
    +... In your component:
    +self:set_nodes(nodes)
    +
+ +
+
+ + component:set_style(self, druid_style) +
+
+ Set current component style table. +

Invoke `on_style_change` on component, if exist. Component should handle + their style changing and store all style params + + +

Parameters:

+ + +

Returns:

+
    + + BaseComponent + BaseComponent +
+ + + + +
+
+ + component:set_template(self, template) +
+
+ Set component template name. +

Use on all your custom components with GUI layouts used as templates. + It will check parent template name to build full template name in self:get_node() + + +

Parameters:

+
    +
  • self + BaseComponent + BaseComponent +
  • +
  • template + string + BaseComponent template name +
  • +
+ +

Returns:

+
    + + BaseComponent + BaseComponent +
+ + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Blocker.html b/docs/modules/Blocker.html new file mode 100644 index 00000000..a27a4fcc --- /dev/null +++ b/docs/modules/Blocker.html @@ -0,0 +1,237 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Blocker

+

Component to consume input in special zone defined by GUI node.

+

+ # Overview # +

# Notes # +

Blocker consume input if `gui.pick_node` works on it. +

• Blocker inheritance BaseComponent, you can use all of its methods in addition to those described here. +

• Blocker initial enabled state is `gui.is_enabled(node, true)` +

• The Blocker node should be enabled to capture the input

+

Usage:

+
    +
    local node = gui.get_node("blocker_node")
    +local blocker = self.druid:new_blocker(node)
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + +
init(self, node)Blocker constructor
is_enabled(self)Return blocker enabled state
set_enabled(self, state)Set enabled blocker component state.
+

Fields

+ + + + + +
nodeBlocker node
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node) +
+
+ Blocker constructor + + +

Parameters:

+
    +
  • self + Blocker + Blocker +
  • +
  • node + node + Gui node +
  • +
+ + + + + +
+
+ + is_enabled(self) +
+
+ Return blocker enabled state + + +

Parameters:

+ + +

Returns:

+
    + + bool + True, if blocker is enabled +
+ + + + +
+
+ + set_enabled(self, state) +
+
+ Set enabled blocker component state. +

Don't change node enabled state itself. + + +

Parameters:

+
    +
  • self + Blocker + Blocker +
  • +
  • state + bool + Enabled state +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + node +
+
+ Blocker node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Button.html b/docs/modules/Button.html new file mode 100644 index 00000000..f4d6b1b8 --- /dev/null +++ b/docs/modules/Button.html @@ -0,0 +1,894 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Button

+

Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.

+

+

# Overview # +

This component provides a versatile solution for handling user click interactions. + It allows you to make any GUI node clickable and define various callbacks for different types of clicks. +

# Notes # +

• The click callback will not trigger if the cursor moves outside the node's + area between the pressed and released states. +

• If a button has a double click event subscriber and the double click event is triggered, + the regular click callback will not be triggered. +

• Buttons can be triggered using a keyboard key by calling the button:set_key_trigger method. +

• To animate a small icon on a big button panel, you can use an animation node. + The trigger node name should be set as "big panel," and the animation node should be set as "small icon." +

Example Link

+

Usage:

+
    +
    local function on_button_click(self, args, button)
    +    print("Button has clicked with params: " .. args)
    +    print("Also the button component is passed in callback params")
    +end
    +
    +local custom_args = "Any variable to pass inside callback"
    +local button = self.druid:new_button("button_name", on_button_click, custom_args)
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_key_trigger(self)Get current key name to trigger this button.
init(self, node, callback[, custom_args[, anim_node]])The Button constructor
is_enabled(self)Get button enabled state.
set_check_function(self[, check_function[, failure_callback]])Set function for additional check for button click availability
set_click_zone(self, zone)Set additional button click area.
set_enabled(self, state)Set button enabled state.
set_key_trigger(self, key)Set key name to trigger this button by keyboard.
set_web_user_interaction(self[, is_web_mode])Set Button mode to work inside user HTML5 interaction event.
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
anim_nodeButton animation node.
click_zoneAdditional button click area, defined by another GUI Node
hoverThe Hover: Button Hover component
nodeButton trigger node
node_idThe GUI node id from button node
on_clickThe DruidEvent: Event on successful release action over button.
on_click_outsideThe DruidEvent: Event calls if click event was outside of button.
on_double_clickThe DruidEvent: Event on double tap action over button.
on_hold_callbackThe DruidEvent: Event calls every frame before on_long_click event.
on_long_clickThe DruidEvent: Event on long tap action over button.
on_pressedThe DruidEvent: Event triggered if button was pressed by user.
on_repeated_clickThe DruidEvent: Event on repeated action over button.
paramsCustom args for any Button event.
+ +
+
+ + +

Functions

+ +
+
+ + get_key_trigger(self) +
+
+ Get current key name to trigger this button. + + +

Parameters:

+
    +
  • self + Button + +
  • +
+ +

Returns:

+
    + + hash + The action_id of the input key +
+ + + +

Usage:

+
    +
    local key_hash = button:get_key_trigger()
    +
+ +
+
+ + init(self, node, callback[, custom_args[, anim_node]]) +
+
+ The Button constructor + + +

Parameters:

+
    +
  • self + Button + Button +
  • +
  • node + string or Node + Node name or GUI Node itself +
  • +
  • callback + function + On click button callback +
  • +
  • custom_args + any + Button events custom arguments + (optional) +
  • +
  • anim_node + string or Node + Node to animate instead of trigger node. + (optional) +
  • +
+ + + + + +
+
+ + is_enabled(self) +
+
+ Get button enabled state. +

By default all Buttons is enabled on creating. + + +

Parameters:

+
    +
  • self + Button + Button +
  • +
+ +

Returns:

+
    + + bool + True, if button is enabled now, False overwise +
+ + + +

Usage:

+
    +
    local is_enabled = button:is_enabled()
    +
+ +
+
+ + set_check_function(self[, check_function[, failure_callback]]) +
+
+ Set function for additional check for button click availability + + +

Parameters:

+
    +
  • self + Button + +
  • +
  • check_function + function + Should return true or false. If true - button can be pressed. + (optional) +
  • +
  • failure_callback + function + Function will be called on button click, if check function return false + (optional) +
  • +
+ +

Returns:

+
    + + Button + Current button instance +
+ + + + +
+
+ + set_click_zone(self, zone) +
+
+ Set additional button click area. + Useful to restrict click outside out stencil node or scrollable content. +

This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check + + +

Parameters:

+
    +
  • self + Button + Button +
  • +
  • zone + node + Gui node +
  • +
+ +

Returns:

+
    + + Button + Current button instance +
+ + + +

Usage:

+
    +
    button:set_click_zone("stencil_node")
    +
+ +
+
+ + set_enabled(self, state) +
+
+ Set button enabled state. + The style.on_set_enabled will be triggered. + Disabled button is not clickable. + + +

Parameters:

+
    +
  • self + Button + Button +
  • +
  • state + bool + Enabled state +
  • +
+ +

Returns:

+
    + + Button + Current button instance +
+ + + +

Usage:

+
    +
    button:set_enabled(false)
    +button:set_enabled(true)
    +
+ +
+
+ + set_key_trigger(self, key) +
+
+ Set key name to trigger this button by keyboard. + + +

Parameters:

+
    +
  • self + Button + Button +
  • +
  • key + hash + The action_id of the input key +
  • +
+ +

Returns:

+
    + + Button + Current button instance +
+ + + +

Usage:

+
    +
    button:set_key_trigger("key_space")
    +
+ +
+
+ + set_web_user_interaction(self[, is_web_mode]) +
+
+ Set Button mode to work inside user HTML5 interaction event. +

It's required to make protected things like copy & paste text, show mobile keyboard, etc + The HTML5 button's doesn't call any events except on_click event. +

If the game is not HTML, html mode will be not enabled + + +

Parameters:

+
    +
  • self + Button + +
  • +
  • is_web_mode + boolean + If true - button will be called inside html5 callback + (optional) +
  • +
+ +

Returns:

+
    + + Button + Current button instance +
+ + + +

Usage:

+
    +
    button:set_web_user_interaction(true)
    +
+ +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in Druid styles table + or create your own style + + +

Fields:

+
    +
  • LONGTAP_TIME + number + Minimum time to trigger on_hold_callback + (default 0.4) +
  • +
  • AUTOHOLD_TRIGGER + number + Maximum hold time to trigger button release while holding + (default 0.8) +
  • +
  • DOUBLETAP_TIME + number + Time between double taps + (default 0.4) +
  • +
  • on_click + function + (self, node) +
  • +
  • on_click_disabled + function + (self, node) +
  • +
  • on_hover + function + (self, node, hover_state) +
  • +
  • on_mouse_hover + function + (self, node, hover_state) +
  • +
  • on_set_enabled + function + (self, node, enabled_state) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + anim_node +
+
+ Button animation node. + In default case equals to clickable node. +

Usecase: You have the big clickable panel, but want to animate only one small icon on it. + + +

    +
  • anim_node + node + + (default node) +
  • +
+ + + + + +
+
+ + click_zone +
+
+ Additional button click area, defined by another GUI Node + + +
    +
  • click_zone + node + + (optional) +
  • +
+ + + + + +
+
+ + hover +
+
+ The Hover: Button Hover component + + +
    +
  • hover + Hover + Hover +
  • +
+ + + + + +
+
+ + node +
+
+ Button trigger node + + +
    +
  • node + Node + +
  • +
+ + + + + +
+
+ + node_id +
+
+ The GUI node id from button node + + +
    +
  • node_id + hash + +
  • +
+ + + + + +
+
+ + on_click +
+
+ The DruidEvent: Event on successful release action over button. + + + + + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_click:subscribe(function(self, custom_args, button_instance)
    +    print("On button click!")
    +end)
    +
+ +
+
+ + on_click_outside +
+
+ The DruidEvent: Event calls if click event was outside of button. +

This event will be triggered for each button what was not clicked on user click action +

Usecase: Hide the popup when click outside + + +

    +
  • on_click_outside + DruidEvent + DruidEvent +
  • +
+ + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_click_outside:subscribe(function(self, custom_args, button_instance)
    +    print("On click Button outside!")
    +end)
    +
+ +
+
+ + on_double_click +
+
+ The DruidEvent: Event on double tap action over button. +

If secondary click was too fast after previous one, the double + click will be called instead usual click (if on_double_click subscriber exists) + + +

+ + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_double_click:subscribe(function(self, custom_args, button_instance, click_amount)
    +    print("On double Button click!")
    +end)
    +
+ +
+
+ + on_hold_callback +
+
+ The DruidEvent: Event calls every frame before on_long_click event. +

If long_click subscriber exists, the on_hold_callback will be called before long_click trigger. +

Usecase: Animate button progress of long tap + + +

    +
  • on_hold_callback + DruidEvent + DruidEvent +
  • +
+ + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_double_click:subscribe(function(self, custom_args, button_instance, time)
    +    print("On hold Button callback!")
    +end)
    +
+ +
+
+ + on_long_click +
+
+ The DruidEvent: Event on long tap action over button. +

This callback will be triggered if user pressed the button and hold the some amount of time. + The amount of time picked from button style param: LONGTAP_TIME + + +

+ + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_long_click:subscribe(function(self, custom_args, button_instance, hold_time)
    +    print("On long Button click!")
    +end)
    +
+ +
+
+ + on_pressed +
+
+ The DruidEvent: Event triggered if button was pressed by user. + + + + + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_pressed:subscribe(function(self, custom_args, button_instance)
    +    print("On Button pressed!")
    +end)
    +
+ +
+
+ + on_repeated_click +
+
+ The DruidEvent: Event on repeated action over button. +

This callback will be triggered if user hold the button. The repeat rate pick from `input.repeat_interval` in game.project + + +

    +
  • on_repeated_click + DruidEvent + DruidEvent +
  • +
+ + + + +

Usage:

+
    +
    -- Custom args passed in Button constructor
    +button.on_repeated_click:subscribe(function(self, custom_args, button_instance, click_count)
    +    print("On repeated Button click!")
    +end)
    +
+ +
+
+ + params +
+
+ Custom args for any Button event. Setup in Button constructor + + +
    +
  • params + any + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Checkbox.html b/docs/modules/Checkbox.html new file mode 100644 index 00000000..f58de1e8 --- /dev/null +++ b/docs/modules/Checkbox.html @@ -0,0 +1,354 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Checkbox

+

Druid checkbox component

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + +
get_state(self)Return checkbox state
init(self, node, callback[, click_node=node[, initial_state=false]])Component init function
set_state(self, state, is_silent, is_instant)Set checkbox state
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + +
buttonButton component from click_node
click_nodeButton trigger node
nodeVisual node
on_change_stateOn change state callback(self, state)
+ +
+
+ + +

Functions

+ +
+
+ + get_state(self) +
+
+ Return checkbox state + + +

Parameters:

+ + +

Returns:

+
    + + bool + Checkbox state +
+ + + + +
+
+ + init(self, node, callback[, click_node=node[, initial_state=false]]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Checkbox + Checkbox +
  • +
  • node + node + Gui node +
  • +
  • callback + function + Checkbox callback +
  • +
  • click_node + node + Trigger node, by default equals to node + (default node) +
  • +
  • initial_state + boolean + The initial state of checkbox, default - false + (default false) +
  • +
+ + + + + +
+
+ + set_state(self, state, is_silent, is_instant) +
+
+ Set checkbox state + + +

Parameters:

+
    +
  • self + Checkbox + Checkbox +
  • +
  • state + bool + Checkbox state +
  • +
  • is_silent + bool + Don't trigger on_change_state if true +
  • +
  • is_instant + bool + If instant checkbox change +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • on_change_state + function + (self, node, state) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + button +
+
+ Button component from click_node + + +
    +
  • button + Button + Button +
  • +
+ + + + + +
+
+ + click_node +
+
+ Button trigger node + + +
    +
  • click_node + node + + (default node) +
  • +
+ + + + + +
+
+ + node +
+
+ Visual node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_change_state +
+
+ On change state callback(self, state) + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/CheckboxGroup.html b/docs/modules/CheckboxGroup.html new file mode 100644 index 00000000..ad693a42 --- /dev/null +++ b/docs/modules/CheckboxGroup.html @@ -0,0 +1,261 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module CheckboxGroup

+

Checkbox group module

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + +
get_state(self)Return checkbox group state
init(self, nodes, callback[, click_nodes=node])Component init function
set_state(self, indexes, is_instant)Set checkbox group state
+

Fields

+ + + + + + + + + +
checkboxesArray of checkbox components
on_checkbox_clickOn any checkbox click callback(self, index)
+ +
+
+ + +

Functions

+ +
+
+ + get_state(self) +
+
+ Return checkbox group state + + +

Parameters:

+ + +

Returns:

+
    + + bool[] + Array if checkboxes state +
+ + + + +
+
+ + init(self, nodes, callback[, click_nodes=node]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + CheckboxGroup + CheckboxGroup +
  • +
  • nodes + node[] + Array of gui node +
  • +
  • callback + function + Checkbox callback +
  • +
  • click_nodes + node[] + Array of trigger nodes, by default equals to nodes + (default node) +
  • +
+ + + + + +
+
+ + set_state(self, indexes, is_instant) +
+
+ Set checkbox group state + + +

Parameters:

+
    +
  • self + CheckboxGroup + CheckboxGroup +
  • +
  • indexes + bool[] + Array of checkbox state +
  • +
  • is_instant + boolean + If instant state change +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + checkboxes +
+
+ Array of checkbox components + + + + + + + + +
+
+ + on_checkbox_click +
+
+ On any checkbox click callback(self, index) + + +
    +
  • on_checkbox_click + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/DataList.html b/docs/modules/DataList.html new file mode 100644 index 00000000..5fe39963 --- /dev/null +++ b/docs/modules/DataList.html @@ -0,0 +1,653 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module DataList

+

Component to manage data for huge dataset in scroll.

+

+ It requires Druid Scroll and Druid Grid (Static or Dynamic) components +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
clear(self)Clear the DataList and refresh visuals
get_created_components(self)Return all currenly created components in DataList
get_created_nodes(self)Return all currenly created nodes in DataList
get_data(self)Return current data from DataList component
get_first_index(self)Return first index from data.
get_index(self, data)Return index for data value
get_last_index(self)Return last index from data
get_length(self)Return amount of data
init(self, scroll, grid, create_function)Data list constructor
on_remove(self)Druid System on_remove function
scroll_to_index(self, index)Instant scroll to element with passed index
set_data(self, data)Set new data set for DataList component
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
gridThe Druid Grid component
last_indexThe current visual last data index
on_element_addOn DataList visual element created Event callback(self, index, node, instance)
on_element_removeOn DataList visual element created Event callback(self, index)
on_scroll_progress_changeEvent triggered when scroll progress is changed; event(self, progress_value)
scrollThe Druid scroll component
scroll_progressThe current progress of scroll posititon
top_indexThe current visual top data index
+ +
+
+ + +

Functions

+ +
+
+ + clear(self) +
+
+ Clear the DataList and refresh visuals + + +

Parameters:

+ + + + + + +
+
+ + get_created_components(self) +
+
+ Return all currenly created components in DataList + + +

Parameters:

+ + +

Returns:

+
    + + druid.base_component[] + List of created nodes +
+ + + + +
+
+ + get_created_nodes(self) +
+
+ Return all currenly created nodes in DataList + + +

Parameters:

+ + +

Returns:

+
    + + Node[] + List of created nodes +
+ + + + +
+
+ + get_data(self) +
+
+ Return current data from DataList component + + +

Parameters:

+ + +

Returns:

+
    + + table + The current data array +
+ + + + +
+
+ + get_first_index(self) +
+
+ Return first index from data. It not always equals to 1 + + +

Parameters:

+ + + + + + +
+
+ + get_index(self, data) +
+
+ Return index for data value + + +

Parameters:

+ + + + + + +
+
+ + get_last_index(self) +
+
+ Return last index from data + + +

Parameters:

+ + + + + + +
+
+ + get_length(self) +
+
+ Return amount of data + + +

Parameters:

+ + + + + + +
+
+ + init(self, scroll, grid, create_function) +
+
+ Data list constructor + + +

Parameters:

+
    +
  • self + DataList + DataList +
  • +
  • scroll + Scroll + The Scroll instance for Data List component +
  • +
  • grid + StaticGrid or DynamicGrid + The StaticGrid or DynamicGrid instance for Data List component +
  • +
  • create_function + function + The create function callback(self, data, index, data_list). Function should return (node, [component]) +
  • +
+ + + + + +
+
+ + on_remove(self) +
+
+ Druid System on_remove function + + +

Parameters:

+ + + + + + +
+
+ + scroll_to_index(self, index) +
+
+ Instant scroll to element with passed index + + +

Parameters:

+
    +
  • self + DataList + DataList +
  • +
  • index + number + +
  • +
+ + + + + +
+
+ + set_data(self, data) +
+
+ Set new data set for DataList component + + +

Parameters:

+
    +
  • self + DataList + DataList +
  • +
  • data + table + The new data array +
  • +
+ +

Returns:

+
    + + druid.data_list + Current DataList instance +
+ + + + +
+
+

Fields

+ +
+
+ + grid +
+
+ The Druid Grid component + + + + + + + + +
+
+ + last_index +
+
+ The current visual last data index + + +
    +
  • last_index + number + +
  • +
+ + + + + +
+
+ + on_element_add +
+
+ On DataList visual element created Event callback(self, index, node, instance) + + + + + + + + +
+
+ + on_element_remove +
+
+ On DataList visual element created Event callback(self, index) + + +
    +
  • on_element_remove + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + on_scroll_progress_change +
+
+ Event triggered when scroll progress is changed; event(self, progress_value) + + +
    +
  • on_scroll_progress_change + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + scroll +
+
+ The Druid scroll component + + +
    +
  • scroll + Scroll + Scroll +
  • +
+ + + + + +
+
+ + scroll_progress +
+
+ The current progress of scroll posititon + + +
    +
  • scroll_progress + number + +
  • +
+ + + + + +
+
+ + top_index +
+
+ The current visual top data index + + +
    +
  • top_index + number + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Drag.html b/docs/modules/Drag.html new file mode 100644 index 00000000..b6868c13 --- /dev/null +++ b/docs/modules/Drag.html @@ -0,0 +1,567 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Drag

+

Component to handle drag action on node.

+

+ Drag have correct handling for multitouch and swap + touched while dragging. Drag will be processed even + the cursor is outside of node, if drag is already started +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
init(self, node, on_drag_callback)Drag component constructor
is_enabled(self)Check if Drag component is enabled
set_click_zone(self, node)Strict drag click area.
set_enabled(self, is_enabled)Set Drag input enabled or disabled
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
can_xIs drag component process vertical dragging.
can_yIs drag component process horizontal.
is_dragIs component now dragging
is_touchIs component now touching
on_dragon drag progress callback(self, dx, dy, total_x, total_y)
on_drag_endEvent on drag end callback(self, total_x, total_y)
on_drag_startEvent on drag start callback(self)
on_touch_endEvent on touch end callback(self)
on_touch_startEvent on touch start callback(self)
touch_start_posTouch start position
xCurrent touch x position
yCurrent touch y position
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node, on_drag_callback) +
+
+ Drag component constructor + + +

Parameters:

+
    +
  • self + Drag + Drag +
  • +
  • node + node + GUI node to detect dragging +
  • +
  • on_drag_callback + function + Callback for on_drag_event(self, dx, dy) +
  • +
+ + + + + +
+
+ + is_enabled(self) +
+
+ Check if Drag component is enabled + + +

Parameters:

+
    +
  • self + Drag + Drag +
  • +
+ +

Returns:

+
    + + bool + +
+ + + + +
+
+ + set_click_zone(self, node) +
+
+ Strict drag click area. Useful for + restrict events outside stencil node + + +

Parameters:

+
    +
  • self + Drag + Drag +
  • +
  • node + node + Gui node +
  • +
+ + + + + +
+
+ + set_enabled(self, is_enabled) +
+
+ Set Drag input enabled or disabled + + +

Parameters:

+
    +
  • self + Drag + Drag +
  • +
  • is_enabled + bool + +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • DRAG_DEADZONE + number + Distance in pixels to start dragging + (default 10) +
  • +
  • NO_USE_SCREEN_KOEF + boolean + If screen aspect ratio affects on drag values + (default false) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + can_x +
+
+ Is drag component process vertical dragging. Default - true + + +
    +
  • can_x + bool + +
  • +
+ + + + + +
+
+ + can_y +
+
+ Is drag component process horizontal. Default - true + + +
    +
  • can_y + bool + +
  • +
+ + + + + +
+
+ + is_drag +
+
+ Is component now dragging + + +
    +
  • is_drag + bool + +
  • +
+ + + + + +
+
+ + is_touch +
+
+ Is component now touching + + +
    +
  • is_touch + bool + +
  • +
+ + + + + +
+
+ + on_drag +
+
+ on drag progress callback(self, dx, dy, total_x, total_y) + + + + + + + + +
+
+ + on_drag_end +
+
+ Event on drag end callback(self, total_x, total_y) + + + + + + + + +
+
+ + on_drag_start +
+
+ Event on drag start callback(self) + + + + + + + + +
+
+ + on_touch_end +
+
+ Event on touch end callback(self) + + + + + + + + +
+
+ + on_touch_start +
+
+ Event on touch start callback(self) + + + + + + + + +
+
+ + touch_start_pos +
+
+ Touch start position + + +
    +
  • touch_start_pos + vector3 + +
  • +
+ + + + + +
+
+ + x +
+
+ Current touch x position + + +
    +
  • x + number + +
  • +
+ + + + + +
+
+ + y +
+
+ Current touch y position + + +
    +
  • y + number + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Druid.html b/docs/modules/Druid.html new file mode 100644 index 00000000..0b5f5d62 --- /dev/null +++ b/docs/modules/Druid.html @@ -0,0 +1,379 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Druid

+

Druid UI Component Framework.

+

+ # Overview # +

Druid - powerful Defold component UI library. Use basic and extended + Druid components or make your own game-specific components to make + amazing GUI in your games. +

To start using Druid, please refer to the Usage section below. +

# Notes # +

• Each Druid instance maintains the self context from the constructor and passes it to each Druid callback. +

See next: DruidInstance +

+

Usage:

+
    +
    local druid = require("druid.druid")
    +
    +local function on_play(self)
    +    print("Gonna play!")
    +end
    +
    +function init(self)
    +    self.druid = druid.new(self)
    +    self.druid:new_button("button_play", on_play)
    +end
    +
    +function final(self)
    +    self.druid:final()
    +end
    +
    +function update(self, dt)
    +    self.druid:update(dt)
    +end
    +
    +function on_message(self, message_id, message, sender)
    +    self.druid:on_message(message_id, message, sender)
    +end
    +
    +function on_input(self, action_id, action)
    +    return self.druid:on_input(action_id, action)
    +end
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
druid.new(context[, style])Create a new Druid instance for creating GUI components.
druid.on_language_change()Call this function when the game language changes.
druid.on_window_callback(event)Set the window callback to enable on_focus_gain and on_focus_lost functions.
druid.register(name, module)Register a new external Druid component.
druid.set_default_style(style)Set your own default style for all Druid instances.
druid.set_sound_function(callback)Set the Druid sound function to play UI sounds if used.
druid.set_text_function(callback)Set the text function for the LangText component.
+ +
+
+ + +

Functions

+ +
+
+ + druid.new(context[, style]) +
+
+ Create a new Druid instance for creating GUI components. + + +

Parameters:

+
    +
  • context + table + The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks. +
  • +
  • style + table + The Druid style table to override style parameters for this Druid instance. + (optional) +
  • +
+ +

Returns:

+
    + + druid_instance + The Druid instance DruidInstance. +
+ + + +

Usage:

+
    +
    local druid = require("druid.druid")
    +
    +function init(self)
    +   self.druid = druid.new(self)
    +end
    +
+ +
+
+ + druid.on_language_change() +
+
+ Call this function when the game language changes. +

This function will translate all current LangText components. + + + + + + +

Usage:

+
    +
    druid.on_language_change()
    +
+ +
+
+ + druid.on_window_callback(event) +
+
+ Set the window callback to enable on_focus_gain and on_focus_lost functions. +

This is used to trigger the on_focus_lost and on_focus_gain functions in Druid components. + + +

Parameters:

+
    +
  • event + string + Event param from window listener +
  • +
+ + + + +

Usage:

+
    +
    window.set_listener(function(_, event)
    +   druid.on_window_callback(event)
    +end)
    +
+ +
+
+ + druid.register(name, module) +
+
+ Register a new external Druid component. +

You can register your own components to make new alias: the druid:new_{name} function. + For example, if you want to register a component called "my_component", you can create it using druid:new_my_component(...). + This can be useful if you have your own "basic" components that you don't want to re-create each time. + + +

Parameters:

+
    +
  • name + string + module name +
  • +
  • module + table + lua table with component +
  • +
+ + + + +

Usage:

+
    +
    local my_component = require("path.to.my.component")
    +druid.register("my_component", my_component)
    +...
    +local druid = druid.new(self)
    +local component_instance = self.druid:new_my_component(...)
    +
+ +
+
+ + druid.set_default_style(style) +
+
+ Set your own default style for all Druid instances. +

To create your own style file, copy the default style file and make changes to it. + Register the new style before creating your Druid instances. + + +

Parameters:

+
    +
  • style + table + Druid style module +
  • +
+ + + + +

Usage:

+
    +
    local my_style = require("path.to.my.style")
    +druid.set_default_style(my_style)
    +
+ +
+
+ + druid.set_sound_function(callback) +
+
+ Set the Druid sound function to play UI sounds if used. +

Set a function to play a sound given a sound_id. This function is used for button clicks to play the "click" sound. + It can also be used to play sounds in your custom components (see the default Druid style file for an example). + + +

Parameters:

+
    +
  • callback + function + Sound play callback +
  • +
+ + + + +

Usage:

+
    +
    druid.set_sound_function(function(sound_id)
    +    sound.play(sound_id) -- Replace with your real function
    +end)
    +
+ +
+
+ + druid.set_text_function(callback) +
+
+ Set the text function for the LangText component. +

The Druid locale component will call this function to get translated text. + After setting the text function, all existing locale components will be updated. + + +

Parameters:

+
    +
  • callback + function + Get localized text function +
  • +
+ + + + +

Usage:

+
    +
    druid.set_text_function(function(text_id)
    +   return lang_data[text_id] -- Replace with your real function
    +end)
    +
+ +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/DruidEvent.html b/docs/modules/DruidEvent.html new file mode 100644 index 00000000..d707bfea --- /dev/null +++ b/docs/modules/DruidEvent.html @@ -0,0 +1,326 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module DruidEvent

+

Druid Event Module +

The Event module provides a simple class for handling callbacks.

+

It is used in many Druid components. +

You can subscribe to an event using the `:subscribe` method and unsubscribe using the `:unsubscribe` method.

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
clear(self)Clear the all event handlers
initialize(self[, initial_callback])DruidEvent constructor
is_exist(self)Return true, if event have at lease one handler
subscribe(self, callback[, context])Subscribe callback on event
trigger(self, ...)Trigger the event and call all subscribed callbacks
unsubscribe(self, callback[, context])Unsubscribe callback on event
+ +
+
+ + +

Functions

+ +
+
+ + clear(self) +
+
+ Clear the all event handlers + + +

Parameters:

+ + + + + +

Usage:

+
    +
    button.on_long_click:clear()
    +
+ +
+
+ + initialize(self[, initial_callback]) +
+
+ DruidEvent constructor + + +

Parameters:

+
    +
  • self + DruidEvent + DruidEvent +
  • +
  • initial_callback + function + Subscribe the callback on new event, if callback exist + (optional) +
  • +
+ + + + +

Usage:

+
    +
    local Event = require("druid.event")
    +...
    +local event = Event(initial_callback)
    +
+ +
+
+ + is_exist(self) +
+
+ Return true, if event have at lease one handler + + +

Parameters:

+ + +

Returns:

+
    + + bool + True if event have handlers +
+ + + +

Usage:

+
    +
    local is_long_click_handler_exists = button.on_long_click:is_exist()
    +
+ +
+
+ + subscribe(self, callback[, context]) +
+
+ Subscribe callback on event + + +

Parameters:

+
    +
  • self + DruidEvent + DruidEvent +
  • +
  • callback + function + Callback itself +
  • +
  • context + Any + Additional context as first param to callback call, usually it's self + (optional) +
  • +
+ + + + +

Usage:

+
    +
    local function on_long_callback(self)
    +    print("Long click!")
    +end
    +...
    +local button = self.druid:new_button("button", callback)
    +button.on_long_click:subscribe(on_long_callback, self)
    +
+ +
+
+ + trigger(self, ...) +
+
+ Trigger the event and call all subscribed callbacks + + +

Parameters:

+
    +
  • self + DruidEvent + DruidEvent +
  • +
  • ... + Any + All event params +
  • +
+ + + + +

Usage:

+
    +
    local Event = require("druid.event")
    +...
    +local event = Event()
    +event:trigger("Param1", "Param2")
    +
+ +
+
+ + unsubscribe(self, callback[, context]) +
+
+ Unsubscribe callback on event + + +

Parameters:

+
    +
  • self + DruidEvent + DruidEvent +
  • +
  • callback + function + Callback itself +
  • +
  • context + Any + Additional context as first param to callback call + (optional) +
  • +
+ + + + +

Usage:

+
    +
    local function on_long_callback(self)
    +    print("Long click!")
    +end
    +...
    +button.on_long_click:unsubscribe(on_long_callback, self)
    +
+ +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/DruidInstance.html b/docs/modules/DruidInstance.html new file mode 100644 index 00000000..6c36eccc --- /dev/null +++ b/docs/modules/DruidInstance.html @@ -0,0 +1,1365 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module DruidInstance

+

Druid Instance which you use for component creation.

+

+

# Component List # +

For a list of all available components, please refer to the "See Also" section. +

# Notes # +

Please review the following API pages: +

Helper - A useful set of functions for working with GUI nodes, such as centering nodes, get GUI scale ratio, etc +

DruidEvent - The core event system in Druid. Learn how to subscribe to any event in every Druid component. +

BaseComponent - The parent class of all Druid components. You can find all default component methods there. +

# Tech Info # +

• To use Druid, you need to create a Druid instance first. This instance is used to spawn components. +

• When using Druid components, provide the node name as a string argument directly. Avoid calling gui.get_node() before passing it to the component. Because Druid can get nodes from template and cloned gui nodes. +

• All Druid and component methods are called using the colon operator (e.g., self.druid:new_button()).

+

See also:

+ +

Usage:

+
    +
    local druid = require("druid.druid")
    +
    +local function close_window(self)
    +    print("Yeah! You closed the game!")
    +end
    +
    +function init(self)
    +    self.druid = druid.new(self)
    +
    +    -- Call all druid instance function with ":" syntax:
    +    local text = self.druid:new_text("text_header", "Hello Druid!")
    +    local button = self.druid:new_button("button_close", close_window)
    +
    +    -- You not need to save component reference if not need it
    +    self.druid:new_back_handler(close_window)
    +end
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
final(self)Call this in gui_script final function.
new(self, component, ...)Create new component.
new_back_handler(self, callback[, params])Create BackHandler component
new_blocker(self, node)Create Blocker component
new_button(self, node, callback[, params[, anim_node]])Create Button component
new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])Create Checkbox component
new_checkbox_group(self, nodes, callback[, click_nodes=node])Create CheckboxGroup component
new_data_list(self, druid_scroll, druid_grid, create_function)Create DataList component
new_drag(self, node, on_drag_callback)Create Drag component
new_dynamic_grid(self, parent)Create DynamicGrid component
new_hotkey(self, keys_array, callback[, params])Create Hotkey component
new_hover(self, node, on_hover_callback)Create Hover component
new_input(self, click_node, text_node[, keyboard_type])Create Input component
new_lang_text(self, node, locale_id, no_adjust)Create LangText component
new_layout(self, node, mode)Create Layout component
new_progress(self, node, key[, init_value=1])Create Progress component
new_radio_group(self, nodes, callback[, click_nodes=node])Create RadioGroup component
new_rich_text(self[, template[, nodes]])Create RichText component.
new_scroll(self, view_node, content_node)Create Scroll component
new_slider(self, node, end_pos[, callback])Create Slider component
new_static_grid(self, parent, element[, in_row=1])Create StaticGrid component
new_swipe(self, node, on_swipe_callback)Create Swipe component
new_text(self, node[, value[, no_adjust]])Create Text component
new_timer(self, node, seconds_from[, seconds_to=0[, callback]])Create Timer component
on_input(self, action_id, action)Call this in gui_script on_input function.
on_message(self, message_id, message, sender)Call this in gui_script on_message function.
remove(self, component)Remove created component from Druid instance.
set_blacklist(self[, blacklist_components=nil])Set blacklist components for input processing.
set_whitelist(self[, whitelist_components=nil])Set whitelist components for input processing.
update(self, dt)Call this in gui_script update function.
+ +
+
+ + +

Functions

+ +
+
+ + final(self) +
+
+ Call this in gui_script final function. + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
+ + + + + +
+
+ + new(self, component, ...) +
+
+ Create new component. + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • component + Component + Component module +
  • +
  • ... + args + Other component params to pass it to component:init function +
  • +
+ + + + + +
+
+ + new_back_handler(self, callback[, params]) +
+
+ Create BackHandler component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • callback + callback + On back button +
  • +
  • params + any + Callback argument + (optional) +
  • +
+ +

Returns:

+
    + + BackHandler + BackHandler component +
+ + + + +
+
+ + new_blocker(self, node) +
+
+ Create Blocker component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui node +
  • +
+ +

Returns:

+
    + + Blocker + Blocker component +
+ + + + +
+
+ + new_button(self, node, callback[, params[, anim_node]]) +
+
+ Create Button component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + GUI node +
  • +
  • callback + function + Button callback +
  • +
  • params + table + Button callback params + (optional) +
  • +
  • anim_node + node + Button anim node (node, if not provided) + (optional) +
  • +
+ +

Returns:

+
    + + Button + Button component +
+ + + + +
+
+ + new_checkbox(self, node, callback[, click_node=node[, initial_state=false]]) +
+
+ Create Checkbox component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui node +
  • +
  • callback + function + Checkbox callback +
  • +
  • click_node + node + Trigger node, by default equals to node + (default node) +
  • +
  • initial_state + boolean + The initial state of checkbox, default - false + (default false) +
  • +
+ +

Returns:

+
    + + Checkbox + Checkbox component +
+ + + + +
+
+ + new_checkbox_group(self, nodes, callback[, click_nodes=node]) +
+
+ Create CheckboxGroup component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • nodes + node[] + Array of gui node +
  • +
  • callback + function + Checkbox callback +
  • +
  • click_nodes + node[] + Array of trigger nodes, by default equals to nodes + (default node) +
  • +
+ +

Returns:

+
    + + CheckboxGroup + CheckboxGroup component +
+ + + + +
+
+ + new_data_list(self, druid_scroll, druid_grid, create_function) +
+
+ Create DataList component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • druid_scroll + Scroll + The Scroll instance for Data List component +
  • +
  • druid_grid + Grid + The Grid instance for Data List component +
  • +
  • create_function + function + The create function callback(self, data, index, data_list). Function should return (node, [component]) +
  • +
+ +

Returns:

+
    + + DataList + DataList component +
+ + + + +
+
+ + new_drag(self, node, on_drag_callback) +
+
+ Create Drag component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + GUI node to detect dragging +
  • +
  • on_drag_callback + function + Callback for on_drag_event(self, dx, dy) +
  • +
+ +

Returns:

+
    + + Drag + Drag component +
+ + + + +
+
+ + new_dynamic_grid(self, parent) +
+
+ Create DynamicGrid component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • parent + node + The gui node parent, where items will be placed +
  • +
+ +

Returns:

+
    + + DynamicGrid + DynamicGrid component +
+ + + + +
+
+ + new_hotkey(self, keys_array, callback[, params]) +
+
+ Create Hotkey component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • keys_array + string or string[] + Keys for trigger action. Should contains one action key and any amount of modificator keys +
  • +
  • callback + function + Button callback +
  • +
  • params + value + Button callback params + (optional) +
  • +
+ +

Returns:

+
    + + Hotkey + Hotkey component +
+ + + + +
+
+ + new_hover(self, node, on_hover_callback) +
+
+ Create Hover component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui node +
  • +
  • on_hover_callback + function + Hover callback +
  • +
+ +

Returns:

+
    + + Hover + Hover component +
+ + + + +
+
+ + new_input(self, click_node, text_node[, keyboard_type]) +
+
+ Create Input component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • click_node + node + Button node to enabled input component +
  • +
  • text_node + node + Text node what will be changed on user input +
  • +
  • keyboard_type + number + Gui keyboard type for input field + (optional) +
  • +
+ +

Returns:

+
    + + Input + Input component +
+ + + + +
+
+ + new_lang_text(self, node, locale_id, no_adjust) +
+
+ Create LangText component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + The text node +
  • +
  • locale_id + string + Default locale id +
  • +
  • no_adjust + bool + If true, will not correct text size +
  • +
+ +

Returns:

+
    + + LangText + LangText component +
+ + + + +
+
+ + new_layout(self, node, mode) +
+
+ Create Layout component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + string or node + Layout node +
  • +
  • mode + string + The layout mode +
  • +
+ +

Returns:

+
    + + Layout + Layout component +
+ + + + +
+
+ + new_progress(self, node, key[, init_value=1]) +
+
+ Create Progress component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + string or node + Progress bar fill node or node name +
  • +
  • key + string + Progress bar direction: const.SIDE.X or const.SIDE.Y +
  • +
  • init_value + number + Initial value of progress bar + (default 1) +
  • +
+ +

Returns:

+
    + + Progress + Progress component +
+ + + + +
+
+ + new_radio_group(self, nodes, callback[, click_nodes=node]) +
+
+ Create RadioGroup component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • nodes + node[] + Array of gui node +
  • +
  • callback + function + Radio callback +
  • +
  • click_nodes + node[] + Array of trigger nodes, by default equals to nodes + (default node) +
  • +
+ +

Returns:

+
    + + RadioGroup + RadioGroup component +
+ + + + +
+
+ + new_rich_text(self[, template[, nodes]]) +
+
+ Create RichText component. + As a template please check rich_text.gui layout. + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • template + string + Template name if used + (optional) +
  • +
  • nodes + table + Nodes table from gui.clone_tree + (optional) +
  • +
+ +

Returns:

+
    + + RichText + RichText component +
+ + + + +
+
+ + new_scroll(self, view_node, content_node) +
+
+ Create Scroll component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • view_node + node + GUI view scroll node +
  • +
  • content_node + node + GUI content scroll node +
  • +
+ +

Returns:

+
    + + Scroll + Scroll component +
+ + + + +
+
+ + new_slider(self, node, end_pos[, callback]) +
+
+ Create Slider component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui pin node +
  • +
  • end_pos + vector3 + The end position of slider +
  • +
  • callback + function + On slider change callback + (optional) +
  • +
+ +

Returns:

+
    + + Slider + Slider component +
+ + + + +
+
+ + new_static_grid(self, parent, element[, in_row=1]) +
+
+ Create StaticGrid component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • parent + node + The gui node parent, where items will be placed +
  • +
  • element + node + Element prefab. Need to get it size +
  • +
  • in_row + number + How many nodes in row can be placed + (default 1) +
  • +
+ +

Returns:

+
    + + StaticGrid + StaticGrid component +
+ + + + +
+
+ + new_swipe(self, node, on_swipe_callback) +
+
+ Create Swipe component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui node +
  • +
  • on_swipe_callback + function + Swipe callback for on_swipe_end event +
  • +
+ +

Returns:

+
    + + Swipe + Swipe component +
+ + + + +
+
+ + new_text(self, node[, value[, no_adjust]]) +
+
+ Create Text component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui text node +
  • +
  • value + string + Initial text. Default value is node text from GUI scene. + (optional) +
  • +
  • no_adjust + bool + If true, text will be not auto-adjust size + (optional) +
  • +
+ +

Returns:

+
    + + Text + Text component +
+ + + + +
+
+ + new_timer(self, node, seconds_from[, seconds_to=0[, callback]]) +
+
+ Create Timer component + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • node + node + Gui text node +
  • +
  • seconds_from + number + Start timer value in seconds +
  • +
  • seconds_to + number + End timer value in seconds + (default 0) +
  • +
  • callback + function + Function on timer end + (optional) +
  • +
+ +

Returns:

+
    + + Timer + Timer component +
+ + + + +
+
+ + on_input(self, action_id, action) +
+
+ Call this in gui_script on_input function. +

Used for almost all components + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • action_id + hash + Action_id from on_input +
  • +
  • action + table + Action from on_input +
  • +
+ +

Returns:

+
    + + bool + The boolean value is input was consumed +
+ + + + +
+
+ + on_message(self, message_id, message, sender) +
+
+ Call this in gui_script on_message function. +

Used for special actions. See SPECIFIC_UI_MESSAGES table + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • message_id + hash + Message_id from on_message +
  • +
  • message + table + Message from on_message +
  • +
  • sender + hash + Sender from on_message +
  • +
+ + + + + +
+
+ + remove(self, component) +
+
+ Remove created component from Druid instance. +

Component `on_remove` function will be invoked, if exist. + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • component + Component + Component instance +
  • +
+ + + + + +
+
+ + set_blacklist(self[, blacklist_components=nil]) +
+
+ Set blacklist components for input processing. +

If blacklist is not empty and component contains in this list, + component will be not processed on input step + + +

Parameters:

+
    +
  • self + DruidInstance + DruidInstance +
  • +
  • blacklist_components + table or Component + The array of component to blacklist + (default nil) +
  • +
+ +

Returns:

+
    + + self + DruidInstance +
+ + + + +
+
+ + set_whitelist(self[, whitelist_components=nil]) +
+
+ Set whitelist components for input processing. +

If whitelist is not empty and component not contains in this list, + component will be not processed on input step + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • whitelist_components + table or Component + The array of component to whitelist + (default nil) +
  • +
+ +

Returns:

+
    + + self + DruidInstance +
+ + + + +
+
+ + update(self, dt) +
+
+ Call this in gui_script update function. +

Used for: scroll, progress, timer components + + +

Parameters:

+
    +
  • self + DruidInstance + +
  • +
  • dt + number + Delta time +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/DynamicGrid.html b/docs/modules/DynamicGrid.html new file mode 100644 index 00000000..67583d14 --- /dev/null +++ b/docs/modules/DynamicGrid.html @@ -0,0 +1,798 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module DynamicGrid

+

Component to handle placing components in row

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_get_side_vector(self, side, is_forward)Return side vector to correct node shifting
add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])Add new node to the grid
clear(self)Clear grid nodes array.
get_all_pos(self)Return array of all node positions
get_borders(self)Return grid content borders
get_index_by_node(self, node)Return grid index by node
get_offset(self)Return DynamicGrid offset, where DynamicGrid content starts.
get_pos(self, index, node[, origin_index])Return pos for grid node index
get_size(self, border)Return grid content size
init(self, parent)Component init function
remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])Remove the item from the grid.
set_position_function(self, callback)Change set position function for grid nodes.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
borderThe size of item content
first_indexThe first index of node in grid
last_indexThe last index of node in grid
node_sizeItem size
nodesList of all grid elements.
on_add_itemOn item add callback(self, node, index)
on_change_itemsOn item add or remove callback(self, index)
on_clearOn grid clear callback(self)
on_remove_itemOn item remove callback(self, index)
on_update_positionsOn update item positions callback(self)
parentParent gui node
+ +
+
+ + +

Functions

+ +
+
+ + _get_side_vector(self, side, is_forward) +
+
+ Return side vector to correct node shifting + + +

Parameters:

+
    +
  • self + +
  • +
  • side + +
  • +
  • is_forward + +
  • +
+ + + + + +
+
+ + add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]]) +
+
+ Add new node to the grid + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • node + node + Gui node +
  • +
  • index + number + The node position. By default add as last node + (optional) +
  • +
  • shift_policy + number + How shift nodes, if required. See const.SHIFT + (default SHIFT.RIGHT) +
  • +
  • is_instant + boolean + If true, update node positions instantly + (default false) +
  • +
+ + + + + +
+
+ + clear(self) +
+
+ Clear grid nodes array. GUI nodes will be not deleted! + If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear + + +

Parameters:

+ + +

Returns:

+
    + + druid.dynamic_grid + Current grid instance +
+ + + + +
+
+ + get_all_pos(self) +
+
+ Return array of all node positions + + +

Parameters:

+ + +

Returns:

+
    + + vector3[] + All grid node positions +
+ + + + +
+
+ + get_borders(self) +
+
+ Return grid content borders + + +

Parameters:

+ + +

Returns:

+
    + + vector3 + The grid content borders +
+ + + + +
+
+ + get_index_by_node(self, node) +
+
+ Return grid index by node + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • node + node + The gui node in the grid +
  • +
+ +

Returns:

+
    + + number + The node index +
+ + + + +
+
+ + get_offset(self) +
+
+ Return DynamicGrid offset, where DynamicGrid content starts. + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid The DynamicGrid instance +
  • +
+ +

Returns:

+
    + + vector3 + The DynamicGrid offset +
+ + + + +
+
+ + get_pos(self, index, node[, origin_index]) +
+
+ Return pos for grid node index + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • index + number + The grid element index +
  • +
  • node + node + The node to be placed +
  • +
  • origin_index + number + Index of nearby node + (optional) +
  • +
+ +

Returns:

+
    + + vector3 + Node position +
+ + + + +
+
+ + get_size(self, border) +
+
+ Return grid content size + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • border + vector3 + +
  • +
+ +

Returns:

+
    + + vector3 + The grid content size +
+ + + + +
+
+ + init(self, parent) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • parent + node + The gui node parent, where items will be placed +
  • +
+ + + + + +
+
+ + remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]) +
+
+ Remove the item from the grid. Note that gui node will be not deleted + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • index + number + The grid node index to remove +
  • +
  • shift_policy + number + How shift nodes, if required. See const.SHIFT + (default SHIFT.RIGHT) +
  • +
  • is_instant + boolean + If true, update node positions instantly + (default false) +
  • +
+ +

Returns:

+
    + + node + The deleted gui node from grid +
+ + + + +
+
+ + set_position_function(self, callback) +
+
+ Change set position function for grid nodes. It will call on + update poses on grid elements. Default: gui.set_position + + +

Parameters:

+
    +
  • self + DynamicGrid + DynamicGrid +
  • +
  • callback + function + Function on node set position +
  • +
+ +

Returns:

+
    + + druid.dynamic_grid + Current grid instance +
+ + + + +
+
+

Fields

+ +
+
+ + border +
+
+ The size of item content + + +
    +
  • border + vector4 + +
  • +
+ + + + + +
+
+ + first_index +
+
+ The first index of node in grid + + +
    +
  • first_index + number + +
  • +
+ + + + + +
+
+ + last_index +
+
+ The last index of node in grid + + +
    +
  • last_index + number + +
  • +
+ + + + + +
+
+ + node_size +
+
+ Item size + + +
    +
  • node_size + vector3 + +
  • +
+ + + + + +
+
+ + nodes +
+
+ List of all grid elements. Contains from node, pos, size, pivot + + +
    +
  • nodes + node[] + +
  • +
+ + + + + +
+
+ + on_add_item +
+
+ On item add callback(self, node, index) + + + + + + + + +
+
+ + on_change_items +
+
+ On item add or remove callback(self, index) + + + + + + + + +
+
+ + on_clear +
+
+ On grid clear callback(self) + + + + + + + + +
+
+ + on_remove_item +
+
+ On item remove callback(self, index) + + + + + + + + +
+
+ + on_update_positions +
+
+ On update item positions callback(self) + + +
    +
  • on_update_positions + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + parent +
+
+ Parent gui node + + +
    +
  • parent + node + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Helper.html b/docs/modules/Helper.html new file mode 100644 index 00000000..5887232d --- /dev/null +++ b/docs/modules/Helper.html @@ -0,0 +1,891 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Helper

+

Helper module with various usefull GUI functions.

+

+

Usage:

+
    +
    local helper = require("druid.helper")
    +helper.centrate_nodes(0, node_1, node_2)
    +
    +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
helper.add_array(target[, source])Add all elements from source array to the target array
helper.centrate_nodes([margin=0], ...)Centerate nodes by x position with margin.
helper.clamp(a, min, max)Clamp value between min and max
helper.contains(t, value)Check if value is in array and return index of it
helper.deepcopy(orig_table)Make a copy table with all nested tables
helper.distance(x1, y1, x2, y2)Calculate distance between two points
helper.get_border(node[, offset])Distance from node position to his borders
helper.get_closest_stencil_node(node)Return closest non inverted clipping parent node for given node
helper.get_gui_scale()Get current GUI scale for each side
helper.get_pivot_offset(pivot)Get node offset for given GUI pivot.
helper.get_scaled_size(node)Get node size adjusted by scale
helper.get_scene_scale(node, include_passed_node_scale)Get cumulative parent's node scale
helper.get_screen_aspect_koef()Get current screen stretch multiplier for each side
helper.get_text_metrics_from_node(text_node)Get text metric from GUI node.
helper.insert_with_shift(array, item[, index[, shift_policy]])Add value to array with shift policy
helper.is_mobile()Check if device is native mobile (Android or iOS)
helper.is_web()Check if device is HTML5
helper.lerp(a, b, t)Lerp between two values
helper.remove_with_shift(array[, index[, shift_policy]])Remove value from array with shift policy
helper.round(num[, num_decimal_places=0])Round number to specified decimal places
helper.sign(val)Return sign of value (-1, 0, 1)
helper.step(current, target, step)Move value from current to target value with step amount
helper.table_to_string(t)Simple table to one-line string converter
+ +
+
+ + +

Functions

+ +
+
+ + helper.add_array(target[, source]) +
+
+ Add all elements from source array to the target array + + +

Parameters:

+
    +
  • target + table + Array to put elements from source +
  • +
  • source + table + The source array to get elements from + (optional) +
  • +
+ +

Returns:

+
    + + array + The target array +
+ + + + +
+
+ + helper.centrate_nodes([margin=0], ...) +
+
+ Centerate nodes by x position with margin. +

This functions calculate total width of nodes and set position for each node. + The centrate will be around 0 x position. + + +

Parameters:

+
    +
  • margin + number + Offset between nodes + (default 0) +
  • +
  • ... + Gui nodes +
  • +
+ + + + + +
+
+ + helper.clamp(a, min, max) +
+
+ Clamp value between min and max + + +

Parameters:

+
    +
  • a + number + Value +
  • +
  • min + number + Min value +
  • +
  • max + number + Max value +
  • +
+ +

Returns:

+
    + + number + Clamped value +
+ + + + +
+
+ + helper.contains(t, value) +
+
+ Check if value is in array and return index of it + + +

Parameters:

+
    +
  • t + table + Array +
  • +
  • value + Value +
  • +
+ +

Returns:

+
    + + number or nil + Index of value or nil +
+ + + + +
+
+ + helper.deepcopy(orig_table) +
+
+ Make a copy table with all nested tables + + +

Parameters:

+
    +
  • orig_table + table + Original table +
  • +
+ +

Returns:

+
    + + table + Copy of original table +
+ + + + +
+
+ + helper.distance(x1, y1, x2, y2) +
+
+ Calculate distance between two points + + +

Parameters:

+
    +
  • x1 + number + First point x +
  • +
  • y1 + number + First point y +
  • +
  • x2 + number + Second point x +
  • +
  • y2 + number + Second point y +
  • +
+ +

Returns:

+
    + + number + Distance +
+ + + + +
+
+ + helper.get_border(node[, offset]) +
+
+ Distance from node position to his borders + + +

Parameters:

+
    +
  • node + node + GUI node +
  • +
  • offset + vector3 + Offset from node position. Pass current node position to get non relative border values + (optional) +
  • +
+ +

Returns:

+
    + + vector4 + Vector4 with border values (left, top, right, down) +
+ + + + +
+
+ + helper.get_closest_stencil_node(node) +
+
+ Return closest non inverted clipping parent node for given node + + +

Parameters:

+
    +
  • node + node + GUI node +
  • +
+ +

Returns:

+
    + + node or nil + The closest stencil node or nil +
+ + + + +
+
+ + helper.get_gui_scale() +
+
+ Get current GUI scale for each side + + + +

Returns:

+
    +
  1. + number + scale_x
  2. +
  3. + number + scale_y
  4. +
+ + + + +
+
+ + helper.get_pivot_offset(pivot) +
+
+ Get node offset for given GUI pivot. +

Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top. + + +

Parameters:

+
    +
  • pivot + gui.pivot + The node pivot +
  • +
+ +

Returns:

+
    + + vector3 + Vector offset with [-0.5..0.5] values +
+ + + + +
+
+ + helper.get_scaled_size(node) +
+
+ Get node size adjusted by scale + + +

Parameters:

+
    +
  • node + node + GUI node +
  • +
+ +

Returns:

+
    + + vector3 + Scaled size +
+ + + + +
+
+ + helper.get_scene_scale(node, include_passed_node_scale) +
+
+ Get cumulative parent's node scale + + +

Parameters:

+
    +
  • node + node + Gui node +
  • +
  • include_passed_node_scale + bool + True if add current node scale to result +
  • +
+ +

Returns:

+
    + + vector3 + The scene node scale +
+ + + + +
+
+ + helper.get_screen_aspect_koef() +
+
+ Get current screen stretch multiplier for each side + + + +

Returns:

+
    +
  1. + number + stretch_x
  2. +
  3. + number + stretch_y
  4. +
+ + + + +
+
+ + helper.get_text_metrics_from_node(text_node) +
+
+ Get text metric from GUI node. + + +

Parameters:

+
    +
  • text_node + Node + +
  • +
+ +

Returns:

+
    + + GUITextMetrics + +
+ + + +

Usage:

+
    +
    type GUITextMetrics = {
    +  width: number,
    +  height: number,
    +  max_ascent: number,
    +  max_descent: number
    +}
    +
+ +
+
+ + helper.insert_with_shift(array, item[, index[, shift_policy]]) +
+
+ Add value to array with shift policy Shift policy can be: left, right, no_shift + + +

Parameters:

+
    +
  • array + table + Array +
  • +
  • item + Item to insert +
  • +
  • index + number + Index to insert. If nil, item will be inserted at the end of array + (optional) +
  • +
  • shift_policy + const.SHIFT + Shift policy + (optional) +
  • +
+ +

Returns:

+
    + + item + Inserted item +
+ + + + +
+
+ + helper.is_mobile() +
+
+ Check if device is native mobile (Android or iOS) + + + +

Returns:

+
    + + bool + Is mobile +
+ + + + +
+
+ + helper.is_web() +
+
+ Check if device is HTML5 + + + +

Returns:

+
    + + bool + Is web +
+ + + + +
+
+ + helper.lerp(a, b, t) +
+
+ Lerp between two values + + +

Parameters:

+
    +
  • a + number + First value +
  • +
  • b + number + Second value +
  • +
  • t + number + Lerp amount +
  • +
+ +

Returns:

+
    + + number + Lerped value +
+ + + + +
+
+ + helper.remove_with_shift(array[, index[, shift_policy]]) +
+
+ Remove value from array with shift policy Shift policy can be: left, right, no_shift + + +

Parameters:

+
    +
  • array + table + Array +
  • +
  • index + number + Index to remove. If nil, item will be removed from the end of array + (optional) +
  • +
  • shift_policy + const.SHIFT + Shift policy + (optional) +
  • +
+ +

Returns:

+
    + + item + Removed item +
+ + + + +
+
+ + helper.round(num[, num_decimal_places=0]) +
+
+ Round number to specified decimal places + + +

Parameters:

+
    +
  • num + number + Number +
  • +
  • num_decimal_places + number + Decimal places + (default 0) +
  • +
+ +

Returns:

+
    + + number + Rounded number +
+ + + + +
+
+ + helper.sign(val) +
+
+ Return sign of value (-1, 0, 1) + + +

Parameters:

+
    +
  • val + number + Value +
  • +
+ +

Returns:

+
    + + number + Sign +
+ + + + +
+
+ + helper.step(current, target, step) +
+
+ Move value from current to target value with step amount + + +

Parameters:

+
    +
  • current + number + Current value +
  • +
  • target + number + Target value +
  • +
  • step + number + Step amount +
  • +
+ +

Returns:

+
    + + number + New value +
+ + + + +
+
+ + helper.table_to_string(t) +
+
+ Simple table to one-line string converter + + +

Parameters:

+ + +

Returns:

+
    + + string + +
+ + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Hotkey.html b/docs/modules/Hotkey.html new file mode 100644 index 00000000..f8a16114 --- /dev/null +++ b/docs/modules/Hotkey.html @@ -0,0 +1,315 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Hotkey

+

Druid hotkey component

+

Example Link

+ + +

Functions

+ + + + + + + + + +
add_hotkey(self, keys[, callback_argument])Add hotkey for component callback
init(self, keys, callback[, callback_argument])Component init function
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + +
buttonButton component from click_node
click_nodeButton trigger node
nodeVisual node
on_change_stateOn change state callback(self, state)
+ +
+
+ + +

Functions

+ +
+
+ + add_hotkey(self, keys[, callback_argument]) +
+
+ Add hotkey for component callback + + +

Parameters:

+
    +
  • self + Hotkey + Hotkey +
  • +
  • keys + string[], hash[], string or hash + that have to be pressed before key pressed to activate +
  • +
  • callback_argument + value + The argument to pass into the callback function + (optional) +
  • +
+ + + + + +
+
+ + init(self, keys, callback[, callback_argument]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Hotkey + Hotkey +
  • +
  • keys + string[] or string + The keys to be pressed for trigger callback. Should contains one key and any modificator keys +
  • +
  • callback + function + The callback function +
  • +
  • callback_argument + value + The argument to pass into the callback function + (optional) +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • MODIFICATORS + string[] + The list of action_id as hotkey modificators +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + button +
+
+ Button component from click_node + + +
    +
  • button + Button + Button +
  • +
+ + + + + +
+
+ + click_node +
+
+ Button trigger node + + +
    +
  • click_node + node + + (default node) +
  • +
+ + + + + +
+
+ + node +
+
+ Visual node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_change_state +
+
+ On change state callback(self, state) + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Hover.html b/docs/modules/Hover.html new file mode 100644 index 00000000..b4306b8d --- /dev/null +++ b/docs/modules/Hover.html @@ -0,0 +1,404 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Hover

+

Component to handle hover node interaction

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
init(self, node, on_hover_callback)Component init function
is_enabled(self)Return current hover enabled state
is_hovered(self)Return current hover state.
is_mouse_hovered(self)Return current hover state.
set_click_zone(self, zone)Strict hover click area.
set_enabled(self, state)Set enable state of hover component.
set_hover(self, state)Set hover state
set_mouse_hover(self, state)Set mouse hover state
+

Fields

+ + + + + + + + + +
on_hoverOn hover callback(self, state, hover_instance)
on_mouse_hoverOn mouse hover callback(self, state, hover_instance)
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node, on_hover_callback) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
  • node + node + Gui node +
  • +
  • on_hover_callback + function + Hover callback +
  • +
+ + + + + +
+
+ + is_enabled(self) +
+
+ Return current hover enabled state + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
+ +

Returns:

+
    + + bool + The hover enabled state +
+ + + + +
+
+ + is_hovered(self) +
+
+ Return current hover state. True if touch action was on the node at current time + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
+ +

Returns:

+
    + + bool + The current hovered state +
+ + + + +
+
+ + is_mouse_hovered(self) +
+
+ Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
+ +

Returns:

+
    + + bool + The current hovered state +
+ + + + +
+
+ + set_click_zone(self, zone) +
+
+ Strict hover click area. Useful for + no click events outside stencil node + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
  • zone + node + Gui node +
  • +
+ + + + + +
+
+ + set_enabled(self, state) +
+
+ Set enable state of hover component. + If hover is not enabled, it will not generate + any hover events + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
  • state + bool + The hover enabled state +
  • +
+ + + + + +
+
+ + set_hover(self, state) +
+
+ Set hover state + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
  • state + bool + The hover state +
  • +
+ + + + + +
+
+ + set_mouse_hover(self, state) +
+
+ Set mouse hover state + + +

Parameters:

+
    +
  • self + Hover + Hover +
  • +
  • state + bool + The mouse hover state +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + on_hover +
+
+ On hover callback(self, state, hover_instance) + + + + + + + + +
+
+ + on_mouse_hover +
+
+ On mouse hover callback(self, state, hover_instance) + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Input.html b/docs/modules/Input.html new file mode 100644 index 00000000..a213dc27 --- /dev/null +++ b/docs/modules/Input.html @@ -0,0 +1,744 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Input

+

Druid input text component.

+

+ Carry on user text input +

Example Link

+

Info:

+
    +
  • Author: Part of code from Britzl gooey input component
  • +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_text(self)Return current input field text
init(self, click_node, text_node[, keyboard_type])Component init function
reset_changes(self)Reset current input selection and return previous value
select(self)Select input field.
set_allowed_characters(self, characters)Set allowed charaters for input field.
set_max_length(self, max_length)Set maximum length for input field.
set_text(self, input_text)Set text for input field
unselect(self)Remove selection from input.
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
allowerd_charactersPattern matching for user input
buttonButton component
is_emptyIs current input is empty now
is_selectedIs current input selected now
keyboard_typeGui keyboard type for input field
max_lengthMax length for input text
on_input_emptyOn input field text change to empty string callback(self, input_text)
on_input_fullOn input field text change to max length string callback(self, input_text)
on_input_selectOn input field select callback(self, button_node)
on_input_textOn input field text change callback(self, input_text)
on_input_unselectOn input field unselect callback(self, input_text)
on_input_wrongOn trying user input with not allowed character callback(self, params, button_instance)
textText component
+ +
+
+ + +

Functions

+ +
+
+ + get_text(self) +
+
+ Return current input field text + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
+ +

Returns:

+
    + + string + The current input field text +
+ + + + +
+
+ + init(self, click_node, text_node[, keyboard_type]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
  • click_node + node + Node to enabled input component +
  • +
  • text_node + node or Text + Text node what will be changed on user input. You can pass text component instead of text node name Text +
  • +
  • keyboard_type + number + Gui keyboard type for input field + (optional) +
  • +
+ + + + + +
+
+ + reset_changes(self) +
+
+ Reset current input selection and return previous value + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
+ + + + + +
+
+ + select(self) +
+
+ Select input field. It will show the keyboard and trigger on_select events + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
+ + + + + +
+
+ + set_allowed_characters(self, characters) +
+
+ Set allowed charaters for input field. + See: https://defold.com/ref/stable/string/ + ex: [%a%d] for alpha and numeric + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
  • characters + string + Regulax exp. for validate user input +
  • +
+ +

Returns:

+
    + + druid.input + Current input instance +
+ + + + +
+
+ + set_max_length(self, max_length) +
+
+ Set maximum length for input field. + Pass nil to make input field unliminted (by default) + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
  • max_length + number + Maximum length for input text field +
  • +
+ +

Returns:

+
    + + druid.input + Current input instance +
+ + + + +
+
+ + set_text(self, input_text) +
+
+ Set text for input field + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
  • input_text + string + The string to apply for input field +
  • +
+ + + + + +
+
+ + unselect(self) +
+
+ Remove selection from input. It will hide the keyboard and trigger on_unselect events + + +

Parameters:

+
    +
  • self + Input + Input +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • IS_LONGTAP_ERASE + bool + Is long tap will erase current input data + (default false) +
  • +
  • MASK_DEFAULT_CHAR + string + Default character mask for password input + (default *) +
  • +
  • IS_UNSELECT_ON_RESELECT + bool + If true, call unselect on select selected input + (default false) +
  • +
  • NO_CONSUME_INPUT_WHILE_SELECTED + bool + If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) + (default false) +
  • +
  • on_select + function + (self, button_node) Callback on input field selecting +
  • +
  • on_unselect + function + (self, button_node) Callback on input field unselecting +
  • +
  • on_input_wrong + function + (self, button_node) Callback on wrong user input +
  • +
  • button_style + table + Custom button style for input node +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + allowerd_characters +
+
+ Pattern matching for user input + + +
    +
  • allowerd_characters + string + + (optional) +
  • +
+ + + + + +
+
+ + button +
+
+ Button component + + +
    +
  • button + Button + Button +
  • +
+ + + + + +
+
+ + is_empty +
+
+ Is current input is empty now + + +
    +
  • is_empty + bool + +
  • +
+ + + + + +
+
+ + is_selected +
+
+ Is current input selected now + + +
    +
  • is_selected + bool + +
  • +
+ + + + + +
+
+ + keyboard_type +
+
+ Gui keyboard type for input field + + +
    +
  • keyboard_type + number + +
  • +
+ + + + + +
+
+ + max_length +
+
+ Max length for input text + + +
    +
  • max_length + number + + (optional) +
  • +
+ + + + + +
+
+ + on_input_empty +
+
+ On input field text change to empty string callback(self, input_text) + + + + + + + + +
+
+ + on_input_full +
+
+ On input field text change to max length string callback(self, input_text) + + + + + + + + +
+
+ + on_input_select +
+
+ On input field select callback(self, button_node) + + + + + + + + +
+
+ + on_input_text +
+
+ On input field text change callback(self, input_text) + + + + + + + + +
+
+ + on_input_unselect +
+
+ On input field unselect callback(self, input_text) + + +
    +
  • on_input_unselect + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + on_input_wrong +
+
+ On trying user input with not allowed character callback(self, params, button_instance) + + + + + + + + +
+
+ + text +
+
+ Text component + + +
    +
  • text + Text + Text +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/LangText.html b/docs/modules/LangText.html new file mode 100644 index 00000000..c705e58f --- /dev/null +++ b/docs/modules/LangText.html @@ -0,0 +1,375 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module LangText

+

Component to wrap over GUI Text nodes with localization helpers +

# Overview # +

• The initialization of druid.set_text_function is required to enable localization + using the localization ID.

+

+

• The LangText component supports up to 7 string format parameters. + This limitation exists due to certain issues with using ... arguments. +

# Notes # +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])Format string with new text params on localized text
init(self, node, locale_id[, adjust_type=downscale])The LangText constructor
set_to(self, text)Setup raw text to lang_text component
translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])Translate the text by locale_id
+

Fields

+ + + + + + + + + +
on_changeOn change text callback
textThe text component
+ +
+
+ + +

Functions

+ +
+
+ + format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]]) +
+
+ Format string with new text params on localized text + + +

Parameters:

+
    +
  • self + LangText + LangText +
  • +
  • a + string + Optional param to string.format + (optional) +
  • +
  • b + string + Optional param to string.format + (optional) +
  • +
  • c + string + Optional param to string.format + (optional) +
  • +
  • d + string + Optional param to string.format + (optional) +
  • +
  • e + string + Optional param to string.format + (optional) +
  • +
  • f + string + Optional param to string.format + (optional) +
  • +
  • g + string + Optional param to string.format + (optional) +
  • +
+ +

Returns:

+
    + + LangText + Current instance +
+ + + + +
+
+ + init(self, node, locale_id[, adjust_type=downscale]) +
+
+ The LangText constructor + + +

Parameters:

+
    +
  • self + LangText + LangText +
  • +
  • node + string or node + Node name or GUI Text Node itself +
  • +
  • locale_id + string + Default locale id or text from node as default +
  • +
  • adjust_type + string + Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference + (default downscale) +
  • +
+ + + + + +
+
+ + set_to(self, text) +
+
+ Setup raw text to lang_text component + + +

Parameters:

+
    +
  • self + LangText + LangText +
  • +
  • text + string + Text for text node +
  • +
+ +

Returns:

+
    + + LangText + Current instance +
+ + + + +
+
+ + translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]]) +
+
+ Translate the text by locale_id + + +

Parameters:

+
    +
  • self + LangText + LangText +
  • +
  • locale_id + string + Locale id +
  • +
  • a + string + Optional param to string.format + (optional) +
  • +
  • b + string + Optional param to string.format + (optional) +
  • +
  • c + string + Optional param to string.format + (optional) +
  • +
  • d + string + Optional param to string.format + (optional) +
  • +
  • e + string + Optional param to string.format + (optional) +
  • +
  • f + string + Optional param to string.format + (optional) +
  • +
  • g + string + Optional param to string.format + (optional) +
  • +
+ +

Returns:

+
    + + LangText + Current instance +
+ + + + +
+
+

Fields

+ +
+
+ + on_change +
+
+ On change text callback + + + + + + + + +
+
+ + text +
+
+ The text component + + +
    +
  • text + Text + Text +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Layout.html b/docs/modules/Layout.html new file mode 100644 index 00000000..e154aa36 --- /dev/null +++ b/docs/modules/Layout.html @@ -0,0 +1,498 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Layout

+

Layout management on node

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fit_into_node(self[, node])Set node for layout node to fit inside it.
fit_into_size(self, target_size)Set size for layout node to fit inside it
fit_into_window(self)Set current size for layout node to fit inside it
init(self, node, mode[, on_size_changed_callback])Component init function
set_max_gui_upscale(self, max_gui_upscale)Set max gui upscale for FIT adjust mode (or side).
set_max_size(self, max_size)Set maximum size of layout node
set_min_size(self, min_size)Set minimal size of layout node
set_origin_position(self, new_origin_position)Set new origin position of layout node.
set_origin_size(self, new_origin_size)Set new origin size of layout node.
+

Fields

+ + + + + + + + + + + + + +
modeCurrent layout mode
nodeLayout node
on_size_changedOn window resize callback(self, new_size)
+ +
+
+ + +

Functions

+ +
+
+ + fit_into_node(self[, node]) +
+
+ Set node for layout node to fit inside it. Pass nil to reset + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • node + Node + + (optional) +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + fit_into_size(self, target_size) +
+
+ Set size for layout node to fit inside it + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • target_size + vector3 + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + fit_into_window(self) +
+
+ Set current size for layout node to fit inside it + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + init(self, node, mode[, on_size_changed_callback]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • node + node + Gui node +
  • +
  • mode + string + The layout mode (from const.LAYOUT_MODE) +
  • +
  • on_size_changed_callback + function + The callback on window resize + (optional) +
  • +
+ + + + + +
+
+ + set_max_gui_upscale(self, max_gui_upscale) +
+
+ Set max gui upscale for FIT adjust mode (or side). It happens on bigger render gui screen + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • max_gui_upscale + number + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + set_max_size(self, max_size) +
+
+ Set maximum size of layout node + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • max_size + vector3 + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + set_min_size(self, min_size) +
+
+ Set minimal size of layout node + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • min_size + vector3 + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + set_origin_position(self, new_origin_position) +
+
+ Set new origin position of layout node. You should apply this on node movement + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • new_origin_position + vector3 + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+ + set_origin_size(self, new_origin_size) +
+
+ Set new origin size of layout node. You should apply this on node manual size change + + +

Parameters:

+
    +
  • self + Layout + Layout +
  • +
  • new_origin_size + vector3 + +
  • +
+ +

Returns:

+
    + + Layout + Layout +
+ + + + +
+
+

Fields

+ +
+
+ + mode +
+
+ Current layout mode + + + + + + + + +
+
+ + node +
+
+ Layout node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_size_changed +
+
+ On window resize callback(self, new_size) + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/PinKnob.html b/docs/modules/PinKnob.html new file mode 100644 index 00000000..9b4a757f --- /dev/null +++ b/docs/modules/PinKnob.html @@ -0,0 +1,300 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module PinKnob

+

Druid pin knob custom component.

+

+ It's simple rotating input element

+ + +

Functions

+ + + + + + + + + + + + + +
init(self, callback, template, nodes)Component init function
set_angle(self, cur_value, min, max)Set current and min/max angles for component
set_friction(self[, value=1])Set current and min/max angles for component
+

Fields

+ + + + + + + + + + + + + +
druidThe component druid instance
is_dragIs currently under user control
nodeThe pin node
+ +
+
+ + +

Functions

+ +
+
+ + init(self, callback, template, nodes) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + PinKnob + PinKnob +
  • +
  • callback + function + Callback(self, value) on value changed +
  • +
  • template + string + The template string name +
  • +
  • nodes + table + Nodes table from gui.clone_tree +
  • +
+ + + + + +
+
+ + set_angle(self, cur_value, min, max) +
+
+ Set current and min/max angles for component + + +

Parameters:

+
    +
  • self + PinKnob + PinKnob +
  • +
  • cur_value + number + The new value for pin knob +
  • +
  • min + number + The minimum value for pin knob +
  • +
  • max + number + The maximum value for pin knob +
  • +
+ +

Returns:

+
    + + PinKnob + PinKnob +
+ + + + +
+
+ + set_friction(self[, value=1]) +
+
+ Set current and min/max angles for component + + +

Parameters:

+
    +
  • self + PinKnob + PinKnob +
  • +
  • value + number + The spin speed multiplier + (default 1) +
  • +
+ +

Returns:

+
    + + PinKnob + PinKnob +
+ + + + +
+
+

Fields

+ +
+
+ + druid +
+
+ The component druid instance + + + + + + + + +
+
+ + is_drag +
+
+ Is currently under user control + + +
    +
  • is_drag + bool + +
  • +
+ + + + + +
+
+ + node +
+
+ The pin node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Progress.html b/docs/modules/Progress.html new file mode 100644 index 00000000..089717cb --- /dev/null +++ b/docs/modules/Progress.html @@ -0,0 +1,577 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Progress

+

Druid component to handle the progress bars.

+

+ # Overview # +

# Notes # +

• Progress Node should be fully filled in your GUI scene node. It will be the progress maximum size +

• Progress correct working with Slice9 nodes, it trying to set size by _set_size_ first, if it is not possible, it set up sizing via _set_scale_ +

• Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene +

• If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles +

+ Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
empty(self)Empty a progress bar
fill(self)Fill a progress bar and stop progress animation
get(self)Return current progress bar value
init(self, node, key[, init_value=1])Progress constructor
set_max_size(self, max_size)Set progress bar max node size
set_steps(self, steps, callback)Set points on progress bar to fire the callback
set_to(self, to)Instant fill progress bar to value
to(self, to[, callback])Start animation of a progress bar
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
keyThe progress bar direction.
max_sizeMaximum size of progress bar
nodeProgress bar fill node
on_changeOn progress bar change callback(self, new_value)
scaleCurrent progress bar scale
sizeCurrent progress bar size
sliceProgress bar slice9 settings
+ +
+
+ + +

Functions

+ +
+
+ + empty(self) +
+
+ Empty a progress bar + + +

Parameters:

+ + + + + + +
+
+ + fill(self) +
+
+ Fill a progress bar and stop progress animation + + +

Parameters:

+ + + + + + +
+
+ + get(self) +
+
+ Return current progress bar value + + +

Parameters:

+ + + + + + +
+
+ + init(self, node, key[, init_value=1]) +
+
+ Progress constructor + + +

Parameters:

+
    +
  • self + Progress + Progress +
  • +
  • node + string or node + Node name or GUI Node itself. +
  • +
  • key + string + Progress bar direction: const.SIDE.X or const.SIDE.Y +
  • +
  • init_value + number + Initial value of progress bar + (default 1) +
  • +
+ + + + + +
+
+ + set_max_size(self, max_size) +
+
+ Set progress bar max node size + + +

Parameters:

+
    +
  • self + Progress + Progress +
  • +
  • max_size + vector3 + The new node maximum (full) size +
  • +
+ +

Returns:

+
    + + Progress + Progress +
+ + + + +
+
+ + set_steps(self, steps, callback) +
+
+ Set points on progress bar to fire the callback + + +

Parameters:

+
    +
  • self + Progress + Progress +
  • +
  • steps + number[] + Array of progress bar values +
  • +
  • callback + function + Callback on intersect step value +
  • +
+ + + + +

Usage:

+
    +
    progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
    +
+ +
+
+ + set_to(self, to) +
+
+ Instant fill progress bar to value + + +

Parameters:

+
    +
  • self + Progress + Progress +
  • +
  • to + number + Progress bar value, from 0 to 1 +
  • +
+ + + + + +
+
+ + to(self, to[, callback]) +
+
+ Start animation of a progress bar + + +

Parameters:

+
    +
  • self + Progress + Progress +
  • +
  • to + number + value between 0..1 +
  • +
  • callback + function + Callback on animation ends + (optional) +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • SPEED + number + Progress bas fill rate. More -> faster + (default 5) +
  • +
  • MIN_DELTA + number + Minimum step to fill progress bar + (default 0.005) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + key +
+
+ The progress bar direction. +

The values are: "x" or "y". (const.SIDE.X or const.SIDE.Y) + + +

+ + + + + +
+
+ + max_size +
+
+ Maximum size of progress bar + + +
    +
  • max_size + number + +
  • +
+ + + + + +
+
+ + node +
+
+ Progress bar fill node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_change +
+
+ On progress bar change callback(self, new_value) + + + + + + + + +
+
+ + scale +
+
+ Current progress bar scale + + +
    +
  • scale + vector3 + +
  • +
+ + + + + +
+
+ + size +
+
+ Current progress bar size + + +
    +
  • size + vector3 + +
  • +
+ + + + + +
+
+ + slice +
+
+ Progress bar slice9 settings + + +
    +
  • slice + vector4 + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/RadioGroup.html b/docs/modules/RadioGroup.html new file mode 100644 index 00000000..741e33f1 --- /dev/null +++ b/docs/modules/RadioGroup.html @@ -0,0 +1,261 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module RadioGroup

+

Radio group module

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + +
get_state(self)Return radio group state
init(self, nodes, callback[, click_nodes=node])Component init function
set_state(self, index, is_instant)Set radio group state
+

Fields

+ + + + + + + + + +
checkboxesArray of checkbox components
on_radio_clickOn any checkbox click
+ +
+
+ + +

Functions

+ +
+
+ + get_state(self) +
+
+ Return radio group state + + +

Parameters:

+ + +

Returns:

+
    + + number + Index in radio group +
+ + + + +
+
+ + init(self, nodes, callback[, click_nodes=node]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + RadioGroup + RadioGroup +
  • +
  • nodes + node[] + Array of gui node +
  • +
  • callback + function + Radio callback +
  • +
  • click_nodes + node[] + Array of trigger nodes, by default equals to nodes + (default node) +
  • +
+ + + + + +
+
+ + set_state(self, index, is_instant) +
+
+ Set radio group state + + +

Parameters:

+
    +
  • self + RadioGroup + RadioGroup +
  • +
  • index + number + Index in radio group +
  • +
  • is_instant + boolean + If is instant state change +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + checkboxes +
+
+ Array of checkbox components + + +
    +
  • checkboxes + Checkbox[] + +
  • +
+ + + + + +
+
+ + on_radio_click +
+
+ On any checkbox click + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/RichInput.html b/docs/modules/RichInput.html new file mode 100644 index 00000000..797c9d0b --- /dev/null +++ b/docs/modules/RichInput.html @@ -0,0 +1,270 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module RichInput

+

Druid Rich Input custom component.

+

+ It's wrapper on Input component with cursor and placeholder text

+ + +

Functions

+ + + + + + + + + +
init(self, template, nodes)Component init function
set_placeholder(self, placeholder_text)Set placeholder text
+

Fields

+ + + + + + + + + + + + + + + + + +
cursorOn input field text change to empty string callback(self, input_text)
druidThe component druid instance
inputOn input field text change callback(self, input_text)
placeholderOn input field text change to max length string callback(self, input_text)
+ +
+
+ + +

Functions

+ +
+
+ + init(self, template, nodes) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + RichInput + RichInput +
  • +
  • template + string + The template string name +
  • +
  • nodes + table + Nodes table from gui.clone_tree +
  • +
+ + + + + +
+
+ + set_placeholder(self, placeholder_text) +
+
+ Set placeholder text + + +

Parameters:

+
    +
  • self + RichInput + RichInput +
  • +
  • placeholder_text + string + The placeholder text +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + cursor +
+
+ On input field text change to empty string callback(self, input_text) + + +
    +
  • cursor + node + +
  • +
+ + + + + +
+
+ + druid +
+
+ The component druid instance + + + + + + + + +
+
+ + input +
+
+ On input field text change callback(self, input_text) + + +
    +
  • input + Input + Input +
  • +
+ + + + + +
+
+ + placeholder +
+
+ On input field text change to max length string callback(self, input_text) + + +
    +
  • placeholder + druid.text + Text +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/RichText.html b/docs/modules/RichText.html new file mode 100644 index 00000000..f53e5315 --- /dev/null +++ b/docs/modules/RichText.html @@ -0,0 +1,430 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module RichText

+

Druid Rich Text Custom Component.

+

+ # Overview # +

This custom component is inspired by defold-richtext by britzl. + It uses a similar syntax for tags but currently supports fewer tags. +

All parameters for the Rich Text component are adjusted in the GUI scene. +

This component uses GUI component template. (/druid/custom/rich_text/rich_text.gui). +

You able to customize it or make your own with the next node scructure: +

root +

- text_prefab +

- icon_prefab +

# Rich Text Setup # +

• Root node size: Set the maximum width and height of the text. +

• Root anchor: Define the alignment of the Rich Text inside the root node size area. +

• Text prefab: Configure all default text parameters for the text node. +

• Text prefab anchor: Set the anchor for each text node (adjust this only if animating text). +

• Icon prefab: Configure all default node parameters for the icon node. +

• Icon prefab anchor: Set the anchor for each icon node (adjust this only if animating the icon). +

# Notes # +

• Nested tags are supported +

Example Link

+

Usage:

+
    +
  • local RichText = require("druid.custom.rich_text.rich_text")
    +...
    +self.rich_text = self.druid:new(RichText, "rich_text")
    +self.rich_text:set_text("Hello, Druid Rich Text!")
    +
  • +
  • type druid.rich_text.word = {
    +  node: Node,
    +  relative_scale: number,
    +  color: vector4,
    +  position: vector3,
    +  offset: vector3,
    +  scale: vector3,
    +  size: vector3,
    +  metrics: druid.rich_text.metrics,
    +  pivot: Pivot,
    +  text: string,
    +  shadow: vector4,
    +  outline: vector4,
    +  font: string,
    +  image: druid.rich_text.image,
    +  default_animation: string,
    +  br: boolean,
    +  nobr: boolean,
    +}
    +
    +type druid.rich_text.word.image = {
    +  texture: string,
    +  anim: string,
    +  width: number,
    +  height: number,
    +}
    +
    +type druid.rich_text.lines_metrics = {
    +  text_width: number,
    +  text_height: number,
    +  lines: table<number, druid.rich_text.metrics>,
    +}
    +
    +type druid.rich_text.metrics = {
    +  width: number,
    +  height: number,
    +  offset_x: number|nil,
    +  offset_y: number|nil,
    +  node_size: vector3|nil @For images only,
    +}
    +
  • +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
clear()Clear all created words.
get_line_metric()Get current line metrics
get_words()Get all current words.
init(self, template, nodes)Rich Text component constructor
set_text(self, text)Set text for Rich Text
tagged(tag)Get all words, which has a passed tag.
+

Tables

+ + + + + +
styleComponent style params.
+ +
+
+ + +

Functions

+ +
+
+ + clear() +
+
+ Clear all created words. + + + + + + + +
+
+ + get_line_metric() +
+
+ Get current line metrics + + + +

Returns:

+
    + + druid.rich_text.lines_metrics + +
+ + + + +
+
+ + get_words() +
+
+ Get all current words. + + + +

Returns:

+
    + + table + druid.rich_text.word[] +
+ + + + +
+
+ + init(self, template, nodes) +
+
+ Rich Text component constructor + + +

Parameters:

+
    +
  • self + RichText + RichText +
  • +
  • template + string + The Rich Text template name +
  • +
  • nodes + table + The node table, if prefab was copied by gui.clone_tree() +
  • +
+ + + + + +
+
+ + set_text(self, text) +
+
+ Set text for Rich Text + + +

Parameters:

+
    +
  • self + RichText + RichText +
  • +
  • text + string + The text to set +
  • +
+ +

Returns:

+
    +
  1. + druid.rich_text.word[] + words
  2. +
  3. + druid.rich_text.lines_metrics + line_metrics
  4. +
+ + + +

Usage:

+
    +
    • color: Change text color
    +
    +<color=red>Foobar</color>
    +<color=1.0,0,0,1.0>Foobar</color>
    +<color=#ff0000>Foobar</color>
    +<color=#ff0000ff>Foobar</color>
    +
    +• shadow: Change text shadow
    +
    +<shadow=red>Foobar</shadow>
    +<shadow=1.0,0,0,1.0>Foobar</shadow>
    +<shadow=#ff0000>Foobar</shadow>
    +<shadow=#ff0000ff>Foobar</shadow>
    +
    +• outline: Change text shadow
    +
    +<outline=red>Foobar</outline>
    +<outline=1.0,0,0,1.0>Foobar</outline>
    +<outline=#ff0000>Foobar</outline>
    +<outline=#ff0000ff>Foobar</outline>
    +
    +• font: Change font
    +
    +<font=MyCoolFont>Foobar</font>
    +
    +• size: Change text size, relative to default size
    +
    +<size=2>Twice as large</size>
    +
    +• br: Insert a line break
    +
    +<br/>
    +
    +• nobr: Prevent the text from breaking
    +
    +Words <nobr>inside tag</nobr> won't break
    +
    +• img: Display image
    +
    +<img=texture:image/>
    +<img=texture:image,size/>
    +<img=texture:image,width,height/>
    +
+ +
+
+ + tagged(tag) +
+
+ Get all words, which has a passed tag. + + +

Parameters:

+ + +

Returns:

+
    + + druid.rich_text.word[] + words +
+ + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in Druid styles table + or create your own style + + +

Fields:

+
    +
  • COLORS + table + Rich Text color aliases + (default {}) +
  • +
  • ADJUST_STEPS + number + Amount steps of attemps text adjust by height + (default 20) +
  • +
  • ADJUST_SCALE_DELTA + number + Scale step on each height adjust step + (default 0.02) +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Scroll.html b/docs/modules/Scroll.html new file mode 100644 index 00000000..bcf92e03 --- /dev/null +++ b/docs/modules/Scroll.html @@ -0,0 +1,1120 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Scroll

+

Component to handle scroll content.

+

+ # Overview # +

The Scroll component is designed to handle scrollable content and consists of two nodes: the scroll parent and the scroll input. +

The scroll input represents the user input zone and remains static. +

The scroll parent is the movable part of the scroll and changes its position. +

The initial scroll size can be set by adjusting the size of the scroll parent. + If the size of the scroll parent is smaller than the scroll input size, scrolling is not available. +

# Notes # +

• By default, the scroll style includes inertia and extra size for a stretching effect. + These settings can be adjusted using the scroll style settings. + For more details, refer to the scroll style settings. +

• "Points of interest" can be set up for the scroll. + The scroll will always be centered on the closest point of interest. + This feature allows creating a slider without inertia and with points of interest on each scroll element. +

• The scroll content size can be adjusted using the scroll:set_size(node_size) method. + This method sets a new size for the _content node. +

• Inertial scrolling mode can be enabled or disabled using the scroll:set_inert(state) method. +

• The extra stretch size can be adjusted using the scroll:set_extra_stretch_size method. +

• Multitouch is required for scrolling. The scroll component correctly handles + touch ID swaps while dragging the scroll. +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bind_grid(self, grid)Bind the grid component (Static or Dynamic) to recalculate + scroll size on grid changes
get_percent(self)Return current scroll progress status.
get_scroll_size(self)Return vector of scroll size with width and height.
init(self, view_node, content_node)Scroll constructor
is_inert(self)Return if scroll have inertion.
is_node_in_view(self, node)Check node if it visible now on scroll.
scroll_to(self, point[, is_instant])Start scroll to target point.
scroll_to_index(self, index[, skip_cb])Scroll to item in scroll by point index.
scroll_to_percent(self, percent[, is_instant])Start scroll to target scroll percent
set_click_zone(self, node)Strict drag scroll area.
set_extra_stretch_size(self[, stretch_size=0])Set extra size for scroll stretching.
set_horizontal_scroll(self, state)Lock or unlock horizontal scroll
set_inert(self, state)Enable or disable scroll inert.
set_points(self, points)Set points of interest.
set_size(self, size, offset)Set scroll content size.
set_vertical_scroll(self, state)Lock or unlock vertical scroll
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
available_posAvailable position for content node: (min_x, max_y, max_x, min_y)
available_sizeSize of available positions: (width, height, 0)
content_nodeScroll content node
dragDrag Druid component
inertionCurrent inert speed
is_animateFlag, if scroll now animating by gui.animate
is_inertFlag, if scroll now moving by inertion
on_point_scrollOn scroll_to_index function callback(self, index, point)
on_scrollOn scroll move callback(self, position)
on_scroll_toOn scroll_to function callback(self, target, is_instant)
positionCurrent scroll posisition
selectedCurrent index of points of interests
target_positionCurrent scroll target position
view_nodeScroll view node
+ +
+
+ + +

Functions

+ +
+
+ + bind_grid(self, grid) +
+
+ Bind the grid component (Static or Dynamic) to recalculate + scroll size on grid changes + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • grid + StaticGrid or DynamicGrid + Druid grid component +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + get_percent(self) +
+
+ Return current scroll progress status. + Values will be in [0..1] interval + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
+ +

Returns:

+
    + + vector3 + New vector with scroll progress values +
+ + + + +
+
+ + get_scroll_size(self) +
+
+ Return vector of scroll size with width and height. + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
+ +

Returns:

+
    + + vector3 + Available scroll size +
+ + + + +
+
+ + init(self, view_node, content_node) +
+
+ Scroll constructor + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • view_node + string or node + GUI view scroll node +
  • +
  • content_node + string or node + GUI content scroll node +
  • +
+ + + + + +
+
+ + is_inert(self) +
+
+ Return if scroll have inertion. + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
+ +

Returns:

+
    + + bool + If scroll have inertion +
+ + + + +
+
+ + is_node_in_view(self, node) +
+
+ Check node if it visible now on scroll. + Extra border is not affected. Return true for elements in extra scroll zone + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • node + node + The node to check +
  • +
+ +

Returns:

+
    + + boolean + True if node in visible scroll area +
+ + + + +
+
+ + scroll_to(self, point[, is_instant]) +
+
+ Start scroll to target point. + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • point + vector3 + Target point +
  • +
  • is_instant + bool + Instant scroll flag + (optional) +
  • +
+ + + + +

Usage:

+
    +
  • scroll:scroll_to(vmath.vector3(0, 50, 0))
  • +
  • scroll:scroll_to(vmath.vector3(0), true)
  • +
+ +
+
+ + scroll_to_index(self, index[, skip_cb]) +
+
+ Scroll to item in scroll by point index. + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • index + number + Point index +
  • +
  • skip_cb + bool + If true, skip the point callback + (optional) +
  • +
+ + + + + +
+
+ + scroll_to_percent(self, percent[, is_instant]) +
+
+ Start scroll to target scroll percent + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • percent + vector3 + target percent +
  • +
  • is_instant + bool + instant scroll flag + (optional) +
  • +
+ + + + +

Usage:

+
    +
    scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
    +
+ +
+
+ + set_click_zone(self, node) +
+
+ Strict drag scroll area. Useful for + restrict events outside stencil node + + +

Parameters:

+
    +
  • self + Drag + +
  • +
  • node + node + Gui node +
  • +
+ + + + + +
+
+ + set_extra_stretch_size(self[, stretch_size=0]) +
+
+ Set extra size for scroll stretching. + Set 0 to disable stretching effect + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • stretch_size + number + Size in pixels of additional scroll area + (default 0) +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + set_horizontal_scroll(self, state) +
+
+ Lock or unlock horizontal scroll + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • state + bool + True, if horizontal scroll is enabled +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + set_inert(self, state) +
+
+ Enable or disable scroll inert. + If disabled, scroll through points (if exist) + If no points, just simple drag without inertion + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • state + bool + Inert scroll state +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + set_points(self, points) +
+
+ Set points of interest. + Scroll will always centered on closer points + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • points + table + Array of vector3 points +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + set_size(self, size, offset) +
+
+ Set scroll content size. + It will change content gui node size + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • size + vector3 + The new size for content node +
  • +
  • offset + vector3 + Offset value to set, where content is starts +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+ + set_vertical_scroll(self, state) +
+
+ Lock or unlock vertical scroll + + +

Parameters:

+
    +
  • self + Scroll + Scroll +
  • +
  • state + bool + True, if vertical scroll is enabled +
  • +
+ +

Returns:

+
    + + druid.scroll + Current scroll instance +
+ + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • FRICT + number + Multiplier for free inertion + (default 0) +
  • +
  • FRICT_HOLD + number + Multiplier for inertion, while touching + (default 0) +
  • +
  • INERT_THRESHOLD + number + Scroll speed to stop inertion + (default 3) +
  • +
  • INERT_SPEED + number + Multiplier for inertion speed + (default 30) +
  • +
  • POINTS_DEADZONE + number + Speed to check points of interests in no_inertion mode + (default 20) +
  • +
  • BACK_SPEED + number + Scroll back returning lerp speed + (default 0.35) +
  • +
  • ANIM_SPEED + number + Scroll gui.animation speed for scroll_to function + (default 0.2) +
  • +
  • EXTRA_STRETCH_SIZE + number + extra size in pixels outside of scroll (stretch effect) + (default 0) +
  • +
  • SMALL_CONTENT_SCROLL + bool + If true, content node with size less than view node size can be scrolled + (default false) +
  • +
  • WHEEL_SCROLL_SPEED + bool + The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling + (default 0) +
  • +
  • WHEEL_SCROLL_INVERTED + bool + If true, invert direction for touchpad and mouse wheel scroll + (default false) +
  • +
  • WHEEL_SCROLL_BY_INERTION + bool + If true, wheel will add inertion to scroll. Direct set position otherwise. + (default false) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + available_pos +
+
+ Available position for content node: (min_x, max_y, max_x, min_y) + + +
    +
  • available_pos + vector4 + +
  • +
+ + + + + +
+
+ + available_size +
+
+ Size of available positions: (width, height, 0) + + +
    +
  • available_size + vector3 + +
  • +
+ + + + + +
+
+ + content_node +
+
+ Scroll content node + + +
    +
  • content_node + node + +
  • +
+ + + + + +
+
+ + drag +
+
+ Drag Druid component + + +
    +
  • drag + Drag + Drag +
  • +
+ + + + + +
+
+ + inertion +
+
+ Current inert speed + + +
    +
  • inertion + vector3 + +
  • +
+ + + + + +
+
+ + is_animate +
+
+ Flag, if scroll now animating by gui.animate + + +
    +
  • is_animate + bool + +
  • +
+ + + + + +
+
+ + is_inert +
+
+ Flag, if scroll now moving by inertion + + +
    +
  • is_inert + bool + +
  • +
+ + + + + +
+
+ + on_point_scroll +
+
+ On scroll_to_index function callback(self, index, point) + + + + + + + + +
+
+ + on_scroll +
+
+ On scroll move callback(self, position) + + + + + + + + +
+
+ + on_scroll_to +
+
+ On scroll_to function callback(self, target, is_instant) + + + + + + + + +
+
+ + position +
+
+ Current scroll posisition + + +
    +
  • position + vector3 + +
  • +
+ + + + + +
+
+ + selected +
+
+ Current index of points of interests + + +
    +
  • selected + number + + (optional) +
  • +
+ + + + + +
+
+ + target_position +
+
+ Current scroll target position + + +
    +
  • target_position + vector3 + +
  • +
+ + + + + +
+
+ + view_node +
+
+ Scroll view node + + +
    +
  • view_node + node + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Slider.html b/docs/modules/Slider.html new file mode 100644 index 00000000..1da2b7ab --- /dev/null +++ b/docs/modules/Slider.html @@ -0,0 +1,477 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Slider

+

Druid slider component

+

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
init(self, node, end_pos[, callback])Component init function
set(self, value[, is_silent])Set value for slider
set_input_node(self, input_node)Set input zone for slider.
set_steps(self, steps)Set slider steps.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
distLength between start and end position
end_posEnd pin node position
is_dragCurrent drag state
nodeSlider pin node
on_change_valueOn change value callback(self, value)
posCurrent pin node position
start_posStart pin node position
target_posTarger pin node position
valueCurrent slider value
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node, end_pos[, callback]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Slider + Slider +
  • +
  • node + node + Gui pin node +
  • +
  • end_pos + vector3 + The end position of slider +
  • +
  • callback + function + On slider change callback + (optional) +
  • +
+ + + + + +
+
+ + set(self, value[, is_silent]) +
+
+ Set value for slider + + +

Parameters:

+
    +
  • self + Slider + Slider +
  • +
  • value + number + Value from 0 to 1 +
  • +
  • is_silent + bool + Don't trigger event if true + (optional) +
  • +
+ + + + + +
+
+ + set_input_node(self, input_node) +
+
+ Set input zone for slider. + User can touch any place of node, pin instantly will + move at this position and node drag will start. + This function require the Defold version 1.3.0+ + + +

Parameters:

+
    +
  • self + Slider + Slider +
  • +
  • input_node + Node + +
  • +
+ +

Returns:

+
    + + Slider + Slider +
+ + + + +
+
+ + set_steps(self, steps) +
+
+ Set slider steps. Pin node will + apply closest step position + + +

Parameters:

+
    +
  • self + Slider + Slider +
  • +
  • steps + number[] + Array of steps +
  • +
+ +

Returns:

+
    + + Slider + Slider +
+ + + +

Usage:

+
    +
    slider:set_steps({0, 0.2, 0.6, 1})
    +
+ +
+
+

Fields

+ +
+
+ + dist +
+
+ Length between start and end position + + +
    +
  • dist + number + +
  • +
+ + + + + +
+
+ + end_pos +
+
+ End pin node position + + +
    +
  • end_pos + vector3 + +
  • +
+ + + + + +
+
+ + is_drag +
+
+ Current drag state + + +
    +
  • is_drag + bool + +
  • +
+ + + + + +
+
+ + node +
+
+ Slider pin node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_change_value +
+
+ On change value callback(self, value) + + + + + + + + +
+
+ + pos +
+
+ Current pin node position + + +
    +
  • pos + vector3 + +
  • +
+ + + + + +
+
+ + start_pos +
+
+ Start pin node position + + +
    +
  • start_pos + vector3 + +
  • +
+ + + + + +
+
+ + target_pos +
+
+ Targer pin node position + + +
    +
  • target_pos + vector3 + +
  • +
+ + + + + +
+
+ + value +
+
+ Current slider value + + +
    +
  • value + number + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/StaticGrid.html b/docs/modules/StaticGrid.html new file mode 100644 index 00000000..be25781c --- /dev/null +++ b/docs/modules/StaticGrid.html @@ -0,0 +1,971 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module StaticGrid

+

Component to handle component's position by row and columns.

+

+ # Overview # +

The Static Grid component allows for positioning components in rows and columns. + It provides a static grid layout with constant node sizes, allowing for pre-calculated + node positions and the option to include gaps between nodes. +

# Notes # +

• In a static grid, the node size remains constant, enabling the calculation of node + positions before placement. If you want add gaps between nodes, increase the root prefab size, + including the padding and margin. +

• The static grid can automatically shift elements when nodes are added or removed. +

• When a node is added, the grid will set the node's parent to the specified parent_node. +

• You can obtain an array of positions for each element, which can be used to set + points of interest in a scroll component. +

• The size of all elements can be retrieved for setting up the size in a scroll component. +

• The grid can be bound to a scroll component for automatic resizing of the scroll content size. +

• The pivot of the parent_node affects the node placement within the grid. +

• A prefab node is used to determine the node size and anchor. +

• You can specify a position_function for animations using the + _static_grid:set_position_function(node, pos) callback. The default position function is gui.set_position(). +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])Add new item to the grid
clear(self)Clear grid nodes array.
get_all_pos(self)Return array of all node positions
get_borders(self)Return grid content borders
get_index(self, pos)Return index for grid pos
get_index_by_node(self, node)Return grid index by node
get_offset(self)Return StaticGrid offset, where StaticGrid content starts.
get_pos(self, index)Return pos for grid node index
get_size(self)Return grid content size
init(self, parent, element[, in_row=1])The StaticGrid constructor
remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])Remove the item from the grid.
set_anchor(self, anchor)Set grid anchor.
set_in_row(self, in_row)Set new in_row elements for grid
set_position_function(self, callback)Change set position function for grid nodes.
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
anchorItem anchor [0..1]
borderThe size of item content
first_indexThe first index of node in grid
last_indexThe last index of node in grid
node_sizeItem size
nodesList of all grid nodes
on_add_itemOn item add callback(self, node, index)
on_change_itemsOn item add, remove or change in_row callback(self, index|nil)
on_clearOn grid clear callback(self)
on_remove_itemOn item remove callback(self, index)
on_update_positionsOn update item positions callback(self)
parentParent gui node
pivotItem pivot [-0.5..0.5]
+ +
+
+ + +

Functions

+ +
+
+ + add(self, item[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]]) +
+
+ Add new item to the grid + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • item + node + Gui node +
  • +
  • index + number + The item position. By default add as last item + (optional) +
  • +
  • shift_policy + number + How shift nodes, if required. See const.SHIFT + (default SHIFT.RIGHT) +
  • +
  • is_instant + boolean + If true, update node positions instantly + (default false) +
  • +
+ + + + + +
+
+ + clear(self) +
+
+ Clear grid nodes array. GUI nodes will be not deleted! + If you want to delete GUI nodes, use static_grid.nodes array before grid:clear + + +

Parameters:

+ + +

Returns:

+
    + + druid.static_grid + Current grid instance +
+ + + + +
+
+ + get_all_pos(self) +
+
+ Return array of all node positions + + +

Parameters:

+ + +

Returns:

+
    + + vector3[] + All grid node positions +
+ + + + +
+
+ + get_borders(self) +
+
+ Return grid content borders + + +

Parameters:

+ + +

Returns:

+
    + + vector3 + The grid content borders +
+ + + + +
+
+ + get_index(self, pos) +
+
+ Return index for grid pos + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • pos + vector3 + The node position in the grid +
  • +
+ +

Returns:

+
    + + number + The node index +
+ + + + +
+
+ + get_index_by_node(self, node) +
+
+ Return grid index by node + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • node + node + The gui node in the grid +
  • +
+ +

Returns:

+
    + + number + The node index +
+ + + + +
+
+ + get_offset(self) +
+
+ Return StaticGrid offset, where StaticGrid content starts. + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid The StaticGrid instance +
  • +
+ +

Returns:

+
    + + vector3 + The StaticGrid offset +
+ + + + +
+
+ + get_pos(self, index) +
+
+ Return pos for grid node index + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • index + number + The grid element index +
  • +
+ +

Returns:

+
    + + vector3 + Node position +
+ + + + +
+
+ + get_size(self) +
+
+ Return grid content size + + +

Parameters:

+ + +

Returns:

+
    + + vector3 + The grid content size +
+ + + + +
+
+ + init(self, parent, element[, in_row=1]) +
+
+ The StaticGrid constructor + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • parent + string or Node + The GUI Node container, where grid's items will be placed +
  • +
  • element + node + Element prefab. Need to get it size +
  • +
  • in_row + number + How many nodes in row can be placed + (default 1) +
  • +
+ + + + + +
+
+ + remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]) +
+
+ Remove the item from the grid. Note that gui node will be not deleted + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • index + number + The grid node index to remove +
  • +
  • shift_policy + number + How shift nodes, if required. See const.SHIFT + (default SHIFT.RIGHT) +
  • +
  • is_instant + boolean + If true, update node positions instantly + (default false) +
  • +
+ +

Returns:

+
    + + Node + The deleted gui node from grid +
+ + + + +
+
+ + set_anchor(self, anchor) +
+
+ Set grid anchor. Default anchor is equal to anchor of grid parent node + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • anchor + vector3 + Anchor +
  • +
+ + + + + +
+
+ + set_in_row(self, in_row) +
+
+ Set new in_row elements for grid + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • in_row + number + The new in_row value +
  • +
+ +

Returns:

+
    + + druid.static_grid + Current grid instance +
+ + + + +
+
+ + set_position_function(self, callback) +
+
+ Change set position function for grid nodes. It will call on + update poses on grid elements. Default: gui.set_position + + +

Parameters:

+
    +
  • self + StaticGrid + StaticGrid +
  • +
  • callback + function + Function on node set position +
  • +
+ +

Returns:

+
    + + druid.static_grid + Current grid instance +
+ + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • IS_DYNAMIC_NODE_POSES + bool + If true, always center grid content as grid pivot sets + (default false) +
  • +
  • IS_ALIGN_LAST_ROW + bool + If true, always align last row of the grid as grid pivot sets + (default false) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + anchor +
+
+ Item anchor [0..1] + + +
    +
  • anchor + vector3 + +
  • +
+ + + + + +
+
+ + border +
+
+ The size of item content + + +
    +
  • border + vector4 + +
  • +
+ + + + + +
+
+ + first_index +
+
+ The first index of node in grid + + +
    +
  • first_index + number + +
  • +
+ + + + + +
+
+ + last_index +
+
+ The last index of node in grid + + +
    +
  • last_index + number + +
  • +
+ + + + + +
+
+ + node_size +
+
+ Item size + + +
    +
  • node_size + vector3 + +
  • +
+ + + + + +
+
+ + nodes +
+
+ List of all grid nodes + + +
    +
  • nodes + node[] + +
  • +
+ + + + + +
+
+ + on_add_item +
+
+ On item add callback(self, node, index) + + + + + + + + +
+
+ + on_change_items +
+
+ On item add, remove or change in_row callback(self, index|nil) + + + + + + + + +
+
+ + on_clear +
+
+ On grid clear callback(self) + + + + + + + + +
+
+ + on_remove_item +
+
+ On item remove callback(self, index) + + + + + + + + +
+
+ + on_update_positions +
+
+ On update item positions callback(self) + + +
    +
  • on_update_positions + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + parent +
+
+ Parent gui node + + +
    +
  • parent + node + +
  • +
+ + + + + +
+
+ + pivot +
+
+ Item pivot [-0.5..0.5] + + +
    +
  • pivot + vector3 + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Swipe.html b/docs/modules/Swipe.html new file mode 100644 index 00000000..aba97375 --- /dev/null +++ b/docs/modules/Swipe.html @@ -0,0 +1,296 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Swipe

+

Component to handle swipe gestures on node.

+

+ Swipe will be triggered, if swipe was started and + ended on one node +

Example Link

+ + +

Functions

+ + + + + + + + + +
init(self, node, on_swipe_callback)Component init function
set_click_zone(self, zone)Strict swipe click area.
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + +
click_zoneRestriction zone
nodeSwipe node
on_swipeTrigger on swipe event(self, swipe_side, dist, delta_time)
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node, on_swipe_callback) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Swipe + Swipe +
  • +
  • node + node + Gui node +
  • +
  • on_swipe_callback + function + Swipe callback for on_swipe_end event +
  • +
+ + + + + +
+
+ + set_click_zone(self, zone) +
+
+ Strict swipe click area. Useful for + restrict events outside stencil node + + +

Parameters:

+
    +
  • self + Swipe + Swipe +
  • +
  • zone + node + Gui node +
  • +
+ + + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • SWIPE_TIME + number + Maximum time for swipe trigger + (default 0.4) +
  • +
  • SWIPE_THRESHOLD + number + Minimum distance for swipe trigger + (default 50) +
  • +
  • SWIPE_TRIGGER_ON_MOVE + bool + If true, trigger on swipe moving, not only release action + (default false) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + click_zone +
+
+ Restriction zone + + +
    +
  • click_zone + node + + (optional) +
  • +
+ + + + + +
+
+ + node +
+
+ Swipe node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_swipe +
+
+ Trigger on swipe event(self, swipe_side, dist, delta_time) + + + + + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Text.html b/docs/modules/Text.html new file mode 100644 index 00000000..6d1295f6 --- /dev/null +++ b/docs/modules/Text.html @@ -0,0 +1,851 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Text

+

Component for Wrapping GUI Text Nodes: Druid Text +

## Overview ## +

Druid Text is a component that provides various adjustment modes for text nodes.

+

It allows text to be scaled down to fit within the size of the text node. +

## Notes ## +

• The text pivot can be changed using the text:set_pivot method. + The anchoring will be inside the text node's area size. +

• There are several text adjustment types available. The default is DOWNSCALE. + You can change the default adjustment type in the Text style. Refer to the example below to see all available adjustment types: +

- const.TEXT_ADJUST.DOWNSCALE: Changes the text's scale to fit within the text node's size. +

- const.TEXT_ADJUST.TRIM: Trims the text with a postfix (default: "...", can be overridden in styles) + to fit within the text node's size. +

- const.TEXT_ADJUST.NO_ADJUST: No adjustment is applied, similar + to the default Defold Text Node behavior. +

- const.TEXT_ADJUST.DOWNSCALE_LIMITED: Changes the text's scale + with a limited downscale. You can set the minimum scale using the text:set_minimal_scale() function. +

- const.TEXT_ADJUST.SCROLL: Changes the text's pivot to imitate scrolling within the text box. + For better effect, use with a stencil node. +

- const.TEXT_ADJUST.SCALE_THEN_SCROLL: Combines two modes: limited downscale first, then scroll. +

Example Link

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_text_adjust(self, adjust_type)Return current text adjust type
get_text_size(self[, text])Calculate text width with font with respect to trailing space
init(self, node[, value[, adjust_type=downscale]])Text constructor
is_multiline(self)Return true, if text with line break
set_alpha(self, alpha)Set alpha
set_color(self, color)Set color
set_minimal_scale(self, minimal_scale)Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
set_pivot(self, pivot)Set text pivot.
set_scale(self, scale)Set scale
set_text_adjust(self[, adjust_type[, minimal_scale]])Set text adjust, refresh the current text visuals, if needed
set_to(self, set_to)Set text to text field
+

Tables

+ + + + + +
styleComponent style params.
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
adjust_typeCurrent text size adjust settings
colorCurrent text color
nodeText node
node_idThe node id of text node
on_set_pivotOn change pivot callback(self, pivot)
on_set_textOn set text callback(self, text)
on_update_text_scaleOn adjust text size callback(self, new_scale, text_metrics)
posCurrent text position
scaleCurrent text node scale
start_scaleInitial text node scale
start_sizeInitial text node size
text_areaCurrent text node available are
+ +
+
+ + +

Functions

+ +
+
+ + get_text_adjust(self, adjust_type) +
+
+ Return current text adjust type + + +

Parameters:

+
    +
  • self + +
  • +
  • adjust_type + +
  • +
+ +

Returns:

+
    + + number + The current text adjust type +
+ + + + +
+
+ + get_text_size(self[, text]) +
+
+ Calculate text width with font with respect to trailing space + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • text + string + + (optional) +
  • +
+ +

Returns:

+
    +
  1. + number + Width
  2. +
  3. + number + Height
  4. +
+ + + + +
+
+ + init(self, node[, value[, adjust_type=downscale]]) +
+
+ Text constructor + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • node + string or node + Node name or GUI Text Node itself +
  • +
  • value + string + Initial text. Default value is node text from GUI scene. + (optional) +
  • +
  • adjust_type + string + Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference + (default downscale) +
  • +
+ + + + + +
+
+ + is_multiline(self) +
+
+ Return true, if text with line break + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
+ +

Returns:

+
    + + bool + Is text node with line break +
+ + + + +
+
+ + set_alpha(self, alpha) +
+
+ Set alpha + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • alpha + number + Alpha for node +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_color(self, color) +
+
+ Set color + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • color + vector4 + Color for node +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_minimal_scale(self, minimal_scale) +
+
+ Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • minimal_scale + number + If pass nil - not use minimal scale +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_pivot(self, pivot) +
+
+ Set text pivot. Text will re-anchor inside text area + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • pivot + gui.pivot + Gui pivot constant +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_scale(self, scale) +
+
+ Set scale + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • scale + vector3 + Scale for node +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_text_adjust(self[, adjust_type[, minimal_scale]]) +
+
+ Set text adjust, refresh the current text visuals, if needed + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • adjust_type + number + See const.TEXT_ADJUST. If pass nil - use current adjust type + (optional) +
  • +
  • minimal_scale + number + If pass nil - not use minimal scale + (optional) +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+ + set_to(self, set_to) +
+
+ Set text to text field + + +

Parameters:

+
    +
  • self + Text + Text +
  • +
  • set_to + string + Text for node +
  • +
+ +

Returns:

+
    + + Text + Current text instance +
+ + + + +
+
+

Tables

+ +
+
+ + style +
+
+ Component style params. + You can override this component styles params in druid styles table + or create your own style + + +

Fields:

+
    +
  • TRIM_POSTFIX + string + The postfix for TRIM adjust type + (default ...) +
  • +
  • DEFAULT_ADJUST + string + The default adjust type for any text component + (default DOWNSCALE) +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + adjust_type +
+
+ Current text size adjust settings + + +
    +
  • adjust_type + number + +
  • +
+ + + + + +
+
+ + color +
+
+ Current text color + + +
    +
  • color + vector3 + +
  • +
+ + + + + +
+
+ + node +
+
+ Text node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + node_id +
+
+ The node id of text node + + +
    +
  • node_id + hash + +
  • +
+ + + + + +
+
+ + on_set_pivot +
+
+ On change pivot callback(self, pivot) + + + + + + + + +
+
+ + on_set_text +
+
+ On set text callback(self, text) + + + + + + + + +
+
+ + on_update_text_scale +
+
+ On adjust text size callback(self, new_scale, text_metrics) + + +
    +
  • on_update_text_scale + DruidEvent + DruidEvent +
  • +
+ + + + + +
+
+ + pos +
+
+ Current text position + + +
    +
  • pos + vector3 + +
  • +
+ + + + + +
+
+ + scale +
+
+ Current text node scale + + +
    +
  • scale + vector3 + +
  • +
+ + + + + +
+
+ + start_scale +
+
+ Initial text node scale + + +
    +
  • start_scale + vector3 + +
  • +
+ + + + + +
+
+ + start_size +
+
+ Initial text node size + + +
    +
  • start_size + vector3 + +
  • +
+ + + + + +
+
+ + text_area +
+
+ Current text node available are + + +
    +
  • text_area + vector3 + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ + diff --git a/docs/modules/Timer.html b/docs/modules/Timer.html new file mode 100644 index 00000000..7193ae16 --- /dev/null +++ b/docs/modules/Timer.html @@ -0,0 +1,415 @@ + + + + + Defold Druid UI Framework + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Timer

+

Component to handle GUI timers.

+

+ Timer updating by game delta time. If game is not focused - + timer will be not updated.

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
init(self, node, seconds_from[, seconds_to=0[, callback]])Component init function
set_interval(self, from, to)Set time interval
set_state(self, is_on)Called when update
set_to(self, set_to)Set text to text field
+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fromInitial timer value
nodeTrigger node
on_set_enabledOn timer change enabled state callback(self, is_enabled)
on_tickOn timer tick.
on_timer_endOn timer end callback
targetTarget timer value
valueCurrent timer value
+ +
+
+ + +

Functions

+ +
+
+ + init(self, node, seconds_from[, seconds_to=0[, callback]]) +
+
+ Component init function + + +

Parameters:

+
    +
  • self + Timer + Timer +
  • +
  • node + node + Gui text node +
  • +
  • seconds_from + number + Start timer value in seconds +
  • +
  • seconds_to + number + End timer value in seconds + (default 0) +
  • +
  • callback + function + Function on timer end + (optional) +
  • +
+ + + + + +
+
+ + set_interval(self, from, to) +
+
+ Set time interval + + +

Parameters:

+
    +
  • self + Timer + Timer +
  • +
  • from + number + Start time in seconds +
  • +
  • to + number + Target time in seconds +
  • +
+ + + + + +
+
+ + set_state(self, is_on) +
+
+ Called when update + + +

Parameters:

+
    +
  • self + Timer + Timer +
  • +
  • is_on + bool + Timer enable state +
  • +
+ + + + + +
+
+ + set_to(self, set_to) +
+
+ Set text to text field + + +

Parameters:

+
    +
  • self + Timer + Timer +
  • +
  • set_to + number + Value in seconds +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + from +
+
+ Initial timer value + + +
    +
  • from + number + +
  • +
+ + + + + +
+
+ + node +
+
+ Trigger node + + +
    +
  • node + node + +
  • +
+ + + + + +
+
+ + on_set_enabled +
+
+ On timer change enabled state callback(self, is_enabled) + + + + + + + + +
+
+ + on_tick +
+
+ On timer tick. Fire every second callback(self, value) + + + + + + + + +
+
+ + on_timer_end +
+
+ On timer end callback + + +
    +
  • on_timer_end + DruidEvent + (self, Timer) DruidEvent +
  • +
+ + + + + +
+
+ + target +
+
+ Target timer value + + +
    +
  • target + number + +
  • +
+ + + + + +
+
+ + value +
+
+ Current timer value + + +
    +
  • value + number + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc TESTING +Last updated 2015-01-01 12:00:00 +
+
+ +