Implemented the changes of the new camera.
This commit is contained in:
parent
e0858ad85d
commit
3c7e6cdefb
@ -51,6 +51,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Camera\Camera.cs" />
|
||||
<Compile Include="Camera\Camera2D.cs" />
|
||||
<Compile Include="ContentSystem\ContentData.cs" />
|
||||
<Compile Include="ContentSystem\ContentManagerController.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<VertexPositionColor>(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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -95,7 +95,7 @@ namespace RecrownedAthenaeum.Render
|
||||
}
|
||||
}
|
||||
vertices.Add(new VertexPositionColor(new Vector3(vertex, 0), color));
|
||||
bufferPosition = vertices.Count;
|
||||
bufferPosition++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -108,6 +108,7 @@ namespace RecrownedAthenaeum.Render
|
||||
if (bufferPosition == 0) return;
|
||||
|
||||
graphicsDevice.DrawUserPrimitives(primitiveType, vertices.ToArray(), 0, bufferPosition / verticesPerPrimitive);
|
||||
vertices.Clear();
|
||||
bufferPosition = 0;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user