Description:
Move Outline methods.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -429,16 +429,6 | |||||
|
429 |
|
429 | ||
|
430 | } |
|
430 | } |
|
431 |
|
431 | ||
|
432 |
|
|||
|
433 | protected void drawTileAt(int x, int y, int tileIndex, int height) |
|
||
|
434 | { |
|
||
|
435 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; |
|
||
|
436 |
|
|||
|
437 | float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); |
|
||
|
438 |
|
|||
|
439 | drawTileAt(x, y, tileIndex, height, depthOffset); |
|
||
|
440 | } |
|
||
|
441 |
|
|||
|
442 | protected Boolean cull(int gridX, int gridY) |
|
432 | protected Boolean cull(int gridX, int gridY) |
|
443 | { |
|
433 | { |
|
444 | int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2; |
|
434 | int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2; |
@@ -451,6 +441,18 | |||||
|
451 | && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height))); |
|
441 | && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height))); |
|
452 | } |
|
442 | } |
|
453 |
|
443 | ||
|
|
444 | |||
|
|
445 | protected void drawTileAt(int x, int y, int tileIndex, int height) | ||
|
|
446 | { | ||
|
|
447 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; | ||
|
|
448 | |||
|
|
449 | float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); | ||
|
|
450 | |||
|
|
451 | drawTileAt(x, y, tileIndex, height, depthOffset); | ||
|
|
452 | } | ||
|
|
453 | |||
|
|
454 | |||
|
|
455 | |||
|
454 | protected void drawTileAt(int x, int y, int tileIndex, int height, float depth) |
|
456 | protected void drawTileAt(int x, int y, int tileIndex, int height, float depth) |
|
455 | { |
|
457 | { |
|
456 | /* |
|
458 | /* |
@@ -697,14 +699,14 | |||||
|
697 | if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth) |
|
699 | if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth) |
|
698 | && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) |
|
700 | && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) |
|
699 | { |
|
701 | { |
|
700 | OutlineSquare(this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); |
|
702 | Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); |
|
701 | } |
|
703 | } |
|
702 |
|
704 | ||
|
703 | #if DEBUG |
|
705 | #if DEBUG |
|
704 | OutlineSquare(1, 1, Color.Red, 2); |
|
706 | Tile.OutlineSquare(batch, 1, 1, Color.Red, 2); |
|
705 | OutlineSquare(3, 1, Color.Blue, 2); |
|
707 | Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2); |
|
706 | OutlineSquare(5, 1, Color.Green, 2); |
|
708 | Tile.OutlineSquare(batch, 5, 1, Color.Green, 2); |
|
707 | OutlineSquare(7, 1, Color.Orange, 2); |
|
709 | Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2); |
|
708 | #endif |
|
710 | #endif |
|
709 |
|
711 | ||
|
710 |
|
712 | ||
@@ -858,41 +860,5 | |||||
|
858 |
|
860 | ||
|
859 | base.Draw(gameTime); |
|
861 | base.Draw(gameTime); |
|
860 | } |
|
862 | } |
|
861 | private void OutlineSquare(float x, float y, Color color) |
|
863 | |
|
862 | { |
|
||
|
863 | this.OutlineSquare(x, y, color, 1); |
|
||
|
864 | } |
|
||
|
865 |
|
|||
|
866 | private void OutlineSquare(float x, float y, Color color, int size) |
|
||
|
867 | { |
|
||
|
868 | Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved |
|
||
|
869 |
|
|||
|
870 | //Upper right |
|
||
|
871 | //float x = this.mouseGrid.X; |
|
||
|
872 | //float y = this.mouseGrid.Y; |
|
||
|
873 | Line.drawLine(batch, |
|
||
|
874 | new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
875 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), |
|
||
|
876 | new Vector2(((x - y + size) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
877 | color, 0.79f); |
|
||
|
878 |
|
|||
|
879 | //Bottom right |
|
||
|
880 | Line.drawLine(batch, |
|
||
|
881 | new Vector2(((x + size - y) * Tile.TileSpriteWidth / 2), (x + size + y) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
882 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), |
|
||
|
883 | new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
884 | color, 0.79f); |
|
||
|
885 | //Bottom left |
|
||
|
886 | Line.drawLine(batch, |
|
||
|
887 | new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
888 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), |
|
||
|
889 | new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
890 | color, 0.79f); |
|
||
|
891 | //Upper left |
|
||
|
892 | Line.drawLine(batch, |
|
||
|
893 | new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
894 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), |
|
||
|
895 | new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, |
|
||
|
896 | color, 0.79f); |
|
||
|
897 | } |
|
||
|
898 | } |
|
864 | } |
@@ -40,5 +40,46 | |||||
|
40 | return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height); |
|
40 | return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height); |
|
41 | } |
|
41 | } |
|
42 |
|
42 | ||
|
|
43 | |||
|
|
44 | |||
|
|
45 | static public void OutlineSquare(SpriteBatch batch, float x, float y, Color color) | ||
|
|
46 | { | ||
|
|
47 | Tile.OutlineSquare(batch, x, y, color, 1); | ||
|
|
48 | } | ||
|
|
49 | |||
|
|
50 | static public void OutlineSquare(SpriteBatch batch, float x, float y, Color color, int size) | ||
|
|
51 | { | ||
|
|
52 | Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved | ||
|
|
53 | |||
|
|
54 | //Upper right | ||
|
|
55 | //float x = this.mouseGrid.X; | ||
|
|
56 | //float y = this.mouseGrid.Y; | ||
|
|
57 | |||
|
|
58 | Line.drawLine(batch, | ||
|
|
59 | new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
60 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), | ||
|
|
61 | new Vector2(((x - y + size) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
62 | color, 0.79f); | ||
|
|
63 | |||
|
|
64 | //Bottom right | ||
|
|
65 | Line.drawLine(batch, | ||
|
|
66 | new Vector2(((x + size - y) * Tile.TileSpriteWidth / 2), (x + size + y) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
67 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), | ||
|
|
68 | new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
69 | color, 0.79f); | ||
|
|
70 | //Bottom left | ||
|
|
71 | Line.drawLine(batch, | ||
|
|
72 | new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
73 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), | ||
|
|
74 | new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
75 | color, 0.79f); | ||
|
|
76 | //Upper left | ||
|
|
77 | Line.drawLine(batch, | ||
|
|
78 | new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
79 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), | ||
|
|
80 | new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2, | ||
|
|
81 | color, 0.79f); | ||
|
|
82 | } | ||
|
|
83 | |||
|
43 | } |
|
84 | } |
|
44 | } |
|
85 | } |
You need to be logged in to leave comments.
Login now