Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
This commit is contained in:
@@ -53,7 +53,7 @@ namespace OpenRA.Renderer.Sdl2
|
||||
Log.Write("graphics", message);
|
||||
Log.Write("graphics", "");
|
||||
Log.Write("graphics", "OpenGL Information:");
|
||||
Log.Write("graphics", "Vendor: {0}", GL.GetString(StringName.Vendor));
|
||||
Log.Write("graphics", "Vendor: {0}", GL.GetString(StringName.Vendor));
|
||||
if (GL.GetString(StringName.Vendor).Contains("Microsoft"))
|
||||
{
|
||||
var msg = "";
|
||||
@@ -62,9 +62,9 @@ namespace OpenRA.Renderer.Sdl2
|
||||
Log.Write("graphics", msg);
|
||||
}
|
||||
|
||||
Log.Write("graphics", "Renderer: {0}", GL.GetString(StringName.Renderer));
|
||||
Log.Write("graphics", "GL Version: {0}", GL.GetString(StringName.Version));
|
||||
Log.Write("graphics", "Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
|
||||
Log.Write("graphics", "Renderer: {0}", GL.GetString(StringName.Renderer));
|
||||
Log.Write("graphics", "GL Version: {0}", GL.GetString(StringName.Version));
|
||||
Log.Write("graphics", "Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
|
||||
Log.Write("graphics", "Available extensions:");
|
||||
Log.Write("graphics", GL.GetString(StringName.Extensions));
|
||||
}
|
||||
|
||||
@@ -55,116 +55,116 @@ namespace OpenRA.Renderer.Sdl2
|
||||
break;
|
||||
|
||||
case SDL.SDL_EventType.SDL_WINDOWEVENT:
|
||||
{
|
||||
switch (e.window.windowEvent)
|
||||
{
|
||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
Game.HasInputFocus = false;
|
||||
break;
|
||||
switch (e.window.windowEvent)
|
||||
{
|
||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
Game.HasInputFocus = false;
|
||||
break;
|
||||
|
||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
Game.HasInputFocus = true;
|
||||
break;
|
||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
Game.HasInputFocus = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN:
|
||||
{
|
||||
if (pendingMotion != null)
|
||||
{
|
||||
inputHandler.OnMouseInput(pendingMotion.Value);
|
||||
pendingMotion = null;
|
||||
if (pendingMotion != null)
|
||||
{
|
||||
inputHandler.OnMouseInput(pendingMotion.Value);
|
||||
pendingMotion = null;
|
||||
}
|
||||
|
||||
var button = MakeButton(e.button.button);
|
||||
lastButtonBits |= button;
|
||||
|
||||
var pos = new int2(e.button.x, e.button.y);
|
||||
|
||||
inputHandler.OnMouseInput(new MouseInput(
|
||||
MouseInputEvent.Down, button, scrollDelta, pos, mods,
|
||||
MultiTapDetection.DetectFromMouse(e.button.button, pos)));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
var button = MakeButton(e.button.button);
|
||||
lastButtonBits |= button;
|
||||
|
||||
var pos = new int2(e.button.x, e.button.y);
|
||||
|
||||
inputHandler.OnMouseInput(new MouseInput(
|
||||
MouseInputEvent.Down, button, scrollDelta, pos, mods,
|
||||
MultiTapDetection.DetectFromMouse(e.button.button, pos)));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_MOUSEBUTTONUP:
|
||||
{
|
||||
if (pendingMotion != null)
|
||||
{
|
||||
inputHandler.OnMouseInput(pendingMotion.Value);
|
||||
pendingMotion = null;
|
||||
if (pendingMotion != null)
|
||||
{
|
||||
inputHandler.OnMouseInput(pendingMotion.Value);
|
||||
pendingMotion = null;
|
||||
}
|
||||
|
||||
var button = MakeButton(e.button.button);
|
||||
lastButtonBits &= ~button;
|
||||
|
||||
var pos = new int2(e.button.x, e.button.y);
|
||||
inputHandler.OnMouseInput(new MouseInput(
|
||||
MouseInputEvent.Up, button, scrollDelta, pos, mods,
|
||||
MultiTapDetection.InfoFromMouse(e.button.button)));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
var button = MakeButton(e.button.button);
|
||||
lastButtonBits &= ~button;
|
||||
|
||||
var pos = new int2(e.button.x, e.button.y);
|
||||
inputHandler.OnMouseInput(new MouseInput(
|
||||
MouseInputEvent.Up, button, scrollDelta, pos, mods,
|
||||
MultiTapDetection.InfoFromMouse(e.button.button)));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_MOUSEMOTION:
|
||||
{
|
||||
pendingMotion = new MouseInput(
|
||||
MouseInputEvent.Move, lastButtonBits, scrollDelta,
|
||||
new int2(e.motion.x, e.motion.y), mods, 0);
|
||||
{
|
||||
pendingMotion = new MouseInput(
|
||||
MouseInputEvent.Move, lastButtonBits, scrollDelta,
|
||||
new int2(e.motion.x, e.motion.y), mods, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_MOUSEWHEEL:
|
||||
{
|
||||
int x, y;
|
||||
SDL.SDL_GetMouseState(out x, out y);
|
||||
scrollDelta = e.wheel.y;
|
||||
inputHandler.OnMouseInput(new MouseInput(MouseInputEvent.Scroll, MouseButton.None, scrollDelta, new int2(x, y), Modifiers.None, 0));
|
||||
{
|
||||
int x, y;
|
||||
SDL.SDL_GetMouseState(out x, out y);
|
||||
scrollDelta = e.wheel.y;
|
||||
inputHandler.OnMouseInput(new MouseInput(MouseInputEvent.Scroll, MouseButton.None, scrollDelta, new int2(x, y), Modifiers.None, 0));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_TEXTINPUT:
|
||||
{
|
||||
var rawBytes = new byte[SDL.SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
unsafe { Marshal.Copy((IntPtr)e.text.text, rawBytes, 0, SDL.SDL_TEXTINPUTEVENT_TEXT_SIZE); }
|
||||
inputHandler.OnTextInput(Encoding.UTF8.GetString(rawBytes, 0, Array.IndexOf(rawBytes, (byte)0)));
|
||||
break;
|
||||
}
|
||||
{
|
||||
var rawBytes = new byte[SDL.SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
unsafe { Marshal.Copy((IntPtr)e.text.text, rawBytes, 0, SDL.SDL_TEXTINPUTEVENT_TEXT_SIZE); }
|
||||
inputHandler.OnTextInput(Encoding.UTF8.GetString(rawBytes, 0, Array.IndexOf(rawBytes, (byte)0)));
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL.SDL_EventType.SDL_KEYDOWN:
|
||||
case SDL.SDL_EventType.SDL_KEYUP:
|
||||
{
|
||||
var keyCode = (Keycode)e.key.keysym.sym;
|
||||
var type = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
||||
KeyInputEvent.Down : KeyInputEvent.Up;
|
||||
|
||||
var tapCount = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
||||
MultiTapDetection.DetectFromKeyboard(keyCode) :
|
||||
MultiTapDetection.InfoFromKeyboard(keyCode);
|
||||
|
||||
var keyEvent = new KeyInput
|
||||
{
|
||||
Event = type,
|
||||
Key = keyCode,
|
||||
Modifiers = mods,
|
||||
UnicodeChar = (char)e.key.keysym.sym,
|
||||
MultiTapCount = tapCount
|
||||
};
|
||||
var keyCode = (Keycode)e.key.keysym.sym;
|
||||
var type = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
||||
KeyInputEvent.Down : KeyInputEvent.Up;
|
||||
|
||||
// Special case workaround for windows users
|
||||
if (e.key.keysym.sym == SDL.SDL_Keycode.SDLK_F4 && mods.HasModifier(Modifiers.Alt) &&
|
||||
Platform.CurrentPlatform == PlatformType.Windows)
|
||||
Game.Exit();
|
||||
else
|
||||
inputHandler.OnKeyInput(keyEvent);
|
||||
var tapCount = e.type == SDL.SDL_EventType.SDL_KEYDOWN ?
|
||||
MultiTapDetection.DetectFromKeyboard(keyCode) :
|
||||
MultiTapDetection.InfoFromKeyboard(keyCode);
|
||||
|
||||
break;
|
||||
}
|
||||
var keyEvent = new KeyInput
|
||||
{
|
||||
Event = type,
|
||||
Key = keyCode,
|
||||
Modifiers = mods,
|
||||
UnicodeChar = (char)e.key.keysym.sym,
|
||||
MultiTapCount = tapCount
|
||||
};
|
||||
|
||||
// Special case workaround for windows users
|
||||
if (e.key.keysym.sym == SDL.SDL_Keycode.SDLK_F4 && mods.HasModifier(Modifiers.Alt) &&
|
||||
Platform.CurrentPlatform == PlatformType.Windows)
|
||||
Game.Exit();
|
||||
else
|
||||
inputHandler.OnKeyInput(keyEvent);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user