diff options
author | manny/MADE <nerurkar@made-apps.biz> | 2013-06-12 13:27:22 +0200 |
---|---|---|
committer | manny/MADE <nerurkar@made-apps.biz> | 2013-06-19 13:11:56 +0200 |
commit | 6d6490e61ef9a63cbf314faa19e152796a21f3d3 (patch) | |
tree | d6b1643e8a4cf4a8f5232f9456d83364b472dd20 | |
parent | 939bda64f5f205c3c6ba774e5a69966053fa6222 (diff) |
IMPROVED: ADDED resizeListener that invokes the GLUT.reshapeFunc if specified
-rw-r--r-- | src/library_glut.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/library_glut.js b/src/library_glut.js index 38cfe55b..ac045d6b 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -262,6 +262,7 @@ var LibraryGLUT = { glutGetModifiers: function() { return GLUT.modifiers; }, + glutInit__deps: ['$Browser'], glutInit: function(argcp, argv) { // Ignore arguments GLUT.initTime = Date.now(); @@ -271,6 +272,13 @@ var LibraryGLUT = { window.addEventListener("mousemove", GLUT.onMousemove, true); window.addEventListener("mousedown", GLUT.onMouseButtonDown, true); window.addEventListener("mouseup", GLUT.onMouseButtonUp, true); + + Browser.resizeListeners.push(function(width, height) { + + if (GLUT.reshapeFunc) { + Runtime.dynCall('vii', GLUT.reshapeFunc, [width, height]); + } + }); __ATEXIT__.push({ func: function() { window.removeEventListener("keydown", GLUT.onKeydown, true); @@ -355,7 +363,7 @@ var LibraryGLUT = { GLUT.specialUpFunc = func; }, - glutReshapeFunc: function(func) { + glutReshapeFunc: function(func) { GLUT.reshapeFunc = func; }, |