diff --git a/DepthsBelow/DepthsBelow/Component/Collision.cs b/DepthsBelow/DepthsBelow/Component/Collision.cs new file mode 100644 index 0000000..e01eb29 --- /dev/null +++ b/DepthsBelow/DepthsBelow/Component/Collision.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; + +namespace DepthsBelow.Component +{ + class Collision : Component + { + + public Rectangle Rectangle; + + public int Width; + public int Height; + + public Collision(Entity parent, int width, int height) + : base(parent) + { + this.Width = width; + this.Height = height; + this.Rectangle = new Rectangle(0, 0, width, height); + } + public void Update(GameTime gameTime) + { + PixelTransform pt = this.Parent.GetComponent(); + this.Rectangle.X = (int)pt.X; + this.Rectangle.Y = (int)pt.Y; + } + } +} diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs index 84bdc7f..fdc3d44 100644 --- a/DepthsBelow/DepthsBelow/Core.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -32,7 +32,7 @@ namespace DepthsBelow graphics.PreferredBackBufferHeight = 720; graphics.IsFullScreen = false; - graphics.SynchronizeWithVerticalRetrace = false; + //graphics.SynchronizeWithVerticalRetrace = false; this.IsFixedTimeStep = false; graphics.ApplyChanges(); diff --git a/DepthsBelow/DepthsBelow/DepthsBelow.csproj b/DepthsBelow/DepthsBelow/DepthsBelow.csproj index ebe96d4..463346a 100644 --- a/DepthsBelow/DepthsBelow/DepthsBelow.csproj +++ b/DepthsBelow/DepthsBelow/DepthsBelow.csproj @@ -121,6 +121,7 @@ + diff --git a/DepthsBelow/DepthsBelow/Entity.cs b/DepthsBelow/DepthsBelow/Entity.cs index 611a7ec..d29b9c2 100644 --- a/DepthsBelow/DepthsBelow/Entity.cs +++ b/DepthsBelow/DepthsBelow/Entity.cs @@ -9,6 +9,7 @@ namespace DepthsBelow List Components; public Component.PixelTransform pixelTransform; public Component.GridTransform gridTransform; + public Component.Collision collision; public Entity() { @@ -17,6 +18,8 @@ namespace DepthsBelow AddComponent(pixelTransform); gridTransform = new Component.GridTransform(this); AddComponent(gridTransform); + collision = new Component.Collision(this, 32, 32); + AddComponent(collision); } public T GetComponent() where T : Component.Component diff --git a/DepthsBelow/DepthsBelow/MouseInput.cs b/DepthsBelow/DepthsBelow/MouseInput.cs index e27d3a9..f88abb2 100644 --- a/DepthsBelow/DepthsBelow/MouseInput.cs +++ b/DepthsBelow/DepthsBelow/MouseInput.cs @@ -49,6 +49,10 @@ namespace DepthsBelow if (ms.LeftButton == ButtonState.Released && selectionRectangle != Rectangle.Empty) { + /*if (selectionRectangle.Intersects()) + { + + }*/ selectionRectangle = Rectangle.Empty; } diff --git a/DepthsBelow/DepthsBelow/Soldier.cs b/DepthsBelow/DepthsBelow/Soldier.cs index 81243b6..cc253c9 100644 --- a/DepthsBelow/DepthsBelow/Soldier.cs +++ b/DepthsBelow/DepthsBelow/Soldier.cs @@ -13,6 +13,7 @@ namespace DepthsBelow class Soldier : Entity { Core game; + bool selected = false; static Texture2D Texture; private KeyboardState lastKeyboardState;