diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-10 17:03:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-10 17:03:26 -0700 |
commit | 27379196d5710f73445eeb1e2d1dbaacdabd1c4c (patch) | |
tree | 98c6208d37339aee7bc38e735dace23edf0dadf8 | |
parent | 4ab8ed773d9082e4e7aa17b47e5bc7b38e5abe23 (diff) |
emscripten_hide_mouse
-rw-r--r-- | src/library_browser.js | 12 | ||||
-rw-r--r-- | system/include/emscripten.h | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 4e25d9d0..eb7f0293 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -208,6 +208,18 @@ mergeInto(LibraryManager.library, { } else { Browser.requestAnimationFrame(asyncCall); } + }, + + emscripten_hide_mouse: function() { + var styleSheet = document.styleSheets[0]; + var rules = styleSheet.cssRules; + for (var i = 0; i < rules.length; i++) { + if (rules[i].cssText.substr(0, 5) == 'canvas') { + styleSheet.deleteRule(i); + i--; + } + } + styleSheet.insertRule('canvas.emscripten { border: 1px solid black; cursor: none; }', 0); } }); diff --git a/system/include/emscripten.h b/system/include/emscripten.h index fdccfe82..a4f15868 100644 --- a/system/include/emscripten.h +++ b/system/include/emscripten.h @@ -57,6 +57,14 @@ void emscripten_async_call(void (*func)(), int millis) { #endif /* + * Hide the OS mouse cursor over the canvas. Note that SDL's + * SDL_ShowCursor command shows and hides the SDL cursor, not + * the OS one. This command is useful to hide the OS cursor + * if your app draws its own cursor. + */ +void emscripten_hide_mouse(); + +/* * This macro-looking function will cause Emscripten to * generate a comment in the generated code. * XXX This is deprecated for now, because it requires us to |