diff --git a/Monofoxe/Monofoxe.Engine/Drawing/Frame.cs b/Monofoxe/Monofoxe.Engine/Drawing/Frame.cs index 5be36da9..f0855ba2 100644 --- a/Monofoxe/Monofoxe.Engine/Drawing/Frame.cs +++ b/Monofoxe/Monofoxe.Engine/Drawing/Frame.cs @@ -84,7 +84,7 @@ SpriteEffects effect { GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( Texture, position, TexturePosition, @@ -131,7 +131,7 @@ public void Draw(Rectangle destRect, Angle rotation, Color color) { GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( Texture, destRect, TexturePosition, @@ -151,7 +151,7 @@ public void Draw(Rectangle destRect, Rectangle srcRect, Angle rotation, Color co srcRect.X += TexturePosition.X; srcRect.Y += TexturePosition.Y; - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( Texture, destRect, srcRect, diff --git a/Monofoxe/Monofoxe.Engine/Drawing/GraphicsMgr.cs b/Monofoxe/Monofoxe.Engine/Drawing/GraphicsMgr.cs index 9dc8eb2a..eba35bca 100644 --- a/Monofoxe/Monofoxe.Engine/Drawing/GraphicsMgr.cs +++ b/Monofoxe/Monofoxe.Engine/Drawing/GraphicsMgr.cs @@ -16,7 +16,7 @@ public static class GraphicsMgr /// /// Default sprite batch used to draw sprites, text and surfaces. /// - public static SpriteBatch Batch {get; private set;} + internal static SpriteBatch _batch {get; private set;} public static GraphicsDevice Device {get; private set;} @@ -173,7 +173,7 @@ public static void Init(GraphicsDevice device) Device = device; Device.DepthStencilState = DepthStencilState.DepthRead; - Batch = new SpriteBatch(Device); + _batch = new SpriteBatch(Device); _content = new ContentManager(GameMgr.Game.Services); _content.RootDirectory = AssetMgr.ContentDir + '/' + AssetMgr.EffectsDir; @@ -325,7 +325,7 @@ public static void Update(GameTime gameTime) || _currentGraphicsMode == GraphicsMode.SpritesNonPremultiplied ) // If there's something left in batch or vertex buffer, we should draw it. { - Batch.End(); + _batch.End(); } DrawVertices(); // Drawing GUI stuff. @@ -364,7 +364,7 @@ public static void SwitchGraphicsMode(GraphicsMode mode, Texture2D texture = nul { if (_currentGraphicsMode == GraphicsMode.Sprites || _currentGraphicsMode == GraphicsMode.SpritesNonPremultiplied) { - Batch.End(); + _batch.End(); } else { @@ -400,7 +400,7 @@ public static void SwitchGraphicsMode(GraphicsMode mode, Texture2D texture = nul resultingEffect = _currentEffect; } - Batch.Begin(SpriteSortMode.Deferred, _blendState, _sampler, null, _rasterizer, resultingEffect, CurrentView); + _batch.Begin(SpriteSortMode.Deferred, _blendState, _sampler, null, _rasterizer, resultingEffect, CurrentView); } _currentGraphicsMode = mode; _currentTexture = texture; diff --git a/Monofoxe/Monofoxe.Engine/Drawing/Surface.cs b/Monofoxe/Monofoxe.Engine/Drawing/Surface.cs index 8300351f..64cad783 100644 --- a/Monofoxe/Monofoxe.Engine/Drawing/Surface.cs +++ b/Monofoxe/Monofoxe.Engine/Drawing/Surface.cs @@ -102,7 +102,7 @@ public void Draw(Vector2 position, Vector2 origin, Vector2 scale, Angle rotation // Proper negative scaling. GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( RenderTarget, position, RenderTarget.Bounds, @@ -122,13 +122,13 @@ public void Draw(Vector2 position, Vector2 origin, Vector2 scale, Angle rotation public void Draw(Rectangle destRect) { GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); - GraphicsMgr.Batch.Draw(RenderTarget, destRect, RenderTarget.Bounds, Color); + GraphicsMgr._batch.Draw(RenderTarget, destRect, RenderTarget.Bounds, Color); } public void Draw(Rectangle destRect, Angle rotation, Color color) { GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( RenderTarget, destRect, RenderTarget.Bounds, @@ -147,7 +147,7 @@ public void Draw(Rectangle destRect, Rectangle srcRect) srcRect.X += RenderTarget.Bounds.X; srcRect.Y += RenderTarget.Bounds.Y; - GraphicsMgr.Batch.Draw(RenderTarget, destRect, srcRect, GraphicsMgr.CurrentColor); + GraphicsMgr._batch.Draw(RenderTarget, destRect, srcRect, GraphicsMgr.CurrentColor); } public void Draw(Rectangle destRect, Rectangle srcRect, Angle rotation, Color color) @@ -157,7 +157,7 @@ public void Draw(Rectangle destRect, Rectangle srcRect, Angle rotation, Color co srcRect.X += RenderTarget.Bounds.X; srcRect.Y += RenderTarget.Bounds.Y; - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( RenderTarget, destRect, RenderTarget.Bounds, diff --git a/Monofoxe/Monofoxe.Engine/Drawing/Text.cs b/Monofoxe/Monofoxe.Engine/Drawing/Text.cs index 18becce9..fe596a06 100644 --- a/Monofoxe/Monofoxe.Engine/Drawing/Text.cs +++ b/Monofoxe/Monofoxe.Engine/Drawing/Text.cs @@ -72,7 +72,7 @@ public static void Draw(string text, Vector2 position) { GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); } - CurrentFont.Draw(GraphicsMgr.Batch, text, position, HorAlign, VerAlign); + CurrentFont.Draw(GraphicsMgr._batch, text, position, HorAlign, VerAlign); } /// @@ -123,7 +123,7 @@ Angle rotation GraphicsMgr.SwitchGraphicsMode(GraphicsMode.Sprites); } - CurrentFont.Draw(GraphicsMgr.Batch, text, Vector2.Zero, HorAlign, VerAlign); + CurrentFont.Draw(GraphicsMgr._batch, text, Vector2.Zero, HorAlign, VerAlign); GraphicsMgr.ResetTransformMatrix(); } diff --git a/Monofoxe/Monofoxe.Engine/Utils/Tilemaps/BasicTilemapSystem.cs b/Monofoxe/Monofoxe.Engine/Utils/Tilemaps/BasicTilemapSystem.cs index 1b8608c5..2fbd9e78 100644 --- a/Monofoxe/Monofoxe.Engine/Utils/Tilemaps/BasicTilemapSystem.cs +++ b/Monofoxe/Monofoxe.Engine/Utils/Tilemaps/BasicTilemapSystem.cs @@ -120,7 +120,7 @@ public override void Draw(Component component) // A bunch of Tiled magic. // Mass-drawing srpites with spritebatch is a bit faster. - GraphicsMgr.Batch.Draw( + GraphicsMgr._batch.Draw( tilesetTile.Frame.Texture, tilemap.Offset + new Vector2(tilemap.TileWidth * x, tilemap.TileHeight * y) - offset + tile.Tileset.Offset, tilesetTile.Frame.TexturePosition,