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

Transcript
Page 1: Creating a Game Loop in a Windows Store Game using HTML and JavaScript

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

win8gamekit.codeplex.com

Page 3: Creating a Game Loop in a Windows Store Game using HTML and JavaScript
Page 4: Creating a Game Loop in a Windows Store Game using HTML and JavaScript

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

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

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