From 20e258f88ea35ea91fe9498c839f75a767a13cfd Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 26 Mar 2019 17:34:07 +0200 Subject: [PATCH] (26025de59) Allow panning the campaign map with WASD. Closes #1352 --- .../BarotraumaClient/Source/Map/Map/Map.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs b/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs index c264d6853..4abd51d76 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs @@ -364,15 +364,23 @@ namespace Barotrauma } } + if (GUI.KeyboardDispatcher.Subscriber == null) + { + float moveSpeed = 1000.0f; + Vector2 moveAmount = Vector2.Zero; + if (PlayerInput.KeyDown(InputType.Left)) { moveAmount += Vector2.UnitX; } + if (PlayerInput.KeyDown(InputType.Right)) { moveAmount -= Vector2.UnitX; } + if (PlayerInput.KeyDown(InputType.Up)) { moveAmount += Vector2.UnitY; } + if (PlayerInput.KeyDown(InputType.Down)) { moveAmount -= Vector2.UnitY; } + drawOffset += moveAmount * moveSpeed / zoom * deltaTime; + } + if (GUI.MouseOn == mapContainer) { zoom += PlayerInput.ScrollWheelSpeed / 1000.0f; zoom = MathHelper.Clamp(zoom, 1.0f, 4.0f); - if (PlayerInput.MidButtonHeld()) - { - drawOffset += PlayerInput.MouseSpeed / zoom; - } + if (PlayerInput.MidButtonHeld()) { drawOffset += PlayerInput.MouseSpeed / zoom; } #if DEBUG if (PlayerInput.DoubleClicked() && highlightedLocation != null) {