diff --git a/RecrownedAthenaeum/RecrownedAthenaeum.csproj b/RecrownedAthenaeum/RecrownedAthenaeum.csproj index 187c5dc..076d410 100644 --- a/RecrownedAthenaeum/RecrownedAthenaeum.csproj +++ b/RecrownedAthenaeum/RecrownedAthenaeum.csproj @@ -51,6 +51,7 @@ + diff --git a/RecrownedAthenaeum/Render/PrimitiveBatch.cs b/RecrownedAthenaeum/Render/PrimitiveBatch.cs index 83cf156..3ddc247 100644 --- a/RecrownedAthenaeum/Render/PrimitiveBatch.cs +++ b/RecrownedAthenaeum/Render/PrimitiveBatch.cs @@ -34,11 +34,11 @@ namespace RecrownedAthenaeum.Render { this.graphicsDevice = graphicsDevice ?? (Configuration.GraphicsDeviceManager.GraphicsDevice); camera = camera ?? (Configuration.Camera2D); - basicEffect = new BasicEffect(this.graphicsDevice); basicEffect.VertexColorEnabled = true; - basicEffect.View = camera.Matrix; - + basicEffect.Projection = camera.projectionMatrix; + basicEffect.View = camera.ViewMatrix; + basicEffect.World = Matrix.Identity; vertices = new List(verticesPerBatch); } @@ -69,9 +69,9 @@ namespace RecrownedAthenaeum.Render public void End() { if (disposed) throw new ObjectDisposedException(this.GetType().Name); - if (!began) throw new InvalidOperationException("Begin must be called before ending."); Flush(); + began = false; } /// @@ -95,7 +95,7 @@ namespace RecrownedAthenaeum.Render } } vertices.Add(new VertexPositionColor(new Vector3(vertex, 0), color)); - bufferPosition = vertices.Count; + bufferPosition++; } /// @@ -108,6 +108,7 @@ namespace RecrownedAthenaeum.Render if (bufferPosition == 0) return; graphicsDevice.DrawUserPrimitives(primitiveType, vertices.ToArray(), 0, bufferPosition / verticesPerPrimitive); + vertices.Clear(); bufferPosition = 0; } diff --git a/RecrownedAthenaeum/ScreenSystem/ScreenManager.cs b/RecrownedAthenaeum/ScreenSystem/ScreenManager.cs index a3e2859..37cad41 100644 --- a/RecrownedAthenaeum/ScreenSystem/ScreenManager.cs +++ b/RecrownedAthenaeum/ScreenSystem/ScreenManager.cs @@ -129,13 +129,13 @@ namespace RecrownedAthenaeum.ScreenSystem { graphics.GraphicsDevice.SetRenderTarget(previousScreenRenderTarget); graphics.GraphicsDevice.Clear(previousScreen.BackgroundColor); - spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Matrix); + spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.TransformationMatrix); previousScreen.Draw(spriteBatch); spriteBatch.End(); graphics.GraphicsDevice.SetRenderTarget(null); Screen.UpdatePreviousScreenFrame(previousScreenRenderTarget); } - spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Matrix); + spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.TransformationMatrix); Screen.Draw(spriteBatch); spriteBatch.End(); } diff --git a/RecrownedAthenaeum/UI/BookSystem/Book.cs b/RecrownedAthenaeum/UI/BookSystem/Book.cs index b76e766..55ee376 100644 --- a/RecrownedAthenaeum/UI/BookSystem/Book.cs +++ b/RecrownedAthenaeum/UI/BookSystem/Book.cs @@ -131,8 +131,8 @@ namespace RecrownedAthenaeum.UI.BookSystem public void GoToPage(Page page) { Rectangle targetBounds = page.bounds; - camera.Position.X = targetBounds.X + (targetBounds.Width * 0.5f); - camera.Position.Y = targetBounds.Y + (targetBounds.Height * 0.5f); + camera.position.X = targetBounds.X + (targetBounds.Width * 0.5f); + camera.position.Y = targetBounds.Y + (targetBounds.Height * 0.5f); } } } diff --git a/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs b/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs index 5013f86..d46ee47 100644 --- a/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs +++ b/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs @@ -48,7 +48,7 @@ namespace RecrownedAthenaeum.UI.Modular if (scissorBounds != null) { batch.End(); - batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer, null, camera?.Matrix); + batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer, null, camera?.TransformationMatrix); scissorBounds.Width = bounds.Width; scissorBounds.Height = bounds.Height; scissorBounds.X = bounds.X; @@ -72,7 +72,7 @@ namespace RecrownedAthenaeum.UI.Modular { batch.GraphicsDevice.ScissorRectangle = scissorBounds; batch.End(); - batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera?.Matrix); + batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera?.TransformationMatrix); } }