Browse Source

Changed Android port to use iOS resources and code files.

Dominique Louis 14 years ago
parent
commit
ceb6a20e8e

+ 211 - 67
StarterKits/Android/Platformer/Platformer.csproj

@@ -8,13 +8,13 @@
     <ProjectGuid>{9FA77471-A020-4452-928B-7D72BF15C991}</ProjectGuid>
     <ProjectGuid>{9FA77471-A020-4452-928B-7D72BF15C991}</ProjectGuid>
     <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <OutputType>Library</OutputType>
     <OutputType>Library</OutputType>
-    <RootNamespace>PlatformerTwo</RootNamespace>
+    <RootNamespace>Platformer</RootNamespace>
     <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
     <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
     <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
     <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
     <AndroidResgenClass>Resource</AndroidResgenClass>
     <AndroidResgenClass>Resource</AndroidResgenClass>
     <AndroidApplication>True</AndroidApplication>
     <AndroidApplication>True</AndroidApplication>
     <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
     <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
-    <AssemblyName>PlatformerTwo</AssemblyName>
+    <AssemblyName>Platformer</AssemblyName>
     <TargetFrameworkVersion>v2.2</TargetFrameworkVersion>
     <TargetFrameworkVersion>v2.2</TargetFrameworkVersion>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -49,17 +49,42 @@
   <ItemGroup>
   <ItemGroup>
     <Compile Include="Activity1.cs" />
     <Compile Include="Activity1.cs" />
     <Compile Include="Resources\Resource.designer.cs" />
     <Compile Include="Resources\Resource.designer.cs" />
-    <Compile Include="Animation.cs" />
-    <Compile Include="AnimationPlayer.cs" />
-    <Compile Include="Circle.cs" />
-    <Compile Include="Enemy.cs" />
-    <Compile Include="Gem.cs" />
-    <Compile Include="Level.cs" />
-    <Compile Include="PlatformerGame.cs" />
-    <Compile Include="Player.cs" />
-    <Compile Include="RectangleExtensions.cs" />
-    <Compile Include="Tile.cs" />
-    <Compile Include="TouchCollectionExtensions.cs" />
+    <Compile Include="..\..\iOS\Platformer\Accelerometer.cs">
+      <Link>Accelerometer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Animation.cs">
+      <Link>Animation.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\AnimationPlayer.cs">
+      <Link>AnimationPlayer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Circle.cs">
+      <Link>Circle.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Enemy.cs">
+      <Link>Enemy.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Gem.cs">
+      <Link>Gem.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Level.cs">
+      <Link>Level.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\PlatformerGame.cs">
+      <Link>PlatformerGame.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Player.cs">
+      <Link>Player.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\RectangleExtensions.cs">
+      <Link>RectangleExtensions.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\Tile.cs">
+      <Link>Tile.cs</Link>
+    </Compile>
+    <Compile Include="..\..\iOS\Platformer\TouchCollectionExtensions.cs">
+      <Link>TouchCollectionExtensions.cs</Link>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -70,6 +95,177 @@
     <None Include="GameThumbnail.png" />
     <None Include="GameThumbnail.png" />
     <None Include="Properties\AppManifest.xml" />
     <None Include="Properties\AppManifest.xml" />
     <None Include="Properties\WMAppManifest.xml" />
     <None Include="Properties\WMAppManifest.xml" />
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer0_0.png">
+      <Link>Assets\Content\Backgrounds\Layer0_0.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer0_1.png">
+      <Link>Assets\Content\Backgrounds\Layer0_1.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer0_2.png">
+      <Link>Assets\Content\Backgrounds\Layer0_2.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer1_0.png">
+      <Link>Assets\Content\Backgrounds\Layer1_0.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer1_1.png">
+      <Link>Assets\Content\Backgrounds\Layer1_1.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer1_2.png">
+      <Link>Assets\Content\Backgrounds\Layer1_2.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer2_0.png">
+      <Link>Assets\Content\Backgrounds\Layer2_0.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer2_1.png">
+      <Link>Assets\Content\Backgrounds\Layer2_1.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Backgrounds\Layer2_2.png">
+      <Link>Assets\Content\Backgrounds\Layer2_2.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Fonts\Hud.xnb">
+      <Link>Assets\Content\Fonts\Hud.xnb</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Levels\0.txt">
+      <Link>Assets\Content\Levels\0.txt</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Levels\1.txt">
+      <Link>Assets\Content\Levels\1.txt</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Levels\2.txt">
+      <Link>Assets\Content\Levels\2.txt</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Overlays\you_died.png">
+      <Link>Assets\Content\Overlays\you_died.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Overlays\you_lose.png">
+      <Link>Assets\Content\Overlays\you_lose.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Overlays\you_win.png">
+      <Link>Assets\Content\Overlays\you_win.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\ExitReached.mp3">
+      <Link>Assets\Content\Sounds\ExitReached.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\ExitReached.wav">
+      <Link>Assets\Content\Sounds\ExitReached.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\GemCollected.mp3">
+      <Link>Assets\Content\Sounds\GemCollected.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\GemCollected.wav">
+      <Link>Assets\Content\Sounds\GemCollected.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\MonsterKilled.mp3">
+      <Link>Assets\Content\Sounds\MonsterKilled.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\MonsterKilled.wav">
+      <Link>Assets\Content\Sounds\MonsterKilled.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\Music.mp3">
+      <Link>Assets\Content\Sounds\Music.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\Music.wav">
+      <Link>Assets\Content\Sounds\Music.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerFall.mp3">
+      <Link>Assets\Content\Sounds\PlayerFall.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerFall.wav">
+      <Link>Assets\Content\Sounds\PlayerFall.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerJump.mp3">
+      <Link>Assets\Content\Sounds\PlayerJump.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerJump.wav">
+      <Link>Assets\Content\Sounds\PlayerJump.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerKilled.mp3">
+      <Link>Assets\Content\Sounds\PlayerKilled.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PlayerKilled.wav">
+      <Link>Assets\Content\Sounds\PlayerKilled.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PowerUp.mp3">
+      <Link>Assets\Content\Sounds\PowerUp.mp3</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sounds\PowerUp.wav">
+      <Link>Assets\Content\Sounds\PowerUp.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Gem.png">
+      <Link>Assets\Content\Sprites\Gem.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterA\Idle.png">
+      <Link>Assets\Content\Sprites\MonsterA\Idle.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterA\Run.png">
+      <Link>Assets\Content\Sprites\MonsterA\Run.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterB\Idle.png">
+      <Link>Assets\Content\Sprites\MonsterB\Idle.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterB\Run.png">
+      <Link>Assets\Content\Sprites\MonsterB\Run.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterC\Idle.png">
+      <Link>Assets\Content\Sprites\MonsterC\Idle.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterC\Run.png">
+      <Link>Assets\Content\Sprites\MonsterC\Run.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterD\Idle.png">
+      <Link>Assets\Content\Sprites\MonsterD\Idle.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\MonsterD\Run.png">
+      <Link>Assets\Content\Sprites\MonsterD\Run.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Player\Celebrate.png">
+      <Link>Assets\Content\Sprites\Player\Celebrate.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Player\Die.png">
+      <Link>Assets\Content\Sprites\Player\Die.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Player\Idle.png">
+      <Link>Assets\Content\Sprites\Player\Idle.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Player\Jump.png">
+      <Link>Assets\Content\Sprites\Player\Jump.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Sprites\Player\Run.png">
+      <Link>Assets\Content\Sprites\Player\Run.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA0.png">
+      <Link>Assets\Content\Tiles\BlockA0.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA1.png">
+      <Link>Assets\Content\Tiles\BlockA1.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA2.png">
+      <Link>Assets\Content\Tiles\BlockA2.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA3.png">
+      <Link>Assets\Content\Tiles\BlockA3.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA4.png">
+      <Link>Assets\Content\Tiles\BlockA4.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA5.png">
+      <Link>Assets\Content\Tiles\BlockA5.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockA6.png">
+      <Link>Assets\Content\Tiles\BlockA6.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockB0.png">
+      <Link>Assets\Content\Tiles\BlockB0.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\BlockB1.png">
+      <Link>Assets\Content\Tiles\BlockB1.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\Exit.png">
+      <Link>Assets\Content\Tiles\Exit.png</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\iOS\Platformer\Content\Tiles\Platform.png">
+      <Link>Assets\Content\Tiles\Platform.png</Link>
+    </AndroidAsset>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <AndroidResource Include="Resources\layout\Main.axml" />
     <AndroidResource Include="Resources\layout\Main.axml" />
@@ -79,62 +275,10 @@
   <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
   <ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />
     <Folder Include="Properties\" />
-    <Folder Include="Assets\Content\Fonts\" />
-    <Folder Include="Assets\Content\Sounds\" />
+    <Folder Include="Assets\" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer0_0.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer0_1.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer0_2.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer1_0.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer1_1.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer1_2.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer2_0.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer2_1.png" />
-    <AndroidAsset Include="Assets\Content\Backgrounds\Layer2_2.png" />
-    <AndroidAsset Include="Assets\Content\Levels\0.txt" />
-    <AndroidAsset Include="Assets\Content\Levels\1.txt" />
-    <AndroidAsset Include="Assets\Content\Levels\2.txt" />
-    <AndroidAsset Include="Assets\Content\Overlays\you_died.png" />
-    <AndroidAsset Include="Assets\Content\Overlays\you_lose.png" />
-    <AndroidAsset Include="Assets\Content\Overlays\you_win.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Gem.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterA\Idle.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterA\Run.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterB\Idle.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterB\Run.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterC\Idle.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterC\Run.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterD\Idle.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\MonsterD\Run.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Player\Celebrate.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Player\Die.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Player\Idle.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Player\Jump.png" />
-    <AndroidAsset Include="Assets\Content\Sprites\Player\Run.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA0.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA1.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA2.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA3.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA4.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA5.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockA6.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockB0.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\BlockB1.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\Exit.png" />
-    <AndroidAsset Include="Assets\Content\Tiles\Platform.png" />
-    <AndroidAsset Include="Assets\Content\Fonts\Hud.xnb" />
-    <AndroidAsset Include="Assets\Content\Sounds\ExitReached.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\GemCollected.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\MonsterKilled.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\Music.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\PlayerFall.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\PlayerJump.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\PlayerKilled.wav" />
-    <AndroidAsset Include="Assets\Content\Sounds\PowerUp.wav" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.Android.csproj">
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.Android.csproj">
       <Project>{BA9476CF-99BA-4D03-92F2-73D2C5E58883}</Project>
       <Project>{BA9476CF-99BA-4D03-92F2-73D2C5E58883}</Project>
       <Name>MonoGame.Framework.Android</Name>
       <Name>MonoGame.Framework.Android</Name>
     </ProjectReference>
     </ProjectReference>

+ 272 - 263
StarterKits/iOS/Platformer/PlatformerGame.cs

@@ -1,263 +1,272 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// PlatformerGame.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using System.IO;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-using Microsoft.Xna.Framework.Input.Touch;
-
-
-namespace Platformer
-{
-    /// <summary>
-    /// This is the main type for your game
-    /// </summary>
-    public class PlatformerGame : Microsoft.Xna.Framework.Game
-    {
-        // Resources for drawing.
-        private GraphicsDeviceManager graphics;
-        private SpriteBatch spriteBatch;
-
-        // Global content.
-        private SpriteFont hudFont;
-
-        private Texture2D winOverlay;
-        private Texture2D loseOverlay;
-        private Texture2D diedOverlay;
-
-        // Meta-level game state.
-        private int levelIndex = -1;
-        private Level level;
-        private bool wasContinuePressed;
-
-        // When the time remaining is less than the warning time, it blinks on the hud
-        private static readonly TimeSpan WarningTime = TimeSpan.FromSeconds(30);
-
-        // We store our input states so that we only poll once per frame, 
-        // then we use the same input state wherever needed
-        private GamePadState gamePadState;
-        private KeyboardState keyboardState;
-        private TouchCollection touchState;
-        private AccelerometerState accelerometerState;
-        
-        // The number of levels in the Levels directory of our content. We assume that
-        // levels in our content are 0-based and that all numbers under this constant
-        // have a level file present. This allows us to not need to check for the file
-        // or handle exceptions, both of which can add unnecessary time to level loading.
-        private const int numberOfLevels = 3;
-
-        public PlatformerGame()
-        {
-            graphics = new GraphicsDeviceManager(this);
-            Content.RootDirectory = "Content";
-
-#if WINDOWS_PHONE
-            TargetElapsedTime = TimeSpan.FromTicks(333333);
-#endif
-
-#if MONOMAC
-			graphics.PreferredBackBufferWidth = 800;
-			graphics.PreferredBackBufferHeight = 480;
-#else
-			graphics.IsFullScreen = true;
-			graphics.SupportedOrientations =  DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
-#endif			
-            Accelerometer.Initialize();
-
-        }
-
-        /// <summary>
-        /// LoadContent will be called once per game and is the place to load
-        /// all of your content.
-        /// </summary>
-        protected override void LoadContent()
-        {
-            // Create a new SpriteBatch, which can be used to draw textures.
-            spriteBatch = new SpriteBatch(GraphicsDevice);
-
-            // Load fonts
-            hudFont = Content.Load<SpriteFont>("Fonts/Hud");
-
-            // Load overlay textures
-            winOverlay = Content.Load<Texture2D>("Overlays/you_win");
-            loseOverlay = Content.Load<Texture2D>("Overlays/you_lose");
-            diedOverlay = Content.Load<Texture2D>("Overlays/you_died");
-
-            //Known issue that you get exceptions if you use Media PLayer while connected to your PC
-            //See http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/c8a243d2-d360-46b1-96bd-62b1ef268c66
-            //Which means its impossible to test this from VS.
-            //So we have to catch the exception and throw it away
-            try
-            {
-                MediaPlayer.IsRepeating = true;
-                MediaPlayer.Play(Content.Load<Song>("Sounds/Music"));
-            }
-            catch { }
-
-            LoadNextLevel();
-        }
-
-        /// <summary>
-        /// Allows the game to run logic such as updating the world,
-        /// checking for collisions, gathering input, and playing audio.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Update(GameTime gameTime)
-        {
-            // Handle polling for our input and handling high-level input
-            HandleInput();
-
-            // update our level, passing down the GameTime along with all of our input states
-            level.Update(gameTime, keyboardState, gamePadState, touchState, 
-                         accelerometerState, Window.CurrentOrientation);
-
-            base.Update(gameTime);
-        }
-
-        private void HandleInput()
-        {
-            // get all of our input states
-            keyboardState = Keyboard.GetState();
-            gamePadState = GamePad.GetState(PlayerIndex.One);
-            touchState = TouchPanel.GetState();
-            accelerometerState = Accelerometer.GetState();
-
-            // Exit the game when back is pressed.
-            if (gamePadState.Buttons.Back == ButtonState.Pressed)
-                Exit();
-
-            bool continuePressed =
-                keyboardState.IsKeyDown(Keys.Space) ||
-                gamePadState.IsButtonDown(Buttons.A) ||
-                touchState.AnyTouch();
-
-            // Perform the appropriate action to advance the game and
-            // to get the player back to playing.
-            if (!wasContinuePressed && continuePressed)
-            {
-                if (!level.Player.IsAlive)
-                {
-                    level.StartNewLife();
-                }
-                else if (level.TimeRemaining == TimeSpan.Zero)
-                {
-                    if (level.ReachedExit)
-                        LoadNextLevel();
-                    else
-                        ReloadCurrentLevel();
-                }
-            }
-
-            wasContinuePressed = continuePressed;
-        }
-
-        private void LoadNextLevel()
-        {
-            // move to the next level
-            levelIndex = (levelIndex + 1) % numberOfLevels;
-
-            // Unloads the content for the current level before loading the next one.
-            if (level != null)
-                level.Dispose();
-
-            // Load the level.
-            string levelPath = string.Format("{0}/Levels/{1}.txt", Content.RootDirectory, levelIndex);
-            using (Stream fileStream = TitleContainer.OpenStream(levelPath))
-                level = new Level(Services, fileStream, levelIndex);
-        }
-
-        private void ReloadCurrentLevel()
-        {
-            --levelIndex;
-            LoadNextLevel();
-        }
-
-        /// <summary>
-        /// Draws the game from background to foreground.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Draw(GameTime gameTime)
-        {
-            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
-
-
-            spriteBatch.Begin();
-
-            level.Draw(gameTime, spriteBatch);
-
-            DrawHud();
-
-            spriteBatch.End();
-
-            base.Draw(gameTime);
-        }
-
-        private void DrawHud()
-        {
-            Rectangle titleSafeArea = GraphicsDevice.Viewport.TitleSafeArea;
-            Vector2 hudLocation = new Vector2(titleSafeArea.X, titleSafeArea.Y);
-            Vector2 center = new Vector2(titleSafeArea.X + titleSafeArea.Width / 2.0f,
-                                         titleSafeArea.Y + titleSafeArea.Height / 2.0f);
-
-            // Draw time remaining. Uses modulo division to cause blinking when the
-            // player is running out of time.
-            string timeString = "TIME: " + level.TimeRemaining.Minutes.ToString("00") + ":" + level.TimeRemaining.Seconds.ToString("00");
-            Color timeColor;
-            if (level.TimeRemaining > WarningTime ||
-                level.ReachedExit ||
-                (int)level.TimeRemaining.TotalSeconds % 2 == 0)
-            {
-                timeColor = Color.Yellow;
-            }
-            else
-            {
-                timeColor = Color.Red;
-            }
-            DrawShadowedString(hudFont, timeString, hudLocation, timeColor);
-
-            // Draw score
-            float timeHeight = hudFont.MeasureString(timeString).Y;
-            DrawShadowedString(hudFont, "SCORE: " + level.Score.ToString(), hudLocation + new Vector2(0.0f, timeHeight * 1.2f), Color.Yellow);
-           
-            // Determine the status overlay message to show.
-            Texture2D status = null;
-            if (level.TimeRemaining == TimeSpan.Zero)
-            {
-                if (level.ReachedExit)
-                {
-                    status = winOverlay;
-                }
-                else
-                {
-                    status = loseOverlay;
-                }
-            }
-            else if (!level.Player.IsAlive)
-            {
-                status = diedOverlay;
-            }
-
-            if (status != null)
-            {
-                // Draw status message.
-                Vector2 statusSize = new Vector2(status.Width, status.Height);
-                spriteBatch.Draw(status, center - statusSize / 2, Color.White);
-            }
-        }
-
-        private void DrawShadowedString(SpriteFont font, string value, Vector2 position, Color color)
-        {
-            spriteBatch.DrawString(font, value, position + new Vector2(1.0f, 1.0f), Color.Black);
-            spriteBatch.DrawString(font, value, position, color);
-        }
-    }
-}
+#region File Description
+//-----------------------------------------------------------------------------
+// PlatformerGame.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+using System;
+using System.IO;
+
+#if ANDROID
+using Android.App;
+#endif
+
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Xna.Framework.Input.Touch;
+
+
+namespace Platformer
+{
+    /// <summary>
+    /// This is the main type for your game
+    /// </summary>
+    public class PlatformerGame : Microsoft.Xna.Framework.Game
+    {
+        // Resources for drawing.
+        private GraphicsDeviceManager graphics;
+        private SpriteBatch spriteBatch;
+
+        // Global content.
+        private SpriteFont hudFont;
+
+        private Texture2D winOverlay;
+        private Texture2D loseOverlay;
+        private Texture2D diedOverlay;
+
+        // Meta-level game state.
+        private int levelIndex = -1;
+        private Level level;
+        private bool wasContinuePressed;
+
+        // When the time remaining is less than the warning time, it blinks on the hud
+        private static readonly TimeSpan WarningTime = TimeSpan.FromSeconds(30);
+
+        // We store our input states so that we only poll once per frame, 
+        // then we use the same input state wherever needed
+        private GamePadState gamePadState;
+        private KeyboardState keyboardState;
+        private TouchCollection touchState;
+        private AccelerometerState accelerometerState;
+        
+        // The number of levels in the Levels directory of our content. We assume that
+        // levels in our content are 0-based and that all numbers under this constant
+        // have a level file present. This allows us to not need to check for the file
+        // or handle exceptions, both of which can add unnecessary time to level loading.
+        private const int numberOfLevels = 3;
+
+#if ANDROID 
+		public PlatformerGame (Activity activity) : base (activity)
+#else
+        public PlatformerGame()
+#endif
+        {
+            graphics = new GraphicsDeviceManager(this);
+            Content.RootDirectory = "Content";
+
+#if WINDOWS_PHONE
+            TargetElapsedTime = TimeSpan.FromTicks(333333);
+#endif
+
+#if MONOMAC
+			graphics.PreferredBackBufferWidth = 800;
+			graphics.PreferredBackBufferHeight = 480;
+#else
+			graphics.IsFullScreen = true;
+			graphics.SupportedOrientations =  DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
+#endif			
+            Accelerometer.Initialize();
+
+        }
+
+        /// <summary>
+        /// LoadContent will be called once per game and is the place to load
+        /// all of your content.
+        /// </summary>
+        protected override void LoadContent()
+        {
+            // Create a new SpriteBatch, which can be used to draw textures.
+            spriteBatch = new SpriteBatch(GraphicsDevice);
+
+            // Load fonts
+            hudFont = Content.Load<SpriteFont>("Fonts/Hud");
+
+            // Load overlay textures
+            winOverlay = Content.Load<Texture2D>("Overlays/you_win");
+            loseOverlay = Content.Load<Texture2D>("Overlays/you_lose");
+            diedOverlay = Content.Load<Texture2D>("Overlays/you_died");
+
+            //Known issue that you get exceptions if you use Media PLayer while connected to your PC
+            //See http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/c8a243d2-d360-46b1-96bd-62b1ef268c66
+            //Which means its impossible to test this from VS.
+            //So we have to catch the exception and throw it away
+            try
+            {
+                MediaPlayer.IsRepeating = true;
+                MediaPlayer.Play(Content.Load<Song>("Sounds/Music"));
+            }
+            catch { }
+
+            LoadNextLevel();
+        }
+
+        /// <summary>
+        /// Allows the game to run logic such as updating the world,
+        /// checking for collisions, gathering input, and playing audio.
+        /// </summary>
+        /// <param name="gameTime">Provides a snapshot of timing values.</param>
+        protected override void Update(GameTime gameTime)
+        {
+            // Handle polling for our input and handling high-level input
+            HandleInput();
+
+            // update our level, passing down the GameTime along with all of our input states
+            level.Update(gameTime, keyboardState, gamePadState, touchState, 
+                         accelerometerState, Window.CurrentOrientation);
+
+            base.Update(gameTime);
+        }
+
+        private void HandleInput()
+        {
+            // get all of our input states
+            keyboardState = Keyboard.GetState();
+            gamePadState = GamePad.GetState(PlayerIndex.One);
+            touchState = TouchPanel.GetState();
+            accelerometerState = Accelerometer.GetState();
+
+            // Exit the game when back is pressed.
+            if (gamePadState.Buttons.Back == ButtonState.Pressed)
+                Exit();
+
+            bool continuePressed =
+                keyboardState.IsKeyDown(Keys.Space) ||
+                gamePadState.IsButtonDown(Buttons.A) ||
+                touchState.AnyTouch();
+
+            // Perform the appropriate action to advance the game and
+            // to get the player back to playing.
+            if (!wasContinuePressed && continuePressed)
+            {
+                if (!level.Player.IsAlive)
+                {
+                    level.StartNewLife();
+                }
+                else if (level.TimeRemaining == TimeSpan.Zero)
+                {
+                    if (level.ReachedExit)
+                        LoadNextLevel();
+                    else
+                        ReloadCurrentLevel();
+                }
+            }
+
+            wasContinuePressed = continuePressed;
+        }
+
+        private void LoadNextLevel()
+        {
+            // move to the next level
+            levelIndex = (levelIndex + 1) % numberOfLevels;
+
+            // Unloads the content for the current level before loading the next one.
+            if (level != null)
+                level.Dispose();
+
+            // Load the level.
+            string levelPath = string.Format("{0}/Levels/{1}.txt", Content.RootDirectory, levelIndex);
+            using (Stream fileStream = TitleContainer.OpenStream(levelPath))
+                level = new Level(Services, fileStream, levelIndex);
+        }
+
+        private void ReloadCurrentLevel()
+        {
+            --levelIndex;
+            LoadNextLevel();
+        }
+
+        /// <summary>
+        /// Draws the game from background to foreground.
+        /// </summary>
+        /// <param name="gameTime">Provides a snapshot of timing values.</param>
+        protected override void Draw(GameTime gameTime)
+        {
+            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
+
+
+            spriteBatch.Begin();
+
+            level.Draw(gameTime, spriteBatch);
+
+            DrawHud();
+
+            spriteBatch.End();
+
+            base.Draw(gameTime);
+        }
+
+        private void DrawHud()
+        {
+            Rectangle titleSafeArea = GraphicsDevice.Viewport.TitleSafeArea;
+            Vector2 hudLocation = new Vector2(titleSafeArea.X, titleSafeArea.Y);
+            Vector2 center = new Vector2(titleSafeArea.X + titleSafeArea.Width / 2.0f,
+                                         titleSafeArea.Y + titleSafeArea.Height / 2.0f);
+
+            // Draw time remaining. Uses modulo division to cause blinking when the
+            // player is running out of time.
+            string timeString = "TIME: " + level.TimeRemaining.Minutes.ToString("00") + ":" + level.TimeRemaining.Seconds.ToString("00");
+            Color timeColor;
+            if (level.TimeRemaining > WarningTime ||
+                level.ReachedExit ||
+                (int)level.TimeRemaining.TotalSeconds % 2 == 0)
+            {
+                timeColor = Color.Yellow;
+            }
+            else
+            {
+                timeColor = Color.Red;
+            }
+            DrawShadowedString(hudFont, timeString, hudLocation, timeColor);
+
+            // Draw score
+            float timeHeight = hudFont.MeasureString(timeString).Y;
+            DrawShadowedString(hudFont, "SCORE: " + level.Score.ToString(), hudLocation + new Vector2(0.0f, timeHeight * 1.2f), Color.Yellow);
+           
+            // Determine the status overlay message to show.
+            Texture2D status = null;
+            if (level.TimeRemaining == TimeSpan.Zero)
+            {
+                if (level.ReachedExit)
+                {
+                    status = winOverlay;
+                }
+                else
+                {
+                    status = loseOverlay;
+                }
+            }
+            else if (!level.Player.IsAlive)
+            {
+                status = diedOverlay;
+            }
+
+            if (status != null)
+            {
+                // Draw status message.
+                Vector2 statusSize = new Vector2(status.Width, status.Height);
+                spriteBatch.Draw(status, center - statusSize / 2, Color.White);
+            }
+        }
+
+        private void DrawShadowedString(SpriteFont font, string value, Vector2 position, Color color)
+        {
+            spriteBatch.DrawString(font, value, position + new Vector2(1.0f, 1.0f), Color.Black);
+            spriteBatch.DrawString(font, value, position, color);
+        }
+    }
+}