Fix SDL2 build errors

This commit is contained in:
Michael Martin
2020-04-03 23:30:10 -07:00
parent f2a7328037
commit 75da16d99e
4 changed files with 20 additions and 62 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
// first match wins
// add better platform techs to the top
#ifdef MMX_ASM
if ( (!force_platform && (SDL_HasSSE () || SDL_HasMMXExt ()))
if ( (!force_platform && (SDL_HasSSE () || SDL_HasMMX ()))
|| force_platform == PLATFORM_SSE)
{
log_add (log_Info, "Screen scalers are using SSE/MMX-Ext/MMX code");
+11
View File
@@ -260,6 +260,17 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height)
return 0;
}
void
TFB_Pure_UninitGraphics (void)
{
if (renderer) {
SDL_DestroyRenderer (renderer);
}
if (window) {
SDL_DestroyWindow (window);
}
}
static void
TFB_SDL2_UploadTransitionScreen (void)
{
+2 -50
View File
@@ -50,61 +50,13 @@ TFB_GRAPHICS_BACKEND *graphics_backend = NULL;
volatile int QuitPosted = 0;
volatile int GameActive = 1; // Track the SDL_ACTIVEEVENT state SDL_APPACTIVE
int
TFB_ReInitGraphics (int driver, int flags, int width, int height)
{
int result;
int togglefullscreen = 0;
char caption[200];
if (GfxFlags == (flags ^ TFB_GFXFLAGS_FULLSCREEN) &&
driver == GraphicsDriver &&
width == ScreenWidthActual && height == ScreenHeightActual)
{
togglefullscreen = 1;
}
GfxFlags = flags;
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
{
#ifdef HAVE_OPENGL
result = TFB_GL_ConfigureVideo (driver, flags, width, height,
togglefullscreen);
#else
driver = TFB_GFXDRIVER_SDL_PURE;
log_add (log_Warning, "OpenGL support not compiled in,"
" so using pure SDL driver");
result = TFB_Pure_ConfigureVideo (driver, flags, width, height,
togglefullscreen);
#endif
}
else
{
result = TFB_Pure_ConfigureVideo (driver, flags, width, height,
togglefullscreen);
}
sprintf (caption, "The Ur-Quan Masters v%d.%d.%d%s",
UQM_MAJOR_VERSION, UQM_MINOR_VERSION,
UQM_PATCH_VERSION, UQM_EXTRA_VERSION);
SDL_WM_SetCaption (caption, NULL);
if (flags & TFB_GFXFLAGS_FULLSCREEN)
SDL_ShowCursor (SDL_DISABLE);
else
SDL_ShowCursor (SDL_ENABLE);
return result;
}
int
TFB_InitGraphics (int driver, int flags, int width, int height)
{
int i, result;
int result, i;
char caption[200];
/* Null out screen pointers for the first time */
/* Null out screen pointers the first time */
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
{
SDL_Screens[i] = NULL;
+6 -11
View File
@@ -220,19 +220,13 @@ TFB_SetInputVectors (volatile int menu[], int num_menu_, volatile int flight[],
num_flight = num_flight_;
}
#ifdef HAVE_JOYSTICK
static void
initJoystick (void)
{
int nJoysticks;
#if SDL_MAJOR_VERSION == 1
SDL_EnableUNICODE(1);
(void)SDL_GetKeyState (&num_keys);
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
#endif
#ifdef HAVE_JOYSTICK
if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1)
{
log_add (log_Fatal, "Couldn't initialize joystick subsystem: %s",
@@ -269,14 +263,15 @@ TFB_InitInput (int driver, int flags)
(void)driver;
(void)flags;
#if SDL_MAJOR_VERSION == 1
SDL_EnableUNICODE(1);
(void)SDL_GetKeyState (&num_keys);
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
#endif
#ifdef HAVE_JOYSTICK
#ifdef HAVE_JOYSTICK
initJoystick ();
#endif /* HAVE_JOYSTICK */
#endif
in_character_mode = FALSE;
resetKeyboardState ();