diff --git a/2D/Screens/PauseScreen.cs b/2D/Screens/PauseScreen.cs index 631d2773a..63f15d53c 100644 --- a/2D/Screens/PauseScreen.cs +++ b/2D/Screens/PauseScreen.cs @@ -28,7 +28,11 @@ namespace ClassicalSharp { } Font titleFont, keyStatusFont, textFont; + static string[] keyNames; public override void Init() { + if( keyNames == null ) { + keyNames = Enum.GetNames( typeof( Key ) ); + } titleFont = new Font( "Arial", 16, FontStyle.Bold ); keyStatusFont = new Font( "Arial", 13, FontStyle.Italic ); textFont = new Font( "Arial", 14, FontStyle.Bold ); @@ -59,7 +63,8 @@ namespace ClassicalSharp { widgets = new KeyMapWidget[mappings.Length]; for( int i = 0; i < keysLeft.Length; i++ ) { - string text = descriptions[i] + ": " + Window.Keys[mappings[i]]; + Key tkKey = Window.Keys[mappings[i]]; + string text = descriptions[i] + ": " + keyNames[(int)tkKey]; TextWidget widget = TextWidget.Create( Window, 0, startY, text, Docking.LeftOrTop, Docking.LeftOrTop, textFont ); widget.XOffset = offset; widget.MoveTo( widget.X + widget.XOffset, widget.Y ); diff --git a/2D/Widgets/TextInputWidget.cs b/2D/Widgets/TextInputWidget.cs index 97e62639d..6958c3977 100644 --- a/2D/Widgets/TextInputWidget.cs +++ b/2D/Widgets/TextInputWidget.cs @@ -237,7 +237,7 @@ namespace ClassicalSharp { for( int i = 0; i < handlers.Length; i++ ) { if( handlers[i].HandlesKeyDown( key ) ) return true; } - bool controlDown = Window.IsKeyDown( Key.LControl) || Window.IsKeyDown( Key.RControl ); + bool controlDown = Window.IsKeyDown( Key.ControlLeft ) || Window.IsKeyDown( Key.ControlRight ); if( key == Key.V && controlDown && chatInputText.Length < 64 ) { string text = Clipboard.GetText(); if( String.IsNullOrEmpty( text ) ) return true; diff --git a/Game/Game.InputHandling.cs b/Game/Game.InputHandling.cs index 6513eea79..a9e5adcce 100644 --- a/Game/Game.InputHandling.cs +++ b/Game/Game.InputHandling.cs @@ -169,7 +169,7 @@ namespace ClassicalSharp { Key[] Keys = new Key[] { Key.W, Key.S, Key.A, Key.D, Key.Space, Key.R, Key.Y, Key.T, Key.Enter, Key.Escape, Key.B, Key.F12, Key.F11, Key.F7, - Key.F5, Key.F6, Key.Z, Key.LShift, Key.X, Key.Q, Key.E, + Key.F5, Key.F6, Key.Z, Key.ShiftLeft, Key.X, Key.Q, Key.E, Key.Tab, Key.H, }; diff --git a/OpenTK.dll b/OpenTK.dll index 397fa59b2..a064c76e5 100644 Binary files a/OpenTK.dll and b/OpenTK.dll differ diff --git a/Utils/Camera.cs b/Utils/Camera.cs index 564d3af3e..1cc491243 100644 --- a/Utils/Camera.cs +++ b/Utils/Camera.cs @@ -1,6 +1,5 @@ using System; using System.Drawing; -using System.Windows.Forms; using OpenTK; using OpenTK.Input; @@ -31,8 +30,10 @@ namespace ClassicalSharp { public abstract class PerspectiveCamera : Camera { protected Player player; + IInputDriver driver; public PerspectiveCamera( Game window ) { Window = window; + driver = window.InputDriver; player = Window.LocalPlayer; } @@ -53,12 +54,12 @@ namespace ClassicalSharp { Vector2 Orientation; void CentreMousePosition() { if( !Window.Focused ) return; - Point current = Cursor.Position; + Point current = driver.DesktopCursorPos; delta = new Point( current.X - previous.X, current.Y - previous.Y ); Rectangle bounds = Window.Bounds; int cenX = bounds.Left + bounds.Width / 2; int cenY = bounds.Top + bounds.Height / 2; - Cursor.Position = new Point( cenX, cenY ); + driver.DesktopCursorPos = new Point( cenX, cenY ); previous = new Point( cenX, cenY ); } @@ -66,7 +67,7 @@ namespace ClassicalSharp { Rectangle bounds = Window.Bounds; int cenX = bounds.Left + bounds.Width / 2; int cenY = bounds.Top + bounds.Height / 2; - Cursor.Position = new Point( cenX, cenY ); + driver.DesktopCursorPos = new Point( cenX, cenY ); previous = new Point( cenX, cenY ); delta = Point.Empty; }