Update docs and example page

This commit is contained in:
Insality 2024-10-17 02:02:07 +03:00
parent 3579370287
commit dd41aab962
46 changed files with 10684 additions and 540 deletions

View File

@ -1 +1 @@
{"content":[{"name":"game.projectc","size":4141,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":23248,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":608384,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":26065,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]} {"content":[{"name":"game.projectc","size":4491,"pieces":[{"name":"game0.projectc","offset":0}]},{"name":"game.arci","size":11968,"pieces":[{"name":"game0.arci","offset":0}]},{"name":"game.arcd","size":3549174,"pieces":[{"name":"game0.arcd","offset":0},{"name":"game1.arcd","offset":2097152}]},{"name":"game.dmanifest","size":13396,"pieces":[{"name":"game0.dmanifest","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game0.public.der","offset":0}]}],"total_size":3579191}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,24 +1,25 @@
[project] [project]
title = druid title = Druid
version = 0.11.718 version = 1.0.0
write_log = 0 write_log = 0
compress_archive = 1 compress_archive = 1
publisher = Insality publisher = Insality
developer = Insality developer = Maksim Tuprikov
commit_sha = 9132dc477b645d674ec21efbfcf85f48ef0ea8a6 custom_resources = /example/locales
build_date = 2023-10-20T08:23:33Z commit_sha = 3579370287f00a1a03e89dbb01a2a5b953e83991
title_as_file_name = druid build_date = 2024-10-16T22:59:05Z
title_as_file_name = Druid
[display] [display]
width = 600 width = 1920
height = 900 height = 1080
high_dpi = 1 high_dpi = 1
samples = 0 samples = 0
fullscreen = 0 fullscreen = 0
update_frequency = 0 update_frequency = 0
swap_interval = 1 swap_interval = 1
vsync = 1 vsync = 1
display_profiles = /example/custom.display_profilesc display_profiles = /builtins/render/default.display_profilesc
dynamic_orientation = 1 dynamic_orientation = 1
display_device_info = 0 display_device_info = 0
@ -51,7 +52,7 @@ velocity_threshold = 1
max_fixed_timesteps = 2 max_fixed_timesteps = 2
[bootstrap] [bootstrap]
main_collection = /example/example.collectionc main_collection = /example/druid.collectionc
render = /builtins/render/default.renderc render = /builtins/render/default.renderc
[graphics] [graphics]
@ -59,8 +60,9 @@ default_texture_min_filter = linear
default_texture_mag_filter = linear default_texture_mag_filter = linear
max_draw_calls = 128 max_draw_calls = 128
max_characters = 8192 max_characters = 8192
max_font_batches = 128
max_debug_vertices = 10000 max_debug_vertices = 10000
texture_profiles = /example/custom.texture_profiles texture_profiles = /builtins/graphics/default.texture_profiles
verify_graphics_calls = 0 verify_graphics_calls = 0
memory_size = 512 memory_size = 512
@ -84,7 +86,7 @@ max_resources = 1024
repeat_delay = 0.5 repeat_delay = 0.5
repeat_interval = 0.2 repeat_interval = 0.2
gamepads = /builtins/input/default.gamepadsc gamepads = /builtins/input/default.gamepadsc
game_binding = /input/game.input_bindingc game_binding = /builtins/input/all.input_bindingc
use_accelerometer = 0 use_accelerometer = 0
[sprite] [sprite]
@ -123,13 +125,14 @@ pre_renderered_icons = 0
bundle_identifier = example.unnamed bundle_identifier = example.unnamed
bundle_name = bundle_name =
infoplist = /builtins/manifests/ios/Info.plist infoplist = /builtins/manifests/ios/Info.plist
privacymanifest = /builtins/manifests/ios/PrivacyInfo.xcprivacy
default_language = en default_language = en
localizations = en localizations = en
[android] [android]
version_code = 718 version_code = 806
minimum_sdk_version = 19 minimum_sdk_version = 19
target_sdk_version = 33 target_sdk_version = 34
package = com.insality.druid package = com.insality.druid
gcm_sender_id = gcm_sender_id =
manifest = /builtins/manifests/android/AndroidManifest.xml manifest = /builtins/manifests/android/AndroidManifest.xml
@ -139,10 +142,12 @@ immersive_mode = 0
display_cutout = 1 display_cutout = 1
debuggable = 0 debuggable = 0
proguard = proguard =
extract_native_libs = 1
[osx] [osx]
app_icon = app_icon =
infoplist = /builtins/manifests/osx/Info.plist infoplist = /builtins/manifests/osx/Info.plist
privacymanifest = /builtins/manifests/osx/PrivacyInfo.xcprivacy
bundle_identifier = example.unnamed bundle_identifier = example.unnamed
bundle_name = bundle_name =
bundle_version = 1 bundle_version = 1
@ -156,7 +161,7 @@ app_icon =
custom_heap_size = 0 custom_heap_size = 0
heap_size = 64 heap_size = 64
htmlfile = /builtins/manifests/web/engine_template.html htmlfile = /builtins/manifests/web/engine_template.html
cssfile = /example/light_theme.css cssfile = /builtins/manifests/web/dark_theme.css
splash_image = /media/druid_logo.png splash_image = /media/druid_logo.png
archive_location_prefix = archive archive_location_prefix = archive
archive_location_suffix = archive_location_suffix =
@ -164,17 +169,14 @@ engine_arguments = --verify-graphics-calls=false
wasm_streaming = 0 wasm_streaming = 0
show_fullscreen_button = 0 show_fullscreen_button = 0
show_made_with_defold = 0 show_made_with_defold = 0
show_console_banner = 1 show_console_banner = 0
scale_mode = fit scale_mode = stretch
[particle_fx] [particle_fx]
max_count = 0 max_count = 0
max_emitter_count = 0 max_emitter_count = 0
max_particle_count = 0 max_particle_count = 0
[iap]
auto_finish_transactions = 1
[network] [network]
http_timeout = 0 http_timeout = 0
ssl_certificates = ssl_certificates =
@ -198,6 +200,7 @@ sleep_between_server_updates = 0
[liveupdate] [liveupdate]
settings = /liveupdate.settings settings = /liveupdate.settings
enabled = 1 enabled = 1
mount_on_start = 1
[tilemap] [tilemap]
max_count = 0 max_count = 0
@ -206,6 +209,7 @@ max_tile_count = 0
[engine] [engine]
run_while_iconified = 0 run_while_iconified = 0
fixed_update_frequency = 60 fixed_update_frequency = 60
max_time_step = 0.5
[druid] [druid]
no_auto_input = 0 no_auto_input = 0
@ -223,5 +227,13 @@ input_scroll_up = mouse_wheel_up
input_scroll_down = mouse_wheel_down input_scroll_down = mouse_wheel_down
[native_extension] [native_extension]
app_manifest = /example/game.appmanifest app_manifest =
[saver]
autosave_timer = 2
[lang]
path = /example/locales
langs = en,ru,es,de,fr,ja,pt,it,kr,zh
default = es

Binary file not shown.

View File

@ -1,3 +1,93 @@
/*
* 'archive_location_filter':
* Filter function that will run for each archive path.
*
* 'unsupported_webgl_callback':
* Function that is called if WebGL is not supported.
*
* 'engine_arguments':
* List of arguments (strings) that will be passed to the engine.
*
* 'custom_heap_size':
* Number of bytes specifying the memory heap size.
*
* 'disable_context_menu':
* Disables the right-click context menu on the canvas element if true.
*
* 'retry_time':
* Pause before retry file loading after error.
*
* 'retry_count':
* How many attempts we do when trying to download a file.
*
* 'can_not_download_file_callback':
* Function that is called if you can't download file after 'retry_count' attempts.
*
* 'exe_name':
* Executable name which used for find right binary to load
*
* 'resize_window_callback':
* Function that is called when resize/orientationchanges/focus events happened
*/
var CUSTOM_PARAMETERS = {
archive_location_filter: function( path ) {
return ("archive" + path + "");
},
engine_arguments: ["--verify-graphics-calls=false",],
custom_heap_size: 67108864,
full_screen_container: "#canvas-container",
disable_context_menu: true,
retry_time:1.0,
retry_count:10,
unsupported_webgl_callback: function() {
var e = document.getElementById("webgl-not-supported");
e.style.display = "block";
},
resize_window_callback: function() {
var is_iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var buttonHeight = 0;
var prevInnerWidth = -1;
var prevInnerHeight = -1;
// Hack for iOS when exit from Fullscreen mode
if (is_iOS) {
window.scrollTo(0, 0);
}
var app_container = document.getElementById('app-container');
var game_canvas = document.getElementById('canvas');
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight - buttonHeight;
if (prevInnerWidth == innerWidth && prevInnerHeight == innerHeight)
{
return;
}
prevInnerWidth = innerWidth;
prevInnerHeight = innerHeight;
var width = 1920;
var height = 1080;
var targetRatio = width / height;
var actualRatio = innerWidth / innerHeight;
//Stretch
width = innerWidth;
height = innerHeight;
var dpi = 1;
dpi = window.devicePixelRatio || 1;
app_container.style.width = width + "px";
app_container.style.height = height + buttonHeight + "px";
game_canvas.width = Math.floor(width * dpi);
game_canvas.height = Math.floor(height * dpi);
}
}
// file downloader // file downloader
// wraps XMLHttpRequest and adds retry support and progress updates when the // wraps XMLHttpRequest and adds retry support and progress updates when the
// content is gzipped (gzipped content doesn't report a computable content length // content is gzipped (gzipped content doesn't report a computable content length
@ -9,31 +99,36 @@ var FileLoader = {
}, },
// do xhr request with retries // do xhr request with retries
request: function(url, method, responseType, currentAttempt) { request: function(url, method, responseType, currentAttempt) {
if (typeof method === 'undefined') throw "No method specified"; if (typeof method === 'undefined') throw TypeError("No method specified");
if (typeof method === 'responseType') throw "No responseType specified"; if (typeof method === 'responseType') throw TypeError("No responseType specified");
if (typeof currentAttempt === 'undefined') currentAttempt = 0; if (typeof currentAttempt === 'undefined') currentAttempt = 0;
var obj = { var obj = {
send: function() { send: function() {
var onprogress = this.onprogress; var onprogress = this.onprogress;
var onload = this.onload; var onload = this.onload;
var onerror = this.onerror; var onerror = this.onerror;
var onretry = this.onretry;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr._loadedSize = 0;
xhr.open(method, url, true); xhr.open(method, url, true);
xhr.responseType = responseType; xhr.responseType = responseType;
xhr.onprogress = function(e) { xhr.onprogress = function(event) {
if (onprogress) onprogress(xhr, e); if (onprogress) onprogress(xhr, event, xhr._loadedSize);
xhr._loadedSize = event.loaded;
}; };
xhr.onerror = function(e) { xhr.onerror = function(event) {
if (currentAttempt == FileLoader.options.retryCount) { if (currentAttempt == FileLoader.options.retryCount) {
if (onerror) onerror(xhr, e); if (onerror) onerror(xhr, event);
return; return;
} }
currentAttempt = currentAttempt + 1; if (onretry) onretry(xhr, event, xhr._loadedSize, currentAttempt);
xhr._loadedSize = 0;
currentAttempt += 1;
setTimeout(obj.send.bind(obj), FileLoader.options.retryInterval); setTimeout(obj.send.bind(obj), FileLoader.options.retryInterval);
}; };
xhr.onload = function(e) { xhr.onload = function(event) {
if (onload) onload(xhr, e); if (onload) onload(xhr, event);
}; };
xhr.send(null); xhr.send(null);
} }
@ -60,29 +155,21 @@ var FileLoader = {
request.send(); request.send();
}, },
// Do HTTP GET request // Do HTTP GET request
// onprogress(loaded, total) // onprogress(loadedDelta)
// onerror(error) // onerror(error)
// onload(response) // onload(response)
load: function(url, responseType, estimatedSize, onprogress, onerror, onload) { // onretry(loadedSize, currentAttempt)
load: function(url, responseType, onprogress, onerror, onload, onretry) {
var request = FileLoader.request(url, "GET", responseType); var request = FileLoader.request(url, "GET", responseType);
request.onprogress = function(xhr, e) { request.onprogress = function(xhr, e, ls) {
if (e.lengthComputable) { var delta = e.loaded - ls;
onprogress(e.loaded, e.total); onprogress(delta);
return;
}
var contentLength = xhr.getResponseHeader('content-length');
var size = contentLength != undefined ? contentLength : estimatedSize;
if (size) {
onprogress(e.loaded, size);
} else {
onprogress(e.loaded, e.loaded);
}
}; };
request.onerror = function(xhr, e) { request.onerror = function(xhr, e) {
onerror("Error loading '" + url + "' (" + e + ")"); onerror("Error loading '" + url + "' (" + e + ")");
}; };
request.onload = function(xhr, e) { request.onload = function(xhr, e) {
if (xhr.readyState === 4) { if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) { if (xhr.status === 200) {
var res = xhr.response; var res = xhr.response;
if (responseType == "json" && typeof res === "string") { if (responseType == "json" && typeof res === "string") {
@ -95,112 +182,144 @@ var FileLoader = {
} }
} }
}; };
request.onretry = function(xhr, event, loadedSize, currentAttempt) {
onretry(loadedSize, currentAttempt);
}
request.send(); request.send();
} }
}; };
var EngineLoader = { var EngineLoader = {
wasm_size: 2000000, wasm_size: 2374239,
wasmjs_size: 250000, wasmjs_size: 340441,
asmjs_size: 4000000, asmjs_size: 4000000,
wasm_instantiate_progress: 0,
stream_wasm: false, stream_wasm: "false" === "true",
loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) { updateWasmInstantiateProgress: function(totalDownloadedSize) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size, EngineLoader.wasm_instantiate_progress = totalDownloadedSize * 0.1;
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); }, },
// load and instantiate .wasm file using XMLHttpRequest
loadAndInstantiateWasmAsync: function(src, imports, successCallback) {
FileLoader.load(src, "arraybuffer",
function(delta) {
ProgressUpdater.updateCurrent(delta);
},
function(error) { throw error; }, function(error) { throw error; },
function(wasm) { function(wasm) {
Module.instantiateWasm = function(imports, successCallback) { if (wasm.byteLength != EngineLoader.wasm_size) {
throw "Invalid wasm size. Expected: " + EngineLoader.wasm_size + ", actual: " + wasm.byteLength;
}
var wasmInstantiate = WebAssembly.instantiate(new Uint8Array(wasm), imports).then(function(output) { var wasmInstantiate = WebAssembly.instantiate(new Uint8Array(wasm), imports).then(function(output) {
successCallback(output.instance); successCallback(output.instance);
}).catch(function(e) { }).catch(function(e) {
console.log('wasm instantiation failed! ' + e); console.log('wasm instantiation failed! ' + e);
throw e; throw e;
}); });
return {}; // Compiling asynchronously, no exports. },
} function(loadedDelta, currentAttempt){
callback(); ProgressUpdater.updateCurrent(-loadedDelta);
}); });
}, },
setupWasmStreamAsync: async function(src, fromProgress, toProgress) { // stream and instantiate .wasm file
streamAndInstantiateWasmAsync: async function(src, imports, successCallback) {
// https://stackoverflow.com/a/69179454 // https://stackoverflow.com/a/69179454
var fetchFn = fetch; var fetchFn = fetch;
if (typeof TransformStream === "function" && ReadableStream.prototype.pipeThrough) { if (typeof TransformStream === "function" && ReadableStream.prototype.pipeThrough) {
async function fetchWithProgress(path) { async function fetchWithProgress(path) {
const response = await fetch(path); const response = await fetch(path);
// May be incorrect if compressed if (response.ok) {
var contentLength = response.headers.get("Content-Length");
if (!contentLength){
contentLength = EngineLoader.wasm_size;
}
const total = parseInt(contentLength, 10);
let bytesLoaded = 0;
const ts = new TransformStream({ const ts = new TransformStream({
transform (chunk, controller) { transform (chunk, controller) {
bytesLoaded += chunk.byteLength; ProgressUpdater.updateCurrent(chunk.byteLength);
Progress.calculateProgress(fromProgress, toProgress, bytesLoaded, total); controller.enqueue(chunk);
controller.enqueue(chunk)
} }
}); });
return new Response(response.body.pipeThrough(ts), response); return new Response(response.body.pipeThrough(ts), response);
} else {
return new Response(null, response);
}
} }
fetchFn = fetchWithProgress; fetchFn = fetchWithProgress;
} }
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetchFn(src), imports).then(function(output) { WebAssembly.instantiateStreaming(fetchFn(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1); ProgressUpdater.updateCurrent(EngineLoader.wasm_instantiate_progress);
successCallback(output.instance); successCallback(output.instance);
}).catch(function(e) { }).catch(function(e) {
console.log('wasm streaming instantiation failed! ' + e); console.log('wasm streaming instantiation failed! ' + e);
throw e; console.log('Fallback to wasm loading');
EngineLoader.loadAndInstantiateWasmAsync(src, imports, successCallback);
}); });
return {}; // Compiling asynchronously, no exports.
}
}, },
// instantiate the .wasm file either by streaming it or first loading and then instantiate it // 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 // https://github.com/emscripten-core/emscripten/blob/main/test/manual_wasm_instantiate.html
loadWasmAsync: function(exeName) { loadWasmAsync: function(exeName) {
Module.instantiateWasm = function(imports, successCallback) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) { if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.setupWasmStreamAsync(exeName + ".wasm", 10, 50); EngineLoader.streamAndInstantiateWasmAsync(exeName + ".wasm", imports, successCallback);
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 0, 10);
} }
else { else {
EngineLoader.loadAndInstantiateWasmAsync(exeName + ".wasm", 0, 40, function() { EngineLoader.loadAndInstantiateWasmAsync(exeName + ".wasm", imports, successCallback);
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js', EngineLoader.wasmjs_size, 40, 50);
});
} }
return {}; // Compiling asynchronously, no exports.
};
EngineLoader.loadAndRunScriptAsync(exeName + '_wasm.js');
}, },
loadAsmJsAsync: function(exeName) { loadAsmJsAsync: function(exeName) {
EngineLoader.loadAndRunScriptAsync(exeName + '_asmjs.js', EngineLoader.asmjs_size, 0, 50); EngineLoader.loadAndRunScriptAsync(exeName + '_asmjs.js');
}, },
// load and start engine script (asm.js or wasm.js) // load and start engine script (asm.js or wasm.js)
loadAndRunScriptAsync: function(src, estimatedSize, fromProgress, toProgress) { loadAndRunScriptAsync: function(src) {
FileLoader.load(src, "text", estimatedSize, FileLoader.load(src, "text",
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); }, function(delta) {
ProgressUpdater.updateCurrent(delta);
},
function(error) { throw error; }, function(error) { throw error; },
function(response) { function(response) {
var tag = document.createElement("script"); var tag = document.createElement("script");
tag.text = response; tag.text = response;
document.body.appendChild(tag); document.body.appendChild(tag);
},
function(loadedDelta, currentAttempt){
ProgressUpdater.updateCurrent(-loadedDelta);
}); });
}, },
// load engine (asm.js or wasm.js + wasm) // left as entrypoint for backward capability
// start loading archive_files.json
// after receiving it - start loading engine and data concurrently
load: function(appCanvasId, exeName) { load: function(appCanvasId, exeName) {
Progress.addProgress(Module.setupCanvas(appCanvasId)); ProgressView.addProgress(Module.setupCanvas(appCanvasId));
if (Module['isWASMSupported']) { CUSTOM_PARAMETERS['exe_name'] = exeName;
EngineLoader.loadWasmAsync(exeName);
} else { FileLoader.options.retryCount = CUSTOM_PARAMETERS["retry_count"];
EngineLoader.loadAsmJsAsync(exeName); FileLoader.options.retryInterval = CUSTOM_PARAMETERS["retry_time"] * 1000;
if (typeof CUSTOM_PARAMETERS["can_not_download_file_callback"] === "function") {
GameArchiveLoader.addFileDownloadErrorListener(CUSTOM_PARAMETERS["can_not_download_file_callback"]);
}
// Load and assemble archive
GameArchiveLoader.addFileLoadedListener(Module.onArchiveFileLoaded);
GameArchiveLoader.addArchiveLoadedListener(Module.onArchiveLoaded);
GameArchiveLoader.setFileLocationFilter(CUSTOM_PARAMETERS["archive_location_filter"]);
GameArchiveLoader.loadArchiveDescription('/archive_files.json');
// move resize callback setup here to make possible to override callback
// from outside of dmloader.js
if (typeof CUSTOM_PARAMETERS["resize_window_callback"] === "function") {
var callback = CUSTOM_PARAMETERS["resize_window_callback"]
callback();
window.addEventListener('resize', callback, false);
window.addEventListener('orientationchange', callback, false);
window.addEventListener('focus', callback, false);
} }
} }
} }
@ -232,9 +351,6 @@ var GameArchiveLoader = {
_onArchiveLoadedListeners:[], // signature: void _onArchiveLoadedListeners:[], // signature: void
_onFileDownloadErrorListeners: [], // signature: name _onFileDownloadErrorListeners: [], // signature: name
_currentDownloadBytes: 0,
_totalDownloadBytes: 0,
_archiveLocationFilter: function(path) { return "split" + path; }, _archiveLocationFilter: function(path) { return "split" + path; },
cleanUp: function() { cleanUp: function() {
@ -244,13 +360,10 @@ var GameArchiveLoader = {
this._onGameArchiveLoaderCompletedListeners = []; this._onGameArchiveLoaderCompletedListeners = [];
this._onAllTargetsBuiltListeners = []; this._onAllTargetsBuiltListeners = [];
this._onFileDownloadErrorListeners = []; this._onFileDownloadErrorListeners = [];
this._currentDownloadBytes = 0;
this._totalDownloadBytes = 0;
}, },
addListener: function(list, callback) { addListener: function(list, callback) {
if (typeof callback !== 'function') throw "Invalid callback registration"; if (typeof callback !== 'function') throw TypeError("Invalid callback registration");
list.push(callback); list.push(callback);
}, },
notifyListeners: function(list, data) { notifyListeners: function(list, data) {
@ -292,22 +405,31 @@ var GameArchiveLoader = {
FileLoader.load( FileLoader.load(
this._archiveLocationFilter(descriptionUrl), this._archiveLocationFilter(descriptionUrl),
"json", "json",
undefined, function (delta) { },
function (loaded, total) { },
function (error) { GameArchiveLoader.notifyFileDownloadError(descriptionUrl); }, function (error) { GameArchiveLoader.notifyFileDownloadError(descriptionUrl); },
function (json) { GameArchiveLoader.onReceiveDescription(json); }); function (json) { GameArchiveLoader.onReceiveDescription(json); },
function (loadedDelta, currentAttempt) { });
}, },
onReceiveDescription: function(json) { onReceiveDescription: function(json) {
var totalSize = json.total_size;
var exeName = CUSTOM_PARAMETERS['exe_name'];
this._files = json.content; this._files = json.content;
this._totalDownloadBytes = 0;
this._currentDownloadBytes = 0;
// calculate total download size of all files var isWASMSupported = Module['isWASMSupported'];
for(var i=0; i<this._files.length; ++i) { if (isWASMSupported) {
this._totalDownloadBytes += this._files[i].size; EngineLoader.loadWasmAsync(exeName);
totalSize += EngineLoader.wasm_size + EngineLoader.wasmjs_size;
} else {
EngineLoader.loadAsmJsAsync(exeName);
totalSize += EngineLoader.asmjs_size;
} }
this.downloadContent(); this.downloadContent();
ProgressUpdater.resetCurrent();
if (isWASMSupported) {
EngineLoader.updateWasmInstantiateProgress(totalSize);
}
ProgressUpdater.setupTotal(totalSize + EngineLoader.wasm_instantiate_progress);
}, },
downloadContent: function() { downloadContent: function() {
@ -327,30 +449,25 @@ var GameArchiveLoader = {
} }
}, },
notifyDownloadProgress: function() { notifyDownloadProgress: function(delta) {
Progress.calculateProgress(50, 100, this._currentDownloadBytes, this._totalDownloadBytes); ProgressUpdater.updateCurrent(delta);
}, },
downloadPiece: function(file, index) { downloadPiece: function(file, index) {
if (index < file.lastRequestedPiece) { if (index < file.lastRequestedPiece) {
throw "Request out of order"; throw RangeError("Request out of order: " + file.name + ", index: " + index + ", last requested piece: " + file.lastRequestedPiece);
} }
var piece = file.pieces[index]; var piece = file.pieces[index];
file.lastRequestedPiece = index; file.lastRequestedPiece = index;
file.totalLoadedPieces = 0; file.totalLoadedPieces = 0;
var total = 0;
var downloaded = 0;
var url = this._archiveLocationFilter('/' + piece.name); var url = this._archiveLocationFilter('/' + piece.name);
FileLoader.load( FileLoader.load(
url, "arraybuffer", undefined, url, "arraybuffer",
function (loaded, total) { function (delta) {
var delta = loaded - downloaded; GameArchiveLoader.notifyDownloadProgress(delta);
downloaded = loaded;
GameArchiveLoader._currentDownloadBytes += delta;
GameArchiveLoader.notifyDownloadProgress();
}, },
function (error) { function (error) {
GameArchiveLoader.notifyFileDownloadError(error); GameArchiveLoader.notifyFileDownloadError(error);
@ -361,8 +478,10 @@ var GameArchiveLoader = {
total = piece.dataLength; total = piece.dataLength;
downloaded = piece.dataLength; downloaded = piece.dataLength;
GameArchiveLoader.onPieceLoaded(file, piece); GameArchiveLoader.onPieceLoaded(file, piece);
GameArchiveLoader.notifyDownloadProgress();
piece.data = undefined; piece.data = undefined;
},
function(loadedDelta, currentAttempt){
ProgressUpdater.updateCurrent(-loadedDelta);
}); });
}, },
@ -373,10 +492,10 @@ var GameArchiveLoader = {
var start = piece.offset; var start = piece.offset;
var end = start + piece.data.length; var end = start + piece.data.length;
if (0 > start) { if (0 > start) {
throw "Buffer underflow"; throw RangeError("Buffer underflow. Start: " + start);
} }
if (end > file.data.length) { if (end > file.data.length) {
throw "Buffer overflow"; throw RangeError("Buffer overflow. End : " + end + ", data length: " + file.data.length);
} }
file.data.set(piece.data, piece.offset); file.data.set(piece.data, piece.offset);
} }
@ -407,12 +526,11 @@ var GameArchiveLoader = {
actualSize += file.pieces[i].dataLength; actualSize += file.pieces[i].dataLength;
} }
if (actualSize != file.size) { if (actualSize != file.size) {
throw "Unexpected data size"; throw "Unexpected data size: " + file.name + ", expected size: " + file.size + ", actual size: " + actualSize;
} }
// verify the pieces // verify the pieces
if (file.pieces.length > 1) { if (file.pieces.length > 1) {
var output = file.data;
var pieces = file.pieces; var pieces = file.pieces;
for (i=0; i<pieces.length; ++i) { for (i=0; i<pieces.length; ++i) {
var item = pieces[i]; var item = pieces[i];
@ -422,13 +540,13 @@ var GameArchiveLoader = {
if (0 < i) { if (0 < i) {
var previous = pieces[i - 1]; var previous = pieces[i - 1];
if (previous.offset + previous.dataLength > start) { if (previous.offset + previous.dataLength > start) {
throw "Segment underflow"; throw RangeError("Segment underflow in file: " + file.name + ", offset: " + (previous.offset + previous.dataLength) + " , start: " + start);
} }
} }
if (pieces.length - 2 > i) { if (pieces.length - 2 > i) {
var next = pieces[i + 1]; var next = pieces[i + 1];
if (end > next.offset) { if (end > next.offset) {
throw "Segment overflow"; throw RangeError("Segment overflow in file: " + file.name + ", offset: " + next.offset + ", end: " + end);
} }
} }
} }
@ -456,14 +574,42 @@ var GameArchiveLoader = {
/* Default splash and progress visualisation */ /* Default splash and progress visualisation */
/* ********************************************************************* */ /* ********************************************************************* */
var Progress = { var ProgressView = {
progress_id: "defold-progress", progress_id: "defold-progress",
bar_id: "defold-progress-bar", bar_id: "defold-progress-bar",
addProgress : function (canvas) {
/* Insert default progress bar below canvas */
canvas.insertAdjacentHTML('afterend', '<div id="' + ProgressView.progress_id + '" class="canvas-app-progress"><div id="' + ProgressView.bar_id + '" class="canvas-app-progress-bar" style="transform: scaleX(0.0);"></div></div>');
ProgressView.bar = document.getElementById(ProgressView.bar_id);
ProgressView.progress = document.getElementById(ProgressView.progress_id);
},
updateProgress: function(percentage) {
if (ProgressView.bar) {
ProgressView.bar.style.transform = "scaleX(" + Math.min(percentage, 100) / 100 + ")";
}
},
removeProgress: function () {
if (ProgressView.progress.parentElement !== null) {
ProgressView.progress.parentElement.removeChild(ProgressView.progress);
// Remove any background/splash image that was set in runApp().
// Workaround for Safari bug DEF-3061.
Module.canvas.style.background = "";
}
}
};
var ProgressUpdater = {
current: 0,
total: 1,
listeners: [], listeners: [],
addListener: function(callback) { addListener: function(callback) {
if (typeof callback !== 'function') throw "Invalid callback registration"; if (typeof callback !== 'function') throw TypeError("Invalid callback registration");
this.listeners.push(callback); this.listeners.push(callback);
}, },
@ -473,32 +619,64 @@ var Progress = {
} }
}, },
setupTotal: function (total) {
this.total = total;
},
setCurrent: function (current) {
this.current = current;
var percentage = this.calculateProgress();
ProgressView.updateProgress(percentage);
this.notifyListeners(percentage);
},
updateCurrent: function (diff) {
this.current += diff;
var percentage = this.calculateProgress();
ProgressView.updateProgress(percentage);
this.notifyListeners(percentage);
},
resetCurrent: function () {
this.current = 0;
},
complete: function () {
this.setCurrent(this.total);
},
calculateProgress: function () {
return this.current / this.total * 100;
}
};
/* DEPRECATED!
* Use ProgressUpdater and ProgressView instead.
* Left for backward compatability.
*/
var Progress = {
addListener: function(callback) {
ProgressUpdater.addListener(callback);
},
notifyListeners: function(percentage) {
// no-op
},
addProgress : function (canvas) { addProgress : function (canvas) {
/* Insert default progress bar below canvas */ ProgressView.addProgress(canvas);
canvas.insertAdjacentHTML('afterend', '<div id="' + Progress.progress_id + '" class="canvas-app-progress"><div id="' + Progress.bar_id + '" class="canvas-app-progress-bar" style="width: 0%;"></div></div>');
Progress.bar = document.getElementById(Progress.bar_id);
Progress.progress = document.getElementById(Progress.progress_id);
}, },
updateProgress: function(percentage) { updateProgress: function(percentage) {
if (Progress.bar) { // no-op
Progress.bar.style.width = percentage + "%";
}
Progress.notifyListeners(percentage);
}, },
calculateProgress: function (from, to, current, total) { calculateProgress: function (from, to, current, total) {
this.updateProgress(from + (current / total) * (to - from)); // no-op
}, },
removeProgress: function () { removeProgress: function () {
if (Progress.progress.parentElement !== null) { ProgressView.removeProgress();
Progress.progress.parentElement.removeChild(Progress.progress);
// Remove any background/splash image that was set in runApp().
// Workaround for Safari bug DEF-3061.
Module.canvas.style.background = "";
}
} }
}; };
@ -512,7 +690,7 @@ var Module = {
_filesToPreload: [], _filesToPreload: [],
_archiveLoaded: false, _archiveLoaded: false,
_preLoadDone: false, _preLoadDone: false,
_waitingForArchive: false, _isEngineLoaded: false,
// Persistent storage // Persistent storage
persistentStorage: true, persistentStorage: true,
@ -550,7 +728,6 @@ var Module = {
var error = errObj || (typeof window.event != "undefined" ? window.event.error : "" ) || err || "Undefined Error"; var error = errObj || (typeof window.event != "undefined" ? window.event.error : "" ) || err || "Undefined Error";
var message = ""; var message = "";
var stack = ""; var stack = "";
var backtrace = "";
if (typeof error == "object" && typeof error.stack != "undefined" && typeof error.message != "undefined") { if (typeof error == "object" && typeof error.stack != "undefined" && typeof error.message != "undefined") {
stack = String(error.stack); stack = String(error.stack);
@ -603,61 +780,14 @@ var Module = {
/** /**
* Module.runApp - Starts the application given a canvas element id * Module.runApp - Starts the application given a canvas element id
*
* 'extra_params' is an optional object that can have the following fields:
*
* 'archive_location_filter':
* Filter function that will run for each archive path.
*
* 'unsupported_webgl_callback':
* Function that is called if WebGL is not supported.
*
* 'engine_arguments':
* List of arguments (strings) that will be passed to the engine.
*
* 'persistent_storage':
* Boolean toggling the usage of persistent storage.
*
* 'custom_heap_size':
* Number of bytes specifying the memory heap size.
*
* 'disable_context_menu':
* Disables the right-click context menu on the canvas element if true.
*
* 'retry_time':
* Pause before retry file loading after error.
*
* 'retry_count':
* How many attempts we do when trying to download a file.
*
* 'can_not_download_file_callback':
* Function that is called if you can't download file after 'retry_count' attempts.
**/ **/
runApp: function(appCanvasId, extra_params) { runApp: function(appCanvasId, _) {
Module._isEngineLoaded = true;
Module.setupCanvas(appCanvasId); Module.setupCanvas(appCanvasId);
var params = { Module.arguments = CUSTOM_PARAMETERS["engine_arguments"];
archive_location_filter: function(path) { return 'split' + path; },
unsupported_webgl_callback: undefined,
engine_arguments: [],
persistent_storage: true,
custom_heap_size: undefined,
disable_context_menu: true,
retry_time: 1,
retry_count: 10,
can_not_download_file_callback: undefined,
};
for (var k in extra_params) { var fullScreenContainer = CUSTOM_PARAMETERS["full_screen_container"];
if (extra_params.hasOwnProperty(k)) {
params[k] = extra_params[k];
}
}
Module.arguments = params["engine_arguments"];
Module.persistentStorage = params["persistent_storage"];
var fullScreenContainer = params["full_screen_container"];
if (typeof fullScreenContainer === "string") { if (typeof fullScreenContainer === "string") {
fullScreenContainer = document.querySelector(fullScreenContainer); fullScreenContainer = document.querySelector(fullScreenContainer);
} }
@ -667,31 +797,22 @@ var Module = {
Module.canvas.focus(); Module.canvas.focus();
// Add context menu hide-handler if requested // Add context menu hide-handler if requested
if (params["disable_context_menu"]) if (CUSTOM_PARAMETERS["disable_context_menu"])
{ {
Module.canvas.oncontextmenu = function(e) { Module.canvas.oncontextmenu = function(e) {
e.preventDefault(); e.preventDefault();
}; };
} }
Module._preloadAndCallMain();
FileLoader.options.retryCount = params["retry_count"];
FileLoader.options.retryInterval = params["retry_time"] * 1000;
if (typeof params["can_not_download_file_callback"] === "function") {
GameArchiveLoader.addFileDownloadErrorListener(params["can_not_download_file_callback"]);
}
// Load and assemble archive
GameArchiveLoader.addFileLoadedListener(Module.onArchiveFileLoaded);
GameArchiveLoader.addArchiveLoadedListener(Module.onArchiveLoaded);
GameArchiveLoader.setFileLocationFilter(params["archive_location_filter"]);
GameArchiveLoader.loadArchiveDescription('/archive_files.json');
} else { } else {
Progress.updateProgress(100, "Unable to start game, WebGL not supported"); // "Unable to start game, WebGL not supported"
ProgressUpdater.complete();
Module.setStatus = function(text) { Module.setStatus = function(text) {
if (text) Module.printErr('[missing WebGL] ' + text); if (text) Module.printErr('[missing WebGL] ' + text);
}; };
if (typeof params["unsupported_webgl_callback"] === "function") { if (typeof CUSTOM_PARAMETERS["unsupported_webgl_callback"] === "function") {
params["unsupported_webgl_callback"](); CUSTOM_PARAMETERS["unsupported_webgl_callback"]();
} }
} }
}, },
@ -703,11 +824,7 @@ var Module = {
onArchiveLoaded: function() { onArchiveLoaded: function() {
GameArchiveLoader.cleanUp(); GameArchiveLoader.cleanUp();
Module._archiveLoaded = true; Module._archiveLoaded = true;
Progress.updateProgress(100, "Starting...");
if (Module._waitingForArchive) {
Module._preloadAndCallMain(); Module._preloadAndCallMain();
}
}, },
toggleFullscreen: function(element) { toggleFullscreen: function(element) {
@ -720,7 +837,6 @@ var Module = {
preSync: function(done) { preSync: function(done) {
if (Module.persistentStorage != true) { if (Module.persistentStorage != true) {
Module._syncInitial = true;
done(); done();
return; return;
} }
@ -820,26 +936,33 @@ var Module = {
postRun: [function() { postRun: [function() {
if(Module._archiveLoaded) { if(Module._archiveLoaded) {
Progress.removeProgress(); ProgressView.removeProgress();
} }
}], }],
_preloadAndCallMain: function() { _preloadAndCallMain: function() {
if (Module._syncInitial || Module.persistentStorage != true) {
// If the archive isn't loaded, // If the archive isn't loaded,
// we will have to wait with calling main. // we will have to wait with calling main.
if (!Module._archiveLoaded) { if (Module._archiveLoaded) {
Module._waitingForArchive = true;
} else {
Module.preloadAll(); Module.preloadAll();
Progress.removeProgress(); if (Module._isEngineLoaded) {
// "Starting...."
ProgressUpdater.complete();
Module._callMain();
}
}
}
},
_callMain: function() {
ProgressView.removeProgress();
if (Module.callMain === undefined) { if (Module.callMain === undefined) {
Module.noInitialRun = false; Module.noInitialRun = false;
} else { } else {
Module.callMain(Module.arguments); Module.callMain(Module.arguments);
} }
}
}, },
// Wrap IDBFS syncfs call with logic to avoid multiple syncs // Wrap IDBFS syncfs call with logic to avoid multiple syncs
// running at the same time. // running at the same time.
_startSyncFS: function() { _startSyncFS: function() {
@ -864,6 +987,26 @@ var Module = {
}, },
}; };
// common engine setup
Module['persistentStorage'] = (typeof window !== 'undefined') && !!(window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB);
Module['INITIAL_MEMORY'] = CUSTOM_PARAMETERS.custom_heap_size;
Module['onRuntimeInitialized'] = function() {
Module.runApp("canvas");
};
Module["locateFile"] = function(path, scriptDirectory)
{
// dmengine*.wasm is hardcoded in the built JS loader for WASM,
// we need to replace it here with the correct project name.
if (path == "dmengine.wasm" || path == "dmengine_release.wasm" || path == "dmengine_headless.wasm") {
path = "Druid.wasm";
}
return scriptDirectory + path;
};
window.onerror = function(err, url, line, column, errObj) { window.onerror = function(err, url, line, column, errObj) {
if (typeof Module.ccall !== 'undefined') { if (typeof Module.ccall !== 'undefined') {
var errorObject = Module.prepareErrorObject(err, url, line, column, errObj); var errorObject = Module.prepareErrorObject(err, url, line, column, errObj);

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 492 KiB

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"> <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 --> <!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>druid 0.11.718</title> <title>Druid 1.0.0</title>
<style type='text/css'> <style type='text/css'>
/* Disable user selection to avoid strange bug in Chrome on Windows: /* Disable user selection to avoid strange bug in Chrome on Windows:
* Selecting a text outside the canvas, then clicking+draging would * Selecting a text outside the canvas, then clicking+draging would
@ -54,7 +54,7 @@
-moz-outline-style: none; -moz-outline-style: none;
} }
div { body, div {
-webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
@ -66,7 +66,7 @@
.canvas-app-progress { .canvas-app-progress {
position: absolute; position: absolute;
background-color: #d1dbeb; background-color: #394046;
height: 6px; height: 6px;
margin-top: -6px; margin-top: -6px;
width: 100%; width: 100%;
@ -79,6 +79,9 @@
background-color: #1a72eb; background-color: #1a72eb;
text-align: center; text-align: center;
line-height: 20px; line-height: 20px;
transition: transform 1s ease;
transform-origin: left;
transform: scaleX(1.0);
} }
.link, .button { .link, .button {
font-family: sans-serif; font-family: sans-serif;
@ -92,133 +95,54 @@
} }
.buttons-background { .buttons-background {
background-color: #ffffff; background-color: #1e2226;
width: 100%; width: 100%;
height: 42px; height: 42px;
} }
body { body {
background-color: #ffffff; background-color: #1e2226;
} }
.canvas-app-container { .canvas-app-container {
background: rgba(250,252,255,1); background: rgba(36,41,46,1);
background: -moz-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%); background: -moz-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(250,252,255,1)), color-stop(50%, rgba(250,252,255,1)), color-stop(50%, rgba(245,249,255,1)), color-stop(100%, rgba(245,249,255,1))); background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(36,41,46,1)), color-stop(49%, rgba(36,41,46,1)), color-stop(50%, rgba(38,43,49,1)), color-stop(100%, rgba(38,43,49,1)));
background: -webkit-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%); background: -webkit-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -o-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%); background: -o-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: -ms-linear-gradient(-45deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%); background: -ms-linear-gradient(-45deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
background: linear-gradient(135deg, rgba(250,252,255,1) 0%, rgba(250,252,255,1) 50%, rgba(245,249,255,1) 50%, rgba(245,249,255,1) 100%); background: linear-gradient(135deg, rgba(36,41,46,1) 0%, rgba(36,41,46,1) 49%, rgba(38,43,49,1) 50%, rgba(38,43,49,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fafcff', endColorstr='#f5f9ff', GradientType=1 ); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#24292e', endColorstr='#262b31', GradientType=1 );
} }
.canvas-app-canvas { .canvas-app-canvas {
background-repeat:no-repeat; background-repeat:no-repeat;
background-position: center center; background-position: center center;
background-size: contain;
background-image: url("druid_logo.png"); background-image: url("druid_logo.png");
} }
</style> </style>
</head> </head>
<body> <body>
<div id="app-container" class="canvas-app-container">
<div id="running-from-file-warning" style="display: none; margin: 3em;"> <div id="running-from-file-warning" style="display: none; margin: 3em;">
<h1>Running from local file ⚠️</h1> <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>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> <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>
<div id="app-container" class="canvas-app-container"> <div id="webgl-not-supported" style="display: none; margin: 3em;">
<h1>WebGL not supported ⚠️</h1>
<p>WebGL is not supported by your browser - visit <a href="https://get.webgl.org/">https://get.webgl.org/</a> to learn more.</p>
</div>
<div id="canvas-container" class="canvas-app-canvas-container"> <div id="canvas-container" class="canvas-app-canvas-container">
<canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="600" height="900"></canvas> <canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="1920" height="1080"></canvas>
</div> </div>
<div class="buttons-background"> <div class="buttons-background">
</div> </div>
</div> </div>
<!-- --> <!-- -->
<script id='engine-loader' type='text/javascript' src="dmloader.js"></script> <script id='engine-loader' type='text/javascript' src="dmloader.js"></script>
<!-- -->
<script id='engine-setup' type='text/javascript'>
var extra_params = {
archive_location_filter: function( path ) {
return ("archive" + path + "");
},
engine_arguments: ["--verify-graphics-calls=false",],
custom_heap_size: 67108864,
full_screen_container: "#canvas-container",
disable_context_menu: true
}
Module['INITIAL_MEMORY'] = extra_params.custom_heap_size;
Module['onRuntimeInitialized'] = function() {
Module.runApp("canvas", extra_params);
};
Module["locateFile"] = function(path, scriptDirectory)
{
// dmengine*.wasm is hardcoded in the built JS loader for WASM,
// we need to replace it here with the correct project name.
if (path == "dmengine.wasm" || path == "dmengine_release.wasm" || path == "dmengine_headless.wasm") {
path = "druid.wasm";
}
return scriptDirectory + path;
};
var is_iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var buttonHeight = 0;
var prevInnerWidth = -1;
var prevInnerHeight = -1;
function resize_game_canvas() {
// Hack for iOS when exit from Fullscreen mode
if (is_iOS) {
window.scrollTo(0, 0);
}
var app_container = document.getElementById('app-container');
var game_canvas = document.getElementById('canvas');
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight - buttonHeight;
if (prevInnerWidth == innerWidth && prevInnerHeight == innerHeight)
{
return;
}
prevInnerWidth = innerWidth;
prevInnerHeight = innerHeight;
var width = 600;
var height = 900;
var targetRatio = width / height;
var actualRatio = innerWidth / innerHeight;
//Fit
if (actualRatio > targetRatio) {
width = innerHeight * targetRatio;
height = innerHeight;
app_container.style.marginLeft = ((innerWidth - width) / 2) + "px";
app_container.style.marginTop = "0px";
}
else {
width = innerWidth;
height = innerWidth / targetRatio;
app_container.style.marginLeft = "0px";
app_container.style.marginTop = ((innerHeight - height) / 2) + "px";
}
app_container.style.width = width + "px";
app_container.style.height = height + buttonHeight + "px";
game_canvas.width = width;
game_canvas.height = height;
}
resize_game_canvas();
window.addEventListener('resize', resize_game_canvas, false);
window.addEventListener('orientationchange', resize_game_canvas, false);
window.addEventListener('focus', resize_game_canvas, false);
</script>
<script id='engine-start' type='text/javascript'> <script id='engine-start' type='text/javascript'>
var runningFromFileWarning = document.getElementById("running-from-file-warning"); var runningFromFileWarning = document.getElementById("running-from-file-warning");
@ -226,8 +150,7 @@
runningFromFileWarning.style.display = "block"; runningFromFileWarning.style.display = "block";
} }
else { else {
EngineLoader.stream_wasm = "false" === "true"; EngineLoader.load("canvas", "Druid");
EngineLoader.load("canvas", "druid");
runningFromFileWarning.parentNode.removeChild(runningFromFileWarning); runningFromFileWarning.parentNode.removeChild(runningFromFileWarning);
} }
</script> </script>

View File

@ -40,7 +40,6 @@
<li><a href="modules/StaticGrid.html">StaticGrid</a></li> <li><a href="modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="modules/Text.html">Text</a></li> <li><a href="modules/Text.html">Text</a></li>
<li><a href="modules/BaseComponent.html">BaseComponent</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/RichInput.html">RichInput</a></li>
<li><a href="modules/RichText.html">RichText</a></li> <li><a href="modules/RichText.html">RichText</a></li>
<li><a href="modules/Druid.html">Druid</a></li> <li><a href="modules/Druid.html">Druid</a></li>
@ -109,10 +108,6 @@
<td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td> <td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td>
<td class="summary">Basic class for all Druid components.</td> <td class="summary">Basic class for all Druid components.</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="modules/PinKnob.html">PinKnob</a></td>
<td class="summary">Druid pin knob custom component.</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td> <td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td>
<td class="summary">Druid Rich Input custom component.</td> <td class="summary">Druid Rich Input custom component.</td>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>
@ -358,7 +357,7 @@
The <a href="../modules/Scroll.html#">Scroll</a> instance for Data List component The <a href="../modules/Scroll.html#">Scroll</a> instance for Data List component
</li> </li>
<li><span class="parameter">grid</span> <li><span class="parameter">grid</span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span> <span class="types"><span class="type">StaticGrid</span></span>
The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component
</li> </li>
<li><span class="parameter">create_function</span> <li><span class="parameter">create_function</span>
@ -552,7 +551,7 @@
<ul> <ul>
<li><span class="parameter">grid</span> <li><span class="parameter">grid</span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span> <span class="types"><span class="type">StaticGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>, <a href="../modules/DynamicGrid.html#">DynamicGrid</a> <a href="../modules/StaticGrid.html#">StaticGrid</a>, <a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
</ul> </ul>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>
@ -493,7 +492,7 @@ end
The Scroll instance for Data List component The Scroll instance for Data List component
</li> </li>
<li><span class="parameter">druid_grid</span> <li><span class="parameter">druid_grid</span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span> <span class="types"><span class="type">StaticGrid</span></span>
The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component
</li> </li>
<li><span class="parameter">create_function</span> <li><span class="parameter">create_function</span>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><strong>Input</strong></li> <li><strong>Input</strong></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>
@ -605,10 +604,6 @@
<span class="types"><span class="type">function</span></span> <span class="types"><span class="type">function</span></span>
(self, button_node) Callback on wrong user input (self, button_node) Callback on wrong user input
</li> </li>
<li><span class="parameter">button_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Custom button style for input node
</li>
</ul> </ul>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li> <li><strong>LangText</strong></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -56,7 +56,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><strong>Layout</strong></li> <li><strong>Layout</strong></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</a></li> <li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><strong>Progress</strong></li> <li><strong>Progress</strong></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></li> <li><strong>RadioGroup</strong></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><strong>RichInput</strong></li> <li><strong>RichInput</strong></li>
@ -118,6 +117,18 @@
<td class="summary">On input field text change to empty string callback(self, input_text)</td> <td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#cursor_position">cursor_position</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#cursor_text">cursor_text</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#drag">drag</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid">druid</a></td> <td class="name" nowrap><a href="#druid">druid</a></td>
<td class="summary">The component druid instance</td> <td class="summary">The component druid instance</td>
</tr> </tr>
@ -126,13 +137,25 @@
<td class="summary">On input field text change callback(self, input_text)</td> <td class="summary">On input field text change callback(self, input_text)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#input_text">input_text</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#placeholder">placeholder</a></td> <td class="name" nowrap><a href="#placeholder">placeholder</a></td>
<td class="summary">On input field text change to max length string callback(self, input_text)</td> <td class="summary">On input field text change to max length string callback(self, input_text)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#placeholder">placeholder</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#root">root</a></td> <td class="name" nowrap><a href="#root">root</a></td>
<td class="summary">Root node</td> <td class="summary">Root node</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#text_position">text_position</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
</table> </table>
<br/> <br/>
@ -356,6 +379,66 @@
</dd>
<dt>
<a name = "cursor_position"></a>
<strong>cursor_position</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">cursor_position</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "cursor_text"></a>
<strong>cursor_text</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">cursor_text</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "drag"></a>
<strong>drag</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">drag</span>
<span class="types"><span class="type">druid.drag</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "druid"></a> <a name = "druid"></a>
@ -396,6 +479,26 @@
</dd>
<dt>
<a name = "input_text"></a>
<strong>input_text</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">input_text</span>
<span class="types"><span class="type">druid.text</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "placeholder"></a> <a name = "placeholder"></a>
@ -416,6 +519,26 @@
</dd>
<dt>
<a name = "placeholder"></a>
<strong>placeholder</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">placeholder</span>
<span class="types"><span class="type">druid.text</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "root"></a> <a name = "root"></a>
@ -436,6 +559,26 @@
</dd>
<dt>
<a name = "text_position"></a>
<strong>text_position</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">text_position</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd> </dd>
</dl> </dl>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>
@ -184,10 +183,6 @@ type druid.rich_text.metrics = {
<td class="summary">The component druid instance</td> <td class="summary">The component druid instance</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#icon_prefab">icon_prefab</a></td>
<td class="summary">The icon prefab node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#root">root</a></td> <td class="name" nowrap><a href="#root">root</a></td>
<td class="summary">The root node of the Rich Text</td> <td class="summary">The root node of the Rich Text</td>
</tr> </tr>
@ -513,26 +508,6 @@ Words &lt;nobr&gt;inside tag&lt;/nobr&gt; won't <span class="keyword">break</spa
</dd>
<dt>
<a name = "icon_prefab"></a>
<strong>icon_prefab</strong>
</dt>
<dd>
The icon prefab node
<ul>
<li><span class="parameter">icon_prefab</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "root"></a> <a name = "root"></a>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>
@ -270,7 +269,7 @@
<a href="../modules/Scroll.html#">Scroll</a> <a href="../modules/Scroll.html#">Scroll</a>
</li> </li>
<li><span class="parameter">grid</span> <li><span class="parameter">grid</span>
<span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span> <span class="types"><span class="type">StaticGrid</span></span>
Druid grid component Druid grid component
</li> </li>
</ul> </ul>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -58,7 +58,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -57,7 +57,6 @@
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/Layout.html">Layout</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/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li> <li><a href="../modules/RichInput.html">RichInput</a></li>

View File

@ -311,7 +311,7 @@ function druid__checkbox_group.set_state(self, indexes, is_instant) end
---@class druid.data_list : druid.base_component ---@class druid.data_list : druid.base_component
---@field grid druid.static_grid|druid.dynamic_grid The Druid Grid component ---@field grid druid.static_grid The Druid Grid component
---@field last_index number The current last index of visual elements ---@field last_index number The current last index of visual elements
---@field on_element_add druid.event On DataList visual element created Event callback(self, index, node, instance) ---@field on_element_add druid.event On DataList visual element created Event callback(self, index, node, instance)
---@field on_element_remove druid.event On DataList visual element created Event callback(self, index) ---@field on_element_remove druid.event On DataList visual element created Event callback(self, index)
@ -356,7 +356,7 @@ function druid__data_list.get_index(self, data) end
--- The @{DataList} constructor --- The @{DataList} constructor
---@param self druid.data_list @{DataList} ---@param self druid.data_list @{DataList}
---@param scroll druid.scroll The @{Scroll} instance for Data List component ---@param scroll druid.scroll The @{Scroll} instance for Data List component
---@param grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component ---@param grid druid.static_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component]) ---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component])
function druid__data_list.init(self, scroll, grid, create_function) end function druid__data_list.init(self, scroll, grid, create_function) end
@ -834,34 +834,6 @@ function druid__lang_text.translate(self, locale_id, a, b, c, d, e, f, g) end
local druid__layout = {} local druid__layout = {}
---@class druid.pin_knob : druid.base_component
---@field druid druid_instance The component druid instance
---@field is_drag boolean Is currently under user control
---@field node node The pin node
local druid__pin_knob = {}
--- The @{PinKnob} constructor
---@param self druid.pin_knob @{PinKnob}
---@param callback function Callback(self, value) on value changed
---@param template string The template string name
---@param nodes table Nodes table from gui.clone_tree
function druid__pin_knob.init(self, callback, template, nodes) end
--- Set current and min/max angles for component
---@param self druid.pin_knob @{PinKnob}
---@param cur_value number The new value for pin knob
---@param min number The minimum value for pin knob
---@param max number The maximum value for pin knob
---@return druid.pin_knob @{PinKnob}
function druid__pin_knob.set_angle(self, cur_value, min, max) end
--- Set current and min/max angles for component
---@param self druid.pin_knob @{PinKnob}
---@param value number|nil The spin speed multiplier. Default: 1
---@return druid.pin_knob @{PinKnob}
function druid__pin_knob.set_friction(self, value) end
---@class druid.progress : druid.base_component ---@class druid.progress : druid.base_component
---@field key string The progress bar direction. ---@field key string The progress bar direction.
---@field max_size number Maximum size of progress bar ---@field max_size number Maximum size of progress bar
@ -948,10 +920,16 @@ function druid__radio_group.set_state(self, index, is_instant) end
---@class druid.rich_input ---@class druid.rich_input
---@field cursor node On input field text change to empty string callback(self, input_text) ---@field cursor node On input field text change to empty string callback(self, input_text)
---@field cursor_position vector3 On input field text change to empty string callback(self, input_text)
---@field cursor_text node On input field text change to empty string callback(self, input_text)
---@field drag druid.drag On input field text change to empty string callback(self, input_text)
---@field druid druid_instance The component druid instance ---@field druid druid_instance The component druid instance
---@field input druid.input On input field text change callback(self, input_text) ---@field input druid.input On input field text change callback(self, input_text)
---@field input_text druid.text On input field text change to empty string callback(self, input_text)
---@field placeholder druid.text On input field text change to max length string callback(self, input_text) ---@field placeholder druid.text On input field text change to max length string callback(self, input_text)
---@field placeholder druid.text On input field text change to empty string callback(self, input_text)
---@field root node Root node ---@field root node Root node
---@field text_position vector3 On input field text change to empty string callback(self, input_text)
local druid__rich_input = {} local druid__rich_input = {}
--- Set input field text --- Set input field text
@ -995,7 +973,6 @@ function druid__rich_input.set_text(self, text) end
---@class druid.rich_text : druid.base_component ---@class druid.rich_text : druid.base_component
---@field druid druid_instance The component druid instance ---@field druid druid_instance The component druid instance
---@field icon_prefab node The icon prefab node
---@field root node The root node of the Rich Text ---@field root node The root node of the Rich Text
---@field style druid.rich_text.style Component style params. ---@field style druid.rich_text.style Component style params.
---@field text_prefab node The text prefab node ---@field text_prefab node The text prefab node
@ -1071,7 +1048,7 @@ local druid__scroll = {}
--- Bind the grid component (Static or Dynamic) to recalculate scroll size on grid changes --- Bind the grid component (Static or Dynamic) to recalculate scroll size on grid changes
---@param self druid.scroll @{Scroll} ---@param self druid.scroll @{Scroll}
---@param grid druid.static_grid|druid.dynamic_grid Druid grid component ---@param grid druid.static_grid Druid grid component
---@return druid.scroll Current scroll instance ---@return druid.scroll Current scroll instance
function druid__scroll.bind_grid(self, grid) end function druid__scroll.bind_grid(self, grid) end
@ -1595,7 +1572,7 @@ function druid_instance.new_checkbox_group(self, nodes, callback, click_nodes) e
--- Create @{DataList} component --- Create @{DataList} component
---@param self druid_instance ---@param self druid_instance
---@param druid_scroll druid.scroll The Scroll instance for Data List component ---@param druid_scroll druid.scroll The Scroll instance for Data List component
---@param druid_grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component ---@param druid_grid druid.static_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component]) ---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component])
---@return druid.data_list @{DataList} component ---@return druid.data_list @{DataList} component
function druid_instance.new_data_list(self, druid_scroll, druid_grid, create_function) end function druid_instance.new_data_list(self, druid_scroll, druid_grid, create_function) end