diff --git a/Game/Board.cs b/Game/Board.cs
index 22c958f..5deb0cb 100644
--- a/Game/Board.cs
+++ b/Game/Board.cs
@@ -1,18 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Apos.Shapes;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
namespace GameProject {
///
/// Goal: Board, not actually sure what it will handle...
///
class Board {
- public Board(int iWidth, int iHeight) {
- Width = iWidth;
- Height = iHeight;
+ public Board(int width, int height) {
+ Width = width;
+ Height = height;
Paths = [];
OldPaths = [];
@@ -225,27 +224,27 @@ private HashSet FindNeighbors(Tile t) {
return neighbors;
}
- public void Draw(SpriteBatch s) {
- s.FillRectangle(new Rectangle(0, 0, GridSize * Width, GridSize * Height), new Color(15, 15, 15));
+ public void Draw(ShapeBatch sb) {
+ sb.FillRectangle(new Vector2(0, 0), new Vector2(GridSize * Width, GridSize * Height), new Color(15, 15, 15));
for (int i = 1; i < FullWidth - 1; i++) {
for (int j = 1; j < FullHeight - 1; j++) {
- _tiles[i, j].Draw(s, Color.White);
+ _tiles[i, j].Draw(sb, Color.White);
}
}
- Board.DrawPaths(s, OldPaths);
- Board.DrawPathLines(s, OldPaths);
- Board.DrawPaths(s, Paths);
- Board.DrawPathLines(s, Paths);
+ DrawPaths(sb, OldPaths);
+ DrawPathLines(sb, OldPaths);
+ DrawPaths(sb, Paths);
+ DrawPathLines(sb, Paths);
}
- public static void DrawPaths(SpriteBatch s, List paths) {
+ public static void DrawPaths(ShapeBatch sb, List paths) {
foreach (Path p in paths) {
- p.Draw(s);
+ p.Draw(sb);
}
}
- public static void DrawPathLines(SpriteBatch s, List paths) {
+ public static void DrawPathLines(ShapeBatch sb, List paths) {
foreach (Path p in paths) {
- p.DrawLine(s);
+ p.DrawLine(sb);
}
}
diff --git a/Game/GameRoot.cs b/Game/GameRoot.cs
index 0a89809..88d143d 100644
--- a/Game/GameRoot.cs
+++ b/Game/GameRoot.cs
@@ -1,5 +1,6 @@
using System;
using Apos.Input;
+using Apos.Shapes;
using FontStashSharp;
using GameProject.Towers;
using GameProject.UI;
@@ -11,7 +12,9 @@
namespace GameProject {
public class GameRoot : Game {
public GameRoot() {
- _graphics = new GraphicsDeviceManager(this);
+ _graphics = new GraphicsDeviceManager(this) {
+ GraphicsProfile = GraphicsProfile.HiDef
+ };
Content.RootDirectory = "Content";
IsMouseVisible = true;
Window.AllowUserResizing = true;
@@ -34,6 +37,7 @@ protected override void Initialize() {
protected override void LoadContent() {
InputHelper.Setup(this);
_s = new SpriteBatch(GraphicsDevice);
+ _sb = new ShapeBatch(GraphicsDevice, Content);
_renderTarget01 = new RenderTarget2D(GraphicsDevice, Utility.Board.GridSize * Utility.Board.Width, Utility.Board.GridSize * Utility.Board.Height);
Utility.AssetManager = new AssetManager(Content);
Utility.AssetManager.PlayMusic("break_space", 0.3F);
@@ -79,7 +83,7 @@ protected override void Update(GameTime gameTime) {
}
protected override void Draw(GameTime gameTime) {
if (Utility.CurrentGameState == Utility.GameState.Playing) {
- DrawPlayingState(_s);
+ DrawPlayingState();
}
else if (Utility.CurrentGameState == Utility.GameState.GameOver) {
GraphicsDevice.Clear(Color.Black);
@@ -141,45 +145,50 @@ private void UpdatePlayingState(GameTime gameTime) {
}
*/
}
- private void DrawPlayingState(SpriteBatch spriteBatch) {
+ private void DrawPlayingState() {
GraphicsDevice.SetRenderTarget(_renderTarget01);
GraphicsDevice.Clear(Color.Black);
// TODO: Add your drawing code here
- spriteBatch.Begin();
- Utility.Board.Draw(spriteBatch);
+ _sb.Begin();
+ Utility.Board.Draw(_sb);
if (_latestHoveredOverTower != null)
- HUD.DrawRangeIndicators(spriteBatch, new Point(_latestHoveredOverTower.X, _latestHoveredOverTower.Y), _latestHoveredOverTower);
+ HUD.DrawRangeIndicators(_sb, new Point(_latestHoveredOverTower.X, _latestHoveredOverTower.Y), _latestHoveredOverTower);
// Highlight needs to be drawn before the actual towers
if (_previewTower != null) {
if (IsWithinDimensions())
- HUD.DrawPlacementIndicator(spriteBatch, _previewTower, IsValidTileForTower(Utility.MouseToGameGrid().X, Utility.MouseToGameGrid().Y));
- _selectedTower!.DrawSelectionHighlight(spriteBatch);
+ HUD.DrawPlacementIndicator(_sb, _previewTower, IsValidTileForTower(Utility.MouseToGameGrid().X, Utility.MouseToGameGrid().Y));
+ _selectedTower!.DrawSelectionHighlight(_sb);
}
- foreach (Tower t in Utility.TowerList) t.Draw(spriteBatch);
+ foreach (Tower t in Utility.TowerList) t.Draw(_sb);
+ _sb.End();
+ _s.Begin();
+ foreach (Tower t in Utility.TowerList) t.DrawHotkey(_s);
foreach (Path p in Utility.Board.Paths) {
- p.DrawMinions(spriteBatch);
+ p.DrawMinions(_s);
}
+ _s.End();
+ _sb.Begin();
// Draw projectiles and fire effect
foreach(Tower t in Utility.TowerList) {
- if (t is Shotgun) (t as Shotgun)!.DrawProjectiles(spriteBatch);
- else if (t is FlameThrower) (t as FlameThrower)!.DrawFireEffect(spriteBatch);
+ if (t is Shotgun) (t as Shotgun)!.DrawProjectiles(_sb);
+ else if (t is FlameThrower) (t as FlameThrower)!.DrawFireEffect(_sb);
}
- spriteBatch.End();
+ _sb.End();
GraphicsDevice.SetRenderTarget(null);
- spriteBatch.Begin();
- spriteBatch.Draw(_renderTarget01, new Vector2(0, 0), Color.White);
- spriteBatch.End();
+ _s.Begin();
+ _s.Draw(_renderTarget01, new Vector2(0, 0), Color.White);
+ _s.End();
// Draw sideBar
- spriteBatch.Begin();
- if (_latestHoveredOverTower != null) _sidebarUI.DrawTowerInfo(spriteBatch, _latestHoveredOverTower);
- _sidebarUI.Draw(spriteBatch);
- spriteBatch.End();
+ _s.Begin();
+ if (_latestHoveredOverTower != null) _sidebarUI.DrawTowerInfo(_s, _latestHoveredOverTower);
+ _sidebarUI.Draw(_s);
+ _s.End();
_latestHoveredOverTower = null;
}
- public bool IsWithinDimensions() {
+ public static bool IsWithinDimensions() {
if (Utility.MouseToGameGrid().X >= Utility.Board.FullWidth - 1 || Utility.MouseToGameGrid().X <= 0)
return false;
else if (Utility.MouseToGameGrid().Y >= Utility.Board.FullHeight - 1 || Utility.MouseToGameGrid().Y <= 0)
@@ -299,6 +308,7 @@ private static void AddTower(int x, int y, Utility.TowerType type, int HotKeyNum
private const int _startingLives = 10;
readonly GraphicsDeviceManager _graphics;
SpriteBatch _s = null!;
+ ShapeBatch _sb = null!;
RenderTarget2D _renderTarget01 = null!;
Tower? _latestHoveredOverTower;
HUD _hud = null!;
diff --git a/Game/Path.cs b/Game/Path.cs
index 9aa6434..dbd4805 100644
--- a/Game/Path.cs
+++ b/Game/Path.cs
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
+using Apos.Shapes;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
namespace GameProject {
///
@@ -123,33 +123,33 @@ public void Update(GameTime gameTime) {
}
}
- public void Draw(SpriteBatch s) {
+ public void Draw(ShapeBatch sb) {
if (Sequence == Animation.Spawn) {
for (int i = 0; i < _pathsShown; i++) {
- DrawPathTile(s, i);
+ DrawPathTile(sb, i);
}
} else if (Sequence == Animation.Despawn) {
for (int i = _pathsShown; i < pathway.Count; i++) {
- DrawPathTile(s, i);
+ DrawPathTile(sb, i);
}
} else {
for (int i = 0; i < pathway.Count; i++) {
- DrawPathTile(s, i);
+ DrawPathTile(sb, i);
}
}
}
- public void DrawLine(SpriteBatch s) {
+ public void DrawLine(ShapeBatch sb) {
if (Sequence == Animation.Spawn) {
for (int i = 1; i < _pathsShown; i++) {
- DrawPathLine(s, i);
+ DrawPathLine(sb, i);
}
} else if (Sequence == Animation.Despawn) {
for (int i = _pathsShown + 1; i < pathway.Count; i++) {
- DrawPathLine(s, i);
+ DrawPathLine(sb, i);
}
} else {
for (int i = 1; i < pathway.Count; i++) {
- DrawPathLine(s, i);
+ DrawPathLine(sb, i);
}
}
}
@@ -157,17 +157,16 @@ public void DrawMinions(SpriteBatch s) {
foreach (Minion m in MinionList)
m.Draw(s);
}
- private void DrawPathTile(SpriteBatch s, int i) {
- s.FillRectangle(new Rectangle(Utility.GameToScreen(pathway[i].X), Utility.GameToScreen(pathway[i].Y), Utility.Board.GridSize, Utility.Board.GridSize), new Color(19, 59, 131));
+ private void DrawPathTile(ShapeBatch sb, int i) {
+ sb.FillRectangle(new Vector2(Utility.GameToScreen(pathway[i].X), Utility.GameToScreen(pathway[i].Y)), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), new Color(19, 59, 131));
}
- private void DrawPathLine(SpriteBatch s, int i) {
+ private void DrawPathLine(ShapeBatch sb, int i) {
float x1 = Utility.GameToScreen(pathway[i].X + 0.5f);
float y1 = Utility.GameToScreen(pathway[i].Y + 0.5f);
float x2 = Utility.GameToScreen(pathway[i - 1].X + 0.5f);
float y2 = Utility.GameToScreen(pathway[i - 1].Y + 0.5f);
- s.DrawLine(x1, y1, x2, y2, Color.Black, Utility.Board.GridSize * 0.15f);
- s.DrawLine(x1, y1, x2, y2, Color.White, Utility.Board.GridSize * 0.1f);
+ sb.DrawLine(new Vector2(x1, y1), new Vector2(x2, y2), Utility.Board.GridSize * 0.1f, Color.White, Color.Black, Utility.Board.GridSize * 0.001f);
}
private readonly Spawner _spawner;
diff --git a/Game/Tile.cs b/Game/Tile.cs
index 0d73fd4..918d385 100644
--- a/Game/Tile.cs
+++ b/Game/Tile.cs
@@ -1,6 +1,5 @@
+using Apos.Shapes;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
namespace GameProject {
///
@@ -10,8 +9,8 @@ class Tile(int x, int y) {
public int X = x;
public int Y = y;
- public void Draw(SpriteBatch s, Color c) {
- s.DrawRectangle(new RectangleF(Utility.GameToScreen(X), Utility.GameToScreen(Y), Utility.Board.GridSize, Utility.Board.GridSize), c, 1);
+ public void Draw(ShapeBatch sb, Color c) {
+ sb.BorderRectangle(new Vector2(Utility.GameToScreen(X), Utility.GameToScreen(Y)), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), c, 1f);
}
}
}
diff --git a/Game/Towers/FlameThrower.cs b/Game/Towers/FlameThrower.cs
index 0b2a203..0802a59 100644
--- a/Game/Towers/FlameThrower.cs
+++ b/Game/Towers/FlameThrower.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
+using Apos.Shapes;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
namespace GameProject.Towers {
class FlameThrower : Tower {
@@ -37,11 +37,8 @@ public override void Update(GameTime gameTime) {
f.MarkedForDeletion = true;
}
}
- public override void Draw(SpriteBatch s) {
- base.Draw(s);
- }
- public void DrawFireEffect(SpriteBatch s) {
+ public void DrawFireEffect(ShapeBatch s) {
foreach (Projectile f in _flameList)
f.Draw(s);
}
diff --git a/Game/Towers/Projectile.cs b/Game/Towers/Projectile.cs
index 166c9bf..0ed33ca 100644
--- a/Game/Towers/Projectile.cs
+++ b/Game/Towers/Projectile.cs
@@ -1,6 +1,5 @@
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
+using Apos.Shapes;
+using Microsoft.Xna.Framework;
namespace GameProject.Towers {
class Projectile(Vector2 position, Vector2 direction, Color color, float speed) {
@@ -9,10 +8,9 @@ public void Update(GameTime gameTime) {
_distanceTraveled += _speed * (float)gameTime.ElapsedGameTime.TotalSeconds;
}
- public void Draw(SpriteBatch s) {
- Point2 tempP = new Point2(Utility.GameToScreen(_position.X), Utility.GameToScreen(_position.Y));
- s.DrawCircle(new CircleF(tempP, Radius * Utility.Board.GridSize), 8, _color, Radius * Utility.Board.GridSize);
- s.DrawCircle(new CircleF(tempP, Radius * Utility.Board.GridSize), 8, Color.Black, 1);
+ public void Draw(ShapeBatch sb) {
+ Vector2 tempP = new Vector2(Utility.GameToScreen(_position.X), Utility.GameToScreen(_position.Y));
+ sb.DrawCircle(tempP, Radius * Utility.Board.GridSize, _color, Color.Black, 1f);
}
public float DistanceTraveled => _distanceTraveled;
diff --git a/Game/Towers/Shotgun.cs b/Game/Towers/Shotgun.cs
index b9a39c9..89143bb 100644
--- a/Game/Towers/Shotgun.cs
+++ b/Game/Towers/Shotgun.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
+using Apos.Shapes;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
namespace GameProject.Towers {
class Shotgun : Tower {
@@ -51,13 +51,9 @@ private void BulletCollisionChecker() {
}
}
- public override void Draw(SpriteBatch s) {
- base.Draw(s);
- }
-
- public void DrawProjectiles(SpriteBatch s) {
+ public void DrawProjectiles(ShapeBatch sb) {
foreach (Projectile b in _bulletList)
- b.Draw(s);
+ b.Draw(sb);
}
private void ShootAtTargetedMinion() {
diff --git a/Game/Towers/Sniper.cs b/Game/Towers/Sniper.cs
index 04dab06..6cf1bf4 100644
--- a/Game/Towers/Sniper.cs
+++ b/Game/Towers/Sniper.cs
@@ -1,7 +1,6 @@
using System;
+using Apos.Shapes;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
namespace GameProject.Towers {
class Sniper : Tower {
@@ -28,10 +27,10 @@ public override void Update(GameTime gameTime) {
}
base.Update(gameTime);
}
- public override void Draw(SpriteBatch s) {
- base.Draw(s);
+ public override void Draw(ShapeBatch sb) {
+ base.Draw(sb);
if (!_disabled && !(_targetedMinion == null))
- s.DrawLine(Utility.GameToScreen(X) + Utility.Board.GridSize / 2, Utility.GameToScreen(Y) + Utility.Board.GridSize / 2, Utility.GameToScreen(_targetedMinion.Position.X), Utility.GameToScreen(_targetedMinion.Position.Y), Color.Red, 2f);
+ sb.BorderLine(new Vector2(Utility.GameToScreen(X) + Utility.Board.GridSize / 2, Utility.GameToScreen(Y) + Utility.Board.GridSize / 2), new Vector2(Utility.GameToScreen(_targetedMinion.Position.X), Utility.GameToScreen(_targetedMinion.Position.Y)), 1f, Color.Red, 2f);
}
private void TargetMinion() {
_targetedMinion = null;
diff --git a/Game/Towers/Tower.cs b/Game/Towers/Tower.cs
index 206f1ba..d872358 100644
--- a/Game/Towers/Tower.cs
+++ b/Game/Towers/Tower.cs
@@ -1,8 +1,8 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
using FontStashSharp;
+using Apos.Shapes;
namespace GameProject.Towers {
///
@@ -44,25 +44,27 @@ public bool IsDisabled {
public virtual void Update(GameTime gameTime) {
_attackTimer.Update(gameTime);
}
- public virtual void Draw(SpriteBatch s) {
+ public virtual void Draw(ShapeBatch sb) {
if (_disabled)
- s.FillRectangle(new RectangleF(Utility.GameToScreen(_x), Utility.GameToScreen(_y), Utility.Board.GridSize, Utility.Board.GridSize), Color.Gray);
+ sb.FillRectangle(new Vector2(Utility.GameToScreen(_x), Utility.GameToScreen(_y)), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), Color.Gray);
else
- s.FillRectangle(new RectangleF(Utility.GameToScreen(_x), Utility.GameToScreen(_y), Utility.Board.GridSize, Utility.Board.GridSize), TowerColor);
+ sb.FillRectangle(new Vector2(Utility.GameToScreen(_x), Utility.GameToScreen(_y)), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), TowerColor);
+ DrawCoolDownTimer(sb);
+ }
+ public virtual void DrawHotkey(SpriteBatch s) {
s.DrawString(Utility.AssetManager.GetFont(0.5f * Utility.Board.GridSize), HotkeyNumber.ToString(), new Vector2(Utility.GameToScreen(_x) + Utility.Board.GridSize / 2.5f, Utility.GameToScreen(_y) + Utility.Board.GridSize / 4), Color.Black);
- DrawCoolDownTimer(s);
}
- private void DrawCoolDownTimer(SpriteBatch s) {
+ private void DrawCoolDownTimer(ShapeBatch sb) {
Vector2 position = new Vector2(Utility.GameToScreen(X), Utility.GameToScreen(Y) + Utility.Board.GridSize / 8);
- RectangleF coolDownRectangle = new RectangleF(position.X, position.Y, 1 * ((_attackTimer.MaxTime - _attackTimer.SecondsElapsed) / _attackTimer.MaxTime) * Utility.Board.GridSize, Utility.Board.GridSize / 8);
- s.FillRectangle(coolDownRectangle, Color.Yellow);
- RectangleF outlineRectangle = new RectangleF(position.X, position.Y, Utility.Board.GridSize , Utility.Board.GridSize / 8);
- s.DrawRectangle(outlineRectangle, Color.Black, 2F);
+ Vector2 coolDownSize = new Vector2(1 * ((_attackTimer.MaxTime - _attackTimer.SecondsElapsed) / _attackTimer.MaxTime) * Utility.Board.GridSize, Utility.Board.GridSize / 8);
+ sb.FillRectangle(position, coolDownSize, Color.Yellow);
+ Vector2 outlineSize = new Vector2(Utility.Board.GridSize , Utility.Board.GridSize / 8);
+ sb.BorderRectangle(position, outlineSize, Color.Black, 1f);
}
- public void DrawSelectionHighlight(SpriteBatch s) {
- s.FillRectangle(new RectangleF(Utility.GameToScreen(_x) - Utility.Board.GridSize * _highlightOffset / 2, Utility.GameToScreen(_y) - Utility.Board.GridSize * _highlightOffset / 2, Utility.Board.GridSize + _highlightOffset * Utility.Board.GridSize, Utility.Board.GridSize + _highlightOffset * Utility.Board.GridSize), Color.Yellow);
+ public void DrawSelectionHighlight(ShapeBatch sb) {
+ sb.FillRectangle(new Vector2(Utility.GameToScreen(_x) - Utility.Board.GridSize * _highlightOffset / 2, Utility.GameToScreen(_y) - Utility.Board.GridSize * _highlightOffset / 2), new Vector2(Utility.Board.GridSize + _highlightOffset * Utility.Board.GridSize, Utility.Board.GridSize + _highlightOffset * Utility.Board.GridSize), Color.Yellow);
}
protected bool IsWithinRange(int x, int y) {
return !(Math.Abs(x) > _minRange || Math.Abs(y) > _minRange);
diff --git a/Game/UI/HUD.cs b/Game/UI/HUD.cs
index 63722c2..b493ce2 100644
--- a/Game/UI/HUD.cs
+++ b/Game/UI/HUD.cs
@@ -1,18 +1,17 @@
-using GameProject.Towers;
+using Apos.Shapes;
+using GameProject.Towers;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using MonoGame.Extended;
namespace GameProject.UI {
class HUD() {
- public static void DrawPlacementIndicator(SpriteBatch s, Tower tower, bool isValidPosition) {
+ public static void DrawPlacementIndicator(ShapeBatch sb, Tower tower, bool isValidPosition) {
if (isValidPosition) {
- DrawRangeIndicators(s, Utility.MouseToGameGrid(), tower, 0.3F);
- s.FillRectangle(new RectangleF(Utility.MouseGridBoardPosition(), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize)), Color.White * 0.6f);
+ DrawRangeIndicators(sb, Utility.MouseToGameGrid(), tower, 0.3F);
+ sb.FillRectangle(Utility.MouseGridBoardPosition().ToVector2(), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), Color.White * 0.6f);
}
- else s.FillRectangle(new RectangleF(Utility.MouseGridBoardPosition(), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize)), Color.Red * 0.7f);
+ else sb.FillRectangle(Utility.MouseGridBoardPosition().ToVector2(), new Vector2(Utility.Board.GridSize, Utility.Board.GridSize), Color.Red * 0.7f);
}
- public static void DrawRangeIndicators(SpriteBatch s, Point origin, Tower tower, float transparency = 0.1f) {
+ public static void DrawRangeIndicators(ShapeBatch sb, Point origin, Tower tower, float transparency = 0.1f) {
float horizontal0 = origin.X - tower.MaximumRange;
float horizontal1 = origin.X - tower.MinimumRange;
float horizontal2 = origin.X + tower.MinimumRange + 1;
@@ -23,18 +22,23 @@ public static void DrawRangeIndicators(SpriteBatch s, Point origin, Tower tower,
float vertical3 = origin.Y + tower.MaximumRange + 1;
//Draws the minimum range.
- RectangleF minRange = new RectangleF(Utility.GameToScreen(horizontal1), Utility.GameToScreen(vertical1), (horizontal2 - horizontal1) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
+ Vector2 minRange = new Vector2(Utility.GameToScreen(horizontal1), Utility.GameToScreen(vertical1));
+ Vector2 minRangeSize = new Vector2((horizontal2 - horizontal1) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
- RectangleF maxRangeTop = new RectangleF(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical0), (horizontal3 - horizontal0) * Utility.Board.GridSize, (vertical1 - vertical0) * Utility.Board.GridSize);
- RectangleF maxRangeBot = new RectangleF(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical2), (horizontal3 - horizontal0) * Utility.Board.GridSize, (vertical3 - vertical2) * Utility.Board.GridSize);
- RectangleF maxRangeLeft = new RectangleF(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical1), (horizontal1 - horizontal0) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
- RectangleF maxRangeRight = new RectangleF(Utility.GameToScreen(horizontal2), Utility.GameToScreen(vertical1), (horizontal3 - horizontal2) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
+ Vector2 maxRangeTop = new Vector2(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical0));
+ Vector2 maxRangeTopSize = new Vector2((horizontal3 - horizontal0) * Utility.Board.GridSize, (vertical1 - vertical0) * Utility.Board.GridSize);
+ Vector2 maxRangeBot = new Vector2(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical2));
+ Vector2 maxRangeBotSize = new Vector2((horizontal3 - horizontal0) * Utility.Board.GridSize, (vertical3 - vertical2) * Utility.Board.GridSize);
+ Vector2 maxRangeLeft = new Vector2(Utility.GameToScreen(horizontal0), Utility.GameToScreen(vertical1));
+ Vector2 maxRangeLeftSize = new Vector2((horizontal1 - horizontal0) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
+ Vector2 maxRangeRight = new Vector2(Utility.GameToScreen(horizontal2), Utility.GameToScreen(vertical1));
+ Vector2 maxRangeRightSize = new Vector2((horizontal3 - horizontal2) * Utility.Board.GridSize, (vertical2 - vertical1) * Utility.Board.GridSize);
- s.FillRectangle(minRange, Color.Red * transparency);
- s.FillRectangle(maxRangeTop, Color.Green * transparency);
- s.FillRectangle(maxRangeBot, Color.Green * transparency);
- s.FillRectangle(maxRangeLeft, Color.Green * transparency);
- s.FillRectangle(maxRangeRight, Color.Green * transparency);
+ sb.FillRectangle(minRange, minRangeSize, Color.Red * transparency);
+ sb.FillRectangle(maxRangeTop, maxRangeTopSize, Color.Green * transparency);
+ sb.FillRectangle(maxRangeBot, maxRangeBotSize, Color.Green * transparency);
+ sb.FillRectangle(maxRangeLeft, maxRangeLeftSize, Color.Green * transparency);
+ sb.FillRectangle(maxRangeRight, maxRangeRightSize, Color.Green * transparency);
}
}
}