1 decade ago by KirbySaysHi
I'm on a laptop, so it's very important that the CPU not be churning away when I'm not actively using the game (both for battery life and my lap!). I saw a previous thread regarding requestAnimationFrame in the git repo, but I guess that never made it past a test phase.
Anywho, I made my own tonight, and figured I'd share it. I tested it using the jumpandrun and box2d examples. It's a git diff patch, since the changes are just a bit too complex to paste in here (it would basically end up with me pasting whole files, which is not good). It's only a few small changes, which are pretty obvious from the diff if you wanted to apply it manually.
Here it is:
https://gist.github.com/1255534
It includes Paul Irish's requestAnimFrame polyfill, and also allows for non-requestAnimationFrame use (i.e. the standard setInterval Impact uses) by setting ig.system.raf to false in your main init function.
I'm new here, so if there is a better way to do this, please let me know!
Anywho, I made my own tonight, and figured I'd share it. I tested it using the jumpandrun and box2d examples. It's a git diff patch, since the changes are just a bit too complex to paste in here (it would basically end up with me pasting whole files, which is not good). It's only a few small changes, which are pretty obvious from the diff if you wanted to apply it manually.
Here it is:
https://gist.github.com/1255534
It includes Paul Irish's requestAnimFrame polyfill, and also allows for non-requestAnimationFrame use (i.e. the standard setInterval Impact uses) by setting ig.system.raf to false in your main init function.
I'm new here, so if there is a better way to do this, please let me know!