diff options
Diffstat (limited to 'src/library_glut.js')
-rw-r--r-- | src/library_glut.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/library_glut.js b/src/library_glut.js index 722ea85c..ba4d75ab 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -59,6 +59,9 @@ var LibraryGLUT = { getSpecialKey: function(keycode) { var key = null; switch (keycode) { + case 8: key = 120 /* backspace */; break; + case 46: key = 111 /* delete */; break; + case 0x70 /*DOM_VK_F1*/: key = 1 /* GLUT_KEY_F1 */; break; case 0x71 /*DOM_VK_F2*/: key = 2 /* GLUT_KEY_F2 */; break; case 0x72 /*DOM_VK_F3*/: key = 3 /* GLUT_KEY_F3 */; break; @@ -228,14 +231,14 @@ var LibraryGLUT = { if (delta < 0) { button = 4; // wheel down } - + if (GLUT.mouseFunc) { event.preventDefault(); GLUT.saveModifiers(event); Runtime.dynCall('viiii', GLUT.mouseFunc, [button, 0/*GLUT_DOWN*/, Browser.mouseX, Browser.mouseY]); } }, - + // TODO add fullscreen API ala: // http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/ onFullScreenEventChange: function(event) { @@ -304,7 +307,7 @@ var LibraryGLUT = { // Firefox window.addEventListener("DOMMouseScroll", GLUT.onMouseWheel, true); } - + Browser.resizeListeners.push(function(width, height) { if (GLUT.reshapeFunc) { Runtime.dynCall('vii', GLUT.reshapeFunc, [width, height]); @@ -372,7 +375,7 @@ var LibraryGLUT = { }, glutIdleFunc: function(func) { - var callback = function() { + function callback() { if (GLUT.idleFunc) { Runtime.dynCall('v', GLUT.idleFunc); Browser.safeSetTimeout(callback, 0); @@ -427,7 +430,9 @@ var LibraryGLUT = { glutCreateWindow__deps: ['$Browser'], glutCreateWindow: function(name) { var contextAttributes = { - antialias: ((GLUT.initDisplayMode & 0x0080 /*GLUT_MULTISAMPLE*/) != 0) + antialias: ((GLUT.initDisplayMode & 0x0080 /*GLUT_MULTISAMPLE*/) != 0), + depth: ((GLUT.initDisplayMode & 0x0010 /*GLUT_DEPTH*/) != 0), + stencil: ((GLUT.initDisplayMode & 0x0020 /*GLUT_STENCIL*/) != 0) }; Module.ctx = Browser.createContext(Module['canvas'], true, true, contextAttributes); return Module.ctx ? 1 /* a new GLUT window ID for the created context */ : 0 /* failure */; |