Description:
Add translucent effect.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -550,13 +550,17 | |||||
|
550 | } |
|
550 | } |
|
551 |
|
551 | ||
|
552 | //Convenience method I'm not super sure about anymore. |
|
552 | //Convenience method I'm not super sure about anymore. |
|
553 | protected void drawTileAt(int x, int y, int tileIndex, int height) |
|
553 | protected void drawTileAt(int x, int y, int tileIndex, int height, Color color) |
|
554 | { |
|
554 | { |
|
555 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; |
|
555 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; |
|
556 |
|
556 | ||
|
557 | float depthOffset = 0.7f - ((x + (y * Tile.TileWidth)) / maxdepth); |
|
557 | float depthOffset = 0.7f - ((x + (y * Tile.TileWidth)) / maxdepth); |
|
558 |
|
558 | ||
|
559 | Tile.drawTileAt(this.tileBatch, x, y, tileIndex, height, depthOffset); |
|
559 | Tile.drawTileAt(this.tileBatch, x, y, tileIndex, height, depthOffset, color); |
|
|
560 | } | ||
|
|
561 | |||
|
|
562 | protected void drawTileAt(int x, int y, int tileIndex, int height) { | ||
|
|
563 | drawTileAt(x, y, tileIndex, height, Color.White); | ||
|
560 | } |
|
564 | } |
|
561 |
|
565 | ||
|
562 |
|
566 | ||
@@ -709,33 +713,33 | |||||
|
709 | } |
|
713 | } |
|
710 | */ |
|
714 | */ |
|
711 | tileBatch.Begin(SpriteSortMode.BackToFront, |
|
715 | tileBatch.Begin(SpriteSortMode.BackToFront, |
|
712 |
|
|
716 | BlendState.AlphaBlend, |
|
713 |
|
|
717 | null, |
|
714 |
|
|
718 | null, |
|
715 |
|
|
719 | null, |
|
716 |
|
|
720 | null, |
|
717 |
|
|
721 | camera.get_transformation(GraphicsDevice)); |
|
|
722 | #if DEBUG | ||
|
718 |
|
723 | ||
|
719 | #if DEBUG |
|
724 | var translucent = new Color(1.0f, 1.0f, 1.0f, 0.25f); |
|
720 | drawTileAt(4, 4, 140, 3); |
|
725 | drawTileAt(4, 4, 140, 3, translucent); |
|
721 | drawTileAt(6, 4, 141, 3); |
|
726 | drawTileAt(6, 4, 141, 3, translucent); |
|
722 | drawTileAt(8, 4, 142, 2); |
|
727 | drawTileAt(8, 4, 142, 2, translucent); |
|
723 | drawTileAt(10, 4, 142, 3); |
|
728 | drawTileAt(10, 4, 142, 3, translucent); |
|
724 |
|
729 | ||
|
725 | for (int i = 10; i < 199; i++) { |
|
730 | for (int i = 10; i < 199; i++) { |
|
726 | drawTileAt(10, i, 281, 1); |
|
731 | drawTileAt(10, i, 281, 1, translucent); |
|
727 | } |
|
732 | } |
|
728 | drawTileAt(10, 199, 284, 1); |
|
733 | drawTileAt(10, 199, 284, 1, translucent); |
|
729 | drawTileAt(11, 199, 280, 1); |
|
734 | drawTileAt(11, 199, 280, 1, translucent); |
|
730 | drawTileAt(12, 199, 280, 1); |
|
735 | drawTileAt(12, 199, 280, 1, translucent); |
|
731 | drawTileAt(13, 199, 283, 1); |
|
736 | drawTileAt(13, 199, 283, 1, translucent); |
|
732 | drawTileAt(13, 198, 281, 1); |
|
737 | drawTileAt(13, 198, 281, 1, translucent); |
|
733 | drawTileAt(13, 197, 282, 1); |
|
738 | drawTileAt(13, 197, 282, 1, translucent); |
|
734 | drawTileAt(12, 197, 285, 1); |
|
739 | drawTileAt(12, 197, 285, 1, translucent); |
|
735 | drawTileAt(12, 25, 300, 2); |
|
740 | drawTileAt(12, 25, 300, 2, translucent); |
|
736 | #endif |
|
741 | #endif |
|
737 |
|
742 | ||
|
738 |
|
|||
|
739 | #if DEBUG |
|
743 | #if DEBUG |
|
740 | Tile.OutlineSquare(tileBatch, 1, 1, Color.Red, 2); |
|
744 | Tile.OutlineSquare(tileBatch, 1, 1, Color.Red, 2); |
|
741 | Tile.OutlineSquare(tileBatch, 3, 1, Color.Blue, 2); |
|
745 | Tile.OutlineSquare(tileBatch, 3, 1, Color.Blue, 2); |
You need to be logged in to leave comments.
Login now