Fix recently introduced bad line endings.

This commit is contained in:
Paul Chote
2018-06-30 16:40:43 +01:00
parent b892336285
commit 8ec3df7550
3 changed files with 62 additions and 62 deletions

View File

@@ -10,8 +10,8 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace OpenRA.Mods.Common.UpdateRules.Rules namespace OpenRA.Mods.Common.UpdateRules.Rules
{ {
public class MoveHackyAISupportPowerDecisions : UpdateRule public class MoveHackyAISupportPowerDecisions : UpdateRule

View File

@@ -6,15 +6,15 @@
* as published by the Free Software Foundation, either version 3 of * as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more * the License, or (at your option) any later version. For more
* information, see COPYING. * information, see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using SDL2; using SDL2;
namespace OpenRA.Platforms.Default namespace OpenRA.Platforms.Default
{ {
class Sdl2HardwareCursorException : Exception class Sdl2HardwareCursorException : Exception

View File

@@ -74,55 +74,55 @@ namespace OpenRA.Platforms.Default
public Sdl2PlatformWindow(Size requestWindowSize, WindowMode windowMode, int batchSize) public Sdl2PlatformWindow(Size requestWindowSize, WindowMode windowMode, int batchSize)
{ {
Console.WriteLine("Using SDL 2 with OpenGL renderer"); Console.WriteLine("Using SDL 2 with OpenGL renderer");
// Lock the Window/Surface properties until initialization is complete // Lock the Window/Surface properties until initialization is complete
lock (syncObject) lock (syncObject)
{ {
windowSize = requestWindowSize; windowSize = requestWindowSize;
// Disable legacy scaling on Windows // Disable legacy scaling on Windows
if (Platform.CurrentPlatform == PlatformType.Windows && !Game.Settings.Graphics.DisableWindowsDPIScaling) if (Platform.CurrentPlatform == PlatformType.Windows && !Game.Settings.Graphics.DisableWindowsDPIScaling)
SetProcessDPIAware(); SetProcessDPIAware();
SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO); SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1); SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8); SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8); SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8); SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0); SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);
SDL.SDL_DisplayMode display; SDL.SDL_DisplayMode display;
SDL.SDL_GetCurrentDisplayMode(0, out display); SDL.SDL_GetCurrentDisplayMode(0, out display);
Console.WriteLine("Desktop resolution: {0}x{1}", display.w, display.h); Console.WriteLine("Desktop resolution: {0}x{1}", display.w, display.h);
if (windowSize.Width == 0 && windowSize.Height == 0) if (windowSize.Width == 0 && windowSize.Height == 0)
{ {
Console.WriteLine("No custom resolution provided, using desktop resolution"); Console.WriteLine("No custom resolution provided, using desktop resolution");
windowSize = new Size(display.w, display.h); windowSize = new Size(display.w, display.h);
} }
Console.WriteLine("Using resolution: {0}x{1}", windowSize.Width, windowSize.Height); Console.WriteLine("Using resolution: {0}x{1}", windowSize.Width, windowSize.Height);
var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL.SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI; var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL.SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI;
// HiDPI doesn't work properly on OSX with (legacy) fullscreen mode // HiDPI doesn't work properly on OSX with (legacy) fullscreen mode
if (Platform.CurrentPlatform == PlatformType.OSX && windowMode == WindowMode.Fullscreen) if (Platform.CurrentPlatform == PlatformType.OSX && windowMode == WindowMode.Fullscreen)
SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1"); SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED,
windowSize.Width, windowSize.Height, windowFlags); windowSize.Width, windowSize.Height, windowFlags);
surfaceSize = windowSize; surfaceSize = windowSize;
windowScale = 1; windowScale = 1;
// Enable high resolution rendering for Retina displays // Enable high resolution rendering for Retina displays
if (Platform.CurrentPlatform == PlatformType.OSX) if (Platform.CurrentPlatform == PlatformType.OSX)
{ {
// OSX defines the window size in "points", with a device-dependent number of pixels per point. // OSX defines the window size in "points", with a device-dependent number of pixels per point.
// The window scale is simply the ratio of GL pixels / window points. // The window scale is simply the ratio of GL pixels / window points.
int width, height; int width, height;
SDL.SDL_GL_GetDrawableSize(Window, out width, out height); SDL.SDL_GL_GetDrawableSize(Window, out width, out height);
surfaceSize = new Size(width, height); surfaceSize = new Size(width, height);
windowScale = width * 1f / windowSize.Width; windowScale = width * 1f / windowSize.Width;
@@ -145,25 +145,25 @@ namespace OpenRA.Platforms.Default
windowScale = scale; windowScale = scale;
windowSize = new Size((int)(surfaceSize.Width / windowScale), (int)(surfaceSize.Height / windowScale)); windowSize = new Size((int)(surfaceSize.Width / windowScale), (int)(surfaceSize.Height / windowScale));
} }
} }
Console.WriteLine("Using window scale {0:F2}", windowScale); Console.WriteLine("Using window scale {0:F2}", windowScale);
if (Game.Settings.Game.LockMouseWindow) if (Game.Settings.Game.LockMouseWindow)
GrabWindowMouseFocus(); GrabWindowMouseFocus();
else else
ReleaseWindowMouseFocus(); ReleaseWindowMouseFocus();
if (windowMode == WindowMode.Fullscreen) if (windowMode == WindowMode.Fullscreen)
{ {
SDL.SDL_SetWindowFullscreen(Window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN); SDL.SDL_SetWindowFullscreen(Window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN);
// Fullscreen mode on OSX will ignore the configured display resolution // Fullscreen mode on OSX will ignore the configured display resolution
// and instead always picks an arbitrary scaled resolution choice that may // and instead always picks an arbitrary scaled resolution choice that may
// not match the window size, leading to graphical and input issues. // not match the window size, leading to graphical and input issues.
// We work around this by force disabling HiDPI and resetting the window and // We work around this by force disabling HiDPI and resetting the window and
// surface sizes to match the size that is forced by SDL. // surface sizes to match the size that is forced by SDL.
// This is usually not what the player wants, but is the best we can consistently do. // This is usually not what the player wants, but is the best we can consistently do.
if (Platform.CurrentPlatform == PlatformType.OSX) if (Platform.CurrentPlatform == PlatformType.OSX)
{ {
int width, height; int width, height;
@@ -173,12 +173,12 @@ namespace OpenRA.Platforms.Default
} }
} }
else if (windowMode == WindowMode.PseudoFullscreen) else if (windowMode == WindowMode.PseudoFullscreen)
{ {
// Work around a visual glitch in OSX: the window is offset // Work around a visual glitch in OSX: the window is offset
// partially offscreen if the dock is at the left of the screen // partially offscreen if the dock is at the left of the screen
if (Platform.CurrentPlatform == PlatformType.OSX) if (Platform.CurrentPlatform == PlatformType.OSX)
SDL.SDL_SetWindowPosition(Window, 0, 0); SDL.SDL_SetWindowPosition(Window, 0, 0);
SDL.SDL_SetWindowFullscreen(Window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP); SDL.SDL_SetWindowFullscreen(Window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
} }
@@ -258,8 +258,8 @@ namespace OpenRA.Platforms.Default
{ {
oldScale = windowScale; oldScale = windowScale;
surfaceSize = new Size(width, height); surfaceSize = new Size(width, height);
windowScale = width * 1f / windowSize.Width; windowScale = width * 1f / windowSize.Width;
} }
OnWindowScaleChanged(oldScale, windowScale); OnWindowScaleChanged(oldScale, windowScale);
} }