Browse Source

[wip] enable minimal runtime for the test app

chainsaw-surgery
Vladimír Vondruš 7 years ago
parent
commit
29e01d9b88
  1. 2
      src/Magnum/Platform/Test/CMakeLists.txt
  2. 19
      src/Magnum/Platform/Test/EmscriptenApplicationTest.html

2
src/Magnum/Platform/Test/CMakeLists.txt

@ -25,6 +25,8 @@
set(ADDITIONAL_WEB_FILES "")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lGL -s MINIMAL_RUNTIME=2 -s IGNORE_CLOSURE_COMPILER_ERRORS=1 -s ENVIRONMENT=web")
if(WITH_ANDROIDAPPLICATION)
add_library(PlatformAndroidApplicationTest SHARED AndroidApplicationTest.cpp)
target_link_libraries(PlatformAndroidApplicationTest PRIVATE MagnumAndroidApplication)

19
src/Magnum/Platform/Test/EmscriptenApplicationTest.html

@ -14,8 +14,25 @@
<div id="status">Initialization...</div>
<div id="status-description"></div>
<script src="EmscriptenApplication.js"></script>
<script async="async" src="PlatformEmscriptenApplicationTest.js"></script>
<script>
function script(url, cb) {
var s = document.createElement('script');
s.src = url;
s.onload = cb;
document.body.appendChild(s);
}
function binary(url, cb) {
var x = new XMLHttpRequest();
x.open('GET', url, true);
x.responseType = 'arraybuffer';
x.onload = function() { cb(x.response); }
x.send(null);
}
binary('PlatformEmscriptenApplicationTest.wasm', function(wasm) {
Module.wasm = wasm;
script('PlatformEmscriptenApplicationTest.js');
});
/* To test keyboard capture directly on the canvas */
Module.keyboardListeningElement = Module.canvas;
Module.canvas.addEventListener('mousedown', function(event) {

Loading…
Cancel
Save