Skip to content

Commit

Permalink
IMPROVED: ADDED resizeListener that invokes the GLUT.reshapeFunc if s…
Browse files Browse the repository at this point in the history
…pecified
  • Loading branch information
MannyClicks committed Jun 19, 2013
1 parent 939bda6 commit 6d6490e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/library_glut.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ var LibraryGLUT = {

glutGetModifiers: function() { return GLUT.modifiers; },

glutInit__deps: ['$Browser'],
glutInit: function(argcp, argv) {
// Ignore arguments
GLUT.initTime = Date.now();
Expand All @@ -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);
Expand Down Expand Up @@ -355,7 +363,7 @@ var LibraryGLUT = {
GLUT.specialUpFunc = func;
},

glutReshapeFunc: function(func) {
glutReshapeFunc: function(func) {
GLUT.reshapeFunc = func;
},

Expand Down

0 comments on commit 6d6490e

Please sign in to comment.