Game Development Reference
In-Depth Information
Consider this the quick-start guide to fast track running your own HTML5 game on Win-
dows 8.
Since everyone has their own way of building a JS game, I'll walk you through some basic
concepts and suggestions on how to get your game running.
First, move all of your game's code into the project. You can do this one of two ways:
First, follow the current project's structure and place all your images in the images folder.
Then, move your CSS into the css directory, and anything else you may have. This way you
work with the default project structure and only make a few alterations where they are
needed.
Second, ignore the current project setup and move your code over as is. For example, Impact
games make use of a media folder for all of their assets, including images and sounds, a lib
folder for all of the JavaScript code, and have their own default index.html page. Simply
move these files over as is and you'll retain the pre-existing project structure.
Understanding the App Lifecycle
As with any type of software built on a larger framework, there is the notion of an applica-
tion lifecycle. In our case, we are just referring to the build up, pause/resume, and tear down
of our application in the Windows 8 environment. If you open up the js directory and select
the default.js file, you will see the base WinJS app launch point.
// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !==
activation.ApplicationExecutionState.terminated) {
// TODO: This application has been newly launched. Initialize
// your application here.
} else {
Search WWH ::




Custom Search