diff --git a/TODO.taskpaper b/TODO.taskpaper --- a/TODO.taskpaper +++ b/TODO.taskpaper @@ -186,6 +186,7 @@ - Trees jump around when pressing show/hide grid @done(2022-01-23) - Grids sometimes overlap trees, including area overlays - Trees sometimes overlap each other @done(2022-01-23) + - Area overlays overlap trees @done(2022-01-24) - Sometimes framerate jumps to 180-200 fps. (Better than reverse, but kinda weird) - Graphics don't adjust for the resolution - Scroll area @done(2021-06-23) diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -43,6 +43,7 @@ private MouseState mousePrev = new MouseState(); private SpriteBatch batch; + private SpriteBatch tileBatch; #if DEBUG private SoundEffect sound; #endif @@ -188,7 +189,8 @@ protected override void LoadContent() { // Create the batch... - batch = new SpriteBatch(GraphicsDevice); + this.batch = new SpriteBatch(GraphicsDevice); + this.tileBatch = new SpriteBatch(GraphicsDevice); #if DEBUG sound = Content.Load("FNASound"); @@ -288,7 +290,7 @@ WorldBuilder.AddEngine(new SimulationGameRateBridgeEngine(this.simulation)); - WorldBuilder.AddGeneralRenderer(new AreaRenderer(this.batch, this.monoFont), 1); + WorldBuilder.AddGeneralRenderer(new AreaRenderer(this.tileBatch, this.monoFont), 1); WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(this, this.simulation, this.imGuiWindowBridgeEngine, this.gdm), 2); var contractWindow = WorldBuilder.CreateEntity(); WorldBuilder.SetComponent(contractWindow, new VisibilityComponent { visible = false }); @@ -527,7 +529,7 @@ float depthOffset = 0.7f - ((x + (y * Tile.TileWidth)) / maxdepth); - Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset); + Tile.drawTileAt(this.tileBatch, x, y, tileIndex, height, depthOffset); } @@ -682,7 +684,7 @@ } */ - batch.Begin(SpriteSortMode.BackToFront, + tileBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, @@ -702,29 +704,29 @@ if (MathUtils.Between(this.mouseGrid.X, 0, this.simulation.map.MapWidth) && MathUtils.Between(this.mouseGrid.Y, 0, this.simulation.map.MapHeight)) { - Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); + Tile.OutlineSquare(tileBatch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); } #if DEBUG - Tile.OutlineSquare(batch, 1, 1, Color.Red, 2); - Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2); - Tile.OutlineSquare(batch, 5, 1, Color.Green, 2); - Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2); - Tile.OutlineSquare(batch, 9, 1, Color.Orange, 3); + Tile.OutlineSquare(tileBatch, 1, 1, Color.Red, 2); + Tile.OutlineSquare(tileBatch, 3, 1, Color.Blue, 2); + Tile.OutlineSquare(tileBatch, 5, 1, Color.Green, 2); + Tile.OutlineSquare(tileBatch, 7, 1, Color.Orange, 2); + Tile.OutlineSquare(tileBatch, 9, 1, Color.Orange, 3); //donut - Tile.DrawOutlinedSquares(batch, new Vector2[] {new Vector2(19, 1), new Vector2(19, 2), new Vector2(20, 1), new Vector2(21, 1), + Tile.DrawOutlinedSquares(tileBatch, new Vector2[] {new Vector2(19, 1), new Vector2(19, 2), new Vector2(20, 1), new Vector2(21, 1), new Vector2(21, 2), new Vector2(19, 3), new Vector2(20, 3), new Vector2(21, 3) }, Color.Purple); - Quad.FillSquare2(batch, 7, 4, Color.Orange, 1.0f, 0.79f); - Quad.FillSquare2(batch, 7, 3, Color.Yellow, 1.0f, 0.79f); - Quad.FillSquare2(batch, 7, 5, Color.Yellow, .5f, 0.79f); - Quad.FillSquare2(batch, 7, 6, Color.Yellow, .25f, 0.79f); - Quad.FillSquare2(batch, 7, 7, Color.Yellow, .125f, 0.79f); - Quad.FillSquare2(batch, 8, 5, Color.Teal, .5f, 0.79f); - Quad.FillSquare2(batch, 8, 6, Color.Teal, .25f, 0.79f); - Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f); + Quad.FillSquare2(tileBatch, 7, 4, Color.Orange, 1.0f, 0.79f); + Quad.FillSquare2(tileBatch, 7, 3, Color.Yellow, 1.0f, 0.79f); + Quad.FillSquare2(tileBatch, 7, 5, Color.Yellow, .5f, 0.79f); + Quad.FillSquare2(tileBatch, 7, 6, Color.Yellow, .25f, 0.79f); + Quad.FillSquare2(tileBatch, 7, 7, Color.Yellow, .125f, 0.79f); + Quad.FillSquare2(tileBatch, 8, 5, Color.Teal, .5f, 0.79f); + Quad.FillSquare2(tileBatch, 8, 6, Color.Teal, .25f, 0.79f); + Quad.FillSquare2(tileBatch, 8, 7, Color.Teal, .125f, 0.79f); #endif #endregion draw_cursor @@ -773,7 +775,7 @@ World.Draw(); // _imGuiRenderer.AfterLayout(); - batch.End(); + tileBatch.End(); #region draw_header batch.Begin(SpriteSortMode.BackToFront, diff --git a/isometric-park-fna/Renderers/AreaRenderer.cs b/isometric-park-fna/Renderers/AreaRenderer.cs --- a/isometric-park-fna/Renderers/AreaRenderer.cs +++ b/isometric-park-fna/Renderers/AreaRenderer.cs @@ -38,7 +38,7 @@ ) { Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Teal); - Quad.FillSquares(batch, areaComponent.squares, Color.Teal, 0.5f, 0.79f); + Quad.FillSquares(batch, areaComponent.squares, Color.Teal, 0.5f, 0.99f); } var selected = GetComponent(entity).selected; @@ -49,9 +49,9 @@ ) { Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Teal); - Quad.FillSquares(batch, areaComponent.squares, Color.Gray, 0.5f, 0.80f); + Quad.FillSquares(batch, areaComponent.squares, Color.Gray, 0.5f, 0.98f); } } } } -} \ No newline at end of file +}