mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 21:55:03 -07:00
Fixed a bug I introduced ;)
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ namespace LunaLightXMG
|
||||
public float Zoom
|
||||
{
|
||||
get => zoom;
|
||||
set => zoom = (int)Math.Floor(MathHelper.Clamp(value, 1f, 3f));
|
||||
set => zoom = (int)Math.Floor(MathHelper.Clamp(value, 1f, 2f));
|
||||
}
|
||||
public float Rotation
|
||||
{
|
||||
|
||||
+5
-14
@@ -98,22 +98,12 @@ namespace LunaLightXMG
|
||||
private void TestCameraWhilePlaying()
|
||||
{
|
||||
KeyboardState keyboardState = Keyboard.GetState();
|
||||
var KeyI = keyboardState.IsKeyDown(Keys.I);
|
||||
var KeyO = keyboardState.IsKeyDown(Keys.O);
|
||||
var KeyK = keyboardState.IsKeyDown(Keys.K);
|
||||
var KeyL = keyboardState.IsKeyDown(Keys.L);
|
||||
var KeyB = keyboardState.IsKeyDown(Keys.B);
|
||||
var KeyN = keyboardState.IsKeyDown(Keys.N);
|
||||
var KeyM = keyboardState.IsKeyDown(Keys.M);
|
||||
|
||||
if (KeyI)
|
||||
{
|
||||
camera2D.Zoom += 1f;
|
||||
}
|
||||
if (KeyO)
|
||||
{
|
||||
camera2D.Zoom -= 1f;
|
||||
}
|
||||
if (KeyK)
|
||||
{
|
||||
camera2D.Rotation -= 0.01f;
|
||||
@@ -263,12 +253,10 @@ namespace LunaLightXMG
|
||||
spriteBatch.DrawString(debugFont, $"Walled: {player.walled}", new Vector2(10, 50), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Position: {player.position}", new Vector2(10, 70), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Camera Position: {camera2D.Position}", new Vector2(10, 90), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Camera Zoom: {camera2D.Zoom}", new Vector2(10, 110), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Camera Rotation: {camera2D.Rotation}", new Vector2(10, 130), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Render Target Zoom: {renderHandler.ZoomLevel}", new Vector2(10, 150), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Camera Rotation: {camera2D.Rotation}", new Vector2(10, 110), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Render Target Zoom: {renderHandler.ZoomLevel}", new Vector2(10, 130), Color.White);
|
||||
|
||||
|
||||
spriteBatch.DrawString(debugFont, $"Camera Zoom Control - Zoom in: I, Zoom out: O", new Vector2(10, 170), Color.White);
|
||||
spriteBatch.DrawString(debugFont, $"Camera Rotation Control - Rotate left: K, Rotate right: L", new Vector2(10, 190), Color.White);
|
||||
|
||||
spriteBatch.DrawString(debugFont, $"Render Target Zoom Control - Zoom in: B, Zoom normal: N, Zoom out: M", new Vector2(10, 210), Color.White);
|
||||
@@ -285,6 +273,9 @@ namespace LunaLightXMG
|
||||
// reset cam
|
||||
camera2D.Rotation = 0;
|
||||
camera2D.Zoom = 1f;
|
||||
|
||||
// reset render target zoom
|
||||
renderHandler.ZoomNormalize();
|
||||
|
||||
// Reset player position
|
||||
player.Reset(new Vector2(163, 0));
|
||||
|
||||
+6
-5
@@ -12,8 +12,8 @@ namespace LunaLightXMG
|
||||
private RenderTarget2D renderTarget;
|
||||
private Rectangle renderDestination;
|
||||
|
||||
private float retroWidth;
|
||||
private float retroHeight;
|
||||
private readonly float retroWidth;
|
||||
private readonly float retroHeight;
|
||||
private float zoomLevel = 1.0f;
|
||||
private float zoomTarget = 1.0f;
|
||||
private readonly float zoomMin = 0.50f;
|
||||
@@ -71,10 +71,11 @@ namespace LunaLightXMG
|
||||
// Calculate the integer scale factor
|
||||
float scaleX = screenSize.X / (retroWidth * zoomLevel);
|
||||
float scaleY = screenSize.Y / (retroHeight * zoomLevel);
|
||||
|
||||
float scale = Math.Min(scaleX, scaleY);
|
||||
|
||||
// Set renderDestination
|
||||
renderDestination.Width = (int)(retroWidth * scaleX);
|
||||
renderDestination.Height = (int)(retroHeight * scaleY);
|
||||
renderDestination.Width = (int)(retroWidth * scale);
|
||||
renderDestination.Height = (int)(retroHeight * scale);
|
||||
renderDestination.X = (screenSize.X - renderDestination.Width) / 2;
|
||||
renderDestination.Y = (screenSize.Y - renderDestination.Height) / 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user