Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Windows 8 RTM Release & Fixes

- Updated for Windows 8 RTM
- Fixed Accelerometer Device Check.  Gravity Pulse will not be available
if no Accelerometer device is present.  It will instead ignore any
Gravity Pulse Power ups. On devices with an Accelerometer the Gravity
Pulse power will be enabled.
  • Loading branch information...
commit 0f9a6354c0b3226492d6534fc4ce9ab8a36bfb5b 1 parent 5a4ea21
David Isbitski authored
View
2  Readme.txt
@@ -1,4 +1,4 @@
-Metro Game Kit
+Metro Game Kit 1.00 (Windows 8 RTM Release)
Author: Dave Isbitski
Git: http://github.com/disbitski
View
56 SpaceCadet.sln
@@ -1,44 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 11
-Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "SpaceCadet", "SpaceCadet\SpaceCadet.jsproj", "{2666F999-F568-44A2-A589-CA5C477D0B33}"
+# Visual Studio Express 2012 for Windows 8
+Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "SpaceCadet", "SpaceCadet\SpaceCadet.jsproj", "{EE017C39-8A16-433B-9AD7-E2C9D02B676F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM = Debug|ARM
Debug|Any CPU = Debug|Any CPU
+ Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
- Release|ARM = Release|ARM
Release|Any CPU = Release|Any CPU
+ Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|ARM.ActiveCfg = Debug|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|ARM.Build.0 = Debug|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|ARM.Deploy.0 = Debug|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x64.ActiveCfg = Debug|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x64.Build.0 = Debug|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x64.Deploy.0 = Debug|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x86.ActiveCfg = Debug|x86
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x86.Build.0 = Debug|x86
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Debug|x86.Deploy.0 = Debug|x86
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|ARM.ActiveCfg = Release|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|ARM.Build.0 = Release|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|ARM.Deploy.0 = Release|ARM
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|Any CPU.Build.0 = Release|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x64.ActiveCfg = Release|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x64.Build.0 = Release|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x64.Deploy.0 = Release|x64
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x86.ActiveCfg = Release|x86
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x86.Build.0 = Release|x86
- {2666F999-F568-44A2-A589-CA5C477D0B33}.Release|x86.Deploy.0 = Release|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|ARM.ActiveCfg = Debug|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|ARM.Build.0 = Debug|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|ARM.Deploy.0 = Debug|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x64.ActiveCfg = Debug|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x64.Build.0 = Debug|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x64.Deploy.0 = Debug|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x86.ActiveCfg = Debug|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x86.Build.0 = Debug|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Debug|x86.Deploy.0 = Debug|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|ARM.ActiveCfg = Release|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|ARM.Build.0 = Release|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|ARM.Deploy.0 = Release|ARM
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x64.ActiveCfg = Release|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x64.Build.0 = Release|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x64.Deploy.0 = Release|x64
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x86.ActiveCfg = Release|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x86.Build.0 = Release|x86
+ {EE017C39-8A16-433B-9AD7-E2C9D02B676F}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
16 SpaceCadet/SpaceCadet.jsproj
@@ -35,7 +35,10 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>2666f999-f568-44a2-a589-ca5c477d0b33</ProjectGuid>
+ <ProjectGuid>ee017c39-8a16-433b-9ad7-e2c9d02b676f</ProjectGuid>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0'">
+ <VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
@@ -66,12 +69,11 @@
<Content Include="images\splashscreen.png" />
<Content Include="images\starfield.jpg" />
<Content Include="images\storelogo.png" />
- <Content Include="css\default.css" />
<Content Include="js\default.js" />
+ <Content Include="css\default.css" />
<Content Include="js\ship.js" />
<Content Include="js\sound.js" />
<Content Include="js\starField.js" />
- <Content Include="page.html" />
<Content Include="sounds\hydrogen.mp3" />
<Content Include="sounds\laser1.mp3" />
<Content Include="sounds\laser2.mp3" />
@@ -82,14 +84,18 @@
<None Include="SpaceCadet_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
- <SDKReference Include="Microsoft.WinJS.1.0.RC, Version=1.0" />
+ <SDKReference Include="Microsoft.WinJS.1.0, Version=1.0" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below then uncomment
+ that target and the DisableFastUpToDateCheck PropertyGroup.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
+ <PropertyGroup>
+ <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
+ </PropertyGroup>
-->
</Project>
View
BIN  SpaceCadet/SpaceCadet_TemporaryKey.pfx
Binary file not shown
View
6 SpaceCadet/css/default.css
@@ -18,7 +18,6 @@ body {
height: 768px;
width: 1024px;
}
-
@media screen and (-ms-view-state: fullscreen-landscape) {
}
@@ -26,7 +25,7 @@ body {
}
@media screen and (-ms-view-state: snapped) {
- #imgMenu {
+ #imgMenu {
-ms-transform: translate(0px, 0px) rotate(0deg) scale(0.50);
}
@@ -53,7 +52,8 @@ body {
#txtScore {
-ms-transform: translate(0px, 0px) rotate(0deg) scale(0.30);
}
-
+
+
}
@media screen and (-ms-view-state: fullscreen-portrait) {
View
16 SpaceCadet/default.html
@@ -1,23 +1,23 @@
<!DOCTYPE html>
<html>
<head>
- <meta charset="utf-8">
+ <meta charset="utf-8" />
<title>SpaceCadet</title>
- <!-- WinJS References -->
- <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
- <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
- <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
+ <!-- WinJS references -->
+ <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
+ <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
+ <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
- <!-- App References -->
- <link href="/css/default.css" rel="stylesheet">
+ <!-- SpaceCadet references -->
+ <link href="/css/default.css" rel="stylesheet" />
<link href="/css/space.css" rel="stylesheet"/>
<script src="/js/default.js"></script>
<script src="/js/sound.js"></script>
<script src="/js/ship.js"></script>
<script src="/js/starField.js"></script>
-
</head>
+
<body style="background-image: url('/images/starfield.jpg');">
<div id="divGame">
View
94 SpaceCadet/js/default.js
@@ -3,7 +3,7 @@
/// <reference path="starField.js" />
// Title: Space Cadet
-// Version 1.0
+// Version 1.0 Windows 8 RTM
// Desc: Fun Space Game to demonstrate Win8 Metro Style App using HTML5 Canvas, CSS3,
// Accelerometer, Camera, Touch, and Trial APIs
//
@@ -13,7 +13,7 @@
//
// Contact: david.isbitski@microsoft.com, twitter.com/thedavedev, blogs.msdn.com/davedev, github.com/disbitski, slideshare.net/disbitski
//
-// Last Mod: 6/7/12
+// Last Mod: 8/23/2012
//
// Special Thanks To:
// Mark Hindsbo - Developer of starField.js which is used in the Menu Screen
@@ -27,19 +27,20 @@
(function () {
"use strict";
+ WinJS.Binding.optimizeBindingReferences = true;
+
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
- WinJS.strictProcessing();
//Version
- var GAME_VERSION = "1.00";
+ var GAME_VERSION = "1.00 RTM";
//ship and screen constants
var POINTS_SHIPHIT = 100;
var SNAPPED_VIEW = 320;
var SCREEN_WIDTH = 1366;
var SCREEN_HEIGHT = 768;
- var FULLSCREEN_WIDTH = 1366; //To fix current CP bug
+ var FULLSCREEN_WIDTH = 1366;
var SHIP_WIDTH = 190;
var SHIP_HEIGHT = 100;
var MAX_ACCEL = 17;
@@ -51,7 +52,7 @@
var LEVEL_RENDER_FRAMES = 10;
var LEVEL_PTS_REQ = 2000;
var LEVEL_SPEED_INCREASE = 0.1;
- var GRAVITY_WAVE_PTS_REQ = 1500; //1000 for rest, 4000 real gameplay
+ var GRAVITY_WAVE_PTS_REQ = 1000; //1000 for rest, 4000 real gameplay
//initial player score
@@ -61,7 +62,7 @@
//canvas and context
var canvas;
var ctx;
-
+
//camera
var capturedPhoto;
@@ -69,7 +70,7 @@
var accelerometer;
var intervalId = 0;
var getReadingInterval = 0;
-
+
//ships
var ships = new Array(MAX_SHIPS);
@@ -114,8 +115,8 @@
var lvlCurrent = 0;
var lvlNextPts = LEVEL_PTS_REQ;
var lvlDifficulty = LEVEL_SPEED_INCREASE;
-
-
+
+
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
@@ -128,7 +129,8 @@
args.setPromise(WinJS.UI.processAll());
}
};
-
+
+
function gravityWave() {
//playSound("gravitywave");
for (var i = 0; i < MAX_SHIPS; i++) {
@@ -138,12 +140,12 @@
//Accelerometer has been shaken and now we need to grant the bonus power
function onShakenAccel(event) {
- //Stop Listening to Accelerometer
+ //Stop Listening to Accelerometer
accelerometer.removeEventListener("shaken", onShakenAccel);
//Gravity Wave Power - Destory all ships
gravityWave();
-
+
}
//Init Accelerometer
@@ -155,9 +157,9 @@
var reportInterval = minimumReportInterval > 16 ? minimumReportInterval : 16;
accelerometer.reportInterval = reportInterval;
getReadingInterval = reportInterval * 2; // double the interval for display (to reduce CPU usage)
-
+
} else {
- displayError("No accelerometer found");
+ displayError("No accelerometer found");
}
}
@@ -205,14 +207,14 @@
stars = new StarField(ctx, 500, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, "z", -0.2);
//Init Sounds
- SoundJS.addBatch([
- { name: "redalert", src: "../sounds/redalert.mp3", instances: 1 },
- { name: "newlevel", src: "../sounds/newlevel.mp3", instances: 1 },
- { name: "pulse", src: "../sounds/pulse.mp3", instances: 1 },
- { name: "laser1", src: "../sounds/laser1.mp3", instances: 1 },
- { name: "laser2", src: "../sounds/laser2.mp3", instances: 1 },
- { name: "laser3", src: "../sounds/laser3.mp3", instances: 1 }]);
-
+ SoundJS.addBatch([
+ { name: "redalert", src: "../sounds/redalert.mp3", instances: 1 },
+ { name: "newlevel", src: "../sounds/newlevel.mp3", instances: 1 },
+ { name: "pulse", src: "../sounds/pulse.mp3", instances: 1 },
+ { name: "laser1", src: "../sounds/laser1.mp3", instances: 1 },
+ { name: "laser2", src: "../sounds/laser2.mp3", instances: 1 },
+ { name: "laser3", src: "../sounds/laser3.mp3", instances: 1 }]);
+
//Handle Touch
canvas.addEventListener("MSPointerUp", touchHandler, false);
@@ -267,7 +269,7 @@
//Set boundries to be one ship size
MAX_X = canvas.width - (SHIP_WIDTH + 20);
MAX_Y = canvas.height - (SHIP_HEIGHT + 50);
-
+
var menuX, btnX, btnY;
menuX = (SCREEN_WIDTH - imgMenu.width) / 2;
@@ -283,13 +285,13 @@
musicGame.pause();
musicMenu.play();
-
+
}
//Set up Game Screen UI Elements
function startGame(event) {
- txtPlayerName.style.visibility="visible";
- txtScore.style.visibility="visible";
+ txtPlayerName.style.visibility = "visible";
+ txtScore.style.visibility = "visible";
imgPlayer.style.visibility = "visible";
imgMenu.style.visibility = "hidden";
btnStart.style.visibility = "hidden";
@@ -303,7 +305,7 @@
musicGame.play();
menuEnabled = false;
-
+
}
//AppBar Camera Icon Event Handler
@@ -342,7 +344,7 @@
//Save state of current x position
function applicationStateCheckpoint() {
- //TODO: Save State
+ //TODO: Save State
}
//Verify if point was within the bounds of an actual ship
@@ -360,7 +362,7 @@
var r = randomAccel(0, 2);
var laserSound = lasers[r];
SoundJS.play(laserSound, SoundJS.INTERRUPT_ANY);
-
+
//TODO: Animation Explosion and better sound
var explosion = new Image();
explosion.onload = function () {
@@ -371,7 +373,7 @@
ship.destroyed = true;
updateScore(POINTS_SHIPHIT);
-
+
return ship;
}
@@ -395,7 +397,7 @@
else {
return false;
}
-
+
}
//update player score
@@ -406,10 +408,12 @@
txtScore.innerHTML = " Score: " + score;
if (scoreGravity === GRAVITY_WAVE_PTS_REQ) {
- accelerometer.addEventListener("shaken", onShakenAccel);
- txtScore.innerHTML = " > SHAKE THAT SCREEN <";
+ if (accelerometer != null && accelerometer != undefined) {
+ accelerometer.addEventListener("shaken", onShakenAccel);
+ txtScore.innerHTML = " > SHAKE THAT SCREEN <";
+ SoundJS.play("pulse", SoundJS.INTERRUPT_ANY);
+ }
scoreGravity = 0;
- SoundJS.play("pulse", SoundJS.INTERRUPT_ANY);
}
//new level
@@ -419,7 +423,7 @@
txtLevel.innerHTML = "Level: " + lvlCurrent;
lvlDifficulty = LEVEL_SPEED_INCREASE * lvlCurrent;
- SoundJS.play("newlevel",SoundJS.INTERUPT_ANY);
+ SoundJS.play("newlevel", SoundJS.INTERUPT_ANY);
}
@@ -461,7 +465,7 @@
//clear each frame
ctx.clearRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
-
+
//Render ships to canvas
for (var i = 0; i < MAX_SHIPS; i++) {
ship = ships[i];
@@ -515,7 +519,7 @@
displayError(err);
}
}
-
+
function displayError(err) {
errorMsg = err;
}
@@ -532,10 +536,22 @@
} else if (newViewState === viewStates.fullScreenPortrait) {
//Currently not supported
}
-
+
}
//If Document fully loaded than begin processing
document.addEventListener("DOMContentLoaded", initialize, false);
+
+
+ //app.oncheckpoint = function (args) {
+ // // TODO: This application is about to be suspended. Save any state
+ // // that needs to persist across suspensions here. You might use the
+ // // WinJS.Application.sessionState object, which is automatically
+ // // saved and restored across suspension. If you need to complete an
+ // // asynchronous operation before your application is suspended, call
+ // // args.setPromise().
+ //};
+
+ //app.start();
})();
View
11 SpaceCadet/package.appxmanifest
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
- <Identity Name="2666f999-f568-44a2-a589-ca5c477d0b33" Version="1.0.0.0" Publisher="CN=David" />
+ <Identity Name="ee017c39-8a16-433b-9ad7-e2c9d02b676f" Version="1.0.0.0" Publisher="CN=davisbi" />
<Properties>
<DisplayName>SpaceCadet</DisplayName>
- <PublisherDisplayName>David</PublisherDisplayName>
+ <PublisherDisplayName>davisbi</PublisherDisplayName>
<Logo>images\storelogo.png</Logo>
</Properties>
<Prerequisites>
- <OSMinVersion>6.2.0</OSMinVersion>
- <OSMaxVersionTested>6.2.0</OSMaxVersionTested>
+ <OSMinVersion>6.2.1</OSMinVersion>
+ <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
@@ -17,10 +17,9 @@
<Application Id="App" StartPage="default.html">
<VisualElements DisplayName="SpaceCadet" Logo="images\logo.png" SmallLogo="images\smalllogo.png" Description="SpaceCadet" ForegroundText="light" BackgroundColor="black">
<DefaultTile ShowName="allLogos" />
- <SplashScreen Image="images\splashscreen.png" BackgroundColor="black" />
+ <SplashScreen Image="images\splashscreen.png" />
<InitialRotationPreference>
<Rotation Preference="landscape" />
- <Rotation Preference="landscapeFlipped" />
</InitialRotationPreference>
</VisualElements>
</Application>
View
8 SpaceCadet/page.html
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title></title>
- </head>
- <body>
- </body>
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.