Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix issue with timer when request animation frame did not exist (Safari)

  • Loading branch information...
commit 9ae040d79533365c66edb06ae9aee14775b859ee 1 parent 3dcf468
@mortennobel authored
View
3  build/kick-debug-0.3.1.js
@@ -8588,7 +8588,7 @@ KICK.namespace = function (ns_string) {
window.msRequestAnimationFrame ||
function (/* function */ callback, /* DOMElement */ element) {
var fps60 = 16.7;
- return window.setTimeout(callback, fps60);
+ return window.setTimeout(callback, fps60, new Date().getTime());
};
})();
@@ -11272,6 +11272,7 @@ KICK.namespace = function (ns_string) {
* @method createDefault
* @param {KICK.core.Engine} engine
* @static
+ * @return {KICK.scene.Scene}
*/
scene.Scene.createDefault = function(engine){
var newScene = new scene.Scene(engine);
View
2  build/kick-min-0.3.1.js
@@ -171,7 +171,7 @@ return null===f?g:parseFloat(f)},scaleImage:function(f,c,g){var d=document.creat
removeElementsFromArray:function(f,c){var g,d;for(g=f.length-1;0<=g;g--)for(d=c.length-1;0<=d;d--)f[g]===c[d]&&f.splice(g,1)},insertSorted:function(f,c,g){var d;g||(g=i.Util.numberSortFunction);for(d=c.length-1;0<=d;d--)if(0>=g(c[d],f)){c.splice(d+1,0,f);return}c.unshift(f)},numberSortFunction:function(f,c){return f-c},contains:function(f,c){for(var g=f.length-1;0<=g;g--)if(f[g]===c)return!0;return!1},uint32ToVec4:function(f,c){c||(c=new Float32Array(4));y[0]=f;for(var g=0;4>g;g++)c[g]=o[g]/255;return c},
vec4ToUint32:function(f){for(var c=0;4>c;c++)o[c]=255*f[c];return y[0]},vec4uint8ToUint32:function(f){for(var c=0;4>c;c++)o[c]=f[c];return y[0]},utf8Encode:function(f){for(var c=[],g=0;g<f.length;g++){var d=f.charCodeAt(g);127>d?c.push(d):2047>=d?(c.push(192+(d>>6)),c.push(128+(d&63))):65535>=d&&(c.push(224+(d>>12)),c.push(128+(d>>6&63)),c.push(128+(d&63)))}return new Uint8Array(c)},utf8Decode:function(f){for(var c="",g=0;g<f.length;g++){var d=f[g];if(0===(d&128))c+=String.fromCharCode(d);else if(192===
(d&224)){g++;var i=f[g],d=(d&31)<<6,i=i&63,d=d+i,c=c+String.fromCharCode(d)}else if(224===(d&240)){g++;i=f[g];g++;var h=f[g],d=(d&31)<<12,i=(i&63)<<6,h=h&63,d=d+i+h,c=c+String.fromCharCode(d)}}return c}};Object.freeze(i.Util);"undefined"===typeof window.requestAnimationFrame&&(window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(f){return window.setTimeout(f,
-16.7)}}(),window.cancelRequestAnimFrame=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout);"undefined"===typeof window.console&&(window.console={});"undefined"===typeof window.console.log&&(window.console.log=function(f){alert(f)})})();KICK=KICK||{};KICK.namespace=function(i){var i=i.split("."),l=window,h;for(h=0;h<i.length;h+=1)"undefined"===typeof l[i[h]]&&(l[i[h]]={}),l=l[i[h]];return l};
+16.7,(new Date).getTime())}}(),window.cancelRequestAnimFrame=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout);"undefined"===typeof window.console&&(window.console={});"undefined"===typeof window.console.log&&(window.console.log=function(f){alert(f)})})();KICK=KICK||{};KICK.namespace=function(i){var i=i.split("."),l=window,h;for(h=0;h<i.length;h+=1)"undefined"===typeof l[i[h]]&&(l[i[h]]={}),l=l[i[h]];return l};
(function(){var i=KICK.namespace("KICK.core"),l=i.Util.utf8Decode,h=i.Util.utf8Encode,y=new Uint8Array(4);i.ChunkData=function(){var i=function(c,g,f,i){var h=this;this.chunkId=c;this.chunkType=g;this.chunkDataLength=f;this.data=i;Object.defineProperties(this,{paddingSize:{get:function(){var c=h.data.length*h.data.BYTES_PER_ELEMENT%8;return c?8-c:0}},paddingData:{get:function(){return y.subarray(0,h.paddingSize)}}})},f=this,c=[],g=function(c){return 1===c?Float32Array:2===c?Float64Array:3===c?Int16Array:
4===c?Int32Array:5===c?Int8Array:6===c?Uint16Array:8===c?Uint8Array:null};this.getSize=function(){for(var d=0,g=0;g<c.length;g++)d+=c[g].chunkDataLength+8+c[g].paddingSize;d=8+d;g=d%8;0!==g&&(d+=8-g);return d};this.serialize=function(){var d=new ArrayBuffer(f.getSize()),i=0,h=new Uint8Array(d,0),o=new Uint16Array(d,i);o[0]=61441;o[1]=1;i+=4;o=new Uint32Array(d,i);o[0]=c.length;for(var i=i+4,l=0;l<c.length;l++)o=new Uint16Array(d,i),o[0]=c[l].chunkId,o[1]=c[l].chunkType,i+=4,o=new Uint32Array(d,i),
o[0]=c[l].chunkDataLength,i+=4,o=new (g(c[l].chunkType))(d),o.set(c[l].data,i/o.BYTES_PER_ELEMENT),i+=c[l].chunkDataLength,h.set(c[l].paddingData,i),i+=c[l].paddingSize;return d};this.get=function(d){for(var g=0;g<c.length;g++)if(c[g].chunkId===d)return c[g].data;return null};this.getString=function(c){return(c=f.get(c))?l(c):null};this.getNumber=function(c){return(c=f.get(c))?c[0]:null};this.getArrayBuffer=function(c){if(c=f.get(c)){var g=new ArrayBuffer(c.length*c.BYTES_PER_ELEMENT);(new Uint8Array(g)).set(c);
View
2  src/js/core.js
@@ -2510,7 +2510,7 @@ KICK.namespace = function (ns_string) {
window.msRequestAnimationFrame ||
function (/* function */ callback, /* DOMElement */ element) {
var fps60 = 16.7;
- return window.setTimeout(callback, fps60);
+ return window.setTimeout(callback, fps60, new Date().getTime());
};
})();
Please sign in to comment.
Something went wrong with that request. Please try again.