Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

headless fixes

  • Loading branch information...
commit 9f34dc735a34638f4e5203c2b66a340fd7edc471 1 parent 20e5d1c
@kripken authored
Showing with 14 additions and 0 deletions.
  1. +12 −0 cube2/game/headless.js
  2. +2 −0  cube2/game/headlessCanvas.js
View
12 cube2/game/headless.js
@@ -85,6 +85,16 @@ var window = {
}
listeners.push(func);
},
+ removeEventListener: function(id, func) {
+ var listeners = this.eventListeners[id];
+ if (!listeners) return;
+ for (var i = 0; i < listeners.length; i++) {
+ if (listeners[i] === func) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ },
callEventListeners: function(id) {
var listeners = this.eventListeners[id];
if (listeners) {
@@ -104,6 +114,7 @@ var document = {
headless: true,
eventListeners: {},
addEventListener: window.addEventListener,
+ removeEventListener: window.removeEventListener,
callEventListeners: window.callEventListeners,
getElementById: function(id) {
switch(id) {
@@ -147,6 +158,7 @@ var document = {
},
eventListeners: {},
addEventListener: document.addEventListener,
+ removeEventListener: document.removeEventListener,
callEventListeners: document.callEventListeners,
};
};
View
2  cube2/game/headlessCanvas.js
@@ -446,6 +446,7 @@ function headlessCanvas() {
case /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ 0x8DFD: return 4096;
case /* GL_MAX_VARYING_VECTORS */ 0x8DFC: return 32;
case /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ 0x8B4D: return 32;
+ case /* GL_ARRAY_BUFFER_BINDING */ 0x8894: return 0;
default: console.log('getParameter ' + pname + '?'); return 0;
}
},
@@ -600,6 +601,7 @@ function headlessCanvas() {
style: {},
eventListeners: {},
addEventListener: function(){},
+ removeEventListener: function(){},
requestFullScreen: function() {
document.fullscreenElement = document.getElementById('canvas');
window.setTimeout(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.