creating a game loop in a windows store game using html and javascript

Post on 24-May-2015

2.496 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

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.

TRANSCRIPT

Creating a Game Loop in a Windows Store Game using HTML and JavaScript

Dave IsbitskiTechnology Evangelist, Windows 8twitter.com/TheDaveDevblogs.msdn/com/davedevdavid.isbitski@microsoft.com

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 | david.isbitski@microsoft.com

http://bit.ly/genapp8

top related