| {␊ |
| ␉class SDL2_GamePlatform : GamePlatform␊ |
| ␉{␊ |
| ␉␉#region Private OSX-specific Variables␊ |
| ␊ |
| ␉␉private bool INTERNAL_useFullscreenSpaces;␊ |
| ␊ |
| ␉␉#endregion␊ |
| ␊ |
| ␉␉#region Private DisplayMode Variables␊ |
| ␊ |
| ␉␉private int displayIndex = 0;␊ |
|
| ␊ |
| ␉␉␉// We hide the mouse cursor by default.␊ |
| ␉␉␉SDL.SDL_ShowCursor(0);␊ |
| ␊ |
| ␉␉␉// OSX has some fancy fullscreen features, let's use them!␊ |
| ␉␉␉if (OSVersion.Equals("Mac OS X"))␊ |
| ␉␉␉{␊ |
| ␉␉␉␉hint = SDL.SDL_GetHint(SDL.SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES);␊ |
| ␉␉␉␉INTERNAL_useFullscreenSpaces = (String.IsNullOrEmpty(hint) || hint.Equals("1"));␊ |
| ␉␉␉}␊ |
| ␉␉␉else␊ |
| ␉␉␉{␊ |
| ␉␉␉␉INTERNAL_useFullscreenSpaces = false;␊ |
| ␉␉␉}␊ |
| ␉␉}␊ |
| ␊ |
| ␉␉#endregion␊ |
|
| ␉␉{␊ |
| ␉␉␉SDL.SDL_ShowWindow(Game.Window.Handle);␊ |
| ␊ |
| ␉␉␉// OSX has some fancy fullscreen features, let's use them!␊ |
| ␉␉␉bool osxUseSpaces;␊ |
| ␉␉␉if (OSVersion.Equals("Mac OS X"))␊ |
| ␉␉␉{␊ |
| ␉␉␉␉string hint = SDL.SDL_GetHint(SDL.SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES);␊ |
| ␉␉␉␉osxUseSpaces = (String.IsNullOrEmpty(hint) || hint.Equals("1"));␊ |
| ␉␉␉}␊ |
| ␉␉␉else␊ |
| ␉␉␉{␊ |
| ␉␉␉␉osxUseSpaces = false;␊ |
| ␉␉␉}␊ |
| ␊ |
| ␉␉␉// Active Key List␊ |
| ␉␉␉List<Keys> keys = new List<Keys>();␊ |
| ␊ |
|
| ␉␉␉␉␉␉{␊ |
| ␉␉␉␉␉␉␉Game.IsActive = true;␊ |
| ␊ |
| ␉␉␉␉␉␉␉if (!INTERNAL_useFullscreenSpaces)␊ |
| ␉␉␉␉␉␉␉if (!osxUseSpaces)␊ |
| ␉␉␉␉␉␉␉{␊ |
| ␉␉␉␉␉␉␉␉// If we alt-tab away, we lose the 'fullscreen desktop' flag on some WMs␊ |
| ␉␉␉␉␉␉␉␉SDL.SDL_SetWindowFullscreen(␊ |
|
| ␉␉␉␉␉␉{␊ |
| ␉␉␉␉␉␉␉Game.IsActive = false;␊ |
| ␊ |
| ␉␉␉␉␉␉␉if (!INTERNAL_useFullscreenSpaces)␊ |
| ␉␉␉␉␉␉␉if (!osxUseSpaces)␊ |
| ␉␉␉␉␉␉␉{␊ |
| ␉␉␉␉␉␉␉␉SDL.SDL_SetWindowFullscreen(Game.Window.Handle, 0);␊ |
| ␉␉␉␉␉␉␉}␊ |