diff --git a/DepthsBelow/DepthsBelow/Camera.cs b/DepthsBelow/DepthsBelow/Camera.cs
new file mode 100644
index 0000000..7957269
--- /dev/null
+++ b/DepthsBelow/DepthsBelow/Camera.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace DepthsBelow
+{
+ class Camera
+ {
+ public float Zoom;
+ public Matrix Transform;
+ public Vector2 Position;
+ public float Rotation;
+
+ public float Speed;
+
+ private Core core;
+
+ public Camera(Core core)
+ {
+ this.core = core;
+
+ Zoom = 1.0f;
+ Rotation = 0.0f;
+ Position = Vector2.Zero;
+ Speed = 5;
+ }
+
+ public void Update(GameTime gameTime)
+ {
+ MouseState ms = Mouse.GetState();
+
+ if (ms.X < 20)
+ Position.X -= Speed;
+ if (ms.X > core.GraphicsDevice.Viewport.Width - 20)
+ Position.X += Speed;
+
+ if (ms.Y < 20)
+ Position.Y -= Speed;
+ if (ms.Y > core.GraphicsDevice.Viewport.Height - 20)
+ Position.Y += Speed;
+
+ Transform =
+ Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0))
+ * Matrix.CreateRotationZ(Rotation)
+ * Matrix.CreateScale(Zoom)
+ //* Matrix.CreateTranslation(new Vector3(
+ ;
+ }
+ }
+}
diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs
index 19d8d83..50d89b6 100644
--- a/DepthsBelow/DepthsBelow/Core.cs
+++ b/DepthsBelow/DepthsBelow/Core.cs
@@ -1,108 +1,112 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-
-namespace DepthsBelow
-{
- ///
- /// This is the main type for your game
- ///
- public class Core : Microsoft.Xna.Framework.Game
- {
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
-
- Soldier soldier;
-
- public Core()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
-
- graphics.PreferredBackBufferWidth = 1280;
- graphics.PreferredBackBufferHeight = 720;
- graphics.IsFullScreen = true;
-
- this.IsMouseVisible = true;
- }
-
- ///
- /// Allows the game to perform any initialization it needs to before starting to run.
- /// This is where it can query for any required services and load any non-graphic
- /// related content. Calling base.Initialize will enumerate through any components
- /// and initialize them as well.
- ///
- protected override void Initialize()
- {
- // TODO: Add your initialization logic here
-
- base.Initialize();
- }
-
- ///
- /// LoadContent will be called once per game and is the place to load
- /// all of your content.
- ///
- protected override void LoadContent()
- {
- // Create a new SpriteBatch, which can be used to draw textures.
- spriteBatch = new SpriteBatch(GraphicsDevice);
-
- // TODO: use this.Content to load your game content here
- Soldier.LoadContent(this);
- soldier = new Soldier(this);
-
- }
-
- ///
- /// UnloadContent will be called once per game and is the place to unload
- /// all content.
- ///
- protected override void UnloadContent()
- {
- // TODO: Unload any non ContentManager content here
- }
-
- ///
- /// Allows the game to run logic such as updating the world,
- /// checking for collisions, gathering input, and playing audio.
- ///
- /// Provides a snapshot of timing values.
- protected override void Update(GameTime gameTime)
- {
- // Allows the game to exit
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
- this.Exit();
-
- // TODO: Add your update logic here
- soldier.Update(gameTime);
-
- base.Update(gameTime);
- }
-
- ///
- /// This is called when the game should draw itself.
- ///
- /// Provides a snapshot of timing values.
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(Color.CornflowerBlue);
-
- // TODO: Add your drawing code here
- spriteBatch.Begin();
- Component.SpriteRenderer rc = soldier.GetComponent();
- if (rc != null)
- rc.Draw(spriteBatch);
- spriteBatch.End();
-
- base.Draw(gameTime);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.GamerServices;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Media;
+
+namespace DepthsBelow
+{
+ ///
+ /// This is the main type for your game
+ ///
+ public class Core : Microsoft.Xna.Framework.Game
+ {
+ GraphicsDeviceManager graphics;
+ SpriteBatch spriteBatch;
+
+ Camera camera;
+ Soldier soldier;
+
+ public Core()
+ {
+ graphics = new GraphicsDeviceManager(this);
+ Content.RootDirectory = "Content";
+
+ graphics.PreferredBackBufferWidth = 1280;
+ graphics.PreferredBackBufferHeight = 720;
+ graphics.IsFullScreen = false;
+
+ this.IsMouseVisible = true;
+ }
+
+ ///
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ ///
+ protected override void Initialize()
+ {
+ // TODO: Add your initialization logic here
+ camera = new Camera(this);
+ base.Initialize();
+ }
+
+ ///
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ ///
+ protected override void LoadContent()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ spriteBatch = new SpriteBatch(GraphicsDevice);
+
+ // TODO: use this.Content to load your game content here
+ Soldier.LoadContent(this);
+ soldier = new Soldier(this);
+ }
+
+ ///
+ /// UnloadContent will be called once per game and is the place to unload
+ /// all content.
+ ///
+ protected override void UnloadContent()
+ {
+ // TODO: Unload any non ContentManager content here
+ }
+
+ ///
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Update(GameTime gameTime)
+ {
+ // Allows the game to exit
+ if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
+ this.Exit();
+
+ camera.Update(gameTime);
+
+ // TODO: Add your update logic here
+ soldier.Update(gameTime);
+
+ base.Update(gameTime);
+ }
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Draw(GameTime gameTime)
+ {
+ GraphicsDevice.Clear(Color.CornflowerBlue);
+
+ spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.Transform);
+
+ // TODO: Foreach etc...
+ Component.SpriteRenderer rc = soldier.GetComponent();
+ if (rc != null)
+ rc.Draw(spriteBatch);
+
+ spriteBatch.End();
+
+ base.Draw(gameTime);
+ }
+ }
+}
diff --git a/DepthsBelow/DepthsBelow/DepthsBelow.csproj b/DepthsBelow/DepthsBelow/DepthsBelow.csproj
index 9494bb8..c4961e0 100644
--- a/DepthsBelow/DepthsBelow/DepthsBelow.csproj
+++ b/DepthsBelow/DepthsBelow/DepthsBelow.csproj
@@ -1,183 +1,184 @@
-
-
-
- {94683C5B-052D-4143-96D8-35C67E831000}
- {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Debug
- x86
- WinExe
- Properties
- DepthsBelow
- DepthsBelow
- v4.0
- Client
- v4.0
- Windows
- HiDef
- faa0577e-a03e-43cf-89c7-0a03f4c22717
- Game
- Game.ico
- GameThumbnail.png
- false
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 1
- 1.0.0.%2a
- false
- true
- true
-
-
- true
- full
- false
- bin\x86\Debug
- DEBUG;TRACE;WINDOWS
- prompt
- 4
- true
- false
- x86
- false
-
-
- pdbonly
- true
- bin\x86\Release
- TRACE;WINDOWS
- prompt
- 4
- true
- false
- x86
- true
-
-
- ECE66DEF071576E8D2F7D57232C0569623E3E2DF
-
-
- DepthsBelow_TemporaryKey.pfx
-
-
- true
-
-
- true
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DepthsBelowContent
- Content
-
-
-
-
- False
- Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
- False
- Microsoft XNA Framework Redistributable 4.0
- true
-
-
-
-
-
-
-
-
+
+
+
+ {94683C5B-052D-4143-96D8-35C67E831000}
+ {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Debug
+ x86
+ WinExe
+ Properties
+ DepthsBelow
+ DepthsBelow
+ v4.0
+ Client
+ v4.0
+ Windows
+ HiDef
+ faa0577e-a03e-43cf-89c7-0a03f4c22717
+ Game
+ Game.ico
+ GameThumbnail.png
+ false
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 1
+ 1.0.0.%2a
+ false
+ true
+ true
+
+
+ true
+ full
+ false
+ bin\x86\Debug
+ DEBUG;TRACE;WINDOWS
+ prompt
+ 4
+ true
+ false
+ x86
+ false
+
+
+ pdbonly
+ true
+ bin\x86\Release
+ TRACE;WINDOWS
+ prompt
+ 4
+ true
+ false
+ x86
+ true
+
+
+ ECE66DEF071576E8D2F7D57232C0569623E3E2DF
+
+
+ DepthsBelow_TemporaryKey.pfx
+
+
+ true
+
+
+ true
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DepthsBelowContent
+ Content
+
+
+
+
+ False
+ Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+ False
+ Microsoft XNA Framework Redistributable 4.0
+ true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DepthsBelow/DepthsBelow/DepthsBelow.csproj.user b/DepthsBelow/DepthsBelow/DepthsBelow.csproj.user
index 50cd2e4..43ea7bc 100644
--- a/DepthsBelow/DepthsBelow/DepthsBelow.csproj.user
+++ b/DepthsBelow/DepthsBelow/DepthsBelow.csproj.user
@@ -1,16 +1,16 @@
-
-
-
-
-
-
-
-
-
- en-US
- false
-
-
- false
-
+
+
+
+ publish\
+
+
+
+
+
+ en-US
+ false
+
+
+ false
+
\ No newline at end of file
diff --git a/DepthsBelow/DepthsBelow/Soldier.cs b/DepthsBelow/DepthsBelow/Soldier.cs
index 4b18be3..81243b6 100644
--- a/DepthsBelow/DepthsBelow/Soldier.cs
+++ b/DepthsBelow/DepthsBelow/Soldier.cs
@@ -1,50 +1,49 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Media;
-
-namespace DepthsBelow
-{
- class Soldier : Entity
- {
- Core game;
- static Texture2D Texture;
-
- private KeyboardState lastKeyboardState;
-
- static public void LoadContent(Core game)
- {
- Texture = game.Content.Load("images/soldier");
- }
-
- public Soldier(Core game)
- {
- if (Texture == null)
- LoadContent(game);
-
- Component.SpriteRenderer rc = new Component.SpriteRenderer(this);
- rc.Texture = Texture;
- rc.Color = Color.HotPink;
- this.AddComponent(rc);
- }
-
- public void Update(GameTime gameTime)
- {
- KeyboardState ks = Keyboard.GetState();
- if (ks.IsKeyDown(Keys.Right) && lastKeyboardState.IsKeyUp(Keys.Right))
- gridTransform.Position.X += 1;
- lastKeyboardState = ks;
-
- Console.WriteLine(pixelTransform.X + " " + gridTransform.X);
- if (pixelTransform.Position.X < gridTransform.X * 32)
- {
- pixelTransform.Position.X += 2;
- }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Media;
+
+namespace DepthsBelow
+{
+ class Soldier : Entity
+ {
+ Core game;
+ static Texture2D Texture;
+
+ private KeyboardState lastKeyboardState;
+
+ static public void LoadContent(Core game)
+ {
+ Texture = game.Content.Load("images/soldier");
+ }
+
+ public Soldier(Core game)
+ {
+ if (Texture == null)
+ LoadContent(game);
+
+ Component.SpriteRenderer rc = new Component.SpriteRenderer(this);
+ rc.Texture = Texture;
+ rc.Color = Color.HotPink;
+ this.AddComponent(rc);
+ }
+
+ public void Update(GameTime gameTime)
+ {
+ /*KeyboardState ks = Keyboard.GetState();
+ if (ks.IsKeyDown(Keys.Right) && lastKeyboardState.IsKeyUp(Keys.Right))
+ gridTransform.Position.X += 1;
+ lastKeyboardState = ks;*/
+
+ if (pixelTransform.Position.X < gridTransform.X * 32)
+ {
+ pixelTransform.Position.X += 2;
+ }
+ }
+ }
+}