1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: Improve some error checking on SDL_Init and SDL_SetVideoMode.
Author: Barry deFreese <bdefreese@debian.org>
@@ -346,13 +346,16 @@
srand( (unsigned)time( NULL ) );
/* initialize SDL. */
- SDL_Init(SDL_INIT_VIDEO);
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ printf("Failed to initialized SDL: %s.\n", SDL_GetError());
/* set the title bar */
SDL_WM_SetCaption("MouseTrap", "MouseTrap");
/* create window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ if (screen == NULL)
+ printf("Failed to set video mode: %s.\n", SDL_GetError());
/* load sprite */
temp = loadImage((char *)"data/images/sprite.bmp");
|