sdl: stub off functions that need to be rewritten for SDL2

sdl: sdl2 now compiles (albeit does not work whatsoever at this point)
(TODO: write InitVideo for SDL2)
This commit is contained in:
punkrockguy318 2013-06-27 01:58:10 +00:00
parent de7c3e26b2
commit 20702c7267
3 changed files with 27 additions and 4 deletions

View File

@ -2154,7 +2154,9 @@ gint convertKeypress(GtkWidget *grab, GdkEventKey *event, gpointer user_data)
if(keystate == 0 || gtk_window_is_active(GTK_WINDOW(MainWindow))) if(keystate == 0 || gtk_window_is_active(GTK_WINDOW(MainWindow)))
{ {
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate; // Not sure how to do this yet with SDL 2.0
// TODO - SDL 2.0
//SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate;
#else #else
SDL_GetKeyState(NULL)[sdlkey] = keystate; SDL_GetKeyState(NULL)[sdlkey] = keystate;
#endif #endif

View File

@ -433,7 +433,7 @@ unsigned int *GetKeyboard(void)
{ {
int size = 256; int size = 256;
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
Uint8* keystate = SDL_GetKeyboardState(&size); Uint8* keystate = (Uint8*)SDL_GetKeyboardState(&size);
#else #else
Uint8* keystate = SDL_GetKeyState(&size); Uint8* keystate = SDL_GetKeyState(&size);
#endif #endif
@ -450,7 +450,7 @@ static void KeyboardCommands ()
char *movie_fname = ""; char *movie_fname = "";
// get the keyboard input // get the keyboard input
#if SDL_VERSION_ATLEAST(1, 3, 0) #if SDL_VERSION_ATLEAST(1, 3, 0)
g_keyState = SDL_GetKeyboardState (NULL); g_keyState = (Uint8*)SDL_GetKeyboardState (NULL);
#else #else
g_keyState = SDL_GetKeyState (NULL); g_keyState = SDL_GetKeyState (NULL);
#endif #endif

View File

@ -147,6 +147,15 @@ void FCEUD_VideoChanged()
else else
PAL = 0; PAL = 0;
} }
#if SDL_VERSION_ATLEAST(2, 0, 0)
int InitVideo(FCEUGI *gi)
{
// This is a big TODO. Stubbing this off into its own function,
// as the SDL surface routines have changed drastically in SDL2
// TODO - SDL2
}
#else
/** /**
* Attempts to initialize the graphical video display. Returns 0 on * Attempts to initialize the graphical video display. Returns 0 on
* success, -1 on failure. * success, -1 on failure.
@ -494,6 +503,7 @@ InitVideo(FCEUGI *gi)
} }
return 0; return 0;
} }
#endif
/** /**
* Toggles the full-screen display. * Toggles the full-screen display.
@ -580,11 +590,14 @@ static void RedoPalette()
SetPaletteBlitToHigh((uint8*)s_psdl); SetPaletteBlitToHigh((uint8*)s_psdl);
} else } else
{ {
#if SDL_VERSION_ATLEAST(2, 0, 0)
//TODO - SDL2
#else
SDL_SetPalette(s_screen, SDL_PHYSPAL, s_psdl, 0, 256); SDL_SetPalette(s_screen, SDL_PHYSPAL, s_psdl, 0, 256);
#endif
} }
} }
} }
// XXX soules - console lock/unlock unimplemented? // XXX soules - console lock/unlock unimplemented?
///Currently unimplemented. ///Currently unimplemented.
@ -693,8 +706,12 @@ BlitScreen(uint8 *XBuf)
} }
// ensure that the display is updated // ensure that the display is updated
#if SDL_VERSION_ATLEAST(2, 0, 0)
//TODO - SDL2
#else
SDL_UpdateRect(s_screen, xo, yo, SDL_UpdateRect(s_screen, xo, yo,
(Uint32)(NWIDTH * s_exs), (Uint32)(s_tlines * s_eys)); (Uint32)(NWIDTH * s_exs), (Uint32)(s_tlines * s_eys));
#endif
#ifdef CREATE_AVI #ifdef CREATE_AVI
#if 0 /* PAL INTO NTSC HACK */ #if 0 /* PAL INTO NTSC HACK */
@ -770,10 +787,14 @@ BlitScreen(uint8 *XBuf)
#endif #endif
#endif #endif
#if SDL_VERSION_ATLEAST(2, 0, 0)
// TODO
#else
// have to flip the displayed buffer in the case of double buffering // have to flip the displayed buffer in the case of double buffering
if(s_screen->flags & SDL_DOUBLEBUF) { if(s_screen->flags & SDL_DOUBLEBUF) {
SDL_Flip(s_screen); SDL_Flip(s_screen);
} }
#endif
} }
/** /**