Update Docs & Example

This commit is contained in:
Insality 2023-07-13 21:39:02 +03:00
parent 1cbe573763
commit 32d184ca81
43 changed files with 2148 additions and 1042 deletions

View File

@ -10,3 +10,4 @@ date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_coun
2022-09-09T17:55:42Z,072507cc9e715541bdee7636d2e5eeeb3c22a57d,0.10.603,2340,43,js-web,release,true,603
2022-09-09T18:00:07Z,072507cc9e715541bdee7636d2e5eeeb3c22a57d,0.10.603,2340,5,js-web,release,true,603
2023-07-05T20:19:22Z,d0062c2a78e618871ebb4c8ee66b1509b763f069,0.10.671,3292,12,x86_64-linux,headless,true,671
2023-07-13T18:37:07Z,1cbe57376397a8352bbafcc67de0b6f95ae37b35,0.10.682,2496,53,js-web,release,true,682

1 date sha version build_size build_time platform mode is_cache_using commits_count
10 2022-09-09T17:55:42Z 072507cc9e715541bdee7636d2e5eeeb3c22a57d 0.10.603 2340 43 js-web release true 603
11 2022-09-09T18:00:07Z 072507cc9e715541bdee7636d2e5eeeb3c22a57d 0.10.603 2340 5 js-web release true 603
12 2023-07-05T20:19:22Z d0062c2a78e618871ebb4c8ee66b1509b763f069 0.10.671 3292 12 x86_64-linux headless true 671
13 2023-07-13T18:37:07Z 1cbe57376397a8352bbafcc67de0b6f95ae37b35 0.10.682 2496 53 js-web release true 682

View File

@ -1 +1 @@
{"content":[{"name":"game.projectc","size":3797,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":19808,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":449757,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":20704,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
{"content":[{"name":"game.projectc","size":4133,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":23248,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":608800,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":24461,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,12 @@
[project]
title = druid
version = 0.10.603
version = 0.10.682
write_log = 0
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = 072507cc9e715541bdee7636d2e5eeeb3c22a57d
build_date = 2022-09-09T18:00:07Z
commit_sha = 1cbe57376397a8352bbafcc67de0b6f95ae37b35
build_date = 2023-07-13T18:37:07Z
title_as_file_name = druid
[display]
@ -16,6 +16,7 @@ high_dpi = 0
samples = 0
fullscreen = 0
update_frequency = 0
swap_interval = 1
vsync = 1
display_profiles = /example/custom.display_profilesc
dynamic_orientation = 1
@ -29,6 +30,8 @@ clear_color_alpha = 0
[physics]
type = 2D
max_collision_object_count = 128
use_fixed_timestep = 0
gravity_y = -10
debug = 0
debug_alpha = 0.9
@ -45,6 +48,7 @@ ray_cast_limit_2d = 64
ray_cast_limit_3d = 128
trigger_overlap_capacity = 16
velocity_threshold = 1
max_fixed_timesteps = 2
[bootstrap]
main_collection = /example/example.collectionc
@ -89,6 +93,7 @@ subpixels = 1
[model]
max_count = 128
split_meshes = 0
[mesh]
max_count = 128
@ -115,43 +120,51 @@ max_count = 128
launch_screen = /builtins/manifests/ios/LaunchScreen.storyboardc
pre_renderered_icons = 0
bundle_identifier = example.unnamed
bundle_name =
infoplist = /builtins/manifests/ios/Info.plist
default_language = en
localizations = en
[android]
version_code = 603
minimum_sdk_version = 16
target_sdk_version = 30
version_code = 682
minimum_sdk_version = 19
target_sdk_version = 33
package = com.insality.druid
gcm_sender_id =
manifest = /builtins/manifests/android/AndroidManifest.xml
iap_provider = GooglePlay
input_method = HiddenInputField
immersive_mode = 0
display_cutout = 1
debuggable = 0
proguard =
[osx]
app_icon =
infoplist = /builtins/manifests/osx/Info.plist
bundle_identifier = example.unnamed
bundle_name =
bundle_version = 1
default_language = en
localizations = en
[windows]
app_icon =
[html5]
custom_heap_size = 0
heap_size = 64
htmlfile = /builtins/manifests/web/engine_template.html
cssfile = /example/light_theme.css
splash_image = /media/druid_logo.png
archive_location_prefix = archive
archive_location_suffix =
engine_arguments = --verify-graphics-calls=false
wasm_streaming = 0
show_fullscreen_button = 0
show_made_with_defold = 0
show_console_banner = 1
scale_mode = fit
engine_arguments = --verify-graphics-calls=false
splash_image = /media/druid_logo.png
[particle_fx]
max_count = 64
@ -163,6 +176,7 @@ auto_finish_transactions = 1
[network]
http_timeout = 0
ssl_certificates =
http_thread_count = 4
http_cache_enabled = 1
@ -178,6 +192,7 @@ subpixels = 1
[profiler]
track_cpu = 0
sleep_between_server_updates = 0
[liveupdate]
settings = /liveupdate.settings
@ -189,6 +204,7 @@ max_tile_count = 2048
[engine]
run_while_iconified = 0
fixed_update_frequency = 60
[druid]
no_auto_input = 0
@ -201,9 +217,9 @@ input_key_esc = key_esc
input_key_back = key_back
input_key_enter = key_enter
input_key_backspace = key_backspace
input_multitouch = multitouch
input_scroll_up = scroll_up
input_scroll_down = scroll_down
input_multitouch = touch_multi
input_scroll_up = mouse_wheel_up
input_scroll_down = mouse_wheel_down
[native_extension]
app_manifest = /example/game.appmanifest

View File

@ -102,18 +102,10 @@ var FileLoader = {
var EngineLoader = {
wasm_size: 2000000,
wasm_from: 0,
wasm_to: 40,
wasmjs_size: 250000,
wasmjs_from: 40,
wasmjs_to: 50,
asmjs_size: 4000000,
asmjs_from: 0,
asmjs_to: 50,
stream_wasm: true,
stream_wasm: false,
loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
@ -133,9 +125,32 @@ var EngineLoader = {
});
},
streamAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
setupWasmStreamAsync: async function(src, fromProgress, toProgress) {
// https://stackoverflow.com/a/69179454
var fetchFn = fetch;
if (typeof TransformStream === "function" && ReadableStream.prototype.pipeThrough) {
async function fetchWithProgress(path) {
const response = await fetch(path);
// May be incorrect if compressed
const contentLength = response.headers.get("Content-Length");
const total = parseInt(contentLength, 10);
let bytesLoaded = 0;
const ts = new TransformStream({
transform (chunk, controller) {
bytesLoaded += chunk.byteLength;
Progress.calculateProgress(fromProgress, toProgress, bytesLoaded, total);
controller.enqueue(chunk)
}
});
return new Response(response.body.pipeThrough(ts), response);
}
fetchFn = fetchWithProgress;
}
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetch(src), imports).then(function(output) {
WebAssembly.instantiateStreaming(fetchFn(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
successCallback(output.instance);
}).catch(function(e) {
@ -144,43 +159,45 @@ var EngineLoader = {
});
return {}; // Compiling asynchronously, no exports.
}
callback();
},
// instantiate the .wasm file either by streaming it or first loading and then instantiate it
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
loadWasmAsync: function(exeName) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.streamAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
EngineLoader.setupWasmStreamAsync(exeName + ".wasm", 10, 50);
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 0, 10);
}
else {
EngineLoader.loadAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
EngineLoader.loadAndInstantiateWasmAsync(exeName + ".wasm", 0, 40, function() {
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 40, 50);
});
}
},
loadAsmJsAsync: function(exeName) {
EngineLoader.loadAndRunScriptAsync(exeName + '_asmjs.js', EngineLoader.asmjs_size, 0, 50);
},
// load and start engine script (asm.js or wasm.js)
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
loadAndRunScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
FileLoader.load(src, "text", estimatedSize,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
function(response) {
var tag = document.createElement("script");
tag.text = response;
document.head.appendChild(tag);
document.body.appendChild(tag);
});
},
// load engine (asm.js or wasm.js + wasm)
// engine load progress goes from 1-50% for ams.js
// engine load progress goes from 0-40% for .wasm and 40-50% for wasm.js
load: function(appCanvasId, exeName) {
Progress.addProgress(Module.setupCanvas(appCanvasId));
if (Module['isWASMSupported']) {
EngineLoader.loadWasmAsync(exeName + ".wasm", EngineLoader.wasm_from, EngineLoader.wasm_to, function(wasm) {
EngineLoader.loadScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, EngineLoader.wasmjs_from, EngineLoader.wasmjs_to);
});
EngineLoader.loadWasmAsync(exeName);
} else {
EngineLoader.loadScriptAsync(exeName + '_asmjs.js', EngineLoader.asmjs_size, EngineLoader.asmjs_from, EngineLoader.asmjs_to);
EngineLoader.loadAsmJsAsync(exeName);
}
}
}
@ -699,6 +716,11 @@ var Module = {
},
preSync: function(done) {
if (Module.persistentStorage != true) {
Module._syncInitial = true;
done();
return;
}
// Initial persistent sync before main is called
FS.syncfs(true, function(err) {
if (err) {
@ -734,6 +756,9 @@ var Module = {
// It will flag that another one is needed if there is already one sync running.
persistentSync: function() {
if (Module.persistentStorage != true) {
return;
}
// Need to wait for the initial sync to finish since it
// will call close on all its file streams which will trigger
// new persistentSync for each.
@ -747,27 +772,40 @@ var Module = {
},
preInit: [function() {
/* Mount filesystem on preinit */
// Mount filesystem on preinit
var dir = DMSYS.GetUserPersistentDataRoot();
try {
FS.mkdir(dir);
}
catch (error) {
Module.persistentStorage = false;
Module._preloadAndCallMain();
return;
}
// If IndexedDB is supported we mount the persistent data root as IDBFS,
// then try to do a IDB->MEM sync before we start the engine to get
// previously saved data before boot.
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
if (Module.persistentStorage && window.indexedDB) {
try {
FS.mount(IDBFS, {}, dir);
// Patch FS.close so it will try to sync MEM->IDB
var _close = FS.close; FS.close = function(stream) { var r = _close(stream); Module.persistentSync(); return r; }
var _close = FS.close;
FS.close = function(stream) {
var r = _close(stream);
Module.persistentSync();
return r;
}
}
catch (error) {
Module.persistentStorage = false;
Module._preloadAndCallMain();
return;
}
// Sync IDB->MEM before calling main()
Module.preSync(function() {
Module._preloadAndCallMain();
});
} else {
Module._preloadAndCallMain();
}
}],
preRun: [function() {

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>druid 0.10.603</title>
<title>druid 0.10.682</title>
<style type='text/css'>
/* Disable user selection to avoid strange bug in Chrome on Windows:
* Selecting a text outside the canvas, then clicking+draging would
@ -123,6 +123,11 @@
</head>
<body>
<div id="running-from-file-warning" style="display: none; margin: 3em;">
<h1>Running from local file ⚠️</h1>
<p>It seems like you have opened this file by double-clicking on it. In order to test your build in a browser <b>you need to load this file from a web server</b>. You can either upload this file and the rest of the files from a Defold HTML5 bundle to a web hosting service OR host them using a local web server on your home network.</p>
<p><a href="https://defold.com/manuals/html5/#testing-html5-build" target="_blank">Learn more about running a local web server in the Defold HTML5 manual</a>.</p>
</div>
<div id="app-container" class="canvas-app-container">
<div id="canvas-container" class="canvas-app-canvas-container">
<canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="600" height="900"></canvas>
@ -214,7 +219,15 @@
</script>
<script id='engine-start' type='text/javascript'>
var runningFromFileWarning = document.getElementById("running-from-file-warning");
if (window.location.href.startsWith("file://")) {
runningFromFileWarning.style.display = "block";
}
else {
EngineLoader.stream_wasm = "false" === "true";
EngineLoader.load("canvas", "druid");
runningFromFileWarning.parentNode.removeChild(runningFromFileWarning);
}
</script>
</body>
</html>

View File

@ -38,12 +38,12 @@
<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><a href="modules/PinKnob.html">PinKnob</a></li>
<li><a href="modules/RichInput.html">RichInput</a></li>
<li><a href="modules/druid.html">druid</a></li>
<li><a href="modules/RichText.html">RichText</a></li>
<li><a href="modules/Druid.html">Druid</a></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>
@ -56,6 +56,7 @@
<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/Swipe.html">Swipe</a></li>
<li><a href="modules/Timer.html">Timer</a></li>
<li><a href="modules/Helper.html">Helper</a></li>
<li><a href="modules/DruidInstance.html">DruidInstance</a></li>
@ -66,21 +67,21 @@
<div id="content">
<h2>Documentation for Druid Library</h2>
<h2>Documentation for Druid Framework</h2>
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/BackHandler.html">BackHandler</a></td>
<td class="summary">Component to handle back key (android, backspace)</td>
<td class="summary">Component with event on back and backspace button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Blocker.html">Blocker</a></td>
<td class="summary">Component to block input on specify zone by node</td>
<td class="summary">Component to consume input in special zone defined by GUI node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Button.html">Button</a></td>
<td class="summary">Component to handle basic GUI button</td>
<td class="summary">Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Drag.html">Drag</a></td>
@ -96,15 +97,13 @@
</tr>
<tr>
<td class="name" nowrap><a href="modules/StaticGrid.html">StaticGrid</a></td>
<td class="summary">Component to handle placing components by row and columns.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Swipe.html">Swipe</a></td>
<td class="summary">Component to handle swipe gestures on node.</td>
<td class="summary">Component to handle component's position by row and columns.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Text.html">Text</a></td>
<td class="summary">Component to handle all GUI texts.</td>
<td class="summary">Component for Wrapping GUI Text Nodes: Druid Text
<p> ## Overview ##
<p> Druid Text is a component that provides various adjustment modes for text nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td>
@ -119,12 +118,17 @@
<td class="summary">Druid Rich Input custom component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid.html">druid</a></td>
<td class="summary">Druid UI Library.</td>
<td class="name" nowrap><a href="modules/RichText.html">RichText</a></td>
<td class="summary">Druid Rich Text Custom Component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Druid.html">Druid</a></td>
<td class="summary">Druid UI Component Framework.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidEvent.html">DruidEvent</a></td>
<td class="summary">Druid lua event library</td>
<td class="summary">Druid Event Module
<p> The Event module provides a simple class for handling callbacks.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td>
@ -152,8 +156,10 @@
</tr>
<tr>
<td class="name" nowrap><a href="modules/LangText.html">LangText</a></td>
<td class="summary">Component to handle all GUI texts
Good working with localization system</td>
<td class="summary">Component to wrap over GUI Text nodes with localization helpers
<p> <b># Overview #</b>
<p> • The initialization of druid.set_text_function is required to enable localization
using the localization ID.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Layout.html">Layout</a></td>
@ -161,7 +167,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="modules/Progress.html">Progress</a></td>
<td class="summary">Basic progress bar component.</td>
<td class="summary">Druid component to handle the progress bars.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RadioGroup.html">RadioGroup</a></td>
@ -171,17 +177,21 @@
<td class="name" nowrap><a href="modules/Slider.html">Slider</a></td>
<td class="summary">Druid slider component</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Swipe.html">Swipe</a></td>
<td class="summary">Component to handle swipe gestures on node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Timer.html">Timer</a></td>
<td class="summary">Component to handle GUI timers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Helper.html">Helper</a></td>
<td class="summary">Druid helper module for gui layouts</td>
<td class="summary">Helper module with various usefull GUI functions.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
<td class="summary">Instance of Druid.</td>
<td class="summary">Druid Instance which you use for component creation.</td>
</tr>
</table>

View File

@ -195,7 +195,7 @@ table.index td { text-align: left; vertical-align: top; }
margin-left: 14em;
padding: 1em;
padding-left: 2em;
width: 700px;
width: 900px;
border-left: 2px solid #cccccc;
// border-right: 2px solid #cccccc;
background-color: #ffffff;

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -32,7 +32,6 @@
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
@ -47,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +60,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -74,30 +74,33 @@
<div id="content">
<h1>Module <code>BackHandler</code></h1>
<p>Component to handle back key (android, backspace)</p>
<p></p>
<p>Component with event on back and backspace button.</p>
<p>
<b># Overview #</b>
<p> Back Handler is recommended to put in every game window to close it
or in main screen to call settings window.
<p> <b># Notes #</b>
<p> • Back Handler inheritance <a href="../modules/BaseComponent.html#">BaseComponent</a>, you can use all of its methods in addition to those described here.
<p> • Back Handler react on release action ACTION_BACK or ACTION_BACKSPACE</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local callback = function(self, params) ... end
local params = {}
local back_handler = self.druid:new_back_handler(callback, [params])
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, callback[, params])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input">on_input(self, action_id, action)</a></td>
<td class="summary">Input handler for component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_back">on_back</a></td>
<td class="summary">On back handler callback(self, params)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Params to back callback</td>
<td class="summary">Custom args to pass in the callback</td>
</tr>
</table>
@ -105,69 +108,6 @@
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, callback[, params])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">callback</span></span>
On back button
</li>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
Callback argument
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "on_input"></a>
<strong>on_input(self, action_id, action)</strong>
</dt>
<dd>
Input handler for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li>
<li><span class="parameter">action_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
on_input action id
</li>
<li><span class="parameter">action</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
on_input action
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
@ -176,7 +116,8 @@
<strong>on_back</strong>
</dt>
<dd>
On back handler callback(self, params)
<a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.
<p> Trigger on input action ACTION_BACK or ACTION_BACKSPACE
<ul>
@ -189,6 +130,11 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Subscribe additional callbacks:
</span>back_handler.on_back:subscribe(callback)</pre>
</ul>
</dd>
<dt>
@ -196,19 +142,25 @@
<strong>params</strong>
</dt>
<dd>
Params to back callback
Custom args to pass in the callback
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Replace params on runtime:
</span>back_handler.params = { ... }</pre>
</ul>
</dd>
</dl>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -33,7 +33,6 @@
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
@ -47,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +60,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -76,90 +76,90 @@
<h1>Module <code>BaseComponent</code></h1>
<p>Basic class for all Druid components.</p>
<p>
To create you component, use `component.create`</p>
To create you custom component, use static function `component.create`</p>
<h3>Usage:</h3>
<ul>
<pre class="example">-- Create your component:
local component = require(&quot;druid.component&quot;)
local AwesomeComponent = component.create(&quot;awesome_component&quot;)
function AwesomeComponent:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
end
return AwesomeComponent
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td>
<td class="summary">Return all children components, recursive (protected)</td>
<td class="name" nowrap><a href="#component:get_childrens">component:get_childrens(self)</a></td>
<td class="summary">Return all children components, recursive</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_context">get_context(self)</a></td>
<td class="summary">Get current component context (protected)</td>
<td class="name" nowrap><a href="#component:get_context">component:get_context(self)</a></td>
<td class="summary">Context used as first arg in all Druid events</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_druid">get_druid(self)</a></td>
<td class="summary">Return druid with context of calling component (protected).</td>
<td class="name" nowrap><a href="#component:get_druid">component:get_druid(self)</a></td>
<td class="summary">Get Druid instance for inner component creation.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_input_priority">get_input_priority(self)</a></td>
<td class="name" nowrap><a href="#component:get_input_priority">component:get_input_priority(self)</a></td>
<td class="summary">Return component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
<td class="name" nowrap><a href="#component:get_name">component:get_name(self)</a></td>
<td class="summary">Return component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
<td class="name" nowrap><a href="#component:get_node">component:get_node(self, node_or_name)</a></td>
<td class="summary">Get component node by name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_component">get_parent_component(self)</a></td>
<td class="summary">Return the parent for current component (protected)</td>
<td class="name" nowrap><a href="#component:get_parent_component">component:get_parent_component(self)</a></td>
<td class="summary">Return the parent component if exist</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_name">get_parent_name(self)</a></td>
<td class="name" nowrap><a href="#component:get_parent_name">component:get_parent_name(self)</a></td>
<td class="summary">Return parent component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_template">get_template(self)</a></td>
<td class="summary">Get current component template name (protected)</td>
<td class="name" nowrap><a href="#component:get_template">component:get_template(self)</a></td>
<td class="summary">Get current component template name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td>
<td class="summary">Return component uid (protected).</td>
<td class="name" nowrap><a href="#component:get_uid">component:get_uid(self)</a></td>
<td class="summary">Return component UID.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#log_message">log_message(self, message, context)</a></td>
<td class="summary">Print log information if debug mode is enabled (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_input_priority">reset_input_priority(self)</a></td>
<td class="name" nowrap><a href="#component:reset_input_priority">component:reset_input_priority(self)</a></td>
<td class="summary">Reset component input priority to default value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_debug">set_debug(self, is_debug)</a></td>
<td class="summary">Set debug logs for component enabled or disabled</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(self, state)</a></td>
<td class="name" nowrap><a href="#component:set_input_enabled">component:set_input_enabled(self, state)</a></td>
<td class="summary">Set component input state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value, is_temporary)</a></td>
<td class="name" nowrap><a href="#component:set_input_priority">component:set_input_priority(self, value, is_temporary)</a></td>
<td class="summary">Set component input priority</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes (protected)</td>
<td class="name" nowrap><a href="#component:set_nodes">component:set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td>
<td class="summary">Set current component style table (protected).</td>
<td class="name" nowrap><a href="#component:set_style">component:set_style(self, druid_style)</a></td>
<td class="summary">Set current component style table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
<td class="summary">Set current component template name (protected)
It will check parent template name to build full template name</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#ON_INPUT">ON_INPUT</a></td>
<td class="summary">Component Interests</td>
<td class="name" nowrap><a href="#component:set_template">component:set_template(self, template)</a></td>
<td class="summary">Set component template name.</td>
</tr>
</table>
@ -171,11 +171,11 @@
<dl class="function">
<dt>
<a name = "get_childrens"></a>
<strong>get_childrens(self)</strong>
<a name = "component:get_childrens"></a>
<strong>component:get_childrens(self)</strong>
</dt>
<dd>
Return all children components, recursive (protected)
Return all children components, recursive
<h3>Parameters:</h3>
@ -198,11 +198,11 @@
</dd>
<dt>
<a name = "get_context"></a>
<strong>get_context(self)</strong>
<a name = "component:get_context"></a>
<strong>component:get_context(self)</strong>
</dt>
<dd>
Get current component context (protected)
Context used as first arg in all Druid events Context is usually self of gui_script.
<h3>Parameters:</h3>
@ -225,12 +225,11 @@
</dd>
<dt>
<a name = "get_druid"></a>
<strong>get_druid(self)</strong>
<a name = "component:get_druid"></a>
<strong>component:get_druid(self)</strong>
</dt>
<dd>
Return druid with context of calling component (protected).
Use it to create component inside of other components.
Get Druid instance for inner component creation.
<h3>Parameters:</h3>
@ -253,8 +252,8 @@
</dd>
<dt>
<a name = "get_input_priority"></a>
<strong>get_input_priority(self)</strong>
<a name = "component:get_input_priority"></a>
<strong>component:get_input_priority(self)</strong>
</dt>
<dd>
Return component input priority
@ -280,8 +279,8 @@
</dd>
<dt>
<a name = "get_name"></a>
<strong>get_name(self)</strong>
<a name = "component:get_name"></a>
<strong>component:get_name(self)</strong>
</dt>
<dd>
Return component name
@ -307,13 +306,13 @@
</dd>
<dt>
<a name = "get_node"></a>
<strong>get_node(self, node_or_name)</strong>
<a name = "component:get_node"></a>
<strong>component:get_node(self, node_or_name)</strong>
</dt>
<dd>
Get node for component by name.
If component has nodes, node_or_name should be string
It auto pick node by template name or from nodes by clone_tree
Get component node by name.
<p> 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
@ -342,11 +341,11 @@
</dd>
<dt>
<a name = "get_parent_component"></a>
<strong>get_parent_component(self)</strong>
<a name = "component:get_parent_component"></a>
<strong>component:get_parent_component(self)</strong>
</dt>
<dd>
Return the parent for current component (protected)
Return the parent component if exist
<h3>Parameters:</h3>
@ -369,8 +368,8 @@
</dd>
<dt>
<a name = "get_parent_name"></a>
<strong>get_parent_name(self)</strong>
<a name = "component:get_parent_name"></a>
<strong>component:get_parent_name(self)</strong>
</dt>
<dd>
Return parent component name
@ -396,11 +395,11 @@
</dd>
<dt>
<a name = "get_template"></a>
<strong>get_template(self)</strong>
<a name = "component:get_template"></a>
<strong>component:get_template(self)</strong>
</dt>
<dd>
Get current component template name (protected)
Get current component template name.
<h3>Parameters:</h3>
@ -423,12 +422,12 @@
</dd>
<dt>
<a name = "get_uid"></a>
<strong>get_uid(self)</strong>
<a name = "component:get_uid"></a>
<strong>component:get_uid(self)</strong>
</dt>
<dd>
Return component uid (protected).
UID generated in component creation order
Return component UID.
<p> UID generated in component creation order.
<h3>Parameters:</h3>
@ -451,37 +450,8 @@
</dd>
<dt>
<a name = "log_message"></a>
<strong>log_message(self, message, context)</strong>
</dt>
<dd>
Print log information if debug mode is enabled (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
<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>
</li>
</ul>
</dd>
<dt>
<a name = "reset_input_priority"></a>
<strong>reset_input_priority(self)</strong>
<a name = "component:reset_input_priority"></a>
<strong>component:reset_input_priority(self)</strong>
</dt>
<dd>
Reset component input priority to default value
@ -507,37 +477,12 @@
</dd>
<dt>
<a name = "set_debug"></a>
<strong>set_debug(self, is_debug)</strong>
</dt>
<dd>
Set debug logs for component enabled or disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">is_debug</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "set_input_enabled"></a>
<strong>set_input_enabled(self, state)</strong>
<a name = "component:set_input_enabled"></a>
<strong>component:set_input_enabled(self, state)</strong>
</dt>
<dd>
Set component input state. By default it enabled
You can disable any input of component by this function
<p> If input is disabled, the component will not receive input events
<h3>Parameters:</h3>
@ -564,11 +509,11 @@
</dd>
<dt>
<a name = "set_input_priority"></a>
<strong>set_input_priority(self, value, is_temporary)</strong>
<a name = "component:set_input_priority"></a>
<strong>component:set_input_priority(self, value, is_temporary)</strong>
</dt>
<dd>
Set component input priority
Set component input priority Default value: 10
<h3>Parameters:</h3>
@ -599,11 +544,11 @@
</dd>
<dt>
<a name = "set_nodes"></a>
<strong>set_nodes(self, nodes)</strong>
<a name = "component:set_nodes"></a>
<strong>component:set_nodes(self, nodes)</strong>
</dt>
<dd>
Set current component nodes (protected)
Set current component nodes Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree.
<h3>Parameters:</h3>
@ -627,15 +572,21 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> nodes = gui.clone_tree(self.prefab)
... In your component:
self:set_nodes(nodes)</pre>
</ul>
</dd>
<dt>
<a name = "set_style"></a>
<strong>set_style(self, druid_style)</strong>
<a name = "component:set_style"></a>
<strong>component:set_style(self, druid_style)</strong>
</dt>
<dd>
Set current component style table (protected).
Invoke `on_style_change` on component, if exist. BaseComponent should handle
Set current component style table.
<p> Invoke `on_style_change` on component, if exist. Component should handle
their style changing and store all style params
@ -651,18 +602,25 @@
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
</dd>
<dt>
<a name = "set_template"></a>
<strong>set_template(self, template)</strong>
<a name = "component:set_template"></a>
<strong>component:set_template(self, template)</strong>
</dt>
<dd>
Set current component template name (protected)
It will check parent template name to build full template name
Set component template name.
<p> 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()
<h3>Parameters:</h3>
@ -687,24 +645,6 @@
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "ON_INPUT"></a>
<strong>ON_INPUT</strong>
</dt>
<dd>
Component Interests
</dd>
</dl>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -74,30 +75,42 @@
<div id="content">
<h1>Module <code>Blocker</code></h1>
<p>Component to block input on specify zone by node</p>
<p></p>
<p>Component to consume input in special zone defined by GUI node.</p>
<p>
<b># Overview #</b>
<p> <b># Notes #</b>
<p> Blocker consume input if `gui.pick_node` works on it.
<p> • Blocker inheritance <a href="../modules/BaseComponent.html#">BaseComponent</a>, you can use all of its methods in addition to those described here.
<p> • Blocker initial enabled state is `gui.is_enabled(node, true)`
<p> • The Blocker node should be enabled to capture the input</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local node = gui.get_node(&quot;blocker_node&quot;)
local blocker = self.druid:new_blocker(node)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node)</a></td>
<td class="summary">Component init function</td>
<td class="summary"><a href="../modules/Blocker.html#">Blocker</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return blocked enabled state</td>
<td class="summary">Return blocker enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state</td>
<td class="summary">Set enabled blocker component state.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
<td class="summary">Blocker node</td>
</tr>
</table>
@ -113,7 +126,7 @@
<strong>init(self, node)</strong>
</dt>
<dd>
Component init function
<a href="../modules/Blocker.html#">Blocker</a> constructor
<h3>Parameters:</h3>
@ -138,7 +151,7 @@
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return blocked enabled state
Return blocker enabled state
<h3>Parameters:</h3>
@ -165,7 +178,8 @@
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state
Set enabled blocker component state.
<p> Don't change node enabled state itself.
<h3>Parameters:</h3>
@ -194,7 +208,7 @@
<strong>node</strong>
</dt>
<dd>
Trigger node
Blocker node
<ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,23 +76,46 @@
<div id="content">
<h1>Module <code>Button</code></h1>
<p>Component to handle basic GUI button</p>
<p></p>
<p>Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More.</p>
<p>
<p> <b># Overview #</b>
<p> 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.
<p> <b># Notes #</b>
<p> • The click callback will not trigger if the cursor moves outside the node's
area between the pressed and released states.
<p> • If a button has a double click event subscriber and the double click event is triggered,
the regular click callback will not be triggered.
<p> • Buttons can be triggered using a keyboard key by calling the button:set_key_trigger method.
<p> • 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."
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_buttons" target="_blank"><b>Example Link</b></a></p>
<h3>Usage:</h3>
<ul>
<pre class="example">local function on_button_click(self, args, button)
print(&quot;Button has clicked with params: &quot; .. args)
print(&quot;Also the button component is passed in callback params&quot;)
end
local custom_args = &quot;Any variable to pass inside callback&quot;
local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, custom_args)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get key-code to trigger this button</td>
<td class="summary">Get current key name to trigger this button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, params[, anim_node]])</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#init">init(self, node, callback[, custom_args[, anim_node]])</a></td>
<td class="summary"><a href="../modules/Button.html#">Button</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return button enabled state</td>
<td class="summary">Get button enabled state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_check_function">set_check_function(self[, check_function[, failure_callback]])</a></td>
@ -99,15 +123,19 @@
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict button click area.</td>
<td class="summary">Set additional button click area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled button component state</td>
<td class="summary">Set button enabled state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(self, key)</a></td>
<td class="summary">Set key-code to trigger this button</td>
<td class="summary">Set key name to trigger this button by keyboard.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_web_user_interaction">set_web_user_interaction(self[, is_web_mode])</a></td>
<td class="summary">Set Button mode to work inside user HTML5 interaction event.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
@ -121,63 +149,55 @@
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#anim_node">anim_node</a></td>
<td class="summary">Animation node</td>
<td class="summary">Button animation node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hash">hash</a></td>
<td class="summary">The hash of trigger node</td>
<td class="summary">Additional button click area, defined by another GUI Node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary">Druid hover logic component</td>
<td class="summary"><a href="../modules/Hover.html#">Hover</a>: Button Hover component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
<td class="summary">Button trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node_id">node_id</a></td>
<td class="summary">The GUI node id from button node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click">on_click</a></td>
<td class="summary">On release button callback(self, params, button_instance)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary">On click outside of button(self, params, button_instance)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
<td class="summary">On double tap button callback(self, params, button_instance, click_amount)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_hold_callback">on_hold_callback</a></td>
<td class="summary">On button hold before long_click callback(self, params, button_instance, time)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">On long tap button callback(self, params, button_instance, time)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_pressed">on_pressed</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary">On repeated action button callback(self, params, button_instance, click_amount)</td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Params to click callbacks</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial scale of anim_node</td>
<td class="summary">Custom args for any Button event.</td>
</tr>
</table>
@ -193,7 +213,7 @@
<strong>get_key_trigger(self)</strong>
</dt>
<dd>
Get key-code to trigger this button
Get current key name to trigger this button.
<h3>Parameters:</h3>
@ -207,20 +227,24 @@
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
<span class="types"><span class="type">hash</span></span>
The action_id of the input key
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> key_hash = button:get_key_trigger()</pre>
</ul>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, params[, anim_node]])</strong>
<strong>init(self, node, callback[, custom_args[, anim_node]])</strong>
</dt>
<dd>
Component init function
<a href="../modules/Button.html#">Button</a> constructor
<h3>Parameters:</h3>
@ -230,21 +254,21 @@
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
Node name or GUI Node itself
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Button callback
On click button callback
</li>
<li><span class="parameter">params</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Button callback params
<li><span class="parameter">custom_args</span>
<span class="types"><span class="type">any</span></span>
Button events custom arguments
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Button anim node (node, if not provided)
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
Node to animate instead of trigger node.
(<em>optional</em>)
</li>
</ul>
@ -259,7 +283,8 @@
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return button enabled state
Get button enabled state.
<p> By default all Buttons is enabled on creating.
<h3>Parameters:</h3>
@ -274,11 +299,15 @@
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled
True, if button is enabled now, False overwise
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_enabled = button:is_enabled()</pre>
</ul>
</dd>
<dt>
@ -302,7 +331,7 @@
</li>
<li><span class="parameter">failure_callback</span>
<span class="types"><span class="type">function</span></span>
Function what will be called on button click, if check function return false
Function will be called on button click, if check function return false
(<em>optional</em>)
</li>
</ul>
@ -323,8 +352,9 @@
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
Set additional button click area.
Useful to restrict click outside out stencil node or scrollable content.
<p> This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check
<h3>Parameters:</h3>
@ -348,6 +378,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_click_zone(<span class="string">"stencil_node"</span>)</pre>
</ul>
</dd>
<dt>
@ -355,7 +389,9 @@
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled button component state
Set button enabled state.
The style.on_set_enabled will be triggered.
Disabled button is not clickable.
<h3>Parameters:</h3>
@ -379,6 +415,11 @@
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_enabled(<span class="keyword">false</span>)
button:set_enabled(<span class="keyword">true</span>)</pre>
</ul>
</dd>
<dt>
@ -386,7 +427,7 @@
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key-code to trigger this button
Set key name to trigger this button by keyboard.
<h3>Parameters:</h3>
@ -396,8 +437,8 @@
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
<span class="types"><span class="type">hash</span></span>
The action_id of the input key
</li>
</ul>
@ -410,6 +451,49 @@
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_key_trigger(<span class="string">"key_space"</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_web_user_interaction"></a>
<strong>set_web_user_interaction(self[, is_web_mode])</strong>
</dt>
<dd>
Set Button mode to work inside user HTML5 interaction event.
<p> 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.
<p> If the game is not HTML, html mode will be not enabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">is_web_mode</span>
<span class="types"><span class="type">boolean</span></span>
If true - button will be called inside html5 callback
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:set_web_user_interaction(<span class="keyword">true</span>)</pre>
</ul>
</dd>
</dl>
@ -422,7 +506,7 @@
</dt>
<dd>
Component style params.
You can override this component styles params in druid styles table
You can override this component styles params in Druid styles table
or create your own style
@ -479,7 +563,9 @@
<strong>anim_node</strong>
</dt>
<dd>
Animation node
Button animation node.
In default case equals to clickable node.
<p> Usecase: You have the big clickable panel, but want to animate only one small icon on it.
<ul>
@ -500,7 +586,7 @@
<strong>click_zone</strong>
</dt>
<dd>
Restriction zone
Additional button click area, defined by another GUI Node
<ul>
@ -515,33 +601,13 @@
</dd>
<dt>
<a name = "hash"></a>
<strong>hash</strong>
</dt>
<dd>
The hash of trigger node
<ul>
<li><span class="parameter">hash</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node_id</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "hover"></a>
<strong>hover</strong>
</dt>
<dd>
Druid hover logic component
<a href="../modules/Hover.html#">Hover</a>: Button Hover component
<ul>
@ -561,12 +627,32 @@
<strong>node</strong>
</dt>
<dd>
Trigger node
Button trigger node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node_id"></a>
<strong>node_id</strong>
</dt>
<dd>
The GUI node id from button node
<ul>
<li><span class="parameter">node_id</span>
<span class="types"><span class="type">hash</span></span>
</li>
</ul>
@ -581,7 +667,7 @@
<strong>on_click</strong>
</dt>
<dd>
On release button callback(self, params, button_instance)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.
<ul>
@ -594,6 +680,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -601,7 +694,9 @@
<strong>on_click_outside</strong>
</dt>
<dd>
On click outside of button(self, params, button_instance)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.
<p> This event will be triggered for each button what was not clicked on user click action
<p> Usecase: Hide the popup when click outside
<ul>
@ -614,6 +709,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_click_outside:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On click Button outside!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -621,7 +723,9 @@
<strong>on_double_click</strong>
</dt>
<dd>
On double tap button callback(self, params, button_instance, click_amount)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.
<p> If secondary click was too fast after previous one, the double
click will be called instead usual click (if on_double_click subscriber exists)
<ul>
@ -634,6 +738,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_double_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, click_amount)
<span class="global">print</span>(<span class="string">"On double Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -641,7 +752,9 @@
<strong>on_hold_callback</strong>
</dt>
<dd>
On button hold before long_click callback(self, params, button_instance, time)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.
<p> If long_click subscriber exists, the on_hold_callback will be called before long_click trigger.
<p> Usecase: Animate button progress of long tap
<ul>
@ -654,6 +767,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_double_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, time)
<span class="global">print</span>(<span class="string">"On hold Button callback!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -661,7 +781,9 @@
<strong>on_long_click</strong>
</dt>
<dd>
On long tap button callback(self, params, button_instance, time)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.
<p> 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
<ul>
@ -674,6 +796,40 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_long_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, hold_time)
<span class="global">print</span>(<span class="string">"On long Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "on_pressed"></a>
<strong>on_pressed</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.
<ul>
<li><span class="parameter">on_pressed</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_pressed:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance)
<span class="global">print</span>(<span class="string">"On Button pressed!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -681,7 +837,8 @@
<strong>on_repeated_click</strong>
</dt>
<dd>
On repeated action button callback(self, params, button_instance, click_amount)
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.
<p> This callback will be triggered if user hold the button. The repeat rate pick from `input.repeat_interval` in game.project
<ul>
@ -694,6 +851,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">-- Custom args passed in Button constructor
</span>button.on_repeated_click:subscribe(<span class="keyword">function</span>(self, custom_args, button_instance, click_count)
<span class="global">print</span>(<span class="string">"On repeated Button click!"</span>)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
@ -701,7 +865,7 @@
<strong>params</strong>
</dt>
<dd>
Params to click callbacks
Custom args for any Button event. Setup in Button constructor
<ul>
@ -715,66 +879,6 @@
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Initial pos of anim_node
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Initial pos of anim_node
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_scale"></a>
<strong>start_scale</strong>
</dt>
<dd>
Initial scale of anim_node
<ul>
<li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
</dl>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -76,7 +77,7 @@
<h1>Module <code>Checkbox</code></h1>
<p>Druid checkbox component</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><strong>CheckboxGroup</strong></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,7 +76,7 @@
<h1>Module <code>CheckboxGroup</code></h1>
<p>Checkbox group module</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><strong>DataList</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -76,7 +77,8 @@
<h1>Module <code>DataList</code></h1>
<p>Component to manage data for huge dataset in scroll.</p>
<p>
It requires Druid Scroll and Druid Grid (Static or Dynamic) components</p>
It requires Druid Scroll and Druid Grid (Static or Dynamic) components
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_data_list" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -79,7 +80,8 @@
<p>
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</p>
the cursor is outside of node, if drag is already started
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_drag" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -295,6 +297,11 @@
Distance in pixels to start dragging
(<em>default</em> 10)
</li>
<li><span class="parameter">NO_USE_SCREEN_KOEF</span>
<span class="types"><span class="type">boolean</span></span>
If screen aspect ratio affects on drag values
(<em>default</em> false)
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -46,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -59,13 +60,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -73,8 +74,10 @@
<div id="content">
<h1>Module <code>DruidEvent</code></h1>
<p>Druid lua event library</p>
<p></p>
<p>Druid Event Module
<p> The Event module provides a simple class for handling callbacks.</p>
<p> It is used in many Druid components.
<p> You can subscribe to an event using the `:subscribe` method and unsubscribe using the `:unsubscribe` method.</p>
<h2><a href="#Functions">Functions</a></h2>
@ -84,15 +87,15 @@
<td class="summary">Clear the all event handlers</td>
</tr>
<tr>
<td class="name" nowrap><a href="#initialize">initialize(self, initial_callback)</a></td>
<td class="summary">Event constructur</td>
<td class="name" nowrap><a href="#initialize">initialize(self[, initial_callback])</a></td>
<td class="summary">DruidEvent constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_exist">is_exist(self)</a></td>
<td class="summary">Return true, if event have at lease one handler</td>
</tr>
<tr>
<td class="name" nowrap><a href="#subscribe">subscribe(self, callback, context)</a></td>
<td class="name" nowrap><a href="#subscribe">subscribe(self, callback[, context])</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
<tr>
@ -100,7 +103,7 @@
<td class="summary">Trigger the event and call all subscribed callbacks</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback, context)</a></td>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback[, context])</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
</table>
@ -131,14 +134,18 @@
<h3>Usage:</h3>
<ul>
<pre class="example">button.on_long_click:clear()</pre>
</ul>
</dd>
<dt>
<a name = "initialize"></a>
<strong>initialize(self, initial_callback)</strong>
<strong>initialize(self[, initial_callback])</strong>
</dt>
<dd>
Event constructur
DruidEvent constructor
<h3>Parameters:</h3>
@ -150,12 +157,19 @@
<li><span class="parameter">initial_callback</span>
<span class="types"><span class="type">function</span></span>
Subscribe the callback on new event, if callback exist
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> Event = <span class="global">require</span>(<span class="string">"druid.event"</span>)
...
<span class="keyword">local</span> event = Event(initial_callback)</pre>
</ul>
</dd>
<dt>
@ -183,11 +197,15 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_long_click_handler_exists = button.on_long_click:is_exist()</pre>
</ul>
</dd>
<dt>
<a name = "subscribe"></a>
<strong>subscribe(self, callback, context)</strong>
<strong>subscribe(self, callback[, context])</strong>
</dt>
<dd>
Subscribe callback on event
@ -204,14 +222,24 @@
Callback itself
</li>
<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>
Additional context as first param to callback call
<span class="types"><span class="type">Any</span></span>
Additional context as first param to callback call, usually it's self
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> on_long_callback(self)
<span class="global">print</span>(<span class="string">"Long click!"</span>)
<span class="keyword">end</span>
...
<span class="keyword">local</span> button = self.druid:new_button(<span class="string">"button"</span>, callback)
button.on_long_click:subscribe(on_long_callback, self)</pre>
</ul>
</dd>
<dt>
@ -229,7 +257,7 @@
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">any</span></span>
<span class="types"><span class="type">Any</span></span>
All event params
</li>
</ul>
@ -237,11 +265,18 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> Event = <span class="global">require</span>(<span class="string">"druid.event"</span>)
...
<span class="keyword">local</span> event = Event()
event:trigger(<span class="string">"Param1"</span>, <span class="string">"Param2"</span>)</pre>
</ul>
</dd>
<dt>
<a name = "unsubscribe"></a>
<strong>unsubscribe(self, callback, context)</strong>
<strong>unsubscribe(self, callback[, context])</strong>
</dt>
<dd>
Unsubscribe callback on event
@ -258,14 +293,23 @@
Callback itself
</li>
<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>
<span class="types"><span class="type">Any</span></span>
Additional context as first param to callback call
(<em>optional</em>)
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> on_long_callback(self)
<span class="global">print</span>(<span class="string">"Long click!"</span>)
<span class="keyword">end</span>
...
button.on_long_click:unsubscribe(on_long_callback, self)</pre>
</ul>
</dd>
</dl>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -46,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><strong>DruidInstance</strong></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -59,13 +60,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -73,37 +74,64 @@
<div id="content">
<h1>Module <code>DruidInstance</code></h1>
<p>Instance of Druid.</p>
<p> Make one instance per gui_script with next code:
<p> local druid = require("druid.druid")
function init(self)
self.druid = druid.new(self)
local button = self.druid:new_button(...)
end
<p> Learn Druid instance function here</p>
<p>Druid Instance which you use for component creation.</p>
<p>
<p> # Component List #
<p> For a list of all available components, please refer to the "See Also" section.
<p> <b># Notes #</b>
<p> Please review the following API pages:
<p> <a href="../modules/Helper.html#">Helper</a> - A useful set of functions for working with GUI nodes, such as centering nodes, get GUI scale ratio, etc
<p> <a href="../modules/DruidEvent.html#">DruidEvent</a> - The core event system in Druid. Learn how to subscribe to any event in every Druid component.
<p> <a href="../modules/BaseComponent.html#">BaseComponent</a> - The parent class of all Druid components. You can find all default component methods there.
<p> # Tech Info #
<p> • To use Druid, you need to create a Druid instance first. This instance is used to spawn components.
<p> • 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.
<p> • All Druid and component methods are called using the colon operator (e.g., self.druid:new_button()).</p>
<h3>See also:</h3>
<ul>
<li><a href="../modules/Button.html#">Button</a></li>
<li><a href="../modules/Blocker.html#">Blocker</a></li>
<li><a href="../modules/BackHandler.html#">BackHandler</a></li>
<li><a href="../modules/Input.html#">Input</a></li>
<li><a href="../modules/Text.html#">Text</a></li>
<li><a href="../modules/LangText.html#">LangText</a></li>
<li><a href="../modules/Timer.html#">Timer</a></li>
<li><a href="../modules/Progress.html#">Progress</a></li>
<li><a href="../modules/StaticGrid.html#">StaticGrid</a></li>
<li><a href="../modules/DynamicGrid.html#">DynamicGrid</a></li>
<li><a href="../modules/Scroll.html#">Scroll</a></li>
<li><a href="../modules/Slider.html#">Slider</a></li>
<li><a href="../modules/Blocker.html#">Blocker</a></li>
<li><a href="../modules/Button.html#">Button</a></li>
<li><a href="../modules/Checkbox.html#">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html#">CheckboxGroup</a></li>
<li><a href="../modules/RadioGroup.html#">RadioGroup</a></li>
<li><a href="../modules/Swipe.html#">Swipe</a></li>
<li><a href="../modules/Drag.html#">Drag</a></li>
<li><a href="../modules/DataList.html#">DataList</a></li>
<li><a href="../modules/Hover.html#">Hover</a></li>
<li><a href="../modules/Layout.html#">Layout</a></li>
<li><a href="../modules/Drag.html#">Drag</a></li>
<li><a href="../modules/DynamicGrid.html#">DynamicGrid</a></li>
<li><a href="../modules/Hotkey.html#">Hotkey</a></li>
<li><a href="../modules/Hover.html#">Hover</a></li>
<li><a href="../modules/Input.html#">Input</a></li>
<li><a href="../modules/LangText.html#">LangText</a></li>
<li><a href="../modules/Layout.html#">Layout</a></li>
<li><a href="../modules/Progress.html#">Progress</a></li>
<li><a href="../modules/RadioGroup.html#">RadioGroup</a></li>
<li><a href="../modules/RichInput.html#">RichInput</a></li>
<li><a href="../modules/RichText.html#">RichText</a></li>
<li><a href="../modules/Scroll.html#">Scroll</a></li>
<li><a href="../modules/Slider.html#">Slider</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/Timer.html#">Timer</a></li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">local druid = require(&quot;druid.druid&quot;)
local function close_window(self)
print(&quot;Yeah! You closed the game!&quot;)
end
function init(self)
self.druid = druid.new(self)
-- Call all druid instance function with &quot;:&quot; syntax:
local text = self.druid:new_text(&quot;text_header&quot;, &quot;Hello Druid!&quot;)
local button = self.druid:new_button(&quot;button_close&quot;, close_window)
-- You not need to save component reference if not need it
self.druid:new_back_handler(close_window)
end
</pre>
</ul>
@ -111,136 +139,119 @@
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#final">final(self)</a></td>
<td class="summary">Call on final function on gui_script.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#late_init">late_init(self)</a></td>
<td class="summary">Druid late update function call after init and before udpate step</td>
</tr>
<tr>
<td class="name" nowrap><a href="#log_message">log_message(self, message[, context])</a></td>
<td class="summary">Log message, if is_debug mode is enabled</td>
<td class="summary">Call this in gui_script final function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new">new(self, component, ...)</a></td>
<td class="summary">Create new druid component</td>
<td class="summary">Create new component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_back_handler">new_back_handler(self, callback[, params])</a></td>
<td class="summary">Create back_handler basic component</td>
<td class="summary">Create <a href="../modules/BackHandler.html#">BackHandler</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_blocker">new_blocker(self, node)</a></td>
<td class="summary">Create blocker basic component</td>
<td class="summary">Create <a href="../modules/Blocker.html#">Blocker</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_button">new_button(self, node, callback[, params[, anim_node]])</a></td>
<td class="summary">Create button basic component</td>
<td class="summary">Create <a href="../modules/Button.html#">Button</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_checkbox">new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
<td class="summary">Create checkbox component</td>
<td class="summary">Create <a href="../modules/Checkbox.html#">Checkbox</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_checkbox_group">new_checkbox_group(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Create checkbox_group component</td>
<td class="summary">Create <a href="../modules/CheckboxGroup.html#">CheckboxGroup</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_data_list">new_data_list(self, druid_scroll, druid_grid, create_function)</a></td>
<td class="summary">Create data list basic component</td>
<td class="summary">Create <a href="../modules/DataList.html#">DataList</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_drag">new_drag(self, node, on_drag_callback)</a></td>
<td class="summary">Create drag basic component</td>
<td class="summary">Create <a href="../modules/Drag.html#">Drag</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_dynamic_grid">new_dynamic_grid(self, parent)</a></td>
<td class="summary">Create dynamic grid component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_grid">new_grid(self, parent, element[, in_row=1])</a></td>
<td class="summary">Create grid basic component
Deprecated</td>
<td class="summary">Create <a href="../modules/DynamicGrid.html#">DynamicGrid</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_hotkey">new_hotkey(self, keys_array, callback[, params])</a></td>
<td class="summary">Create hotkey component</td>
<td class="summary">Create <a href="../modules/Hotkey.html#">Hotkey</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_hover">new_hover(self, node, on_hover_callback)</a></td>
<td class="summary">Create hover basic component</td>
<td class="summary">Create <a href="../modules/Hover.html#">Hover</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_input">new_input(self, click_node, text_node[, keyboard_type])</a></td>
<td class="summary">Create input component</td>
<td class="summary">Create <a href="../modules/Input.html#">Input</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_lang_text">new_lang_text(self, node, locale_id, no_adjust)</a></td>
<td class="summary">Create lang_text component</td>
<td class="summary">Create <a href="../modules/LangText.html#">LangText</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_layout">new_layout(self, node, mode)</a></td>
<td class="summary">Create layout component</td>
<td class="summary">Create <a href="../modules/Layout.html#">Layout</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_progress">new_progress(self, node, key[, init_value=1])</a></td>
<td class="summary">Create progress component</td>
<td class="summary">Create <a href="../modules/Progress.html#">Progress</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_radio_group">new_radio_group(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Create radio_group component</td>
<td class="summary">Create <a href="../modules/RadioGroup.html#">RadioGroup</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_scroll">new_scroll(self, view_node, content_node)</a></td>
<td class="summary">Create scroll basic component</td>
<td class="summary">Create <a href="../modules/Scroll.html#">Scroll</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_slider">new_slider(self, node, end_pos[, callback])</a></td>
<td class="summary">Create slider component</td>
<td class="summary">Create <a href="../modules/Slider.html#">Slider</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_static_grid">new_static_grid(self, parent, element[, in_row=1])</a></td>
<td class="summary">Create static grid basic component</td>
<td class="summary">Create <a href="../modules/StaticGrid.html#">StaticGrid</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_swipe">new_swipe(self, node, on_swipe_callback)</a></td>
<td class="summary">Create swipe basic component</td>
<td class="summary">Create <a href="../modules/Swipe.html#">Swipe</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_text">new_text(self, node[, value[, no_adjust]])</a></td>
<td class="summary">Create text basic component</td>
<td class="summary">Create <a href="../modules/Text.html#">Text</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_timer">new_timer(self, node, seconds_from[, seconds_to=0[, callback]])</a></td>
<td class="summary">Create timer component</td>
<td class="summary">Create <a href="../modules/Timer.html#">Timer</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input">on_input(self, action_id, action)</a></td>
<td class="summary">Druid on_input function</td>
<td class="summary">Call this in gui_script on_input function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_message">on_message(self, message_id, message, sender)</a></td>
<td class="summary">Druid on_message function</td>
<td class="summary">Call this in gui_script on_message function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, component)</a></td>
<td class="summary">Remove component from druid instance.</td>
<td class="summary">Remove created component from Druid instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_blacklist">set_blacklist(self[, blacklist_components=nil])</a></td>
<td class="summary">Set blacklist components for input processing.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_debug">set_debug(self, is_debug)</a></td>
<td class="summary">Set debug mode for current Druid instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_whitelist">set_whitelist(self[, whitelist_components=nil])</a></td>
<td class="summary">Set whitelist components for input processing.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#update">update(self, dt)</a></td>
<td class="summary">Druid update function</td>
<td class="summary">Call this in gui_script update function.</td>
</tr>
</table>
@ -256,8 +267,7 @@
<strong>final(self)</strong>
</dt>
<dd>
Call on final function on gui_script. It will call on_remove
on all druid components
Call this in gui_script final function.
<h3>Parameters:</h3>
@ -272,64 +282,13 @@
</dd>
<dt>
<a name = "late_init"></a>
<strong>late_init(self)</strong>
</dt>
<dd>
Druid late update function call after init and before udpate step
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidInstance</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "log_message"></a>
<strong>log_message(self, message[, context])</strong>
</dt>
<dd>
Log message, if is_debug mode is enabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
<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>
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "new"></a>
<strong>new(self, component, ...)</strong>
</dt>
<dd>
Create new druid component
Create new component.
<h3>Parameters:</h3>
@ -358,7 +317,7 @@
<strong>new_back_handler(self, callback[, params])</strong>
</dt>
<dd>
Create back_handler basic component
Create <a href="../modules/BackHandler.html#">BackHandler</a> component
<h3>Parameters:</h3>
@ -382,7 +341,7 @@
<ol>
<span class="types"><span class="type">BackHandler</span></span>
back_handler component
<a href="../modules/BackHandler.html#">BackHandler</a> component
</ol>
@ -394,7 +353,7 @@
<strong>new_blocker(self, node)</strong>
</dt>
<dd>
Create blocker basic component
Create <a href="../modules/Blocker.html#">Blocker</a> component
<h3>Parameters:</h3>
@ -413,7 +372,7 @@
<ol>
<span class="types"><span class="type">Blocker</span></span>
blocker component
<a href="../modules/Blocker.html#">Blocker</a> component
</ol>
@ -425,7 +384,7 @@
<strong>new_button(self, node, callback[, params[, anim_node]])</strong>
</dt>
<dd>
Create button basic component
Create <a href="../modules/Button.html#">Button</a> component
<h3>Parameters:</h3>
@ -436,7 +395,7 @@
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
GUI node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
@ -458,7 +417,7 @@
<ol>
<span class="types"><span class="type">Button</span></span>
button component
<a href="../modules/Button.html#">Button</a> component
</ol>
@ -470,7 +429,7 @@
<strong>new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</strong>
</dt>
<dd>
Create checkbox component
Create <a href="../modules/Checkbox.html#">Checkbox</a> component
<h3>Parameters:</h3>
@ -503,7 +462,7 @@
<ol>
<span class="types"><span class="type">Checkbox</span></span>
checkbox component
<a href="../modules/Checkbox.html#">Checkbox</a> component
</ol>
@ -515,7 +474,7 @@
<strong>new_checkbox_group(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Create checkbox_group component
Create <a href="../modules/CheckboxGroup.html#">CheckboxGroup</a> component
<h3>Parameters:</h3>
@ -543,7 +502,7 @@
<ol>
<span class="types"><span class="type">CheckboxGroup</span></span>
checkbox_group component
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a> component
</ol>
@ -555,7 +514,7 @@
<strong>new_data_list(self, druid_scroll, druid_grid, create_function)</strong>
</dt>
<dd>
Create data list basic component
Create <a href="../modules/DataList.html#">DataList</a> component
<h3>Parameters:</h3>
@ -582,7 +541,7 @@
<ol>
<span class="types"><span class="type">DataList</span></span>
data_list component
<a href="../modules/DataList.html#">DataList</a> component
</ol>
@ -594,7 +553,7 @@
<strong>new_drag(self, node, on_drag_callback)</strong>
</dt>
<dd>
Create drag basic component
Create <a href="../modules/Drag.html#">Drag</a> component
<h3>Parameters:</h3>
@ -617,7 +576,7 @@
<ol>
<span class="types"><span class="type">Drag</span></span>
drag component
<a href="../modules/Drag.html#">Drag</a> component
</ol>
@ -629,7 +588,7 @@
<strong>new_dynamic_grid(self, parent)</strong>
</dt>
<dd>
Create dynamic grid component
Create <a href="../modules/DynamicGrid.html#">DynamicGrid</a> component
<h3>Parameters:</h3>
@ -648,48 +607,7 @@
<ol>
<span class="types"><span class="type">DynamicGrid</span></span>
grid component
</ol>
</dd>
<dt>
<a name = "new_grid"></a>
<strong>new_grid(self, parent, element[, in_row=1])</strong>
</dt>
<dd>
Create grid basic component
Deprecated
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidInstance</span></span>
</li>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed
</li>
<li><span class="parameter">element</span>
<span class="types"><span class="type">node</span></span>
Element prefab. Need to get it size
</li>
<li><span class="parameter">in_row</span>
<span class="types"><span class="type">number</span></span>
How many nodes in row can be placed
(<em>default</em> 1)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">StaticGrid</span></span>
grid component
<a href="../modules/DynamicGrid.html#">DynamicGrid</a> component
</ol>
@ -701,7 +619,7 @@
<strong>new_hotkey(self, keys_array, callback[, params])</strong>
</dt>
<dd>
Create hotkey component
Create <a href="../modules/Hotkey.html#">Hotkey</a> component
<h3>Parameters:</h3>
@ -729,7 +647,7 @@
<ol>
<span class="types"><span class="type">Hotkey</span></span>
hotkey component
<a href="../modules/Hotkey.html#">Hotkey</a> component
</ol>
@ -741,7 +659,7 @@
<strong>new_hover(self, node, on_hover_callback)</strong>
</dt>
<dd>
Create hover basic component
Create <a href="../modules/Hover.html#">Hover</a> component
<h3>Parameters:</h3>
@ -764,7 +682,7 @@
<ol>
<span class="types"><span class="type">Hover</span></span>
hover component
<a href="../modules/Hover.html#">Hover</a> component
</ol>
@ -776,7 +694,7 @@
<strong>new_input(self, click_node, text_node[, keyboard_type])</strong>
</dt>
<dd>
Create input component
Create <a href="../modules/Input.html#">Input</a> component
<h3>Parameters:</h3>
@ -804,7 +722,7 @@
<ol>
<span class="types"><span class="type">Input</span></span>
input component
<a href="../modules/Input.html#">Input</a> component
</ol>
@ -816,7 +734,7 @@
<strong>new_lang_text(self, node, locale_id, no_adjust)</strong>
</dt>
<dd>
Create lang_text component
Create <a href="../modules/LangText.html#">LangText</a> component
<h3>Parameters:</h3>
@ -843,7 +761,7 @@
<ol>
<span class="types"><span class="type">LangText</span></span>
lang_text component
<a href="../modules/LangText.html#">LangText</a> component
</ol>
@ -855,7 +773,7 @@
<strong>new_layout(self, node, mode)</strong>
</dt>
<dd>
Create layout component
Create <a href="../modules/Layout.html#">Layout</a> component
<h3>Parameters:</h3>
@ -878,7 +796,7 @@
<ol>
<span class="types"><span class="type">Layout</span></span>
layout component
<a href="../modules/Layout.html#">Layout</a> component
</ol>
@ -890,7 +808,7 @@
<strong>new_progress(self, node, key[, init_value=1])</strong>
</dt>
<dd>
Create progress component
Create <a href="../modules/Progress.html#">Progress</a> component
<h3>Parameters:</h3>
@ -918,7 +836,7 @@
<ol>
<span class="types"><span class="type">Progress</span></span>
progress component
<a href="../modules/Progress.html#">Progress</a> component
</ol>
@ -930,7 +848,7 @@
<strong>new_radio_group(self, nodes, callback[, click_nodes=node])</strong>
</dt>
<dd>
Create radio_group component
Create <a href="../modules/RadioGroup.html#">RadioGroup</a> component
<h3>Parameters:</h3>
@ -958,7 +876,7 @@
<ol>
<span class="types"><span class="type">RadioGroup</span></span>
radio_group component
<a href="../modules/RadioGroup.html#">RadioGroup</a> component
</ol>
@ -970,7 +888,7 @@
<strong>new_scroll(self, view_node, content_node)</strong>
</dt>
<dd>
Create scroll basic component
Create <a href="../modules/Scroll.html#">Scroll</a> component
<h3>Parameters:</h3>
@ -993,7 +911,7 @@
<ol>
<span class="types"><span class="type">Scroll</span></span>
scroll component
<a href="../modules/Scroll.html#">Scroll</a> component
</ol>
@ -1005,7 +923,7 @@
<strong>new_slider(self, node, end_pos[, callback])</strong>
</dt>
<dd>
Create slider component
Create <a href="../modules/Slider.html#">Slider</a> component
<h3>Parameters:</h3>
@ -1033,7 +951,7 @@
<ol>
<span class="types"><span class="type">Slider</span></span>
slider component
<a href="../modules/Slider.html#">Slider</a> component
</ol>
@ -1045,7 +963,7 @@
<strong>new_static_grid(self, parent, element[, in_row=1])</strong>
</dt>
<dd>
Create static grid basic component
Create <a href="../modules/StaticGrid.html#">StaticGrid</a> component
<h3>Parameters:</h3>
@ -1073,7 +991,7 @@
<ol>
<span class="types"><span class="type">StaticGrid</span></span>
grid component
<a href="../modules/StaticGrid.html#">StaticGrid</a> component
</ol>
@ -1085,7 +1003,7 @@
<strong>new_swipe(self, node, on_swipe_callback)</strong>
</dt>
<dd>
Create swipe basic component
Create <a href="../modules/Swipe.html#">Swipe</a> component
<h3>Parameters:</h3>
@ -1108,7 +1026,7 @@
<ol>
<span class="types"><span class="type">Swipe</span></span>
swipe component
<a href="../modules/Swipe.html#">Swipe</a> component
</ol>
@ -1120,7 +1038,7 @@
<strong>new_text(self, node[, value[, no_adjust]])</strong>
</dt>
<dd>
Create text basic component
Create <a href="../modules/Text.html#">Text</a> component
<h3>Parameters:</h3>
@ -1148,8 +1066,8 @@
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Tet</span></span>
text component
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a> component
</ol>
@ -1161,7 +1079,7 @@
<strong>new_timer(self, node, seconds_from[, seconds_to=0[, callback]])</strong>
</dt>
<dd>
Create timer component
Create <a href="../modules/Timer.html#">Timer</a> component
<h3>Parameters:</h3>
@ -1194,7 +1112,7 @@
<ol>
<span class="types"><span class="type">Timer</span></span>
timer component
<a href="../modules/Timer.html#">Timer</a> component
</ol>
@ -1206,7 +1124,8 @@
<strong>on_input(self, action_id, action)</strong>
</dt>
<dd>
Druid on_input function
Call this in gui_script on_input function.
<p> Used for almost all components
<h3>Parameters:</h3>
@ -1241,7 +1160,8 @@
<strong>on_message(self, message_id, message, sender)</strong>
</dt>
<dd>
Druid on_message function
Call this in gui_script on_message function.
<p> Used for special actions. See SPECIFIC_UI_MESSAGES table
<h3>Parameters:</h3>
@ -1274,8 +1194,8 @@
<strong>remove(self, component)</strong>
</dt>
<dd>
Remove component from druid instance.
Component `on_remove` function will be invoked, if exist.
Remove created component from Druid instance.
<p> Component `on_remove` function will be invoked, if exist.
<h3>Parameters:</h3>
@ -1301,7 +1221,7 @@
</dt>
<dd>
Set blacklist components for input processing.
If blacklist is not empty and component contains in this list,
<p> If blacklist is not empty and component contains in this list,
component will be not processed on input step
@ -1322,37 +1242,6 @@
</dd>
<dt>
<a name = "set_debug"></a>
<strong>set_debug(self, is_debug)</strong>
</dt>
<dd>
Set debug mode for current Druid instance. It's enable debug log messages
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
<li><span class="parameter">is_debug</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">self</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</ol>
</dd>
<dt>
<a name = "set_whitelist"></a>
@ -1360,7 +1249,7 @@
</dt>
<dd>
Set whitelist components for input processing.
If whitelist is not empty and component not contains in this list,
<p> If whitelist is not empty and component not contains in this list,
component will be not processed on input step
@ -1387,7 +1276,8 @@
<strong>update(self, dt)</strong>
</dt>
<dd>
Druid update function
Call this in gui_script update function.
<p> Used for: scroll, progress, timer components
<h3>Parameters:</h3>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><strong>DynamicGrid</strong></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,7 +76,7 @@
<h1>Module <code>DynamicGrid</code></h1>
<p>Component to handle placing components in row</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_grid" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -46,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -59,13 +60,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -73,55 +74,109 @@
<div id="content">
<h1>Module <code>Helper</code></h1>
<p>Druid helper module for gui layouts</p>
<p>Helper module with various usefull GUI functions.</p>
<p></p>
<h3>Usage:</h3>
<ul>
<pre class="example">local helper = require(&quot;druid.helper&quot;)
helper.centrate_nodes(0, node_1, node_2)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#helper.centrate_icon_with_text">helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</a></td>
<td class="summary">Center two nodes.</td>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0], ...)</a></td>
<td class="summary">Centerate nodes by x position with margin.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0[, ...]])</a></td>
<td class="summary">Center several nodes nodes.</td>
<td class="name" nowrap><a href="#helper.clamp">helper.clamp(a, min, max)</a></td>
<td class="summary">Clamp value between min and max</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_text_with_icon">helper.centrate_text_with_icon([text_node][, icon_node], margin)</a></td>
<td class="summary">Center two nodes.</td>
<td class="name" nowrap><a href="#helper.contains">helper.contains(t, value)</a></td>
<td class="summary">Check if value is in array and return index of it</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.deprecated">helper.deprecated(message)</a></td>
<td class="summary">Show deprecated message.</td>
<td class="name" nowrap><a href="#helper.deepcopy">helper.deepcopy(orig_table)</a></td>
<td class="summary">Make a copy table with all nested tables</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_border">helper.get_border(node, offset)</a></td>
<td class="name" nowrap><a href="#helper.distance">helper.distance(x1, y1, x2, y2)</a></td>
<td class="summary">Calculate distance between two points</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_border">helper.get_border(node[, offset])</a></td>
<td class="summary">Distance from node position to his borders</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_closest_stencil_node">helper.get_closest_stencil_node(node)</a></td>
<td class="summary">Return closest non inverted clipping parent node for node</td>
<td class="summary">Return closest non inverted clipping parent node for given node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_gui_scale">helper.get_gui_scale()</a></td>
<td class="summary">Get current GUI scale for each side</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_pivot_offset">helper.get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given gui pivot</td>
<td class="summary">Get node offset for given GUI pivot.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_scaled_size">helper.get_scaled_size(node)</a></td>
<td class="summary">Get node size adjusted by scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_scene_scale">helper.get_scene_scale(node, include_passed_node_scale)</a></td>
<td class="summary">Get cumulative parent's node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_screen_aspect_koef">helper.get_screen_aspect_koef()</a></td>
<td class="summary">Get current screen stretch multiplier for each side</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_text_metrics_from_node">helper.get_text_metrics_from_node(text_node)</a></td>
<td class="summary">Get text metric from GUI node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.insert_with_shift">helper.insert_with_shift(array, item[, index[, shift_policy]])</a></td>
<td class="summary">Add value to array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_enabled">helper.is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in gui hierarchy.</td>
<td class="summary">Check if node is enabled in GUI hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_mobile">helper.is_mobile()</a></td>
<td class="summary">Check if device is mobile (Android or iOS)</td>
<td class="summary">Check if device is native mobile (Android or iOS)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_web">helper.is_web()</a></td>
<td class="summary">Check if device is HTML5</td>
</tr>
<tr>
<td class="name" nowrap><a href="#table_to_string">table_to_string(t)</a></td>
<td class="summary">Transform table to oneline string</td>
<td class="name" nowrap><a href="#helper.lerp">helper.lerp(a, b, t)</a></td>
<td class="summary">Lerp between two values</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.remove_with_shift">helper.remove_with_shift(array[, index[, shift_policy]])</a></td>
<td class="summary">Remove value from array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.round">helper.round(num[, num_decimal_places=0])</a></td>
<td class="summary">Round number to specified decimal places</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.sign">helper.sign(val)</a></td>
<td class="summary">Return sign of value (-1, 0, 1)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.step">helper.step(current, target, step)</a></td>
<td class="summary">Move value from current to target value with step amount</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.table_to_string">helper.table_to_string(t)</a></td>
<td class="summary">Simple table to one-line string converter</td>
</tr>
</table>
@ -132,47 +187,14 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "helper.centrate_icon_with_text"></a>
<strong>helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
icon_node will be first (at left side)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
</ul>
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0[, ...]])</strong>
<strong>helper.centrate_nodes([margin=0], ...)</strong>
</dt>
<dd>
Center several nodes nodes.
Nodes will be center around 0 x position
Centerate nodes by x position with margin.
<p> This functions calculate total width of nodes and set position for each node.
The centrate will be around 0 x position.
<h3>Parameters:</h3>
@ -183,9 +205,7 @@
(<em>default</em> 0)
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">Node</span></span>
Any count of gui Node
(<em>optional</em>)
Gui nodes
</li>
</ul>
@ -195,54 +215,131 @@
</dd>
<dt>
<a name = "helper.centrate_text_with_icon"></a>
<strong>helper.centrate_text_with_icon([text_node][, icon_node], margin)</strong>
<a name = "helper.clamp"></a>
<strong>helper.clamp(a, min, max)</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
text_node will be first (at left side)
Clamp value between min and max
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
Value
</li>
<li><span class="parameter">min</span>
<span class="types"><span class="type">number</span></span>
Min value
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">number</span></span>
Max value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Clamped value
</ol>
</dd>
<dt>
<a name = "helper.deprecated"></a>
<strong>helper.deprecated(message)</strong>
<a name = "helper.contains"></a>
<strong>helper.contains(t, value)</strong>
</dt>
<dd>
Show deprecated message. Once time per message
Check if value is in array and return index of it
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The deprecated message
<li><span class="parameter">t</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">value</span>
Value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Index of value or nil
</ol>
</dd>
<dt>
<a name = "helper.deepcopy"></a>
<strong>helper.deepcopy(orig_table)</strong>
</dt>
<dd>
Make a copy table with all nested tables
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">orig_table</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Original table
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Copy of original table
</ol>
</dd>
<dt>
<a name = "helper.distance"></a>
<strong>helper.distance(x1, y1, x2, y2)</strong>
</dt>
<dd>
Calculate distance between two points
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">x1</span>
<span class="types"><span class="type">number</span></span>
First point x
</li>
<li><span class="parameter">y1</span>
<span class="types"><span class="type">number</span></span>
First point y
</li>
<li><span class="parameter">x2</span>
<span class="types"><span class="type">number</span></span>
Second point x
</li>
<li><span class="parameter">y2</span>
<span class="types"><span class="type">number</span></span>
Second point y
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Distance
</ol>
@ -250,7 +347,7 @@
</dd>
<dt>
<a name = "helper.get_border"></a>
<strong>helper.get_border(node, offset)</strong>
<strong>helper.get_border(node[, offset])</strong>
</dt>
<dd>
Distance from node position to his borders
@ -260,18 +357,20 @@
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node to check
GUI node
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vector3</span></span>
The offset to add to result
Offset from node position. Pass current node position to get non relative border values
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
vector4 Vector with distance to node border: (left, top, right, down)
<span class="types"><span class="type">vector4</span></span>
Vector4 with border values (left, top, right, down)
</ol>
@ -283,14 +382,14 @@
<strong>helper.get_closest_stencil_node(node)</strong>
</dt>
<dd>
Return closest non inverted clipping parent node for node
Return closest non inverted clipping parent node for given node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
GUI node
</li>
</ul>
@ -298,7 +397,30 @@
<ol>
<span class="types"><span class="type">node</span> or <span class="type">nil</span></span>
The clipping node
The closest stencil node or nil
</ol>
</dd>
<dt>
<a name = "helper.get_gui_scale"></a>
<strong>helper.get_gui_scale()</strong>
</dt>
<dd>
Get current GUI scale for each side
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
scale_x</li>
<li>
<span class="types"><span class="type">number</span></span>
scale_y</li>
</ol>
@ -310,7 +432,8 @@
<strong>helper.get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given gui pivot
Get node offset for given GUI pivot.
<p> Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top.
<h3>Parameters:</h3>
@ -325,7 +448,164 @@
<ol>
<span class="types"><span class="type">vector3</span></span>
Vector offset with [-1..1] values
Vector offset with [-0.5..0.5] values
</ol>
</dd>
<dt>
<a name = "helper.get_scaled_size"></a>
<strong>helper.get_scaled_size(node)</strong>
</dt>
<dd>
Get node size adjusted by scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
GUI node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Scaled size
</ol>
</dd>
<dt>
<a name = "helper.get_scene_scale"></a>
<strong>helper.get_scene_scale(node, include_passed_node_scale)</strong>
</dt>
<dd>
Get cumulative parent's node scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
<li><span class="parameter">include_passed_node_scale</span>
<span class="types"><span class="type">bool</span></span>
True if add current node scale to result
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The scene node scale
</ol>
</dd>
<dt>
<a name = "helper.get_screen_aspect_koef"></a>
<strong>helper.get_screen_aspect_koef()</strong>
</dt>
<dd>
Get current screen stretch multiplier for each side
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
stretch_x</li>
<li>
<span class="types"><span class="type">number</span></span>
stretch_y</li>
</ol>
</dd>
<dt>
<a name = "helper.get_text_metrics_from_node"></a>
<strong>helper.get_text_metrics_from_node(text_node)</strong>
</dt>
<dd>
Get text metric from GUI node.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">pepepe</span></span>
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">type</span> GUITextMetrics = {
width: number,
height: number,
max_ascent: number,
max_descent: number
}</pre>
</ul>
</dd>
<dt>
<a name = "helper.insert_with_shift"></a>
<strong>helper.insert_with_shift(array, item[, index[, shift_policy]])</strong>
</dt>
<dd>
Add value to array with shift policy Shift policy can be: left, right, no_shift
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">array</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">item</span>
Item to insert
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index to insert. If nil, item will be inserted at the end of array
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">const.SHIFT</span></span>
Shift policy
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">item</span></span>
Inserted item
</ol>
@ -337,15 +617,15 @@
<strong>helper.is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in gui hierarchy.
Return false, if node or any his parent is disabled
Check if node is enabled in GUI hierarchy.
<p> Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
GUI node
</li>
</ul>
@ -365,10 +645,16 @@
<strong>helper.is_mobile()</strong>
</dt>
<dd>
Check if device is mobile (Android or iOS)
Check if device is native mobile (Android or iOS)
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is mobile
</ol>
@ -383,17 +669,189 @@
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is web
</ol>
</dd>
<dt>
<a name = "table_to_string"></a>
<strong>table_to_string(t)</strong>
<a name = "helper.lerp"></a>
<strong>helper.lerp(a, b, t)</strong>
</dt>
<dd>
Transform table to oneline string
Lerp between two values
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
First value
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">number</span></span>
Second value
</li>
<li><span class="parameter">t</span>
<span class="types"><span class="type">number</span></span>
Lerp amount
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Lerped value
</ol>
</dd>
<dt>
<a name = "helper.remove_with_shift"></a>
<strong>helper.remove_with_shift(array[, index[, shift_policy]])</strong>
</dt>
<dd>
Remove value from array with shift policy Shift policy can be: left, right, no_shift
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">array</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
Index to remove. If nil, item will be removed from the end of array
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">const.SHIFT</span></span>
Shift policy
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">item</span></span>
Removed item
</ol>
</dd>
<dt>
<a name = "helper.round"></a>
<strong>helper.round(num[, num_decimal_places=0])</strong>
</dt>
<dd>
Round number to specified decimal places
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">num</span>
<span class="types"><span class="type">number</span></span>
Number
</li>
<li><span class="parameter">num_decimal_places</span>
<span class="types"><span class="type">number</span></span>
Decimal places
(<em>default</em> 0)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Rounded number
</ol>
</dd>
<dt>
<a name = "helper.sign"></a>
<strong>helper.sign(val)</strong>
</dt>
<dd>
Return sign of value (-1, 0, 1)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">val</span>
<span class="types"><span class="type">number</span></span>
Value
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Sign
</ol>
</dd>
<dt>
<a name = "helper.step"></a>
<strong>helper.step(current, target, step)</strong>
</dt>
<dd>
Move value from current to target value with step amount
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">current</span>
<span class="types"><span class="type">number</span></span>
Current value
</li>
<li><span class="parameter">target</span>
<span class="types"><span class="type">number</span></span>
Target value
</li>
<li><span class="parameter">step</span>
<span class="types"><span class="type">number</span></span>
Step amount
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
New value
</ol>
</dd>
<dt>
<a name = "helper.table_to_string"></a>
<strong>helper.table_to_string(t)</strong>
</dt>
<dd>
Simple table to one-line string converter
<h3>Parameters:</h3>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -76,7 +77,7 @@
<h1>Module <code>Hotkey</code></h1>
<p>Druid hotkey component</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_hotkey" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -89,6 +90,14 @@
<td class="summary">Return current hover enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_hovered">is_hovered(self)</a></td>
<td class="summary">Return current hover state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_mouse_hovered">is_mouse_hovered(self)</a></td>
<td class="summary">Return current hover state.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
<td class="summary">Strict hover click area.</td>
</tr>
@ -109,11 +118,11 @@
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_hover">on_hover</a></td>
<td class="summary">On hover callback(self, state)</td>
<td class="summary">On hover callback(self, state, hover_instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_mouse_hover">on_mouse_hover</a></td>
<td class="summary">On mouse hover callback(self, state)</td>
<td class="summary">On mouse hover callback(self, state, hover_instance)</td>
</tr>
</table>
@ -179,6 +188,60 @@
</dd>
<dt>
<a name = "is_hovered"></a>
<strong>is_hovered(self)</strong>
</dt>
<dd>
Return current hover state. True if touch action was on the node at current time
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The current hovered state
</ol>
</dd>
<dt>
<a name = "is_mouse_hovered"></a>
<strong>is_mouse_hovered(self)</strong>
</dt>
<dd>
Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
The current hovered state
</ol>
</dd>
<dt>
<a name = "set_click_zone"></a>
@ -292,7 +355,7 @@
<strong>on_hover</strong>
</dt>
<dd>
On hover callback(self, state)
On hover callback(self, state, hover_instance)
<ul>
@ -312,7 +375,7 @@
<strong>on_mouse_hover</strong>
</dt>
<dd>
On mouse hover callback(self, state)
On mouse hover callback(self, state, hover_instance)
<ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -77,7 +78,8 @@
<h1>Module <code>Input</code></h1>
<p>Druid input text component.</p>
<p>
Carry on user text input</p>
Carry on user text input
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_input" target="_blank"><b>Example Link</b></a></p>
<h3>Info:</h3>
<ul>
<li><strong>Author</strong>: Part of code from Britzl gooey input component</li>
@ -232,7 +234,7 @@
</li>
<li><span class="parameter">click_node</span>
<span class="types"><span class="type">node</span></span>
Button node to enabled input component
Node to enabled input component
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">node</span> or <span class="type">Text</span></span>
@ -434,6 +436,11 @@
If true, call unselect on select selected input
(<em>default</em> false)
</li>
<li><span class="parameter">NO_CONSUME_INPUT_WHILE_SELECTED</span>
<span class="types"><span class="type">bool</span></span>
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)
(<em>default</em> false)
</li>
<li><span class="parameter">on_select</span>
<span class="types"><span class="type">function</span></span>
(self, button_node) Callback on input field selecting

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -74,9 +75,15 @@
<div id="content">
<h1>Module <code>LangText</code></h1>
<p>Component to handle all GUI texts
Good working with localization system</p>
<p></p>
<p>Component to wrap over GUI Text nodes with localization helpers
<p> <b># Overview #</b>
<p> • The initialization of druid.set_text_function is required to enable localization
using the localization ID.</p>
<p>
<p> • The LangText component supports up to 7 string format parameters.
This limitation exists due to certain issues with using ... arguments.
<p> <b># Notes #</b>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=texts_lang_text" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -86,8 +93,8 @@
<td class="summary">Format string with new text params on localized text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id, no_adjust)</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#init">init(self, node, locale_id[, adjust_type=downscale])</a></td>
<td class="summary"><a href="../modules/LangText.html#">LangText</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, text)</a></td>
@ -181,10 +188,10 @@
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, locale_id, no_adjust)</strong>
<strong>init(self, node, locale_id[, adjust_type=downscale])</strong>
</dt>
<dd>
Component init function
<a href="../modules/LangText.html#">LangText</a> constructor
<h3>Parameters:</h3>
@ -194,16 +201,17 @@
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The text node
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
Node name or GUI Text Node itself
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Default locale id or text from node as default
</li>
<li><span class="parameter">no_adjust</span>
<span class="types"><span class="type">bool</span></span>
If true, will not correct text size
<li><span class="parameter">adjust_type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
(<em>default</em> downscale)
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,7 +76,7 @@
<h1>Module <code>Layout</code></h1>
<p>Layout management on node</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_layout" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -97,6 +98,10 @@
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_gui_upscale">set_max_gui_upscale(self, max_gui_upscale)</a></td>
<td class="summary">Set max gui upscale for FIT adjust mode (or side).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_size">set_max_size(self, max_size)</a></td>
<td class="summary">Set maximum size of layout node</td>
</tr>
@ -259,6 +264,37 @@
</dd>
<dt>
<a name = "set_max_gui_upscale"></a>
<strong>set_max_gui_upscale(self, max_gui_upscale)</strong>
</dt>
<dd>
Set max gui upscale for FIT adjust mode (or side). It happens on bigger render gui screen
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</li>
<li><span class="parameter">max_gui_upscale</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Layout</span></span>
<a href="../modules/Layout.html#">Layout</a>
</ol>
</dd>
<dt>
<a name = "set_max_size"></a>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><strong>Progress</strong></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,9 +76,16 @@
<div id="content">
<h1>Module <code>Progress</code></h1>
<p>Basic progress bar component.</p>
<p>Druid component to handle the progress bars.</p>
<p>
For correct progress bar init it should be in max size from gui</p>
<b># Overview #</b>
<p> <b># Notes #</b>
<p> • Progress Node should be fully filled in your GUI scene node. It will be the progress maximum size
<p> • 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_
<p> • Progress bar can fill only by vertical or horizontal size. If you want make diagonal progress bar, just rotate node in GUI scene
<p> • If you have glitchy or dark texture bug with progress bar, try to disable mipmaps in your texture profiles
<p>
<a href="https://insality.github.io/druid/druid/index.html?example=general_progress_bar" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -96,7 +104,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td>
<td class="summary">Component init function</td>
<td class="summary"><a href="../modules/Progress.html#">Progress</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_max_size">set_max_size(self, max_size)</a></td>
@ -126,7 +134,7 @@
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#key">key</a></td>
<td class="summary">The progress bar direction</td>
<td class="summary">The progress bar direction.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
@ -229,7 +237,7 @@
<strong>init(self, node, key[, init_value=1])</strong>
</dt>
<dd>
Component init function
<a href="../modules/Progress.html#">Progress</a> constructor
<h3>Parameters:</h3>
@ -240,7 +248,7 @@
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span>
Progress bar fill node or node name
Node name or GUI Node itself.
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
@ -419,7 +427,8 @@
<strong>key</strong>
</dt>
<dd>
The progress bar direction
The progress bar direction.
<p> The values are: "x" or "y". (const.SIDE.X or const.SIDE.Y)
<ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,7 +76,7 @@
<h1>Module <code>RadioGroup</code></h1>
<p>Radio group module</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_checkboxes" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><strong>RichInput</strong></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>

361
docs/modules/RichText.html Normal file
View File

@ -0,0 +1,361 @@
<!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 Framework</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/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</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/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><strong>RichText</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RichText</code></h1>
<p>Druid Rich Text Custom Component.</p>
<p>
<b># Overview #</b>
<p> This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
It uses a similar syntax for tags but currently supports fewer tags.
<p> All parameters for the Rich Text component are adjusted in the GUI scene.
<p> This component uses GUI component template. (/druid/custom/rich_text/rich_text.gui).
<p> You able to customize it or make your own with the next node scructure:
<p> root
<p> - text_prefab
<p> - icon_prefab
<p> <b># Rich Text Setup #</b>
<p> • Root node size: Set the maximum width and height of the text.
<p> • Root anchor: Define the alignment of the Rich Text inside the root node size area.
<p> • Text prefab: Configure all default text parameters for the text node.
<p> • Text prefab anchor: Set the anchor for each text node (adjust this only if animating text).
<p> • Icon prefab: Configure all default node parameters for the icon node.
<p> • Icon prefab anchor: Set the anchor for each icon node (adjust this only if animating the icon).
<p> <b># Notes #</b>
<p> • Nested tags are supported
<p> <a href="https://insality.github.io/druid/druid/index.html?example=custom_rich_text" target="_blank"><b>Example Link</b></a></p>
<h3>Usage:</h3>
<ul>
<li><pre class="example">local RichText = require(&quot;druid.custom.rich_text.rich_text&quot;)
...
self.rich_text = self.druid:new(RichText, &quot;rich_text&quot;)
self.rich_text:set_text(&quot;Hello, Druid Rich Text!&quot;)
</pre></li>
<li><pre class="example">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,
anchor: number,
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&lt;number, druid.rich_text.metrics&gt;,
}
type druid.rich_text.metrics = {
width: number,
height: number,
offset_x: number|nil,
offset_y: number|nil,
node_size: vector3|nil @For images only,
}
</pre></li>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clean">clean()</a></td>
<td class="summary">Clear all created words.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_words">get_words()</a></td>
<td class="summary">Get all current words.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, template, nodes)</a></td>
<td class="summary">Rich Text component constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text">set_text(self, text)</a></td>
<td class="summary">Set text for Rich Text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#tagged">tagged(tag)</a></td>
<td class="summary">Get all words, which has a passed tag</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clean"></a>
<strong>clean()</strong>
</dt>
<dd>
Clear all created words.
</dd>
<dt>
<a name = "get_words"></a>
<strong>get_words()</strong>
</dt>
<dd>
Get all current words.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Words
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, template, nodes)</strong>
</dt>
<dd>
Rich Text component constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichText</span></span>
<a href="../modules/RichText.html#">RichText</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The Rich Text template name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The node table, if prefab was copied by gui.clone_tree()
</li>
</ul>
</dd>
<dt>
<a name = "set_text"></a>
<strong>set_text(self, text)</strong>
</dt>
<dd>
Set text for Rich Text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichText</span></span>
<a href="../modules/RichText.html#">RichText</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The text to set
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">druid.rich_text.word[]</span></span>
words</li>
<li>
<span class="types"><span class="type">druid.rich_text.lines_metrics</span></span>
line_metrics</li>
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">• color: Change text color
&lt;color=red&gt;Foobar&lt;/color&gt;
&lt;color=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/color&gt;
&lt;color=#ff0000&gt;Foobar&lt;/color&gt;
&lt;color=#ff0000ff&gt;Foobar&lt;/color&gt;
• shadow: Change text shadow
&lt;shadow=red&gt;Foobar&lt;/shadow&gt;
&lt;shadow=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/shadow&gt;
&lt;shadow=#ff0000&gt;Foobar&lt;/shadow&gt;
&lt;shadow=#ff0000ff&gt;Foobar&lt;/shadow&gt;
• outline: Change text shadow
&lt;outline=red&gt;Foobar&lt;/outline&gt;
&lt;outline=<span class="number">1.0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">1.0</span>&gt;Foobar&lt;/outline&gt;
&lt;outline=#ff0000&gt;Foobar&lt;/outline&gt;
&lt;outline=#ff0000ff&gt;Foobar&lt;/outline&gt;
• font: Change font
&lt;font=MyCoolFont&gt;Foobar&lt;/font&gt;
• size: Change text size, relative to default size
&lt;size=<span class="number">2</span>&gt;Twice as large&lt;/size&gt;
• br: Insert a line <span class="keyword">break</span>
&lt;br/&gt;
• nobr: Prevent the text from breaking
Words &lt;nobr&gt;inside tag&lt;/nobr&gt; won't <span class="keyword">break</span>
• img: Display image
&lt;img=texture:image/&gt;
&lt;img=texture:image,size/&gt;
&lt;img=texture:image,width,height/&gt;</pre>
</ul>
</dd>
<dt>
<a name = "tagged"></a>
<strong>tagged(tag)</strong>
</dt>
<dd>
Get all words, which has a passed tag
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">tag</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Words
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><strong>Scroll</strong></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -77,12 +78,26 @@
<h1>Module <code>Scroll</code></h1>
<p>Component to handle scroll content.</p>
<p>
Scroll consist from two nodes: scroll parent and scroll input
Scroll input the user input zone, it's static
Scroll parent the scroll moving part, it will change position.
Setup initial scroll size by changing scroll parent size. If scroll parent
size will be less than scroll_input size, no scroll is available. For scroll
parent size should be more than input size</p>
<b># Overview #</b>
<p> The Scroll component is designed to handle scrollable content and consists of two nodes: the scroll parent and the scroll input.
<p> The scroll input represents the user input zone and remains static.
<p> The scroll parent is the movable part of the scroll and changes its position.
<p> 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.
<p> <b># Notes #</b>
<p> • 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.
<p> • "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.
<p> • 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.
<p> • Inertial scrolling mode can be enabled or disabled using the scroll:set_inert(state) method.
<p> • The extra stretch size can be adjusted using the scroll:set_extra_stretch_size method.
<p> • Multitouch is required for scrolling. The scroll component correctly handles
touch ID swaps while dragging the scroll.
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_scroll" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -102,7 +117,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, view_node, content_node)</a></td>
<td class="summary">Scroll constructor</td>
<td class="summary"><a href="../modules/Scroll.html#">Scroll</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_inert">is_inert(self)</a></td>
@ -319,7 +334,7 @@
<strong>init(self, view_node, content_node)</strong>
</dt>
<dd>
Scroll constructor
<a href="../modules/Scroll.html#">Scroll</a> constructor
<h3>Parameters:</h3>
@ -329,11 +344,11 @@
<a href="../modules/Scroll.html#">Scroll</a>
</li>
<li><span class="parameter">view_node</span>
<span class="types"><span class="type">node</span></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
GUI view scroll node
</li>
<li><span class="parameter">content_node</span>
<span class="types"><span class="type">node</span></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
GUI content scroll node
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><strong>Slider</strong></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/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,7 +76,7 @@
<h1>Module <code>Slider</code></h1>
<p>Druid slider component</p>
<p></p>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_sliders" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><strong>StaticGrid</strong></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,9 +76,26 @@
<div id="content">
<h1>Module <code>StaticGrid</code></h1>
<p>Component to handle placing components by row and columns.</p>
<p>Component to handle component's position by row and columns.</p>
<p>
Grid can anchor your elements, get content size and other</p>
## Overview ##
<p> 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.
<p> ## Notes ##
<p> • In a static grid, the node size remains constant, enabling the calculation of node
positions before placement. Nodes can be placed with gaps between them.
<p> • The static grid can automatically shift elements when nodes are added or removed.
<p> • When a node is added, the grid will set the node's parent to the specified parent_node.
<p> • You can obtain an array of positions for each element, which can be used to set
points of interest in a scroll component.
<p> • The size of all elements can be retrieved for setting up the size in a scroll component.
<p> • The grid can be bound to a scroll component for automatic resizing of the scroll content size.
<p> • The pivot of the parent_node affects the node placement within the grid.
<p> • A prefab node is used to determine the node size and anchor.
<p> • 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().
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_grid" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -120,7 +138,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent, element[, in_row=1])</a></td>
<td class="summary">Component init function</td>
<td class="summary"><a href="../modules/StaticGrid.html#">StaticGrid</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
@ -483,7 +501,7 @@
<strong>init(self, parent, element[, in_row=1])</strong>
</dt>
<dd>
Component init function
<a href="../modules/StaticGrid.html#">StaticGrid</a> constructor
<h3>Parameters:</h3>
@ -493,8 +511,8 @@
<a href="../modules/StaticGrid.html#">StaticGrid</a>
</li>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">Node</span></span>
The GUI Node container, where grid's items will be placed
</li>
<li><span class="parameter">element</span>
<span class="types"><span class="type">node</span></span>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -78,7 +79,8 @@
<p>Component to handle swipe gestures on node.</p>
<p>
Swipe will be triggered, if swipe was started and
ended on one node</p>
ended on one node
<p> <a href="https://insality.github.io/druid/druid/index.html?example=general_swipe" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -48,6 +48,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -61,13 +62,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><strong>Text</strong></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
@ -75,10 +76,26 @@
<div id="content">
<h1>Module <code>Text</code></h1>
<p>Component to handle all GUI texts.</p>
<p>
Druid text can adjust itself for text node size
Text will never will be outside of his text size (even multiline)</p>
<p>Component for Wrapping GUI Text Nodes: Druid Text
<p> ## Overview ##
<p> Druid Text is a component that provides various adjustment modes for text nodes.</p>
<p> It allows text to be scaled down to fit within the size of the text node.
<p> ## Notes ##
<p> • The text pivot can be changed using the text:set_pivot method.
The anchoring will be inside the text node's area size.
<p> • 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:
<p> - const.TEXT_ADJUST.DOWNSCALE: Changes the text's scale to fit within the text node's size.
<p> - const.TEXT_ADJUST.TRIM: Trims the text with a postfix (default: "...", can be overridden in styles)
to fit within the text node's size.
<p> - const.TEXT_ADJUST.NO_ADJUST: No adjustment is applied, similar
to the default Defold Text Node behavior.
<p> - 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.
<p> - const.TEXT_ADJUST.SCROLL: Changes the text's pivot to imitate scrolling within the text box.
For better effect, use with a stencil node.
<p> - const.TEXT_ADJUST.SCALE_THEN_SCROLL: Combines two modes: limited downscale first, then scroll.
<p> <a href="https://insality.github.io/druid/druid/index.html?example=texts_general" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
@ -92,8 +109,8 @@
<td class="summary">Calculate text width with font with respect to trailing space</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node[, value[, adjust_type=0]])</a></td>
<td class="summary">Component init function</td>
<td class="name" nowrap><a href="#init">init(self, node[, value[, adjust_type=downscale]])</a></td>
<td class="summary"><a href="../modules/Text.html#">Text</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_multiline">is_multiline(self)</a></td>
@ -163,7 +180,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_text_scale">on_update_text_scale</a></td>
<td class="summary">On adjust text size callback(self, new_scale)</td>
<td class="summary">On adjust text size callback(self, new_scale, text_metrics)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
@ -260,10 +277,10 @@
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node[, value[, adjust_type=0]])</strong>
<strong>init(self, node[, value[, adjust_type=downscale]])</strong>
</dt>
<dd>
Component init function
<a href="../modules/Text.html#">Text</a> constructor
<h3>Parameters:</h3>
@ -273,8 +290,8 @@
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Text.html#node">node</a></span>
Gui text node
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Text.html#node">node</a></span>
Node name or GUI Text Node itself
</li>
<li><span class="parameter">value</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
@ -282,9 +299,9 @@
(<em>optional</em>)
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">int</span></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
(<em>default</em> 0)
(<em>default</em> downscale)
</li>
</ul>
@ -705,7 +722,7 @@
<strong>on_update_text_scale</strong>
</dt>
<dd>
On adjust text size callback(self, new_scale)
On adjust text size callback(self, new_scale, text_metrics)
<ul>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -47,6 +47,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -60,13 +61,13 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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><strong>Timer</strong></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
@ -46,6 +46,7 @@
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><strong>Druid</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
@ -59,66 +60,92 @@
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</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/Timer.html">Timer</a></li>
<li><strong>druid</strong></li>
</ul>
</div>
<div id="content">
<h1>Module <code>druid</code></h1>
<p>Druid UI Library.</p>
<h1>Module <code>Druid</code></h1>
<p>Druid UI Component Framework.</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")
<b># Overview #</b>
<p> 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.
<p> To start using Druid, please refer to the Usage section below.
<p> <b># Notes #</b>
<p> • Each Druid instance maintains the self context from the constructor and passes it to each Druid callback.
<p> See next: <a href="../modules/DruidInstance.html#">DruidInstance</a>
</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local druid = require(&quot;druid.druid&quot;)
local function on_play(self)
print(&quot;Gonna play!&quot;)
end
function init(self)
self.druid = druid.new(self)
self.druid:new_button(&quot;button_play&quot;, on_play)
end
</p>
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
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#new">new(context[, style])</a></td>
<td class="summary">Create Druid instance.</td>
<td class="name" nowrap><a href="#druid.new">druid.new(context[, style])</a></td>
<td class="summary">Create a new Druid instance for creating GUI components.</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>
<td class="name" nowrap><a href="#druid.on_language_change">druid.on_language_change()</a></td>
<td class="summary">Call this function when the game language changes.</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>
<td class="name" nowrap><a href="#druid.on_window_callback">druid.on_window_callback(event)</a></td>
<td class="summary">Set the window callback to enable on_focus_gain and on_focus_lost functions.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Register external druid component.</td>
<td class="name" nowrap><a href="#druid.register">druid.register(name, module)</a></td>
<td class="summary">Register a new external Druid component.</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>
<td class="name" nowrap><a href="#druid.set_default_style">druid.set_default_style(style)</a></td>
<td class="summary">Set your own default style for all Druid instances.</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>
<td class="name" nowrap><a href="#druid.set_sound_function">druid.set_sound_function(callback)</a></td>
<td class="summary">Set the Druid sound function to play UI sounds if used.</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>
<td class="name" nowrap><a href="#druid.set_text_function">druid.set_text_function(callback)</a></td>
<td class="summary">Set the text function for the LangText component.</td>
</tr>
</table>
@ -130,22 +157,22 @@
<dl class="function">
<dt>
<a name = "new"></a>
<strong>new(context[, style])</strong>
<a name = "druid.new"></a>
<strong>druid.new(context[, style])</strong>
</dt>
<dd>
Create Druid instance.
Create a new Druid instance for creating GUI components.
<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
The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks.
</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
The Druid style table to override style parameters for this Druid instance.
(<em>optional</em>)
</li>
</ul>
@ -154,35 +181,47 @@
<ol>
<span class="types"><span class="type">druid_instance</span></span>
Druid instance
The Druid instance <a href="../modules/DruidInstance.html#">DruidInstance</a>.
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
<span class="keyword">function</span> init(self)
self.druid = druid.new(self)
<span class="keyword">end</span></pre>
</ul>
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
<a name = "druid.on_language_change"></a>
<strong>druid.on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
Call this function when the game language changes.
<p> This function will translate all current LangText components.
<h3>Usage:</h3>
<ul>
<pre class="example">druid.on_language_change()</pre>
</ul>
</dd>
<dt>
<a name = "on_window_callback"></a>
<strong>on_window_callback(event)</strong>
<a name = "druid.on_window_callback"></a>
<strong>druid.on_window_callback(event)</strong>
</dt>
<dd>
Callback on global window event.
Used to trigger on_focus_lost and on_focus_gain
Set the window callback to enable on_focus_gain and on_focus_lost functions.
<p> This is used to trigger the on_focus_lost and on_focus_gain functions in Druid components.
<h3>Parameters:</h3>
@ -196,16 +235,23 @@
<h3>Usage:</h3>
<ul>
<pre class="example">window.set_listener(<span class="keyword">function</span>(_, event)
druid.on_window_callback(event)
<span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
<a name = "druid.register"></a>
<strong>druid.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(...)`
Register a new external Druid component.
<p> 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.
<h3>Parameters:</h3>
@ -223,14 +269,24 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> my_component = <span class="global">require</span>(<span class="string">"path.to.my.component"</span>)
druid.register(<span class="string">"my_component"</span>, my_component)
...
<span class="keyword">local</span> druid = druid.new(self)
<span class="keyword">local</span> component_instance = self.druid:new_my_component(...)</pre>
</ul>
</dd>
<dt>
<a name = "set_default_style"></a>
<strong>set_default_style(style)</strong>
<a name = "druid.set_default_style"></a>
<strong>druid.set_default_style(style)</strong>
</dt>
<dd>
Set new default style.
Set your own default style for all Druid instances.
<p> 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.
<h3>Parameters:</h3>
@ -244,16 +300,21 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> my_style = <span class="global">require</span>(<span class="string">"path.to.my.style"</span>)
druid.set_default_style(my_style)</pre>
</ul>
</dd>
<dt>
<a name = "set_sound_function"></a>
<strong>set_sound_function(callback)</strong>
<a name = "druid.set_sound_function"></a>
<strong>druid.set_sound_function(callback)</strong>
</dt>
<dd>
Set sound function.
Component will call this function to
play sound by sound_id
Set the Druid sound function to play UI sounds if used.
<p> 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).
<h3>Parameters:</h3>
@ -267,17 +328,22 @@
<h3>Usage:</h3>
<ul>
<pre class="example">druid.set_sound_function(<span class="keyword">function</span>(sound_id)
sound.play(sound_id) <span class="comment">-- Replace with your real function
</span><span class="keyword">end</span>)</pre>
</ul>
</dd>
<dt>
<a name = "set_text_function"></a>
<strong>set_text_function(callback)</strong>
<a name = "druid.set_text_function"></a>
<strong>druid.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
Set the text function for the LangText component.
<p> The Druid locale component will call this function to get translated text.
After setting the text function, all existing locale components will be updated.
<h3>Parameters:</h3>
@ -291,6 +357,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example">druid.set_text_function(<span class="keyword">function</span>(text_id)
<span class="keyword">return</span> lang_data[text_id] <span class="comment">-- Replace with your real function
</span><span class="keyword">end</span>)</pre>
</ul>
</dd>
</dl>

View File

@ -963,8 +963,8 @@ function druid__rich_text.init(self, template, nodes) end
--- Set text for Rich Text
---@param self druid.rich_text @{RichText}
---@param text string The text to set
---@return table words
---@return table line_metrics
---@return druid.rich_text.word[] words
---@return druid.rich_text.lines_metrics line_metrics
function druid__rich_text.set_text(self, text) end
--- Get all words, which has a passed tag
@ -1729,7 +1729,7 @@ function helper.get_screen_aspect_koef() end
--- Get text metric from GUI node.
---@param text_node Node
---@return GUITextMetrics Fields: width, height, max_ascent, max_descent
---@return pepepe
function helper.get_text_metrics_from_node(text_node) end
--- Add value to array with shift policy