Upload
david-isbitski
View
2.491
Download
0
Embed Size (px)
DESCRIPTION
Creating a Game Loop in a Windows Store Game using HTML and JavaScript. All of the code can be downloaded at http://win8gamekit.codeplex.com. For more in the series check out my blog at http://blogs.msdn.com/davedev.
Citation preview
Creating a Game Loop in a Windows Store Game using HTML and JavaScript
Dave IsbitskiTechnology Evangelist, Windows 8twitter.com/TheDaveDevblogs.msdn/com/[email protected]
win8gamekit.codeplex.com
var FPS = 30;
init(){ // Load content/graphics here
// Start game loopsetInterval(gameLoop, 1000/FPS);
}
gameLoop(){// Update (Figure out what’s happening)// Draw (Show what’s happening)
}
setInterval
function update() {
//RequestAnimationFrame faster pef than setInterval anim = window.msRequestAnimationFrame(update);
if (menuEnabled) { drawStars(); } else { //Game Loop updateShips(); drawShips(); }}
requestAnimationFrame
http://msdn.microsoft.com/en-us/library/ie/hh920765(v=vs.85).aspx
Now is the time to write your game. Enjoy the first to market advantage!
twitter.com/thedavedev | [email protected]
http://bit.ly/genapp8