Przeglądaj źródła

Merge branch 'master' of github.com:CartBlanche/MonoGame-Samples

Conflicts:
	StarterKits/Android/Platformer/Platformer.csproj
	StarterKits/Android/Platformer/PlatformerGame.cs
dellis1972 14 lat temu
rodzic
commit
50941c4193

+ 0 - 181
StarterKits/Android/Platformer/Accelerometer.cs

@@ -1,181 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Accelerometer.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-#endregion
-
-namespace Platformer
-{
-    /// <summary>
-    /// A static encapsulation of accelerometer input to provide games with a polling-based
-    /// accelerometer system.
-    /// </summary>
-    public static class Accelerometer
-    {
-#if WINDOWS_PHONE
-        // the accelerometer sensor on the device
-        private static Microsoft.Devices.Sensors.Accelerometer accelerometer = new Microsoft.Devices.Sensors.Accelerometer();
-        
-        // we need an object for locking because the ReadingChanged event is fired
-        // on a different thread than our game
-        private static object threadLock = new object();
-
-        // we use this to keep the last known value from the accelerometer callback
-        private static Vector3 nextValue = new Vector3();
-#endif
-
-        // we want to prevent the Accelerometer from being initialized twice.
-        private static bool isInitialized = false;
-
-        // whether or not the accelerometer is active
-        private static bool isActive = false;
-
-        /// <summary>
-        /// Initializes the Accelerometer for the current game. This method can only be called once per game.
-        /// </summary>
-        public static void Initialize()
-        {
-            // make sure we don't initialize the Accelerometer twice
-            if (isInitialized)
-            {
-				return;
-                //throw new InvalidOperationException("Initialize can only be called once");
-            }
-
-#if WINDOWS_PHONE
-            // try to start the sensor only on devices, catching the exception if it fails            
-            if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Device)            
-            {
-                try
-                {
-                    accelerometer.ReadingChanged += new EventHandler<Microsoft.Devices.Sensors.AccelerometerReadingEventArgs>(sensor_ReadingChanged);
-                    accelerometer.Start();
-                    isActive = true;
-                }
-                catch (Microsoft.Devices.Sensors.AccelerometerFailedException)
-                {
-                    isActive = false;
-                }
-            }
-            else
-            {
-                // we always return isActive on emulator because we use the arrow
-                // keys for simulation which is always available.
-                isActive = true;
-            }
-#endif
-
-            // remember that we are initialized
-            isInitialized = true;
-        }
-        
-#if WINDOWS_PHONE
-        private static void sensor_ReadingChanged(object sender, Microsoft.Devices.Sensors.AccelerometerReadingEventArgs e)
-        {
-            // store the accelerometer value in our variable to be used on the next Update
-            lock (threadLock)
-            {
-                nextValue = new Vector3((float)e.X, (float)e.Y, (float)e.Z);
-            }
-        }
-#endif
-
-        /// <summary>
-        /// Gets the current state of the accelerometer.
-        /// </summary>
-        /// <returns>A new AccelerometerState with the current state of the accelerometer.</returns>
-        public static AccelerometerState GetState()
-        {
-            // make sure we've initialized the Accelerometer before we try to get the state
-            if (!isInitialized)
-            {
-                throw new InvalidOperationException("You must Initialize before you can call GetState");
-            }
-
-            // create a new value for our state
-            Vector3 stateValue = new Vector3();
-
-#if WINDOWS_PHONE
-            // if the accelerometer is active
-            if (isActive)
-            {
-                if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Device)
-                {
-                    // if we're on device, we'll just grab our latest reading from the accelerometer
-                    lock (threadLock)
-                    {
-                        stateValue = nextValue;
-                    }
-                }
-                else
-                {
-                    // if we're in the emulator, we'll generate a fake acceleration value using the arrow keys
-                    // press the pause/break key to toggle keyboard input for the emulator
-                    KeyboardState keyboardState = Keyboard.GetState();
-
-                    stateValue.Z = -1;
-
-                    if (keyboardState.IsKeyDown(Keys.Left))
-                        stateValue.X--;
-                    if (keyboardState.IsKeyDown(Keys.Right))
-                        stateValue.X++;
-                    if (keyboardState.IsKeyDown(Keys.Up))
-                        stateValue.Y++;
-                    if (keyboardState.IsKeyDown(Keys.Down))
-                        stateValue.Y--;
-
-                    stateValue.Normalize();
-                }
-            }
-#endif
-
-            return new AccelerometerState(stateValue, isActive);
-        }
-    }
-
-    /// <summary>
-    /// An encapsulation of the accelerometer's current state.
-    /// </summary>
-    public struct AccelerometerState
-    {
-        /// <summary>
-        /// Gets the accelerometer's current value in G-force.
-        /// </summary>
-        public Vector3 Acceleration { get; private set; }
-
-        /// <summary>
-        /// Gets whether or not the accelerometer is active and running.
-        /// </summary>
-        public bool IsActive { get; private set; }
-
-        /// <summary>
-        /// Initializes a new AccelerometerState.
-        /// </summary>
-        /// <param name="acceleration">The current acceleration (in G-force) of the accelerometer.</param>
-        /// <param name="isActive">Whether or not the accelerometer is active.</param>
-        public AccelerometerState(Vector3 acceleration, bool isActive)
-            : this()
-        {
-            Acceleration = acceleration;
-            IsActive = isActive;
-        }
-
-        /// <summary>
-        /// Returns a string containing the values of the Acceleration and IsActive properties.
-        /// </summary>
-        /// <returns>A new string describing the state.</returns>
-        public override string ToString()
-        {
-            return string.Format("Acceleration: {0}, IsActive: {1}", Acceleration, IsActive);
-        }
-    }
-}

+ 0 - 88
StarterKits/Android/Platformer/Animation.cs

@@ -1,88 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Animation.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Represents an animated texture.
-    /// </summary>
-    /// <remarks>
-    /// Currently, this class assumes that each frame of animation is
-    /// as wide as each animation is tall. The number of frames in the
-    /// animation are inferred from this.
-    /// </remarks>
-    class Animation
-    {
-        /// <summary>
-        /// All frames in the animation arranged horizontally.
-        /// </summary>
-        public Texture2D Texture
-        {
-            get { return texture; }
-        }
-        Texture2D texture;
-
-        /// <summary>
-        /// Duration of time to show each frame.
-        /// </summary>
-        public float FrameTime
-        {
-            get { return frameTime; }
-        }
-        float frameTime;
-
-        /// <summary>
-        /// When the end of the animation is reached, should it
-        /// continue playing from the beginning?
-        /// </summary>
-        public bool IsLooping
-        {
-            get { return isLooping; }
-        }
-        bool isLooping;
-
-        /// <summary>
-        /// Gets the number of frames in the animation.
-        /// </summary>
-        public int FrameCount
-        {
-            get { return Texture.Width / FrameWidth; }
-        }
-
-        /// <summary>
-        /// Gets the width of a frame in the animation.
-        /// </summary>
-        public int FrameWidth
-        {
-            // Assume square frames.
-            get { return Texture.Height; }
-        }
-
-        /// <summary>
-        /// Gets the height of a frame in the animation.
-        /// </summary>
-        public int FrameHeight
-        {
-            get { return Texture.Height; }
-        }
-
-        /// <summary>
-        /// Constructors a new animation.
-        /// </summary>        
-        public Animation(Texture2D texture, float frameTime, bool isLooping)
-        {
-            this.texture = texture;
-            this.frameTime = frameTime;
-            this.isLooping = isLooping;
-        }
-    }
-}

+ 0 - 99
StarterKits/Android/Platformer/AnimationPlayer.cs

@@ -1,99 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// AnimationPlayer.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Controls playback of an Animation.
-    /// </summary>
-    struct AnimationPlayer
-    {
-        /// <summary>
-        /// Gets the animation which is currently playing.
-        /// </summary>
-        public Animation Animation
-        {
-            get { return animation; }
-        }
-        Animation animation;
-
-        /// <summary>
-        /// Gets the index of the current frame in the animation.
-        /// </summary>
-        public int FrameIndex
-        {
-            get { return frameIndex; }
-        }
-        int frameIndex;
-
-        /// <summary>
-        /// The amount of time in seconds that the current frame has been shown for.
-        /// </summary>
-        private float time;
-
-        /// <summary>
-        /// Gets a texture origin at the bottom center of each frame.
-        /// </summary>
-        public Vector2 Origin
-        {
-            get { return new Vector2(Animation.FrameWidth / 2.0f, Animation.FrameHeight); }
-        }
-
-        /// <summary>
-        /// Begins or continues playback of an animation.
-        /// </summary>
-        public void PlayAnimation(Animation animation)
-        {
-            // If this animation is already running, do not restart it.
-            if (Animation == animation)
-                return;
-
-            // Start the new animation.
-            this.animation = animation;
-            this.frameIndex = 0;
-            this.time = 0.0f;
-        }
-
-        /// <summary>
-        /// Advances the time position and draws the current frame of the animation.
-        /// </summary>
-        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
-        {
-            if (Animation == null)
-                throw new NotSupportedException("No animation is currently playing.");
-
-            // Process passing time.
-            time += (float)gameTime.ElapsedGameTime.TotalSeconds;
-            while (time > Animation.FrameTime)
-            {
-                time -= Animation.FrameTime;
-
-                // Advance the frame index; looping or clamping as appropriate.
-                if (Animation.IsLooping)
-                {
-                    frameIndex = (frameIndex + 1) % Animation.FrameCount;
-                }
-                else
-                {
-                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
-                }
-            }
-
-            // Calculate the source rectangle of the current frame.
-            Rectangle source = new Rectangle(FrameIndex * Animation.Texture.Height, 0, Animation.Texture.Height, Animation.Texture.Height);
-
-            // Draw the current frame.
-            spriteBatch.Draw(Animation.Texture, position, source, Color.White, 0.0f, Origin, 1.0f, spriteEffects, 0.0f);
-        }
-    }
-}

BIN
StarterKits/Android/Platformer/Background.png


+ 0 - 54
StarterKits/Android/Platformer/Circle.cs

@@ -1,54 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Circle.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Represents a 2D circle.
-    /// </summary>
-    struct Circle
-    {
-        /// <summary>
-        /// Center position of the circle.
-        /// </summary>
-        public Vector2 Center;
-
-        /// <summary>
-        /// Radius of the circle.
-        /// </summary>
-        public float Radius;
-
-        /// <summary>
-        /// Constructs a new circle.
-        /// </summary>
-        public Circle(Vector2 position, float radius)
-        {
-            Center = position;
-            Radius = radius;
-        }
-
-        /// <summary>
-        /// Determines if a circle intersects a rectangle.
-        /// </summary>
-        /// <returns>True if the circle and rectangle overlap. False otherwise.</returns>
-        public bool Intersects(Rectangle rectangle)
-        {
-            Vector2 v = new Vector2(MathHelper.Clamp(Center.X, rectangle.Left, rectangle.Right),
-                                    MathHelper.Clamp(Center.Y, rectangle.Top, rectangle.Bottom));
-
-            Vector2 direction = Center - v;
-            float distanceSquared = direction.LengthSquared();
-
-            return ((distanceSquared > 0) && (distanceSquared < Radius * Radius));
-        }
-    }
-}

+ 0 - 179
StarterKits/Android/Platformer/Enemy.cs

@@ -1,179 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Enemy.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Facing direction along the X axis.
-    /// </summary>
-    enum FaceDirection
-    {
-        Left = -1,
-        Right = 1,
-    }
-
-    /// <summary>
-    /// A monster who is impeding the progress of our fearless adventurer.
-    /// </summary>
-    class Enemy
-    {
-        public Level Level
-        {
-            get { return level; }
-        }
-        Level level;
-
-        /// <summary>
-        /// Position in world space of the bottom center of this enemy.
-        /// </summary>
-        public Vector2 Position
-        {
-            get { return position; }
-        }
-        Vector2 position;
-
-        private Rectangle localBounds;
-        /// <summary>
-        /// Gets a rectangle which bounds this enemy in world space.
-        /// </summary>
-        public Rectangle BoundingRectangle
-        {
-            get
-            {
-                int left = (int)Math.Round(Position.X - sprite.Origin.X) + localBounds.X;
-                int top = (int)Math.Round(Position.Y - sprite.Origin.Y) + localBounds.Y;
-
-                return new Rectangle(left, top, localBounds.Width, localBounds.Height);
-            }
-        }
-
-        // Animations
-        private Animation runAnimation;
-        private Animation idleAnimation;
-        private AnimationPlayer sprite;
-
-        /// <summary>
-        /// The direction this enemy is facing and moving along the X axis.
-        /// </summary>
-        private FaceDirection direction = FaceDirection.Left;
-
-        /// <summary>
-        /// How long this enemy has been waiting before turning around.
-        /// </summary>
-        private float waitTime;
-
-        /// <summary>
-        /// How long to wait before turning around.
-        /// </summary>
-        private const float MaxWaitTime = 0.5f;
-
-        /// <summary>
-        /// The speed at which this enemy moves along the X axis.
-        /// </summary>
-        private const float MoveSpeed = 64.0f;
-
-        /// <summary>
-        /// Constructs a new Enemy.
-        /// </summary>
-        public Enemy(Level level, Vector2 position, string spriteSet)
-        {
-            this.level = level;
-            this.position = position;
-
-            LoadContent(spriteSet);
-        }
-
-        /// <summary>
-        /// Loads a particular enemy sprite sheet and sounds.
-        /// </summary>
-        public void LoadContent(string spriteSet)
-        {
-            // Load animations.
-            spriteSet = "Sprites/" + spriteSet + "/";
-            runAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Run"), 0.1f, true);
-            idleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Idle"), 0.15f, true);
-            sprite.PlayAnimation(idleAnimation);
-
-            // Calculate bounds within texture size.
-            int width = (int)(idleAnimation.FrameWidth * 0.35);
-            int left = (idleAnimation.FrameWidth - width) / 2;
-            int height = (int)(idleAnimation.FrameWidth * 0.7);
-            int top = idleAnimation.FrameHeight - height;
-            localBounds = new Rectangle(left, top, width, height);
-        }
-
-
-        /// <summary>
-        /// Paces back and forth along a platform, waiting at either end.
-        /// </summary>
-        public void Update(GameTime gameTime)
-        {
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            // Calculate tile position based on the side we are walking towards.
-            float posX = Position.X + localBounds.Width / 2 * (int)direction;
-            int tileX = (int)Math.Floor(posX / Tile.Width) - (int)direction;
-            int tileY = (int)Math.Floor(Position.Y / Tile.Height);
-
-            if (waitTime > 0)
-            {
-                // Wait for some amount of time.
-                waitTime = Math.Max(0.0f, waitTime - (float)gameTime.ElapsedGameTime.TotalSeconds);
-                if (waitTime <= 0.0f)
-                {
-                    // Then turn around.
-                    direction = (FaceDirection)(-(int)direction);
-                }
-            }
-            else
-            {
-                // If we are about to run into a wall or off a cliff, start waiting.
-                if (Level.GetCollision(tileX + (int)direction, tileY - 1) == TileCollision.Impassable ||
-                    Level.GetCollision(tileX + (int)direction, tileY) == TileCollision.Passable)
-                {
-                    waitTime = MaxWaitTime;
-                }
-                else
-                {
-                    // Move in the current direction.
-                    Vector2 velocity = new Vector2((int)direction * MoveSpeed * elapsed, 0.0f);
-                    position = position + velocity;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Draws the animated enemy.
-        /// </summary>
-        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
-        {
-            // Stop running when the game is paused or before turning around.
-            if (!Level.Player.IsAlive ||
-                Level.ReachedExit ||
-                Level.TimeRemaining == TimeSpan.Zero ||
-                waitTime > 0)
-            {
-                sprite.PlayAnimation(idleAnimation);
-            }
-            else
-            {
-                sprite.PlayAnimation(runAnimation);
-            }
-
-
-            // Draw facing the way the enemy is moving.
-            SpriteEffects flip = direction > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
-            sprite.Draw(gameTime, spriteBatch, Position, flip);
-        }
-    }
-}

BIN
StarterKits/Android/Platformer/Game.ico


BIN
StarterKits/Android/Platformer/GameThumbnail.png


+ 0 - 118
StarterKits/Android/Platformer/Gem.cs

@@ -1,118 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Gem.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Audio;
-
-namespace Platformer
-{
-    /// <summary>
-    /// A valuable item the player can collect.
-    /// </summary>
-    class Gem
-    {
-        private Texture2D texture;
-        private Vector2 origin;
-        private SoundEffect collectedSound;
-
-        public const int PointValue = 30;
-        public readonly Color Color = Color.Yellow;
-
-        // The gem is animated from a base position along the Y axis.
-        private Vector2 basePosition;
-        private float bounce;
-
-        public Level Level
-        {
-            get { return level; }
-        }
-        Level level;
-
-        /// <summary>
-        /// Gets the current position of this gem in world space.
-        /// </summary>
-        public Vector2 Position
-        {
-            get
-            {
-                return basePosition + new Vector2(0.0f, bounce);
-            }
-        }
-
-        /// <summary>
-        /// Gets a circle which bounds this gem in world space.
-        /// </summary>
-        public Circle BoundingCircle
-        {
-            get
-            {
-                return new Circle(Position, Tile.Width / 3.0f);
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new gem.
-        /// </summary>
-        public Gem(Level level, Vector2 position)
-        {
-            this.level = level;
-            this.basePosition = position;
-
-            LoadContent();
-        }
-
-        /// <summary>
-        /// Loads the gem texture and collected sound.
-        /// </summary>
-        public void LoadContent()
-        {
-            texture = Level.Content.Load<Texture2D>("Sprites/Gem");
-            origin = new Vector2(texture.Width / 2.0f, texture.Height / 2.0f);
-            collectedSound = Level.Content.Load<SoundEffect>("Sounds/GemCollected");
-        }
-
-        /// <summary>
-        /// Bounces up and down in the air to entice players to collect them.
-        /// </summary>
-        public void Update(GameTime gameTime)
-        {
-            // Bounce control constants
-            const float BounceHeight = 0.18f;
-            const float BounceRate = 3.0f;
-            const float BounceSync = -0.75f;
-
-            // Bounce along a sine curve over time.
-            // Include the X coordinate so that neighboring gems bounce in a nice wave pattern.            
-            double t = gameTime.TotalGameTime.TotalSeconds * BounceRate + Position.X * BounceSync;
-            bounce = (float)Math.Sin(t) * BounceHeight * texture.Height;
-        }
-
-        /// <summary>
-        /// Called when this gem has been collected by a player and removed from the level.
-        /// </summary>
-        /// <param name="collectedBy">
-        /// The player who collected this gem. Although currently not used, this parameter would be
-        /// useful for creating special powerup gems. For example, a gem could make the player invincible.
-        /// </param>
-        public void OnCollected(Player collectedBy)
-        {
-            collectedSound.Play();
-        }
-
-        /// <summary>
-        /// Draws a gem in the appropriate color.
-        /// </summary>
-        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
-        {
-            spriteBatch.Draw(texture, Position, null, Color, 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
-        }
-    }
-}

+ 0 - 553
StarterKits/Android/Platformer/Level.cs

@@ -1,553 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Level.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using System.Collections.Generic;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Audio;
-using System.IO;
-using Microsoft.Xna.Framework.Input.Touch;
-using Microsoft.Xna.Framework.Input;
-
-namespace Platformer
-{
-    /// <summary>
-    /// A uniform grid of tiles with collections of gems and enemies.
-    /// The level owns the player and controls the game's win and lose
-    /// conditions as well as scoring.
-    /// </summary>
-    class Level : IDisposable
-    {
-        // Physical structure of the level.
-        private Tile[,] tiles;
-        private Texture2D[] layers;
-        // The layer which entities are drawn on top of.
-        private const int EntityLayer = 2;
-
-        // Entities in the level.
-        public Player Player
-        {
-            get { return player; }
-        }
-        Player player;
-
-        private List<Gem> gems = new List<Gem>();
-        private List<Enemy> enemies = new List<Enemy>();
-
-        // Key locations in the level.        
-        private Vector2 start;
-        private Point exit = InvalidPosition;
-        private static readonly Point InvalidPosition = new Point(-1, -1);
-
-        // Level game state.
-        private Random random = new Random(354668); // Arbitrary, but constant seed
-
-        public int Score
-        {
-            get { return score; }
-        }
-        int score;
-
-        public bool ReachedExit
-        {
-            get { return reachedExit; }
-        }
-        bool reachedExit;
-
-        public TimeSpan TimeRemaining
-        {
-            get { return timeRemaining; }
-        }
-        TimeSpan timeRemaining;
-
-        private const int PointsPerSecond = 5;
-
-        // Level content.        
-        public ContentManager Content
-        {
-            get { return content; }
-        }
-        ContentManager content;
-
-        private SoundEffect exitReachedSound;
-
-        #region Loading
-
-        /// <summary>
-        /// Constructs a new level.
-        /// </summary>
-        /// <param name="serviceProvider">
-        /// The service provider that will be used to construct a ContentManager.
-        /// </param>
-        /// <param name="fileStream">
-        /// A stream containing the tile data.
-        /// </param>
-        public Level(IServiceProvider serviceProvider, Stream fileStream, int levelIndex)
-        {
-            // Create a new content manager to load content used just by this level.
-            content = new ContentManager(serviceProvider, "Content");
-
-            timeRemaining = TimeSpan.FromMinutes(2.0);
-
-            LoadTiles(fileStream);
-
-            // Load background layer textures. For now, all levels must
-            // use the same backgrounds and only use the left-most part of them.
-            layers = new Texture2D[3];
-            for (int i = 0; i < layers.Length; ++i)
-            {
-                // Choose a random segment if each background layer for level variety.
-                int segmentIndex = levelIndex;
-                layers[i] = Content.Load<Texture2D>("Backgrounds/Layer" + i + "_" + segmentIndex);
-            }
-
-            // Load sounds.
-            exitReachedSound = Content.Load<SoundEffect>("Sounds/ExitReached");
-        }
-
-        /// <summary>
-        /// Iterates over every tile in the structure file and loads its
-        /// appearance and behavior. This method also validates that the
-        /// file is well-formed with a player start point, exit, etc.
-        /// </summary>
-        /// <param name="fileStream">
-        /// A stream containing the tile data.
-        /// </param>
-        private void LoadTiles(Stream fileStream)
-        {
-            // Load the level and ensure all of the lines are the same length.
-            int width;
-            List<string> lines = new List<string>();
-            using (StreamReader reader = new StreamReader(fileStream))
-            {
-                string line = reader.ReadLine();
-                width = line.Length;
-                while (line != null)
-                {
-                    lines.Add(line);
-                    if (line.Length != width)
-                        throw new Exception(String.Format("The length of line {0} is different from all preceeding lines.", lines.Count));
-                    line = reader.ReadLine();
-                }
-            }
-
-            // Allocate the tile grid.
-            tiles = new Tile[width, lines.Count];
-
-            // Loop over every tile position,
-            for (int y = 0; y < Height; ++y)
-            {
-                for (int x = 0; x < Width; ++x)
-                {
-                    // to load each tile.
-                    char tileType = lines[y][x];
-                    tiles[x, y] = LoadTile(tileType, x, y);
-                }
-            }
-
-            // Verify that the level has a beginning and an end.
-            if (Player == null)
-                throw new NotSupportedException("A level must have a starting point.");
-            if (exit == InvalidPosition)
-                throw new NotSupportedException("A level must have an exit.");
-
-        }
-
-        /// <summary>
-        /// Loads an individual tile's appearance and behavior.
-        /// </summary>
-        /// <param name="tileType">
-        /// The character loaded from the structure file which
-        /// indicates what should be loaded.
-        /// </param>
-        /// <param name="x">
-        /// The X location of this tile in tile space.
-        /// </param>
-        /// <param name="y">
-        /// The Y location of this tile in tile space.
-        /// </param>
-        /// <returns>The loaded tile.</returns>
-        private Tile LoadTile(char tileType, int x, int y)
-        {
-            switch (tileType)
-            {
-                // Blank space
-                case '.':
-                    return new Tile(null, TileCollision.Passable);
-
-                // Exit
-                case 'X':
-                    return LoadExitTile(x, y);
-
-                // Gem
-                case 'G':
-                    return LoadGemTile(x, y);
-
-                // Floating platform
-                case '-':
-                    return LoadTile("Platform", TileCollision.Platform);
-
-                // Various enemies
-                case 'A':
-                    return LoadEnemyTile(x, y, "MonsterA");
-                case 'B':
-                    return LoadEnemyTile(x, y, "MonsterB");
-                case 'C':
-                    return LoadEnemyTile(x, y, "MonsterC");
-                case 'D':
-                    return LoadEnemyTile(x, y, "MonsterD");
-
-                // Platform block
-                case '~':
-                    return LoadVarietyTile("BlockB", 2, TileCollision.Platform);
-
-                // Passable block
-                case ':':
-                    return LoadVarietyTile("BlockB", 2, TileCollision.Passable);
-
-                // Player 1 start point
-                case '1':
-                    return LoadStartTile(x, y);
-
-                // Impassable block
-                case '#':
-                    return LoadVarietyTile("BlockA", 7, TileCollision.Impassable);
-
-                // Unknown tile type character
-                default:
-                    throw new NotSupportedException(String.Format("Unsupported tile type character '{0}' at position {1}, {2}.", tileType, x, y));
-            }
-        }
-
-        /// <summary>
-        /// Creates a new tile. The other tile loading methods typically chain to this
-        /// method after performing their special logic.
-        /// </summary>
-        /// <param name="name">
-        /// Path to a tile texture relative to the Content/Tiles directory.
-        /// </param>
-        /// <param name="collision">
-        /// The tile collision type for the new tile.
-        /// </param>
-        /// <returns>The new tile.</returns>
-        private Tile LoadTile(string name, TileCollision collision)
-        {
-            return new Tile(Content.Load<Texture2D>("Tiles/" + name), collision);
-        }
-
-
-        /// <summary>
-        /// Loads a tile with a random appearance.
-        /// </summary>
-        /// <param name="baseName">
-        /// The content name prefix for this group of tile variations. Tile groups are
-        /// name LikeThis0.png and LikeThis1.png and LikeThis2.png.
-        /// </param>
-        /// <param name="variationCount">
-        /// The number of variations in this group.
-        /// </param>
-        private Tile LoadVarietyTile(string baseName, int variationCount, TileCollision collision)
-        {
-            int index = random.Next(variationCount);
-            return LoadTile(baseName + index, collision);
-        }
-
-
-        /// <summary>
-        /// Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected.
-        /// </summary>
-        private Tile LoadStartTile(int x, int y)
-        {
-            if (Player != null)
-                throw new NotSupportedException("A level may only have one starting point.");
-
-            start = RectangleExtensions.GetBottomCenter(GetBounds(x, y));
-            player = new Player(this, start);
-
-            return new Tile(null, TileCollision.Passable);
-        }
-
-        /// <summary>
-        /// Remembers the location of the level's exit.
-        /// </summary>
-        private Tile LoadExitTile(int x, int y)
-        {
-            if (exit != InvalidPosition)
-                throw new NotSupportedException("A level may only have one exit.");
-
-            exit = GetBounds(x, y).Center;
-
-            return LoadTile("Exit", TileCollision.Passable);
-        }
-
-        /// <summary>
-        /// Instantiates an enemy and puts him in the level.
-        /// </summary>
-        private Tile LoadEnemyTile(int x, int y, string spriteSet)
-        {
-            Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y));
-            enemies.Add(new Enemy(this, position, spriteSet));
-
-            return new Tile(null, TileCollision.Passable);
-        }
-
-        /// <summary>
-        /// Instantiates a gem and puts it in the level.
-        /// </summary>
-        private Tile LoadGemTile(int x, int y)
-        {
-            Point position = GetBounds(x, y).Center;
-            gems.Add(new Gem(this, new Vector2(position.X, position.Y)));
-
-            return new Tile(null, TileCollision.Passable);
-        }
-
-        /// <summary>
-        /// Unloads the level content.
-        /// </summary>
-        public void Dispose()
-        {
-            Content.Unload();
-        }
-
-        #endregion
-
-        #region Bounds and collision
-
-        /// <summary>
-        /// Gets the collision mode of the tile at a particular location.
-        /// This method handles tiles outside of the levels boundries by making it
-        /// impossible to escape past the left or right edges, but allowing things
-        /// to jump beyond the top of the level and fall off the bottom.
-        /// </summary>
-        public TileCollision GetCollision(int x, int y)
-        {
-            // Prevent escaping past the level ends.
-            if (x < 0 || x >= Width)
-                return TileCollision.Impassable;
-            // Allow jumping past the level top and falling through the bottom.
-            if (y < 0 || y >= Height)
-                return TileCollision.Passable;
-
-            return tiles[x, y].Collision;
-        }
-
-        /// <summary>
-        /// Gets the bounding rectangle of a tile in world space.
-        /// </summary>        
-        public Rectangle GetBounds(int x, int y)
-        {
-            return new Rectangle(x * Tile.Width, y * Tile.Height, Tile.Width, Tile.Height);
-        }
-
-        /// <summary>
-        /// Width of level measured in tiles.
-        /// </summary>
-        public int Width
-        {
-            get { return tiles.GetLength(0); }
-        }
-
-        /// <summary>
-        /// Height of the level measured in tiles.
-        /// </summary>
-        public int Height
-        {
-            get { return tiles.GetLength(1); }
-        }
-
-        #endregion
-
-        #region Update
-
-        /// <summary>
-        /// Updates all objects in the world, performs collision between them,
-        /// and handles the time limit with scoring.
-        /// </summary>
-        public void Update(
-            GameTime gameTime, 
-            KeyboardState keyboardState, 
-            GamePadState gamePadState, 
-            TouchCollection touchState, 
-            AccelerometerState accelState,
-            DisplayOrientation orientation)
-        {
-            // Pause while the player is dead or time is expired.
-            if (!Player.IsAlive || TimeRemaining == TimeSpan.Zero)
-            {
-                // Still want to perform physics on the player.
-                Player.ApplyPhysics(gameTime);
-            }
-            else if (ReachedExit)
-            {
-                // Animate the time being converted into points.
-                int seconds = (int)Math.Round(gameTime.ElapsedGameTime.TotalSeconds * 100.0f);
-                seconds = Math.Min(seconds, (int)Math.Ceiling(TimeRemaining.TotalSeconds));
-                timeRemaining -= TimeSpan.FromSeconds(seconds);
-                score += seconds * PointsPerSecond;
-            }
-            else
-            {
-                timeRemaining -= gameTime.ElapsedGameTime;
-                Player.Update(gameTime, keyboardState, gamePadState, touchState, accelState, orientation);
-                UpdateGems(gameTime);
-
-                // Falling off the bottom of the level kills the player.
-                if (Player.BoundingRectangle.Top >= Height * Tile.Height)
-                    OnPlayerKilled(null);
-
-                UpdateEnemies(gameTime);
-
-                // The player has reached the exit if they are standing on the ground and
-                // his bounding rectangle contains the center of the exit tile. They can only
-                // exit when they have collected all of the gems.
-                if (Player.IsAlive &&
-                    Player.IsOnGround &&
-                    Player.BoundingRectangle.Contains(exit))
-                {
-                    OnExitReached();
-                }
-            }
-
-            // Clamp the time remaining at zero.
-            if (timeRemaining < TimeSpan.Zero)
-                timeRemaining = TimeSpan.Zero;
-        }
-
-        /// <summary>
-        /// Animates each gem and checks to allows the player to collect them.
-        /// </summary>
-        private void UpdateGems(GameTime gameTime)
-        {
-            for (int i = 0; i < gems.Count; ++i)
-            {
-                Gem gem = gems[i];
-
-                gem.Update(gameTime);
-
-                if (gem.BoundingCircle.Intersects(Player.BoundingRectangle))
-                {
-                    gems.RemoveAt(i--);
-                    OnGemCollected(gem, Player);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Animates each enemy and allow them to kill the player.
-        /// </summary>
-        private void UpdateEnemies(GameTime gameTime)
-        {
-            foreach (Enemy enemy in enemies)
-            {
-                enemy.Update(gameTime);
-
-                // Touching an enemy instantly kills the player
-                if (enemy.BoundingRectangle.Intersects(Player.BoundingRectangle))
-                {
-                    OnPlayerKilled(enemy);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Called when a gem is collected.
-        /// </summary>
-        /// <param name="gem">The gem that was collected.</param>
-        /// <param name="collectedBy">The player who collected this gem.</param>
-        private void OnGemCollected(Gem gem, Player collectedBy)
-        {
-            score += Gem.PointValue;
-
-            gem.OnCollected(collectedBy);
-        }
-
-        /// <summary>
-        /// Called when the player is killed.
-        /// </summary>
-        /// <param name="killedBy">
-        /// The enemy who killed the player. This is null if the player was not killed by an
-        /// enemy, such as when a player falls into a hole.
-        /// </param>
-        private void OnPlayerKilled(Enemy killedBy)
-        {
-            Player.OnKilled(killedBy);
-        }
-
-        /// <summary>
-        /// Called when the player reaches the level's exit.
-        /// </summary>
-        private void OnExitReached()
-        {
-            Player.OnReachedExit();
-            exitReachedSound.Play();
-            reachedExit = true;
-        }
-
-        /// <summary>
-        /// Restores the player to the starting point to try the level again.
-        /// </summary>
-        public void StartNewLife()
-        {
-            Player.Reset(start);
-        }
-
-        #endregion
-
-        #region Draw
-
-        /// <summary>
-        /// Draw everything in the level from background to foreground.
-        /// </summary>
-        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
-        {
-            for (int i = 0; i <= EntityLayer; ++i)
-                spriteBatch.Draw(layers[i], Vector2.Zero, Color.White);
-
-            DrawTiles(spriteBatch);
-
-            foreach (Gem gem in gems)
-                gem.Draw(gameTime, spriteBatch);
-
-            Player.Draw(gameTime, spriteBatch);
-
-            foreach (Enemy enemy in enemies)
-                enemy.Draw(gameTime, spriteBatch);
-
-            for (int i = EntityLayer + 1; i < layers.Length; ++i)
-                spriteBatch.Draw(layers[i], Vector2.Zero, Color.White);
-        }
-
-        /// <summary>
-        /// Draws each tile in the level.
-        /// </summary>
-        private void DrawTiles(SpriteBatch spriteBatch)
-        {
-            // For each tile position
-            for (int y = 0; y < Height; ++y)
-            {
-                for (int x = 0; x < Width; ++x)
-                {
-                    // If there is a visible tile in that position
-                    Texture2D texture = tiles[x, y].Texture;
-                    if (texture != null)
-                    {
-                        // Draw it in screen space.
-                        Vector2 position = new Vector2(x, y) * Tile.Size;
-                        spriteBatch.Draw(texture, position, Color.White);
-                    }
-                }
-            }
-        }
-
-        #endregion
-    }
-}

+ 212 - 64
StarterKits/Android/Platformer/Platformer.csproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -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" />
@@ -77,57 +273,9 @@
     <AndroidResource Include="Resources\drawable\Icon.png" />
     <AndroidResource Include="Resources\drawable\Icon.png" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
-  <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" />
+    <Folder Include="Properties\" />
+    <Folder Include="Assets\" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.Android.csproj">
     <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.Android.csproj">

+ 0 - 466
StarterKits/Android/Platformer/Player.cs

@@ -1,466 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Player.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Input.Touch;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Our fearless adventurer!
-    /// </summary>
-    class Player
-    {
-        // Animations
-        private Animation idleAnimation;
-        private Animation runAnimation;
-        private Animation jumpAnimation;
-        private Animation celebrateAnimation;
-        private Animation dieAnimation;
-        private SpriteEffects flip = SpriteEffects.None;
-        private AnimationPlayer sprite;
-
-        // Sounds
-        private SoundEffect killedSound;
-        private SoundEffect jumpSound;
-        private SoundEffect fallSound;
-
-        public Level Level
-        {
-            get { return level; }
-        }
-        Level level;
-
-        public bool IsAlive
-        {
-            get { return isAlive; }
-        }
-        bool isAlive;
-
-        // Physics state
-        public Vector2 Position
-        {
-            get { return position; }
-            set { position = value; }
-        }
-        Vector2 position;
-
-        private float previousBottom;
-
-        public Vector2 Velocity
-        {
-            get { return velocity; }
-            set { velocity = value; }
-        }
-        Vector2 velocity;
-
-        // Constants for controling horizontal movement
-        private const float MoveAcceleration = 13000.0f;
-        private const float MaxMoveSpeed = 1750.0f;
-        private const float GroundDragFactor = 0.48f;
-        private const float AirDragFactor = 0.58f;
-
-        // Constants for controlling vertical movement
-        private const float MaxJumpTime = 0.35f;
-        private const float JumpLaunchVelocity = -3500.0f;
-        private const float GravityAcceleration = 3400.0f;
-        private const float MaxFallSpeed = 550.0f;
-        private const float JumpControlPower = 0.14f; 
-
-        // Input configuration
-        private const float MoveStickScale = 1.0f;
-        private const float AccelerometerScale = 1.5f;
-        private const Buttons JumpButton = Buttons.A;
-
-        /// <summary>
-        /// Gets whether or not the player's feet are on the ground.
-        /// </summary>
-        public bool IsOnGround
-        {
-            get { return isOnGround; }
-        }
-        bool isOnGround;
-
-        /// <summary>
-        /// Current user movement input.
-        /// </summary>
-        private float movement;
-
-        // Jumping state
-        private bool isJumping;
-        private bool wasJumping;
-        private float jumpTime;
-
-        private Rectangle localBounds;
-        /// <summary>
-        /// Gets a rectangle which bounds this player in world space.
-        /// </summary>
-        public Rectangle BoundingRectangle
-        {
-            get
-            {
-                int left = (int)Math.Round(Position.X - sprite.Origin.X) + localBounds.X;
-                int top = (int)Math.Round(Position.Y - sprite.Origin.Y) + localBounds.Y;
-
-                return new Rectangle(left, top, localBounds.Width, localBounds.Height);
-            }
-        }
-
-        /// <summary>
-        /// Constructors a new player.
-        /// </summary>
-        public Player(Level level, Vector2 position)
-        {
-            this.level = level;
-
-            LoadContent();
-
-            Reset(position);
-        }
-
-        /// <summary>
-        /// Loads the player sprite sheet and sounds.
-        /// </summary>
-        public void LoadContent()
-        {
-            // Load animated textures.
-            idleAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Idle"), 0.1f, true);
-            runAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Run"), 0.1f, true);
-            jumpAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Jump"), 0.1f, false);
-            celebrateAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Celebrate"), 0.1f, false);
-            dieAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false);
-
-            // Calculate bounds within texture size.            
-            int width = (int)(idleAnimation.FrameWidth * 0.4);
-            int left = (idleAnimation.FrameWidth - width) / 2;
-            int height = (int)(idleAnimation.FrameWidth * 0.8);
-            int top = idleAnimation.FrameHeight - height;
-            localBounds = new Rectangle(left, top, width, height);
-
-            // Load sounds.            
-            killedSound = Level.Content.Load<SoundEffect>("Sounds/PlayerKilled");
-            jumpSound = Level.Content.Load<SoundEffect>("Sounds/PlayerJump");
-            fallSound = Level.Content.Load<SoundEffect>("Sounds/PlayerFall");
-        }
-
-        /// <summary>
-        /// Resets the player to life.
-        /// </summary>
-        /// <param name="position">The position to come to life at.</param>
-        public void Reset(Vector2 position)
-        {
-            Position = position;
-            Velocity = Vector2.Zero;
-            isAlive = true;
-            sprite.PlayAnimation(idleAnimation);
-        }
-
-        /// <summary>
-        /// Handles input, performs physics, and animates the player sprite.
-        /// </summary>
-        /// <remarks>
-        /// We pass in all of the input states so that our game is only polling the hardware
-        /// once per frame. We also pass the game's orientation because when using the accelerometer,
-        /// we need to reverse our motion when the orientation is in the LandscapeRight orientation.
-        /// </remarks>
-        public void Update(
-            GameTime gameTime, 
-            KeyboardState keyboardState, 
-            GamePadState gamePadState, 
-            TouchCollection touchState, 
-            AccelerometerState accelState,
-            DisplayOrientation orientation)
-        {
-            GetInput(keyboardState, gamePadState, touchState, accelState, orientation);
-
-            ApplyPhysics(gameTime);
-
-            if (IsAlive && IsOnGround)
-            {
-                if (Math.Abs(Velocity.X) - 0.02f > 0)
-                {
-                    sprite.PlayAnimation(runAnimation);
-                }
-                else
-                {
-                    sprite.PlayAnimation(idleAnimation);
-                }
-            }
-
-            // Clear input.
-            movement = 0.0f;
-            isJumping = false;
-        }
-
-        /// <summary>
-        /// Gets player horizontal movement and jump commands from input.
-        /// </summary>
-        private void GetInput(
-            KeyboardState keyboardState, 
-            GamePadState gamePadState, 
-            TouchCollection touchState,
-            AccelerometerState accelState, 
-            DisplayOrientation orientation)
-        {
-            // Get analog horizontal movement.
-            movement = gamePadState.ThumbSticks.Left.X * MoveStickScale;
-
-            // Ignore small movements to prevent running in place.
-            if (Math.Abs(movement) < 0.5f)
-                movement = 0.0f;
-
-            // Move the player with accelerometer
-			float accel = 0;
-			if(orientation == DisplayOrientation.Portrait || orientation == DisplayOrientation.PortraitUpsideDown)
-				accel = accelState.Acceleration.X;
-			else
-				accel = accelState.Acceleration.Y;
-            if (Math.Abs(accel) > 0.10f)
-            {
-                // set our movement speed
-                movement = MathHelper.Clamp(-accel * AccelerometerScale, -1f, 1f);
-
-                // if we're in the LandscapeLeft orientation, we must reverse our movement
-                if (orientation == DisplayOrientation.LandscapeRight)
-                    movement = -movement;
-            }
-
-            // If any digital horizontal movement input is found, override the analog movement.
-            if (gamePadState.IsButtonDown(Buttons.DPadLeft) ||
-                keyboardState.IsKeyDown(Keys.Left) ||
-                keyboardState.IsKeyDown(Keys.A))
-            {
-                movement = -1.0f;
-            }
-            else if (gamePadState.IsButtonDown(Buttons.DPadRight) ||
-                     keyboardState.IsKeyDown(Keys.Right) ||
-                     keyboardState.IsKeyDown(Keys.D))
-            {
-                movement = 1.0f;
-            }
-
-            // Check if the player wants to jump.
-            isJumping =
-                gamePadState.IsButtonDown(JumpButton) ||
-                keyboardState.IsKeyDown(Keys.Space) ||
-                keyboardState.IsKeyDown(Keys.Up) ||
-                keyboardState.IsKeyDown(Keys.W) ||
-                touchState.AnyTouch();
-        }
-
-        /// <summary>
-        /// Updates the player's velocity and position based on input, gravity, etc.
-        /// </summary>
-        public void ApplyPhysics(GameTime gameTime)
-        {
-            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
-
-            Vector2 previousPosition = Position;
-
-            // Base velocity is a combination of horizontal movement control and
-            // acceleration downward due to gravity.
-            velocity.X += movement * MoveAcceleration * elapsed;
-            velocity.Y = MathHelper.Clamp(velocity.Y + GravityAcceleration * elapsed, -MaxFallSpeed, MaxFallSpeed);
-
-            velocity.Y = DoJump(velocity.Y, gameTime);
-
-            // Apply pseudo-drag horizontally.
-            if (IsOnGround)
-                velocity.X *= GroundDragFactor;
-            else
-                velocity.X *= AirDragFactor;
-
-            // Prevent the player from running faster than his top speed.            
-            velocity.X = MathHelper.Clamp(velocity.X, -MaxMoveSpeed, MaxMoveSpeed);
-
-            // Apply velocity.
-            Position += velocity * elapsed;
-            Position = new Vector2((float)Math.Round(Position.X), (float)Math.Round(Position.Y));
-
-            // If the player is now colliding with the level, separate them.
-            HandleCollisions();
-
-            // If the collision stopped us from moving, reset the velocity to zero.
-            if (Position.X == previousPosition.X)
-                velocity.X = 0;
-
-            if (Position.Y == previousPosition.Y)
-                velocity.Y = 0;
-        }
-
-        /// <summary>
-        /// Calculates the Y velocity accounting for jumping and
-        /// animates accordingly.
-        /// </summary>
-        /// <remarks>
-        /// During the accent of a jump, the Y velocity is completely
-        /// overridden by a power curve. During the decent, gravity takes
-        /// over. The jump velocity is controlled by the jumpTime field
-        /// which measures time into the accent of the current jump.
-        /// </remarks>
-        /// <param name="velocityY">
-        /// The player's current velocity along the Y axis.
-        /// </param>
-        /// <returns>
-        /// A new Y velocity if beginning or continuing a jump.
-        /// Otherwise, the existing Y velocity.
-        /// </returns>
-        private float DoJump(float velocityY, GameTime gameTime)
-        {
-            // If the player wants to jump
-            if (isJumping)
-            {
-                // Begin or continue a jump
-                if ((!wasJumping && IsOnGround) || jumpTime > 0.0f)
-                {
-                    if (jumpTime == 0.0f)
-                        jumpSound.Play();
-
-                    jumpTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
-                    sprite.PlayAnimation(jumpAnimation);
-                }
-
-                // If we are in the ascent of the jump
-                if (0.0f < jumpTime && jumpTime <= MaxJumpTime)
-                {
-                    // Fully override the vertical velocity with a power curve that gives players more control over the top of the jump
-                    velocityY = JumpLaunchVelocity * (1.0f - (float)Math.Pow(jumpTime / MaxJumpTime, JumpControlPower));
-                }
-                else
-                {
-                    // Reached the apex of the jump
-                    jumpTime = 0.0f;
-                }
-            }
-            else
-            {
-                // Continues not jumping or cancels a jump in progress
-                jumpTime = 0.0f;
-            }
-            wasJumping = isJumping;
-
-            return velocityY;
-        }
-
-        /// <summary>
-        /// Detects and resolves all collisions between the player and his neighboring
-        /// tiles. When a collision is detected, the player is pushed away along one
-        /// axis to prevent overlapping. There is some special logic for the Y axis to
-        /// handle platforms which behave differently depending on direction of movement.
-        /// </summary>
-        private void HandleCollisions()
-        {
-            // Get the player's bounding rectangle and find neighboring tiles.
-            Rectangle bounds = BoundingRectangle;
-            int leftTile = (int)Math.Floor((float)bounds.Left / Tile.Width);
-            int rightTile = (int)Math.Ceiling(((float)bounds.Right / Tile.Width)) - 1;
-            int topTile = (int)Math.Floor((float)bounds.Top / Tile.Height);
-            int bottomTile = (int)Math.Ceiling(((float)bounds.Bottom / Tile.Height)) - 1;
-
-            // Reset flag to search for ground collision.
-            isOnGround = false;
-
-            // For each potentially colliding tile,
-            for (int y = topTile; y <= bottomTile; ++y)
-            {
-                for (int x = leftTile; x <= rightTile; ++x)
-                {
-                    // If this tile is collidable,
-                    TileCollision collision = Level.GetCollision(x, y);
-                    if (collision != TileCollision.Passable)
-                    {
-                        // Determine collision depth (with direction) and magnitude.
-                        Rectangle tileBounds = Level.GetBounds(x, y);
-                        Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds, tileBounds);
-                        if (depth != Vector2.Zero)
-                        {
-                            float absDepthX = Math.Abs(depth.X);
-                            float absDepthY = Math.Abs(depth.Y);
-
-                            // Resolve the collision along the shallow axis.
-                            if (absDepthY < absDepthX || collision == TileCollision.Platform)
-                            {
-                                // If we crossed the top of a tile, we are on the ground.
-                                if (previousBottom <= tileBounds.Top)
-                                    isOnGround = true;
-
-                                // Ignore platforms, unless we are on the ground.
-                                if (collision == TileCollision.Impassable || IsOnGround)
-                                {
-                                    // Resolve the collision along the Y axis.
-                                    Position = new Vector2(Position.X, Position.Y + depth.Y);
-
-                                    // Perform further collisions with the new bounds.
-                                    bounds = BoundingRectangle;
-                                }
-                            }
-                            else if (collision == TileCollision.Impassable) // Ignore platforms.
-                            {
-                                // Resolve the collision along the X axis.
-                                Position = new Vector2(Position.X + depth.X, Position.Y);
-
-                                // Perform further collisions with the new bounds.
-                                bounds = BoundingRectangle;
-                            }
-                        }
-                    }
-                }
-            }
-
-            // Save the new bounds bottom.
-            previousBottom = bounds.Bottom;
-        }
-
-        /// <summary>
-        /// Called when the player has been killed.
-        /// </summary>
-        /// <param name="killedBy">
-        /// The enemy who killed the player. This parameter is null if the player was
-        /// not killed by an enemy (fell into a hole).
-        /// </param>
-        public void OnKilled(Enemy killedBy)
-        {
-            isAlive = false;
-
-            if (killedBy != null)
-                killedSound.Play();
-            else
-                fallSound.Play();
-
-            sprite.PlayAnimation(dieAnimation);
-        }
-
-        /// <summary>
-        /// Called when this player reaches the level's exit.
-        /// </summary>
-        public void OnReachedExit()
-        {
-            sprite.PlayAnimation(celebrateAnimation);
-        }
-
-        /// <summary>
-        /// Draws the animated player.
-        /// </summary>
-        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
-        {
-            // Flip the sprite to face the way we are moving.
-            if (Velocity.X > 0)
-                flip = SpriteEffects.FlipHorizontally;
-            else if (Velocity.X < 0)
-                flip = SpriteEffects.None;
-
-            // Draw that sprite.
-            sprite.Draw(gameTime, spriteBatch, Position, flip);
-        }
-    }
-}

+ 0 - 66
StarterKits/Android/Platformer/RectangleExtensions.cs

@@ -1,66 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// RectangleExtensions.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-
-namespace Platformer
-{
-    /// <summary>
-    /// A set of helpful methods for working with rectangles.
-    /// </summary>
-    public static class RectangleExtensions
-    {
-        /// <summary>
-        /// Calculates the signed depth of intersection between two rectangles.
-        /// </summary>
-        /// <returns>
-        /// The amount of overlap between two intersecting rectangles. These
-        /// depth values can be negative depending on which wides the rectangles
-        /// intersect. This allows callers to determine the correct direction
-        /// to push objects in order to resolve collisions.
-        /// If the rectangles are not intersecting, Vector2.Zero is returned.
-        /// </returns>
-        public static Vector2 GetIntersectionDepth(this Rectangle rectA, Rectangle rectB)
-        {
-            // Calculate half sizes.
-            float halfWidthA = rectA.Width / 2.0f;
-            float halfHeightA = rectA.Height / 2.0f;
-            float halfWidthB = rectB.Width / 2.0f;
-            float halfHeightB = rectB.Height / 2.0f;
-
-            // Calculate centers.
-            Vector2 centerA = new Vector2(rectA.Left + halfWidthA, rectA.Top + halfHeightA);
-            Vector2 centerB = new Vector2(rectB.Left + halfWidthB, rectB.Top + halfHeightB);
-
-            // Calculate current and minimum-non-intersecting distances between centers.
-            float distanceX = centerA.X - centerB.X;
-            float distanceY = centerA.Y - centerB.Y;
-            float minDistanceX = halfWidthA + halfWidthB;
-            float minDistanceY = halfHeightA + halfHeightB;
-
-            // If we are not intersecting at all, return (0, 0).
-            if (Math.Abs(distanceX) >= minDistanceX || Math.Abs(distanceY) >= minDistanceY)
-                return Vector2.Zero;
-
-            // Calculate and return intersection depths.
-            float depthX = distanceX > 0 ? minDistanceX - distanceX : -minDistanceX - distanceX;
-            float depthY = distanceY > 0 ? minDistanceY - distanceY : -minDistanceY - distanceY;
-            return new Vector2(depthX, depthY);
-        }
-
-        /// <summary>
-        /// Gets the position of the center of the bottom edge of the rectangle.
-        /// </summary>
-        public static Vector2 GetBottomCenter(this Rectangle rect)
-        {
-            return new Vector2(rect.X + rect.Width / 2.0f, rect.Bottom);
-        }
-    }
-}

+ 0 - 62
StarterKits/Android/Platformer/Tile.cs

@@ -1,62 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Tile.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Controls the collision detection and response behavior of a tile.
-    /// </summary>
-    enum TileCollision
-    {
-        /// <summary>
-        /// A passable tile is one which does not hinder player motion at all.
-        /// </summary>
-        Passable = 0,
-
-        /// <summary>
-        /// An impassable tile is one which does not allow the player to move through
-        /// it at all. It is completely solid.
-        /// </summary>
-        Impassable = 1,
-
-        /// <summary>
-        /// A platform tile is one which behaves like a passable tile except when the
-        /// player is above it. A player can jump up through a platform as well as move
-        /// past it to the left and right, but can not fall down through the top of it.
-        /// </summary>
-        Platform = 2,
-    }
-
-    /// <summary>
-    /// Stores the appearance and collision behavior of a tile.
-    /// </summary>
-    struct Tile
-    {
-        public Texture2D Texture;
-        public TileCollision Collision;
-
-        public const int Width = 40;
-        public const int Height = 32;
-
-        public static readonly Vector2 Size = new Vector2(Width, Height);
-
-        /// <summary>
-        /// Constructs a new tile.
-        /// </summary>
-        public Tile(Texture2D texture, TileCollision collision)
-        {
-            Texture = texture;
-            Collision = collision;
-        }
-    }
-}

+ 0 - 36
StarterKits/Android/Platformer/TouchCollectionExtensions.cs

@@ -1,36 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// TouchCollectionExtensions.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-using Microsoft.Xna.Framework.Input.Touch;
-
-namespace Platformer
-{
-    /// <summary>
-    /// Provides extension methods for the TouchCollection type.
-    /// </summary>
-    public static class TouchCollectionExtensions
-    {
-        /// <summary>
-        /// Determines if there are any touches on the screen.
-        /// </summary>
-        /// <param name="touchState">The current TouchCollection.</param>
-        /// <returns>True if there are any touches in the Pressed or Moved state, false otherwise</returns>
-        public static bool AnyTouch(this TouchCollection touchState)
-        {
-            foreach (TouchLocation location in touchState)
-            {
-                if (location.State == TouchLocationState.Pressed || location.State == TouchLocationState.Moved)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-}

+ 2 - 1
StarterKits/MacOS/Cards/CardsFramework/CardsFramework.MacOS.csproj

@@ -10,6 +10,7 @@
     <OutputType>Library</OutputType>
     <OutputType>Library</OutputType>
     <RootNamespace>CardsFramework.MacOS</RootNamespace>
     <RootNamespace>CardsFramework.MacOS</RootNamespace>
     <AssemblyName>CardsFramework.MacOS</AssemblyName>
     <AssemblyName>CardsFramework.MacOS</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -59,7 +60,7 @@
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
+    <ProjectReference Include="..\..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Name>MonoGame.Framework.MacOS</Name>
       <Name>MonoGame.Framework.MacOS</Name>
     </ProjectReference>
     </ProjectReference>

+ 96 - 95
StarterKits/MacOS/Cards/CardsGame/BlackJack.MacOS.csproj

@@ -10,6 +10,7 @@
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <RootNamespace>BlackJack.MacOS</RootNamespace>
     <RootNamespace>BlackJack.MacOS</RootNamespace>
     <AssemblyName>BlackJack.MacOS</AssemblyName>
     <AssemblyName>BlackJack.MacOS</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -73,156 +74,156 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Content Include="Info.plist" />
     <Content Include="Info.plist" />
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubJack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubJack.png">
       <Link>Content\Images\Cards\ClubJack.png</Link>
       <Link>Content\Images\Cards\ClubJack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondEight.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondEight.png">
       <Link>Content\Images\Cards\DiamondEight.png</Link>
       <Link>Content\Images\Cards\DiamondEight.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondFive.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondFive.png">
       <Link>Content\Images\Cards\DiamondFive.png</Link>
       <Link>Content\Images\Cards\DiamondFive.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondFour.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondFour.png">
       <Link>Content\Images\Cards\DiamondFour.png</Link>
       <Link>Content\Images\Cards\DiamondFour.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondJack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondJack.png">
       <Link>Content\Images\Cards\DiamondJack.png</Link>
       <Link>Content\Images\Cards\DiamondJack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondKing.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondKing.png">
       <Link>Content\Images\Cards\DiamondKing.png</Link>
       <Link>Content\Images\Cards\DiamondKing.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondNine.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondNine.png">
       <Link>Content\Images\Cards\DiamondNine.png</Link>
       <Link>Content\Images\Cards\DiamondNine.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondQueen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondQueen.png">
       <Link>Content\Images\Cards\DiamondQueen.png</Link>
       <Link>Content\Images\Cards\DiamondQueen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondSeven.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondSeven.png">
       <Link>Content\Images\Cards\DiamondSeven.png</Link>
       <Link>Content\Images\Cards\DiamondSeven.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondSix.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondSix.png">
       <Link>Content\Images\Cards\DiamondSix.png</Link>
       <Link>Content\Images\Cards\DiamondSix.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondTen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondTen.png">
       <Link>Content\Images\Cards\DiamondTen.png</Link>
       <Link>Content\Images\Cards\DiamondTen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondThree.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondThree.png">
       <Link>Content\Images\Cards\DiamondThree.png</Link>
       <Link>Content\Images\Cards\DiamondThree.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondTwo.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondTwo.png">
       <Link>Content\Images\Cards\DiamondTwo.png</Link>
       <Link>Content\Images\Cards\DiamondTwo.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\FirstJoker.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\FirstJoker.png">
       <Link>Content\Images\Cards\FirstJoker.png</Link>
       <Link>Content\Images\Cards\FirstJoker.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartAce.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartAce.png">
       <Link>Content\Images\Cards\HeartAce.png</Link>
       <Link>Content\Images\Cards\HeartAce.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartEight.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartEight.png">
       <Link>Content\Images\Cards\HeartEight.png</Link>
       <Link>Content\Images\Cards\HeartEight.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartFive.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartFive.png">
       <Link>Content\Images\Cards\HeartFive.png</Link>
       <Link>Content\Images\Cards\HeartFive.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartFour.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartFour.png">
       <Link>Content\Images\Cards\HeartFour.png</Link>
       <Link>Content\Images\Cards\HeartFour.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartJack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartJack.png">
       <Link>Content\Images\Cards\HeartJack.png</Link>
       <Link>Content\Images\Cards\HeartJack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartKing.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartKing.png">
       <Link>Content\Images\Cards\HeartKing.png</Link>
       <Link>Content\Images\Cards\HeartKing.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartNine.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartNine.png">
       <Link>Content\Images\Cards\HeartNine.png</Link>
       <Link>Content\Images\Cards\HeartNine.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartQueen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartQueen.png">
       <Link>Content\Images\Cards\HeartQueen.png</Link>
       <Link>Content\Images\Cards\HeartQueen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartSeven.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartSeven.png">
       <Link>Content\Images\Cards\HeartSeven.png</Link>
       <Link>Content\Images\Cards\HeartSeven.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartSix.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartSix.png">
       <Link>Content\Images\Cards\HeartSix.png</Link>
       <Link>Content\Images\Cards\HeartSix.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartTen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartTen.png">
       <Link>Content\Images\Cards\HeartTen.png</Link>
       <Link>Content\Images\Cards\HeartTen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartThree.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartThree.png">
       <Link>Content\Images\Cards\HeartThree.png</Link>
       <Link>Content\Images\Cards\HeartThree.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\HeartTwo.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\HeartTwo.png">
       <Link>Content\Images\Cards\HeartTwo.png</Link>
       <Link>Content\Images\Cards\HeartTwo.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SecondJoker.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SecondJoker.png">
       <Link>Content\Images\Cards\SecondJoker.png</Link>
       <Link>Content\Images\Cards\SecondJoker.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeAce.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeAce.png">
       <Link>Content\Images\Cards\SpadeAce.png</Link>
       <Link>Content\Images\Cards\SpadeAce.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeEight.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeEight.png">
       <Link>Content\Images\Cards\SpadeEight.png</Link>
       <Link>Content\Images\Cards\SpadeEight.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeFive.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeFive.png">
       <Link>Content\Images\Cards\SpadeFive.png</Link>
       <Link>Content\Images\Cards\SpadeFive.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeFour.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeFour.png">
       <Link>Content\Images\Cards\SpadeFour.png</Link>
       <Link>Content\Images\Cards\SpadeFour.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeJack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeJack.png">
       <Link>Content\Images\Cards\SpadeJack.png</Link>
       <Link>Content\Images\Cards\SpadeJack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeKing.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeKing.png">
       <Link>Content\Images\Cards\SpadeKing.png</Link>
       <Link>Content\Images\Cards\SpadeKing.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeNine.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeNine.png">
       <Link>Content\Images\Cards\SpadeNine.png</Link>
       <Link>Content\Images\Cards\SpadeNine.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeQueen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeQueen.png">
       <Link>Content\Images\Cards\SpadeQueen.png</Link>
       <Link>Content\Images\Cards\SpadeQueen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeSeven.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeSeven.png">
       <Link>Content\Images\Cards\SpadeSeven.png</Link>
       <Link>Content\Images\Cards\SpadeSeven.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeSix.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeSix.png">
       <Link>Content\Images\Cards\SpadeSix.png</Link>
       <Link>Content\Images\Cards\SpadeSix.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeTen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeTen.png">
       <Link>Content\Images\Cards\SpadeTen.png</Link>
       <Link>Content\Images\Cards\SpadeTen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeThree.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeThree.png">
       <Link>Content\Images\Cards\SpadeThree.png</Link>
       <Link>Content\Images\Cards\SpadeThree.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\SpadeTwo.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\SpadeTwo.png">
       <Link>Content\Images\Cards\SpadeTwo.png</Link>
       <Link>Content\Images\Cards\SpadeTwo.png</Link>
     </Content>
     </Content>
-    <None Include="..\..\BlackjackHiDefContent\Fonts\Bold.spritefont">
+    <None Include="..\BlackjackHiDefContent\Fonts\Bold.spritefont">
       <Link>Content\Fonts\Bold.spritefont</Link>
       <Link>Content\Fonts\Bold.spritefont</Link>
     </None>
     </None>
-    <None Include="..\..\BlackjackHiDefContent\Fonts\MenuFont.spritefont">
+    <None Include="..\BlackjackHiDefContent\Fonts\MenuFont.spritefont">
       <Link>Content\Fonts\MenuFont.spritefont</Link>
       <Link>Content\Fonts\MenuFont.spritefont</Link>
     </None>
     </None>
-    <None Include="..\..\BlackjackHiDefContent\Fonts\Regular.spritefont">
+    <None Include="..\BlackjackHiDefContent\Fonts\Regular.spritefont">
       <Link>Content\Fonts\Regular.spritefont</Link>
       <Link>Content\Fonts\Regular.spritefont</Link>
     </None>
     </None>
-    <Content Include="..\..\BlackjackHiDefContent\Fonts\Bold.xnb">
+    <Content Include="..\BlackjackHiDefContent\Fonts\Bold.xnb">
       <Link>Content\Fonts\Bold.xnb</Link>
       <Link>Content\Fonts\Bold.xnb</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Fonts\MenuFont.xnb">
+    <Content Include="..\BlackjackHiDefContent\Fonts\MenuFont.xnb">
       <Link>Content\Fonts\MenuFont.xnb</Link>
       <Link>Content\Fonts\MenuFont.xnb</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Fonts\Regular.xnb">
+    <Content Include="..\BlackjackHiDefContent\Fonts\Regular.xnb">
       <Link>Content\Fonts\Regular.xnb</Link>
       <Link>Content\Fonts\Regular.xnb</Link>
     </Content>
     </Content>
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
   <ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\CardsFramework\CardsFramework.MacOS.csproj">
+    <ProjectReference Include="..\CardsFramework\CardsFramework.MacOS.csproj">
       <Project>{B35097FE-CBF0-4CAD-8B93-36C9587057DE}</Project>
       <Project>{B35097FE-CBF0-4CAD-8B93-36C9587057DE}</Project>
       <Name>CardsFramework.MacOS</Name>
       <Name>CardsFramework.MacOS</Name>
     </ProjectReference>
     </ProjectReference>
-    <ProjectReference Include="..\..\..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
+    <ProjectReference Include="..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Name>MonoGame.Framework.MacOS</Name>
       <Name>MonoGame.Framework.MacOS</Name>
     </ProjectReference>
     </ProjectReference>
@@ -231,142 +232,142 @@
     <Folder Include="Content\" />
     <Folder Include="Content\" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <Content Include="..\..\BlackjackHiDefContent\Sounds\Bet.wav">
+    <Content Include="..\BlackjackHiDefContent\Sounds\Bet.wav">
       <Link>Content\Sounds\Bet.wav</Link>
       <Link>Content\Sounds\Bet.wav</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Sounds\CardFlip.wav">
+    <Content Include="..\BlackjackHiDefContent\Sounds\CardFlip.wav">
       <Link>Content\Sounds\CardFlip.wav</Link>
       <Link>Content\Sounds\CardFlip.wav</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Sounds\CardsShuffle.wav">
+    <Content Include="..\BlackjackHiDefContent\Sounds\CardsShuffle.wav">
       <Link>Content\Sounds\CardsShuffle.wav</Link>
       <Link>Content\Sounds\CardsShuffle.wav</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Sounds\Deal.wav">
+    <Content Include="..\BlackjackHiDefContent\Sounds\Deal.wav">
       <Link>Content\Sounds\Deal.wav</Link>
       <Link>Content\Sounds\Deal.wav</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\blank.png">
+    <Content Include="..\BlackjackHiDefContent\Images\blank.png">
       <Link>Content\Images\blank.png</Link>
       <Link>Content\Images\blank.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\CardsFramework\Background.png">
+    <Content Include="..\CardsFramework\Background.png">
       <Link>Content\Background.png</Link>
       <Link>Content\Background.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Button.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Button.png">
       <Link>Content\Images\Button.png</Link>
       <Link>Content\Images\Button.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\ButtonPressed.png">
+    <Content Include="..\BlackjackHiDefContent\Images\ButtonPressed.png">
       <Link>Content\Images\ButtonPressed.png</Link>
       <Link>Content\Images\ButtonPressed.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\ButtonRegular.png">
+    <Content Include="..\BlackjackHiDefContent\Images\ButtonRegular.png">
       <Link>Content\Images\ButtonRegular.png</Link>
       <Link>Content\Images\ButtonRegular.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\GamePadCursor.png">
+    <Content Include="..\BlackjackHiDefContent\Images\GamePadCursor.png">
       <Link>Content\Images\GamePadCursor.png</Link>
       <Link>Content\Images\GamePadCursor.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\instructions.png">
+    <Content Include="..\BlackjackHiDefContent\Images\instructions.png">
       <Link>Content\Images\instructions.png</Link>
       <Link>Content\Images\instructions.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\titlescreen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\titlescreen.png">
       <Link>Content\Images\titlescreen.png</Link>
       <Link>Content\Images\titlescreen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\youLose.png">
+    <Content Include="..\BlackjackHiDefContent\Images\youLose.png">
       <Link>Content\Images\youLose.png</Link>
       <Link>Content\Images\youLose.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\blackjack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\blackjack.png">
       <Link>Content\Images\UI\blackjack.png</Link>
       <Link>Content\Images\UI\blackjack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\bust.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\bust.png">
       <Link>Content\Images\UI\bust.png</Link>
       <Link>Content\Images\UI\bust.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\lose.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\lose.png">
       <Link>Content\Images\UI\lose.png</Link>
       <Link>Content\Images\UI\lose.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\pass.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\pass.png">
       <Link>Content\Images\UI\pass.png</Link>
       <Link>Content\Images\UI\pass.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\push.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\push.png">
       <Link>Content\Images\UI\push.png</Link>
       <Link>Content\Images\UI\push.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\ring.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\ring.png">
       <Link>Content\Images\UI\ring.png</Link>
       <Link>Content\Images\UI\ring.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\Shuffle_Blue.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\Shuffle_Blue.png">
       <Link>Content\Images\UI\Shuffle_Blue.png</Link>
       <Link>Content\Images\UI\Shuffle_Blue.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\Shuffle_Red.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\Shuffle_Red.png">
       <Link>Content\Images\UI\Shuffle_Red.png</Link>
       <Link>Content\Images\UI\Shuffle_Red.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\table.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\table.png">
       <Link>Content\Images\UI\table.png</Link>
       <Link>Content\Images\UI\table.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\UI\win.png">
+    <Content Include="..\BlackjackHiDefContent\Images\UI\win.png">
       <Link>Content\Images\UI\win.png</Link>
       <Link>Content\Images\UI\win.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chip100.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chip100.png">
       <Link>Content\Images\Chips\chip100.png</Link>
       <Link>Content\Images\Chips\chip100.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chip25.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chip25.png">
       <Link>Content\Images\Chips\chip25.png</Link>
       <Link>Content\Images\Chips\chip25.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chip5.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chip5.png">
       <Link>Content\Images\Chips\chip5.png</Link>
       <Link>Content\Images\Chips\chip5.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chip500.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chip500.png">
       <Link>Content\Images\Chips\chip500.png</Link>
       <Link>Content\Images\Chips\chip500.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chipBlack.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chipBlack.png">
       <Link>Content\Images\Chips\chipBlack.png</Link>
       <Link>Content\Images\Chips\chipBlack.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chipRed.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chipRed.png">
       <Link>Content\Images\Chips\chipRed.png</Link>
       <Link>Content\Images\Chips\chipRed.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chipWhite.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chipWhite.png">
       <Link>Content\Images\Chips\chipWhite.png</Link>
       <Link>Content\Images\Chips\chipWhite.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Chips\chipYellow.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Chips\chipYellow.png">
       <Link>Content\Images\Chips\chipYellow.png</Link>
       <Link>Content\Images\Chips\chipYellow.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\CardBack_Blue.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\CardBack_Blue.png">
       <Link>Content\Images\Cards\CardBack_Blue.png</Link>
       <Link>Content\Images\Cards\CardBack_Blue.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\CardBack_Red.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\CardBack_Red.png">
       <Link>Content\Images\Cards\CardBack_Red.png</Link>
       <Link>Content\Images\Cards\CardBack_Red.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubAce.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubAce.png">
       <Link>Content\Images\Cards\ClubAce.png</Link>
       <Link>Content\Images\Cards\ClubAce.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubEight.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubEight.png">
       <Link>Content\Images\Cards\ClubEight.png</Link>
       <Link>Content\Images\Cards\ClubEight.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubFive.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubFive.png">
       <Link>Content\Images\Cards\ClubFive.png</Link>
       <Link>Content\Images\Cards\ClubFive.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubFour.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubFour.png">
       <Link>Content\Images\Cards\ClubFour.png</Link>
       <Link>Content\Images\Cards\ClubFour.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubKing.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubKing.png">
       <Link>Content\Images\Cards\ClubKing.png</Link>
       <Link>Content\Images\Cards\ClubKing.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubNine.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubNine.png">
       <Link>Content\Images\Cards\ClubNine.png</Link>
       <Link>Content\Images\Cards\ClubNine.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubQueen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubQueen.png">
       <Link>Content\Images\Cards\ClubQueen.png</Link>
       <Link>Content\Images\Cards\ClubQueen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubSeven.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubSeven.png">
       <Link>Content\Images\Cards\ClubSeven.png</Link>
       <Link>Content\Images\Cards\ClubSeven.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubSix.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubSix.png">
       <Link>Content\Images\Cards\ClubSix.png</Link>
       <Link>Content\Images\Cards\ClubSix.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubTen.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubTen.png">
       <Link>Content\Images\Cards\ClubTen.png</Link>
       <Link>Content\Images\Cards\ClubTen.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubThree.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubThree.png">
       <Link>Content\Images\Cards\ClubThree.png</Link>
       <Link>Content\Images\Cards\ClubThree.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\ClubTwo.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\ClubTwo.png">
       <Link>Content\Images\Cards\ClubTwo.png</Link>
       <Link>Content\Images\Cards\ClubTwo.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\BlackjackHiDefContent\Images\Cards\DiamondAce.png">
+    <Content Include="..\BlackjackHiDefContent\Images\Cards\DiamondAce.png">
       <Link>Content\Images\Cards\DiamondAce.png</Link>
       <Link>Content\Images\Cards\DiamondAce.png</Link>
     </Content>
     </Content>
   </ItemGroup>
   </ItemGroup>

+ 11 - 11
StarterKits/MacOS/Cards/CardsGame/ScreenManager/InputState.cs

@@ -25,9 +25,8 @@ namespace GameStateManagement
     public class InputState
     public class InputState
     {
     {
         #region Fields
         #region Fields
-
-        public const int MaxInputs = 4;
-
+		public const int MaxInputs = 4;	
+		
         public readonly KeyboardState[] CurrentKeyboardStates;
         public readonly KeyboardState[] CurrentKeyboardStates;
         public readonly GamePadState[] CurrentGamePadStates;
         public readonly GamePadState[] CurrentGamePadStates;
 
 
@@ -72,6 +71,15 @@ namespace GameStateManagement
         /// </summary>
         /// </summary>
         public void Update()
         public void Update()
         {
         {
+#if WINDOWS_PHONE || IOS || ANDROID
+            TouchState = TouchPanel.GetState();
+
+            Gestures.Clear();
+            while (TouchPanel.IsGestureAvailable)
+            {
+                Gestures.Add(TouchPanel.ReadGesture());
+            }
+#else
             for (int i = 0; i < MaxInputs; i++)
             for (int i = 0; i < MaxInputs; i++)
             {
             {
                 LastKeyboardStates[i] = CurrentKeyboardStates[i];
                 LastKeyboardStates[i] = CurrentKeyboardStates[i];
@@ -87,14 +95,6 @@ namespace GameStateManagement
                     GamePadWasConnected[i] = true;
                     GamePadWasConnected[i] = true;
                 }
                 }
             }
             }
-#if WINDOWS_PHONE || IOS || ANDROID
-            TouchState = TouchPanel.GetState();
-
-            Gestures.Clear();
-            while (TouchPanel.IsGestureAvailable)
-            {
-                Gestures.Add(TouchPanel.ReadGesture());
-            }
 #endif
 #endif
         }
         }
 
 

+ 5 - 31
StarterKits/MacOS/Marblets/Marblets.csproj

@@ -10,6 +10,7 @@
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <RootNamespace>Marblets</RootNamespace>
     <RootNamespace>Marblets</RootNamespace>
     <AssemblyName>Marblets</AssemblyName>
     <AssemblyName>Marblets</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -43,7 +44,7 @@
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
   <ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
       <Name>MonoGame.Framework.MacOS</Name>
       <Name>MonoGame.Framework.MacOS</Name>
     </ProjectReference>
     </ProjectReference>
@@ -89,38 +90,11 @@
     <Compile Include="..\..\iOS\Marblets\TutorialGameBoard.cs">
     <Compile Include="..\..\iOS\Marblets\TutorialGameBoard.cs">
       <Link>TutorialGameBoard.cs</Link>
       <Link>TutorialGameBoard.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\..\iOS\Marblets\Sound.cs">
+      <Link>Sound.cs</Link>
+    </Compile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <Content Include="..\..\iOS\Marblets\Content\game_over_frame_zunehd.tga">
-      <Link>Content\game_over_frame_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\marble_burst_zunehd.tga">
-      <Link>Content\marble_burst_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\marble_cursor_zunehd.tga">
-      <Link>Content\marble_cursor_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\marble_glow_1ring_zunehd.tga">
-      <Link>Content\marble_glow_1ring_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\marble_glow_2rings_zunehd.tga">
-      <Link>Content\marble_glow_2rings_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\marble_zunehd.tga">
-      <Link>Content\marble_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\numbers_large.tga">
-      <Link>Content\numbers_large.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\numbers_small.tga">
-      <Link>Content\numbers_small.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\play_frame_zunehd.tga">
-      <Link>Content\play_frame_zunehd.tga</Link>
-    </Content>
-    <Content Include="..\..\iOS\Marblets\Content\title_frame_zunehd.tga">
-      <Link>Content\title_frame_zunehd.tga</Link>
-    </Content>
     <Content Include="..\..\iOS\Marblets\Content\Textures\game_over_frame.png">
     <Content Include="..\..\iOS\Marblets\Content\Textures\game_over_frame.png">
       <Link>Content\Textures\game_over_frame.png</Link>
       <Link>Content\Textures\game_over_frame.png</Link>
     </Content>
     </Content>

+ 35 - 35
StarterKits/iOS/Cards/BlackJack.iOS.csproj

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
     <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
@@ -90,10 +90,10 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Content Include="Info.plist" />
     <Content Include="Info.plist" />
-    <Content Include="..\..\MacOS\Cards\CardsGame\CardsGame\Background.png">
+    <Content Include="..\..\MacOS\Cards\CardsGame\Background.png">
       <Link>Background.png</Link>
       <Link>Background.png</Link>
     </Content>
     </Content>
-    <Content Include="..\..\MacOS\Cards\CardsGame\CardsGame\GameThumbnail.png">
+    <Content Include="..\..\MacOS\Cards\CardsGame\GameThumbnail.png">
       <Link>GameThumbnail.png</Link>
       <Link>GameThumbnail.png</Link>
     </Content>
     </Content>
     <Content Include="..\..\MacOS\Cards\BlackjackLoDefContent\Images\Cards\CardBack_Blue.png">
     <Content Include="..\..\MacOS\Cards\BlackjackLoDefContent\Images\Cards\CardBack_Blue.png">
@@ -339,98 +339,98 @@
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
+      <Project>{DB8508BB-9849-4CC2-BC0F-8EB5DACB3C47}</Project>
+      <Name>MonoGame.Framework.iOS</Name>
+    </ProjectReference>
     <ProjectReference Include="CardsFramework.iOS.csproj">
     <ProjectReference Include="CardsFramework.iOS.csproj">
       <Project>{91CF4A04-9FDC-471D-AED0-D8F057068230}</Project>
       <Project>{91CF4A04-9FDC-471D-AED0-D8F057068230}</Project>
       <Name>CardsFramework.iOS</Name>
       <Name>CardsFramework.iOS</Name>
     </ProjectReference>
     </ProjectReference>
-    <ProjectReference Include="..\..\..\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
-      <Project>{DB8508BB-9849-4CC2-BC0F-8EB5DACB3C47}</Project>
-      <Name>MonoGame.Framework.iOS</Name>
-    </ProjectReference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Game\BlackjackCardGame.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Game\BlackjackCardGame.cs">
       <Link>Blackjack\Game\BlackjackCardGame.cs</Link>
       <Link>Blackjack\Game\BlackjackCardGame.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Misc\BetGameComponent.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Misc\BetGameComponent.cs">
       <Link>Blackjack\Misc\BetGameComponent.cs</Link>
       <Link>Blackjack\Misc\BetGameComponent.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Players\BlackjackAIPlayer.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Players\BlackjackAIPlayer.cs">
       <Link>Blackjack\Players\BlackjackAIPlayer.cs</Link>
       <Link>Blackjack\Players\BlackjackAIPlayer.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Players\BlackjackPlayer.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Players\BlackjackPlayer.cs">
       <Link>Blackjack\Players\BlackjackPlayer.cs</Link>
       <Link>Blackjack\Players\BlackjackPlayer.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Rules\BlackjackGameEventArgs.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Rules\BlackjackGameEventArgs.cs">
       <Link>Blackjack\Rules\BlackjackGameEventArgs.cs</Link>
       <Link>Blackjack\Rules\BlackjackGameEventArgs.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Rules\BlackjackRule.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Rules\BlackjackRule.cs">
       <Link>Blackjack\Rules\BlackjackRule.cs</Link>
       <Link>Blackjack\Rules\BlackjackRule.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Rules\BustRule.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Rules\BustRule.cs">
       <Link>Blackjack\Rules\BustRule.cs</Link>
       <Link>Blackjack\Rules\BustRule.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\Rules\InsuranceRule.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\Rules\InsuranceRule.cs">
       <Link>Blackjack\Rules\InsuranceRule.cs</Link>
       <Link>Blackjack\Rules\InsuranceRule.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\UI\BlackJackAnimatedPlayerHandComponent.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\UI\BlackJackAnimatedPlayerHandComponent.cs">
       <Link>Blackjack\UI\BlackJackAnimatedPlayerHandComponent.cs</Link>
       <Link>Blackjack\UI\BlackJackAnimatedPlayerHandComponent.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\UI\BlackJackTable.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\UI\BlackJackTable.cs">
       <Link>Blackjack\UI\BlackJackTable.cs</Link>
       <Link>Blackjack\UI\BlackJackTable.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\UI\BlackjackAnimatedDealerHandComponent.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\UI\BlackjackAnimatedDealerHandComponent.cs">
       <Link>Blackjack\UI\BlackjackAnimatedDealerHandComponent.cs</Link>
       <Link>Blackjack\UI\BlackjackAnimatedDealerHandComponent.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Blackjack\UI\Button.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Blackjack\UI\Button.cs">
       <Link>Blackjack\UI\Button.cs</Link>
       <Link>Blackjack\UI\Button.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Misc\AudioManager.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Misc\AudioManager.cs">
       <Link>Misc\AudioManager.cs</Link>
       <Link>Misc\AudioManager.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Misc\InputHelper.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Misc\InputHelper.cs">
       <Link>Misc\InputHelper.cs</Link>
       <Link>Misc\InputHelper.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Properties\AssemblyInfo.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Properties\AssemblyInfo.cs">
       <Link>Properties\AssemblyInfo.cs</Link>
       <Link>Properties\AssemblyInfo.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\GameScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\GameScreen.cs">
       <Link>ScreenManager\GameScreen.cs</Link>
       <Link>ScreenManager\GameScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\InputState.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\InputState.cs">
       <Link>ScreenManager\InputState.cs</Link>
       <Link>ScreenManager\InputState.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\MenuEntry.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\MenuEntry.cs">
       <Link>ScreenManager\MenuEntry.cs</Link>
       <Link>ScreenManager\MenuEntry.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\MenuScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\MenuScreen.cs">
       <Link>ScreenManager\MenuScreen.cs</Link>
       <Link>ScreenManager\MenuScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\PlayerIndexEventArgs.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\PlayerIndexEventArgs.cs">
       <Link>ScreenManager\PlayerIndexEventArgs.cs</Link>
       <Link>ScreenManager\PlayerIndexEventArgs.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\ScreenManager\ScreenManager.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\ScreenManager\ScreenManager.cs">
       <Link>ScreenManager\ScreenManager.cs</Link>
       <Link>ScreenManager\ScreenManager.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\BlackjackGame.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\BlackjackGame.cs">
       <Link>BlackjackGame.cs</Link>
       <Link>BlackjackGame.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\BackgroundScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\BackgroundScreen.cs">
       <Link>Screens\BackgroundScreen.cs</Link>
       <Link>Screens\BackgroundScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\GameplayScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\GameplayScreen.cs">
       <Link>Screens\GameplayScreen.cs</Link>
       <Link>Screens\GameplayScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\InstructionScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\InstructionScreen.cs">
       <Link>Screens\InstructionScreen.cs</Link>
       <Link>Screens\InstructionScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\MainMenuScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\MainMenuScreen.cs">
       <Link>Screens\MainMenuScreen.cs</Link>
       <Link>Screens\MainMenuScreen.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\OptionsMenu.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\OptionsMenu.cs">
       <Link>Screens\OptionsMenu.cs</Link>
       <Link>Screens\OptionsMenu.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\MacOS\Cards\CardsGame\CardsGame\Screens\PauseScreen.cs">
+    <Compile Include="..\..\MacOS\Cards\CardsGame\Screens\PauseScreen.cs">
       <Link>Screens\PauseScreen.cs</Link>
       <Link>Screens\PauseScreen.cs</Link>
     </Compile>
     </Compile>
     <Compile Include="Program.iOS.cs" />
     <Compile Include="Program.iOS.cs" />

+ 2 - 2
StarterKits/iOS/Cards/CardsFramework.iOS.csproj

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -49,7 +49,7 @@
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
       <Project>{DB8508BB-9849-4CC2-BC0F-8EB5DACB3C47}</Project>
       <Project>{DB8508BB-9849-4CC2-BC0F-8EB5DACB3C47}</Project>
       <Name>MonoGame.Framework.iOS</Name>
       <Name>MonoGame.Framework.iOS</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);
+        }
+    }
+}