Camera speed dependent on time

This commit is contained in:
2012-09-25 14:12:50 +02:00
parent 6ff77964be
commit 166cd35ee5
2 changed files with 59 additions and 53 deletions
+7 -5
View File
@@ -25,22 +25,24 @@ namespace DepthsBelow
Zoom = 1.0f;
Rotation = 0.0f;
Position = Vector2.Zero;
Speed = 5;
Speed = 300;
}
public void Update(GameTime gameTime)
{
float elapsed = gameTime.ElapsedGameTime.Milliseconds / 1000.0f;
MouseState ms = Mouse.GetState();
if (ms.X < 20)
Position.X -= Speed;
Position.X -= Speed * elapsed;
if (ms.X > core.GraphicsDevice.Viewport.Width - 20)
Position.X += Speed;
Position.X += Speed * elapsed;
if (ms.Y < 20)
Position.Y -= Speed;
Position.Y -= Speed * elapsed;
if (ms.Y > core.GraphicsDevice.Viewport.Height - 20)
Position.Y += Speed;
Position.Y += Speed * elapsed;
Transform =
Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0))
+4
View File
@@ -32,6 +32,10 @@ namespace DepthsBelow
graphics.PreferredBackBufferHeight = 720;
graphics.IsFullScreen = false;
graphics.SynchronizeWithVerticalRetrace = false;
this.IsFixedTimeStep = false;
graphics.ApplyChanges();
this.IsMouseVisible = true;
}