2022-02-12 17:02:27 +02:00

322 lines
8.0 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>druid</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>druid</code></h1>
<p>Druid UI Library.</p>
<p>
Powerful Defold component based UI library. Use standart
components or make your own game-specific components to
make amazing GUI in your games.
<p> Contains the several basic components and examples
to how to do your custom complex components to
separate UI game logic to small files
<p> require("druid.druid")
function init(self)
self.druid = druid.new(self)
end
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Register external druid component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new">new(context[, style])</a></td>
<td class="summary">Create Druid instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_default_style">set_default_style(style)</a></td>
<td class="summary">Set new default style.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_function">set_text_function(callback)</a></td>
<td class="summary">Set text function
Druid locale component will call this function
to get translated text.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_sound_function">set_sound_function(callback)</a></td>
<td class="summary">Set sound function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_window_callback">on_window_callback(event)</a></td>
<td class="summary">Callback on global window event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_layout_change">on_layout_change()</a></td>
<td class="summary">Callback on global layout change event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_language_change">on_language_change()</a></td>
<td class="summary">Callback on global language change event.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
</dt>
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
module name
</li>
<li><span class="parameter">module</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
lua table with component
</li>
</ul>
</dd>
<dt>
<a name = "new"></a>
<strong>new(context[, style])</strong>
</dt>
<dd>
Create Druid instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid context. Usually it is self of script
</li>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid_instance</span></span>
Druid instance
</ol>
</dd>
<dt>
<a name = "set_default_style"></a>
<strong>set_default_style(style)</strong>
</dt>
<dd>
Set new default style.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module
</li>
</ul>
</dd>
<dt>
<a name = "set_text_function"></a>
<strong>set_text_function(callback)</strong>
</dt>
<dd>
Set text function
Druid locale component will call this function
to get translated text. After set_text_funtion
all existing locale component will be updated
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Get localized text function
</li>
</ul>
</dd>
<dt>
<a name = "set_sound_function"></a>
<strong>set_sound_function(callback)</strong>
</dt>
<dd>
Set sound function.
Component will call this function to
play sound by sound_id
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Sound play callback
</li>
</ul>
</dd>
<dt>
<a name = "on_window_callback"></a>
<strong>on_window_callback(event)</strong>
</dt>
<dd>
Callback on global window event.
Used to trigger on_focus_lost and on_focus_gain
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">event</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Event param from window listener
</li>
</ul>
</dd>
<dt>
<a name = "on_layout_change"></a>
<strong>on_layout_change()</strong>
</dt>
<dd>
Callback on global layout change event.
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-02-12 16:59:51 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>