diff options
author | max99x <max99x@gmail.com> | 2011-06-26 02:28:17 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-06-26 02:28:17 +0300 |
commit | f08cb4c404d482abf346c56726c0e97f69b0905b (patch) | |
tree | b95c27c63e22eb8c1e7985ba5f17bdbe71a7e29d | |
parent | 2a1dc05129804978f21b2f51af08ca678fe92ea1 (diff) | |
parent | 3b8d9bd7be99de97c9b8a1ec29d3ae1e6698cd9d (diff) |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | src/library_sdl.js | 21 | ||||
-rw-r--r-- | src/preamble.js | 4 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 40fc5e7f..6a984c43 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1,7 +1,7 @@ // To use emscripten's SDL library here, you need to define // Module.canvas and at least one of Module.ctx2D, Module.ctxGL. // -// More specifically, our SDL implementation will look for +// More specifically, for 2D our SDL implementation will look for // Module.canvas and Module.ctx2D. You should fill them using // something like // @@ -60,6 +60,25 @@ </html> */ +// Other stuff to take into account: +// +// * It's best to set the ctx stuff in your html file, as above. Otherwise you will need +// to edit the generated .js file each time you generate it. +// +// * Your code should not write a 32-bit value and expect that to set an RGBA pixel. +// The reason is that that data will be read as 8-bit values, and according to the +// load-store consistency assumption, it should be written that way (see docs/paper.pdf). +// Instead, do something like *ptr++ = R; *ptr++ = G; *ptr++ = B; +// +// * SQL_Quit will wipe the screen with random noise. This is intentional, in order +// to make it clear when SDL has shut down (which could be due to an error). If you +// want your output to remain on the screen, do not call SDL_Quit. +// +// * A normal C++ main loop with SDL_Delay will not work in JavaScript - there is no way +// to wait for a short time without locking up the web page entirely. The simplest +// solution here is to have a singleIteration() function which is a single loop +// iteration, and from JS to do something like setInterval(_singleIteration, 1/30) + mergeInto(Library, { $SDL__deps: ['$Browser'], $SDL: { diff --git a/src/preamble.js b/src/preamble.js index 8ee543a7..afada476 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -278,8 +278,8 @@ var START_TIME = Date.now(); // Runtime essentials //======================================== -function __globalConstructor__() { -} +var __globalConstructor__ = function globalConstructor() { +}; var __THREW__ = false; // Used in checking for thrown exceptions. |