diff -r 6bb657898f55 test/testjoystick.c --- a/test/testjoystick.c Tue Feb 28 21:58:36 2012 -0500 +++ b/test/testjoystick.c Fri Mar 30 18:48:49 2012 +0200 @@ -12,7 +12,7 @@ /* Simple program to test the SDL joystick routines */ -#if 1 /* FIXME: Rework this using the 2.0 API */ +#if 0 /* FIXME: Rework this using the 2.0 API */ #include int main(int argc, char *argv[]) @@ -38,7 +38,8 @@ void WatchJoystick(SDL_Joystick * joystick) { - SDL_Surface *screen; + SDL_Window *window; + SDL_Surface* screen; const char *name; int i, done; SDL_Event event; @@ -46,9 +47,20 @@ SDL_Rect axis_area[6][2]; /* Set a video mode to display joystick axis position */ - screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, 0); + window = SDL_CreateWindow( + "testjoystick", + SDL_WINDOWPOS_CENTERED, + SDL_WINDOWPOS_CENTERED, + SCREEN_WIDTH, SCREEN_HEIGHT, + SDL_WINDOW_SHOWN ); + if (window == NULL) { + fprintf(stderr, "Couldn't create window: %s\n", SDL_GetError()); + return; + } + + screen = SDL_GetWindowSurface( window ); if (screen == NULL) { - fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError()); + fprintf(stderr, "Couldn't get window surface: %s\n", SDL_GetError()); return; } @@ -127,7 +139,7 @@ } else { SDL_FillRect(screen, &area, 0x0000); } - SDL_UpdateRects(screen, 1, &area); + SDL_UpdateWindowSurfaceRects(window, &area, 1); } for (i = 0; @@ -161,7 +173,7 @@ axis_area[i][draw].h = 16; SDL_FillRect(screen, &axis_area[i][draw], 0xFFFF); - SDL_UpdateRects(screen, 2, axis_area[i]); + SDL_UpdateWindowSurfaceRects(window, axis_area[i],2); } } }