Remove hacky os-specific keyboard shortcuts.
This commit is contained in:
@@ -21,7 +21,6 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
public abstract class SdlGraphics : IGraphicsDevice
|
public abstract class SdlGraphics : IGraphicsDevice
|
||||||
{
|
{
|
||||||
Size windowSize;
|
Size windowSize;
|
||||||
IntPtr surf;
|
|
||||||
SdlInput input;
|
SdlInput input;
|
||||||
|
|
||||||
public Size WindowSize { get { return windowSize; } }
|
public Size WindowSize { get { return windowSize; } }
|
||||||
@@ -29,7 +28,7 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
public SdlGraphics(Size size, WindowMode window, string[] extensions)
|
public SdlGraphics(Size size, WindowMode window, string[] extensions)
|
||||||
{
|
{
|
||||||
windowSize = size;
|
windowSize = size;
|
||||||
surf = InitializeSdlGl(ref windowSize, window, extensions);
|
InitializeSdlGl(ref windowSize, window, extensions);
|
||||||
|
|
||||||
Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
|
Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
|
||||||
ErrorHandler.CheckGlError();
|
ErrorHandler.CheckGlError();
|
||||||
@@ -38,7 +37,7 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
|
|
||||||
Sdl.SDL_SetModState(0);
|
Sdl.SDL_SetModState(0);
|
||||||
|
|
||||||
input = new SdlInput(surf);
|
input = new SdlInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPtr InitializeSdlGl(ref Size size, WindowMode window, string[] requiredExtensions)
|
IntPtr InitializeSdlGl(ref Size size, WindowMode window, string[] requiredExtensions)
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
public class SdlInput
|
public class SdlInput
|
||||||
{
|
{
|
||||||
MouseButton lastButtonBits = (MouseButton)0;
|
MouseButton lastButtonBits = (MouseButton)0;
|
||||||
IntPtr surface;
|
|
||||||
|
|
||||||
public SdlInput(IntPtr surface) { this.surface = surface; }
|
|
||||||
|
|
||||||
MouseButton MakeButton(byte b)
|
MouseButton MakeButton(byte b)
|
||||||
{
|
{
|
||||||
@@ -118,7 +115,6 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
MultiTapCount = MultiTapDetection.DetectFromKeyboard(keyName)
|
MultiTapCount = MultiTapDetection.DetectFromKeyboard(keyName)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!HandleSpecialKey(keyEvent))
|
|
||||||
inputHandler.OnKeyInput(keyEvent);
|
inputHandler.OnKeyInput(keyEvent);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -151,28 +147,5 @@ namespace OpenRA.Renderer.SdlCommon
|
|||||||
|
|
||||||
ErrorHandler.CheckGlError();
|
ErrorHandler.CheckGlError();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HandleSpecialKey(KeyInput k)
|
|
||||||
{
|
|
||||||
switch (k.VirtKey)
|
|
||||||
{
|
|
||||||
case Sdl.SDLK_F13:
|
|
||||||
var path = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
|
|
||||||
+ Path.DirectorySeparatorChar + DateTime.UtcNow.ToString("OpenRA-yyyy-MM-ddThhmmssZ") + ".bmp";
|
|
||||||
Sdl.SDL_SaveBMP(surface, path);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case Sdl.SDLK_F4:
|
|
||||||
if (k.Modifiers.HasModifier(Modifiers.Alt))
|
|
||||||
{
|
|
||||||
OpenRA.Game.Exit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user