Skip to content

Commit

Permalink
Merge pull request #180 from Insality/develop
Browse files Browse the repository at this point in the history
Release 0.9.0
  • Loading branch information
Insality authored Mar 12, 2022
2 parents 2a0998d + 8054ad8 commit b5a7739
Show file tree
Hide file tree
Showing 138 changed files with 15,621 additions and 4,146 deletions.
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,25 @@ input_scroll_down = scroll_down

By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus")`

If you don't need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_:
If you don't need this behaviour, you can disable it by setting `druid.no_auto_input` field in _game.project_:
```
[druid]
no_auto_input = 1
```


### Template name check [optional]

By default, **Druid** will auto check the parent component template name to build the full template name for component.

If for some reason you want to pass the full template name by yourself, you can disable it by setting `druid.no_auto_template` field in _game.project_:

```
[druid]
no_auto_template = 1
```


### Stencil check [optional]

When creating input components inside stencil nodes, you probably will use `component:set_click_zone()` to restrict clicks outside this stencil zone.
Expand All @@ -73,6 +85,7 @@ Druid can do it automatically on _late_init_ component step. To enable this feat
stencil_check = 1
```


### Code [optional]

Adjust **Druid** settings, if needed:
Expand Down Expand Up @@ -120,7 +133,7 @@ druid.on_window_callback(event)

- **[Swipe](docs_md/01-components.md#swipe)** - System Druid component, handle swipe gestures on node

- **[Drag](docs_md/01-components.md#drag)** - System Druid component, handle drag input on node
- **[Drag](docs_md/01-components.md#drag)** - System Druid component, handle drag input on node

**Druid** also provides the following *extended* components:

Expand Down Expand Up @@ -245,11 +258,9 @@ It is recommended to fully integrate all **Druid** lifecycles functions.

## Examples

See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**

See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles
See the [**example folder**](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**

Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app
Try the [**HTML5 version**](https://insality.github.io/druid/druid/) of the **Druid** example app


## Documentation
Expand All @@ -259,17 +270,11 @@ To better understand **Druid**, read the following documentation:
- [Create custom components](docs_md/02-creating_custom_components.md)
- [See FAQ article](docs_md/FAQ.md)
- [Druid styles](docs_md/03-styles.md)
- [Druid asset store](docs_md/04-druid_assets.md)

You can fund the full **Druid** documentation here:
https://insality.github.io/druid/


## Games powered by Druid

_You published your game and you using Druid? Note me!_


## License

- Developed and supported by [Insality](https://github.com/Insality)
Expand Down
8 changes: 5 additions & 3 deletions config.ld
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ description='Documentation for Druid Library'
file={"./druid",
exclude = {
"./druid/styles/",
"./druid/system/middleclass.lua"
"./druid/system/middleclass.lua",
"./druid/templates/",
"./druid/annotations.lua",
}
}
package='druid'
sort=false
sort=true
dir='./docs'
style='!fixed'
topics={}
use_markdown_titles=true
no_space_before_args=true
no_space_before_args=true
1 change: 1 addition & 0 deletions deployer_build_stats.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_coun
2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-03-12T10:01:30Z,d0f3d6641a08b0d6b719b13017aa85907d1667e5,0.8.564,2200,44,js-web,release,true,564
2 changes: 1 addition & 1 deletion docs/druid/archive/archive_files.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"content":[{"name":"game.projectc","size":3748,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":13488,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":948433,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13875,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
{"content":[{"name":"game.projectc","size":3808,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":17168,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":417873,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":17838,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
Binary file modified docs/druid/archive/game.arcd0
Binary file not shown.
Binary file modified docs/druid/archive/game.arci0
Binary file not shown.
Binary file modified docs/druid/archive/game.dmanifest0
Binary file not shown.
19 changes: 10 additions & 9 deletions docs/druid/archive/game.projectc0
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[project]
title = druid
version = 0.8.519
version = 0.8.564
write_log = 0
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = 4e0fd264b169693d088a47f2bb53376a1808fb1e
build_time = 2022-02-12T15:15:53Z
commit_sha = d0f3d6641a08b0d6b719b13017aa85907d1667e5
build_date = 2022-03-12T10:01:30Z
title_as_file_name = druid

[display]
width = 600
Expand All @@ -16,8 +17,8 @@ samples = 0
fullscreen = 0
update_frequency = 0
vsync = 1
display_profiles = /builtins/render/default.display_profilesc
dynamic_orientation = 0
display_profiles = /example/custom.display_profilesc
dynamic_orientation = 1
display_device_info = 0

[render]
Expand All @@ -43,6 +44,7 @@ contact_impulse_limit = 0
ray_cast_limit_2d = 64
ray_cast_limit_3d = 128
trigger_overlap_capacity = 16
velocity_threshold = 1

[bootstrap]
main_collection = /example/example.collectionc
Expand Down Expand Up @@ -85,9 +87,6 @@ use_accelerometer = 0
max_count = 128
subpixels = 1

[spine]
max_count = 128

[model]
max_count = 128

Expand Down Expand Up @@ -121,7 +120,7 @@ default_language = en
localizations = en

[android]
version_code = 519
version_code = 564
minimum_sdk_version = 16
target_sdk_version = 30
package = com.insality.druid
Expand Down Expand Up @@ -156,6 +155,7 @@ splash_image = /media/druid_logo.png

[particle_fx]
max_count = 64
max_emitter_count = 64
max_particle_count = 1024

[iap]
Expand Down Expand Up @@ -193,6 +193,7 @@ run_while_iconified = 0
[druid]
no_auto_input = 0
stencil_check = 0
no_auto_template = 0
input_text = text
input_touch = touch
input_marked_text = marked_text
Expand Down
Binary file modified docs/druid/archive/game.public.der0
Binary file not shown.
89 changes: 29 additions & 60 deletions docs/druid/dmloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ var EngineLoader = {
asmjs_from: 0,
asmjs_to: 50,

// load .wasm and set Module.instantiateWasm to use the loaded .wasm file
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
stream_wasm: true,

loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; },
Expand All @@ -133,6 +133,31 @@ var EngineLoader = {
});
},

streamAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetch(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
successCallback(output.instance);
}).catch(function(e) {
console.log('wasm streaming instantiation failed! ' + e);
throw e;
});
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) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.streamAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
else {
EngineLoader.loadAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
},

// load and start engine script (asm.js or wasm.js)
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
FileLoader.load(src, "text", estimatedSize,
Expand Down Expand Up @@ -457,35 +482,6 @@ var Progress = {
}
};

/* ********************************************************************* */
/* Default input override */
/* ********************************************************************* */

var CanvasInput = {
arrowKeysHandler : function(e) {
switch(e.keyCode) {
case 37: case 38: case 39: case 40: // Arrow keys
case 32: e.preventDefault(); e.stopPropagation(); // Space
default: break; // do not block other keys
}
},

onFocusIn : function(e) {
window.addEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},

onFocusOut: function(e) {
window.removeEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},

addToCanvas : function(canvas) {
canvas.addEventListener("focus", CanvasInput.onFocusIn, false);
canvas.addEventListener("blur", CanvasInput.onFocusOut, false);
canvas.focus();
CanvasInput.onFocusIn();
}
};

/* ********************************************************************* */
/* Module is Emscripten namespace */
/* ********************************************************************* */
Expand Down Expand Up @@ -578,30 +574,6 @@ var Module = {
return webgl_support;
},

handleVisibilityChange: function () {
GLFW.onFocusChanged(document[Module.hiddenProperty] ? 0 : 1);
},

getHiddenProperty: function () {
if ('hidden' in document) return 'hidden';
var prefixes = ['webkit','moz','ms','o'];
for (var i = 0; i < prefixes.length; i++) {
if ((prefixes[i] + 'Hidden') in document)
return prefixes[i] + 'Hidden';
}
return null;
},

setupVisibilityChangeListener: function() {
Module.hiddenProperty = Module.getHiddenProperty();
if( Module.hiddenProperty ) {
var eventName = Module.hiddenProperty.replace(/[H|h]idden/,'') + 'visibilitychange';
document.addEventListener(eventName, Module.handleVisibilityChange, false);
} else {
console.log("No document.hidden property found. The focus events won't be enabled.")
}
},

setupCanvas: function(appCanvasId) {
appCanvasId = (typeof appCanvasId === 'undefined') ? 'canvas' : appCanvasId;
Module.canvas = document.getElementById(appCanvasId);
Expand Down Expand Up @@ -672,10 +644,7 @@ var Module = {
Module.fullScreenContainer = fullScreenContainer || Module.canvas;

if (Module.hasWebGLSupport()) {
// Override game keys
CanvasInput.addToCanvas(Module.canvas);

Module.setupVisibilityChangeListener();
Module.canvas.focus();

// Add context menu hide-handler if requested
if (params["disable_context_menu"])
Expand Down
Binary file modified docs/druid/druid.wasm
Binary file not shown.
44 changes: 22 additions & 22 deletions docs/druid/druid_asmjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/druid/druid_wasm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/druid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.8.519</title>
<title>druid 0.8.564</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
Expand Down
22 changes: 16 additions & 6 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ <h2>Modules</h2>
<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/DruidEvent.html">DruidEvent</a></li>
<li><a href="modules/Checkbox.html">Checkbox</a></li>
Expand All @@ -53,7 +55,7 @@ <h2>Modules</h2>
<li><a href="modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="modules/Slider.html">Slider</a></li>
<li><a href="modules/Timer.html">Timer</a></li>
<li><a href="modules/druid.helper.html">druid.helper</a></li>
<li><a href="modules/Helper.html">Helper</a></li>
<li><a href="modules/DruidInstance.html">DruidInstance</a></li>
</ul>

Expand Down Expand Up @@ -106,13 +108,21 @@ <h2>Modules</h2>
<td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td>
<td class="summary">Basic class for all Druid components.</td>
</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>
<td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td>
<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>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidEvent.html">DruidEvent</a></td>
<td class="summary">Lua event small library</td>
<td class="summary">Druid lua event library</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td>
Expand Down Expand Up @@ -156,8 +166,8 @@ <h2>Modules</h2>
<td class="summary">Component to handle GUI timers.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/druid.helper.html">druid.helper</a></td>
<td class="summary">Text node or icon node can be nil</td>
<td class="name" nowrap><a href="modules/Helper.html">Helper</a></td>
<td class="summary">Druid helper module for gui layouts</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
Expand All @@ -168,8 +178,8 @@ <h2>Modules</h2>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
<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>
Expand Down
Loading

0 comments on commit b5a7739

Please sign in to comment.