From 54e87944e29c2b0cc4dd91974078dec74d805188 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 30 Sep 2024 23:05:04 -0400 Subject: [PATCH] SDL2->SDL3 --- src/FNAPlatform/SDL3_FNAPlatform.cs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/FNAPlatform/SDL3_FNAPlatform.cs b/src/FNAPlatform/SDL3_FNAPlatform.cs index 64102a44..f10991fb 100644 --- a/src/FNAPlatform/SDL3_FNAPlatform.cs +++ b/src/FNAPlatform/SDL3_FNAPlatform.cs @@ -120,7 +120,7 @@ public static string ProgramInit(LaunchParameters args) ); } - // Built-in SDL2 command line arguments + // Built-in SDL3 command line arguments string arg; if (args.TryGetValue("glprofile", out arg)) { @@ -318,7 +318,7 @@ public static void SetEnv(string name, string value) public static GameWindow CreateWindow() { - // Set and initialize the SDL2 window + // Set and initialize the SDL3 window SDL.SDL_WindowFlags initFlags = ( SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN | SDL.SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | @@ -643,11 +643,6 @@ public static bool IsScreenKeyboardShown(IntPtr window) private static void INTERNAL_SetIcon(IntPtr window, string title) { string fileIn = String.Empty; - - /* If the game's using SDL2_image, provide the option to use a PNG - * instead of a BMP. Nice for anyone who cares about transparency. - * -flibit - */ try { fileIn = INTERNAL_GetIconName(title + ".png"); @@ -2248,7 +2243,7 @@ public static void StopTextInput(IntPtr window) #endregion - #region SDL2<->XNA Key Conversion Methods + #region SDL3<->XNA Key Conversion Methods /* From: http://blogs.msdn.com/b/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx * "If you use an enum type as a dictionary key, internal dictionary operations will cause boxing. @@ -2379,12 +2374,12 @@ public static void StopTextInput(IntPtr window) { (int) SDL.SDL_Keycode.SDLK_GRAVE, Keys.OemTilde }, { (int) SDL.SDL_Keycode.SDLK_VOLUMEUP, Keys.VolumeUp }, { (int) SDL.SDL_Keycode.SDLK_VOLUMEDOWN, Keys.VolumeDown }, - { '²' /* FIXME: AZERTY SDL2? -flibit */, Keys.OemTilde }, - { 'é' /* FIXME: BEPO SDL2? -flibit */, Keys.None }, - { '|' /* FIXME: Norwegian SDL2? -flibit */, Keys.OemPipe }, - { '+' /* FIXME: Norwegian SDL2? -flibit */, Keys.OemPlus }, - { 'ø' /* FIXME: Norwegian SDL2? -flibit */, Keys.OemSemicolon }, - { 'æ' /* FIXME: Norwegian SDL2? -flibit */, Keys.OemQuotes }, + { '²' /* FIXME: AZERTY SDL3? -flibit */, Keys.OemTilde }, + { 'é' /* FIXME: BEPO SDL3? -flibit */, Keys.None }, + { '|' /* FIXME: Norwegian SDL3? -flibit */, Keys.OemPipe }, + { '+' /* FIXME: Norwegian SDL3? -flibit */, Keys.OemPlus }, + { 'ø' /* FIXME: Norwegian SDL3? -flibit */, Keys.OemSemicolon }, + { 'æ' /* FIXME: Norwegian SDL3? -flibit */, Keys.OemQuotes }, { (int) SDL.SDL_Keycode.SDLK_UNKNOWN, Keys.None } }; private static Dictionary INTERNAL_scanMap = new Dictionary() @@ -2658,7 +2653,7 @@ private static Keys ToXNAKey(ref uint sym, ref SDL.SDL_Scancode scancode) } } FNALoggerEXT.LogWarn( - "KEY/SCANCODE MISSING FROM SDL2->XNA DICTIONARY: " + + "KEY/SCANCODE MISSING FROM SDL3->XNA DICTIONARY: " + sym.ToString() + " " + scancode.ToString() ); @@ -2682,14 +2677,14 @@ public static Keys GetKeyFromScancode(Keys scancode) return result; } FNALoggerEXT.LogWarn( - "KEYCODE MISSING FROM SDL2->XNA DICTIONARY: " + + "KEYCODE MISSING FROM SDL3->XNA DICTIONARY: " + sym.ToString() ); } else { FNALoggerEXT.LogWarn( - "SCANCODE MISSING FROM XNA->SDL2 DICTIONARY: " + + "SCANCODE MISSING FROM XNA->SDL3 DICTIONARY: " + scancode.ToString() ); }