![Page 1: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/1.jpg)
Creating a Game Loop in a Windows Store Game using HTML and JavaScript
Dave IsbitskiTechnology Evangelist, Windows 8twitter.com/TheDaveDevblogs.msdn/com/[email protected]
![Page 2: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/2.jpg)
win8gamekit.codeplex.com
![Page 3: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/3.jpg)
![Page 4: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/4.jpg)
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
![Page 5: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/5.jpg)
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
![Page 6: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/6.jpg)
Now is the time to write your game. Enjoy the first to market advantage!
twitter.com/thedavedev | [email protected]
http://bit.ly/genapp8
![Page 7: Creating a Game Loop in a Windows Store Game using HTML and JavaScript](https://reader035.vdocuments.net/reader035/viewer/2022070316/5560b4b4d8b42af93b8b496f/html5/thumbnails/7.jpg)