minor change in how the 2d camera is handled
This commit is contained in:
parent
0f10ce3a07
commit
b1e2721850
@ -23,7 +23,7 @@ namespace RhythmBullet.Zer01HD.Game.Screens
|
|||||||
public MainScreen(ContentSystem assets) : base(true)
|
public MainScreen(ContentSystem assets) : base(true)
|
||||||
{
|
{
|
||||||
background = assets.Get<Texture2D>("backgrounds/mainBG");
|
background = assets.Get<Texture2D>("backgrounds/mainBG");
|
||||||
fat = new FadeAwayTransition(1.25f);
|
fat = new FadeAwayTransition(3f);
|
||||||
book = new Book(Camera);
|
book = new Book(Camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,10 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
|||||||
|
|
||||||
public void DrawTransition(SpriteBatch batch)
|
public void DrawTransition(SpriteBatch batch)
|
||||||
{
|
{
|
||||||
batch.Draw(curtain, curtainSize, color);
|
if (curtain != null)
|
||||||
|
{
|
||||||
|
batch.Draw(curtain, curtainSize, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
|
namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ namespace RhythmBullet.Zer01HD.UI.Book
|
|||||||
{
|
{
|
||||||
for (int page = 0; page < pages.Count; page++)
|
for (int page = 0; page < pages.Count; page++)
|
||||||
{
|
{
|
||||||
pages.ElementAt(page).Value.Draw(batch, camera);
|
pages.ElementAt(page).Value.Draw(batch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace RhythmBullet.Zer01HD.Utilities.UI.Interactive
|
|||||||
public class BasicButton : UIModuleGroup
|
public class BasicButton : UIModuleGroup
|
||||||
{
|
{
|
||||||
public event Clicked Listeners;
|
public event Clicked Listeners;
|
||||||
|
|
||||||
public BasicButton()
|
public BasicButton()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
this.font = font;
|
this.font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch batch, Camera2D camera)
|
public override void Draw(SpriteBatch batch)
|
||||||
{
|
{
|
||||||
position.X = Bounds.X;
|
position.X = Bounds.X;
|
||||||
position.Y = Bounds.Y;
|
position.Y = Bounds.Y;
|
||||||
batch.DrawString(font, DisplayedText, position, Color);
|
batch.DrawString(font, DisplayedText, position, Color);
|
||||||
base.Draw(batch, camera);
|
base.Draw(batch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Draw(SpriteBatch batch, Camera2D camera)
|
public virtual void Draw(SpriteBatch batch)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,11 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
List<UIModule> modules = new List<UIModule>();
|
List<UIModule> modules = new List<UIModule>();
|
||||||
Rectangle scissorBounds;
|
Rectangle scissorBounds;
|
||||||
RasterizerState scissorRasterizer = new RasterizerState();
|
RasterizerState scissorRasterizer = new RasterizerState();
|
||||||
|
public Camera2D Camera { get; set; }
|
||||||
|
|
||||||
public UIModuleGroup(bool crop = false)
|
public UIModuleGroup(Camera2D camera = null, bool crop = false)
|
||||||
{
|
{
|
||||||
|
Camera = camera;
|
||||||
if (crop)
|
if (crop)
|
||||||
{
|
{
|
||||||
scissorRasterizer.ScissorTestEnable = true;
|
scissorRasterizer.ScissorTestEnable = true;
|
||||||
@ -26,12 +28,12 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch batch, Camera2D camera)
|
public override void Draw(SpriteBatch batch)
|
||||||
{
|
{
|
||||||
if (scissorBounds != null)
|
if (scissorBounds != null)
|
||||||
{
|
{
|
||||||
batch.End();
|
batch.End();
|
||||||
batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer, null, camera.TransformMatrix);
|
batch.Begin(SpriteSortMode.Deferred, null, null, null, scissorRasterizer, null, Camera?.TransformMatrix);
|
||||||
scissorBounds.Width = Bounds.Width;
|
scissorBounds.Width = Bounds.Width;
|
||||||
scissorBounds.Height = Bounds.Height;
|
scissorBounds.Height = Bounds.Height;
|
||||||
scissorBounds.X = Bounds.X;
|
scissorBounds.X = Bounds.X;
|
||||||
@ -46,7 +48,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
int offsetY = module.Bounds.Y;
|
int offsetY = module.Bounds.Y;
|
||||||
module.Bounds.X = Bounds.X + offsetX;
|
module.Bounds.X = Bounds.X + offsetX;
|
||||||
module.Bounds.Y = Bounds.Y + offsetY;
|
module.Bounds.Y = Bounds.Y + offsetY;
|
||||||
module.Draw(batch, camera);
|
module.Draw(batch);
|
||||||
module.Bounds.X = offsetX;
|
module.Bounds.X = offsetX;
|
||||||
module.Bounds.Y = offsetY;
|
module.Bounds.Y = offsetY;
|
||||||
}
|
}
|
||||||
@ -55,7 +57,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
|
|||||||
{
|
{
|
||||||
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
|
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
|
||||||
batch.End();
|
batch.End();
|
||||||
batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.TransformMatrix);
|
batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Camera?.TransformMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user