History

Better SDL version checking

Olav Sørensen committed 4 years ago

Commit ef1339a1 parent d9f3b8e1 file · +7 −6Browse files

Unified · Split

src/ft2_main.c+7−6
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) · 59 unmodified lines
6060 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
6161 #endif
6262
63−#if SDL_PATCHLEVEL < 5
63+#if SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION == 0 && SDL_PATCHLEVEL < 5
6464 #pragma message("WARNING: The SDL2 dev lib is older than ver 2.0.5. You'll get fullscreen mode issues and no audio input sampling.")
6565 #pragma message("At least version 2.0.7 is recommended.")
6666 #endif
@@ -93,12 +93,13 @@ int main(int argc, char *argv[]) · 26 unmodified lines
9393 }
9494 #endif
9595
96−#if SDL_PATCHLEVEL >= 4 // SDL 2.0.4 or later
97− SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1"); // windows only - prevent ALT+F4 from exiting (FT2 uses ALT+F4)
96+#ifdef _WIN32
97+
98+ // ALT+F4 is used in FT2, but is "close program" in Windows...
99+#if SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION >= 0 && SDL_PATCHLEVEL >= 4
100+ SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1");
98101 #endif
99102
100−#ifdef _WIN32
101−
102103 #ifndef _MSC_VER
103104 SetProcessDPIAware();
104105 #endif
@@ -126,7 +127,7 @@ int main(int argc, char *argv[]) · 21 unmodified lines
126127 ** reinitialized in Windows and what not.
127128 ** Ref.: https://bugzilla.libsdl.org/show_bug.cgi?id=4391
128129 */
129−#if defined _WIN32 && SDL_PATCHLEVEL == 9
130+#if defined _WIN32 && SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION == 0 && SDL_PATCHLEVEL == 9
130131 if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
131132 #else
132133 if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) != 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t