Camera in functional state.

This commit is contained in:
2018-11-11 23:05:51 -06:00
parent 3c44a52a8f
commit a2defc5d11
6 changed files with 40 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RhythmBullet.Zer01HD.Utilities.Camera;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -32,12 +33,12 @@ namespace RhythmBullet.Zer01HD.UI.Modular
this.font = font;
}
public override void Draw(SpriteBatch batch)
public override void Draw(SpriteBatch batch, Camera2D camera)
{
position.X = Bounds.X;
position.Y = Bounds.Y;
batch.DrawString(font, DisplayedText, position, Color);
base.Draw(batch);
base.Draw(batch, camera);
}
}
}

View File

@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RhythmBullet.Zer01HD.Utilities.Camera;
using RhythmBullet.Zer01HD.Utilities.Input;
using System;
using System.Collections.Generic;
@@ -21,7 +22,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
{
}
public virtual void Draw(SpriteBatch batch)
public virtual void Draw(SpriteBatch batch, Camera2D camera)
{
}

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RhythmBullet.Zer01HD.Utilities.Camera;
using RhythmBullet.Zer01HD.Utilities.Input;
namespace RhythmBullet.Zer01HD.UI.Modular
@@ -24,12 +25,12 @@ namespace RhythmBullet.Zer01HD.UI.Modular
}
}
public override void Draw(SpriteBatch batch)
public override void Draw(SpriteBatch batch, Camera2D camera)
{
if (scissorBounds != null)
{
batch.End();
batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer);
batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer, null, camera.TransformMatrix);
scissorBounds.Width = Bounds.Width;
scissorBounds.Height = Bounds.Height;
scissorBounds.X = Bounds.X;
@@ -44,7 +45,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
int offsetY = module.Bounds.Y;
module.Bounds.X = Bounds.X + offsetX;
module.Bounds.Y = Bounds.Y + offsetY;
module.Draw(batch);
module.Draw(batch, camera);
module.Bounds.X = offsetX;
module.Bounds.Y = offsetY;
}
@@ -53,7 +54,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
{
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
batch.End();
batch.Begin();
batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.TransformMatrix);
}
}