Skip to content

Commit b5a7739

Browse files
authored
Merge pull request #180 from Insality/develop
Release 0.9.0
2 parents 2a0998d + 8054ad8 commit b5a7739

File tree

138 files changed

+15621
-4146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+15621
-4146
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,25 @@ input_scroll_down = scroll_down
5757

5858
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")`
5959

60-
If you don't need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_:
60+
If you don't need this behaviour, you can disable it by setting `druid.no_auto_input` field in _game.project_:
6161
```
6262
[druid]
6363
no_auto_input = 1
6464
```
6565

6666

67+
### Template name check [optional]
68+
69+
By default, **Druid** will auto check the parent component template name to build the full template name for component.
70+
71+
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_:
72+
73+
```
74+
[druid]
75+
no_auto_template = 1
76+
```
77+
78+
6779
### Stencil check [optional]
6880

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

88+
7689
### Code [optional]
7790

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

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

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

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

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

246259
## Examples
247260

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

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

254265

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

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

267277

268-
## Games powered by Druid
269-
270-
_You published your game and you using Druid? Note me!_
271-
272-
273278
## License
274279

275280
- Developed and supported by [Insality](https://github.com/Insality)

config.ld

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ description='Documentation for Druid Library'
44
file={"./druid",
55
exclude = {
66
"./druid/styles/",
7-
"./druid/system/middleclass.lua"
7+
"./druid/system/middleclass.lua",
8+
"./druid/templates/",
9+
"./druid/annotations.lua",
810
}
911
}
1012
package='druid'
11-
sort=false
13+
sort=true
1214
dir='./docs'
1315
style='!fixed'
1416
topics={}
1517
use_markdown_titles=true
16-
no_space_before_args=true
18+
no_space_before_args=true

deployer_build_stats.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_coun
44
2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
55
2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
66
2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
7+
2022-03-12T10:01:30Z,d0f3d6641a08b0d6b719b13017aa85907d1667e5,0.8.564,2200,44,js-web,release,true,564
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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}]}]}
1+
{"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}]}]}

docs/druid/archive/game.arcd0

-518 KB
Binary file not shown.

docs/druid/archive/game.arci0

3.59 KB
Binary file not shown.

docs/druid/archive/game.dmanifest0

3.87 KB
Binary file not shown.

docs/druid/archive/game.projectc0

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[project]
22
title = druid
3-
version = 0.8.519
3+
version = 0.8.564
44
write_log = 0
55
compress_archive = 1
66
publisher = Insality
77
developer = Insality
8-
commit_sha = 4e0fd264b169693d088a47f2bb53376a1808fb1e
9-
build_time = 2022-02-12T15:15:53Z
8+
commit_sha = d0f3d6641a08b0d6b719b13017aa85907d1667e5
9+
build_date = 2022-03-12T10:01:30Z
10+
title_as_file_name = druid
1011

1112
[display]
1213
width = 600
@@ -16,8 +17,8 @@ samples = 0
1617
fullscreen = 0
1718
update_frequency = 0
1819
vsync = 1
19-
display_profiles = /builtins/render/default.display_profilesc
20-
dynamic_orientation = 0
20+
display_profiles = /example/custom.display_profilesc
21+
dynamic_orientation = 1
2122
display_device_info = 0
2223

2324
[render]
@@ -43,6 +44,7 @@ contact_impulse_limit = 0
4344
ray_cast_limit_2d = 64
4445
ray_cast_limit_3d = 128
4546
trigger_overlap_capacity = 16
47+
velocity_threshold = 1
4648

4749
[bootstrap]
4850
main_collection = /example/example.collectionc
@@ -85,9 +87,6 @@ use_accelerometer = 0
8587
max_count = 128
8688
subpixels = 1
8789

88-
[spine]
89-
max_count = 128
90-
9190
[model]
9291
max_count = 128
9392

@@ -121,7 +120,7 @@ default_language = en
121120
localizations = en
122121

123122
[android]
124-
version_code = 519
123+
version_code = 564
125124
minimum_sdk_version = 16
126125
target_sdk_version = 30
127126
package = com.insality.druid
@@ -156,6 +155,7 @@ splash_image = /media/druid_logo.png
156155

157156
[particle_fx]
158157
max_count = 64
158+
max_emitter_count = 64
159159
max_particle_count = 1024
160160

161161
[iap]
@@ -193,6 +193,7 @@ run_while_iconified = 0
193193
[druid]
194194
no_auto_input = 0
195195
stencil_check = 0
196+
no_auto_template = 0
196197
input_text = text
197198
input_touch = touch
198199
input_marked_text = marked_text
0 Bytes
Binary file not shown.

docs/druid/dmloader.js

Lines changed: 29 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ var EngineLoader = {
113113
asmjs_from: 0,
114114
asmjs_to: 50,
115115

116-
// load .wasm and set Module.instantiateWasm to use the loaded .wasm file
117-
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
118-
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
116+
stream_wasm: true,
117+
118+
loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
119119
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
120120
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
121121
function(error) { throw error; },
@@ -133,6 +133,31 @@ var EngineLoader = {
133133
});
134134
},
135135

136+
streamAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
137+
Module.instantiateWasm = function(imports, successCallback) {
138+
WebAssembly.instantiateStreaming(fetch(src), imports).then(function(output) {
139+
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
140+
successCallback(output.instance);
141+
}).catch(function(e) {
142+
console.log('wasm streaming instantiation failed! ' + e);
143+
throw e;
144+
});
145+
return {}; // Compiling asynchronously, no exports.
146+
}
147+
callback();
148+
},
149+
150+
// instantiate the .wasm file either by streaming it or first loading and then instantiate it
151+
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
152+
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
153+
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
154+
EngineLoader.streamAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
155+
}
156+
else {
157+
EngineLoader.loadAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
158+
}
159+
},
160+
136161
// load and start engine script (asm.js or wasm.js)
137162
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
138163
FileLoader.load(src, "text", estimatedSize,
@@ -457,35 +482,6 @@ var Progress = {
457482
}
458483
};
459484

460-
/* ********************************************************************* */
461-
/* Default input override */
462-
/* ********************************************************************* */
463-
464-
var CanvasInput = {
465-
arrowKeysHandler : function(e) {
466-
switch(e.keyCode) {
467-
case 37: case 38: case 39: case 40: // Arrow keys
468-
case 32: e.preventDefault(); e.stopPropagation(); // Space
469-
default: break; // do not block other keys
470-
}
471-
},
472-
473-
onFocusIn : function(e) {
474-
window.addEventListener("keydown", CanvasInput.arrowKeysHandler, false);
475-
},
476-
477-
onFocusOut: function(e) {
478-
window.removeEventListener("keydown", CanvasInput.arrowKeysHandler, false);
479-
},
480-
481-
addToCanvas : function(canvas) {
482-
canvas.addEventListener("focus", CanvasInput.onFocusIn, false);
483-
canvas.addEventListener("blur", CanvasInput.onFocusOut, false);
484-
canvas.focus();
485-
CanvasInput.onFocusIn();
486-
}
487-
};
488-
489485
/* ********************************************************************* */
490486
/* Module is Emscripten namespace */
491487
/* ********************************************************************* */
@@ -578,30 +574,6 @@ var Module = {
578574
return webgl_support;
579575
},
580576

581-
handleVisibilityChange: function () {
582-
GLFW.onFocusChanged(document[Module.hiddenProperty] ? 0 : 1);
583-
},
584-
585-
getHiddenProperty: function () {
586-
if ('hidden' in document) return 'hidden';
587-
var prefixes = ['webkit','moz','ms','o'];
588-
for (var i = 0; i < prefixes.length; i++) {
589-
if ((prefixes[i] + 'Hidden') in document)
590-
return prefixes[i] + 'Hidden';
591-
}
592-
return null;
593-
},
594-
595-
setupVisibilityChangeListener: function() {
596-
Module.hiddenProperty = Module.getHiddenProperty();
597-
if( Module.hiddenProperty ) {
598-
var eventName = Module.hiddenProperty.replace(/[H|h]idden/,'') + 'visibilitychange';
599-
document.addEventListener(eventName, Module.handleVisibilityChange, false);
600-
} else {
601-
console.log("No document.hidden property found. The focus events won't be enabled.")
602-
}
603-
},
604-
605577
setupCanvas: function(appCanvasId) {
606578
appCanvasId = (typeof appCanvasId === 'undefined') ? 'canvas' : appCanvasId;
607579
Module.canvas = document.getElementById(appCanvasId);
@@ -672,10 +644,7 @@ var Module = {
672644
Module.fullScreenContainer = fullScreenContainer || Module.canvas;
673645

674646
if (Module.hasWebGLSupport()) {
675-
// Override game keys
676-
CanvasInput.addToCanvas(Module.canvas);
677-
678-
Module.setupVisibilityChangeListener();
647+
Module.canvas.focus();
679648

680649
// Add context menu hide-handler if requested
681650
if (params["disable_context_menu"])

0 commit comments

Comments
 (0)