test/testgesture.c
changeset 9289 5f857c00d25d
parent 9287 644bf5f51d5c
child 9290 fe975b2313fa
equal deleted inserted replaced
9288:573ebcb470a3 9289:5f857c00d25d
    37 
    37 
    38 
    38 
    39 static int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF};
    39 static int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF};
    40 
    40 
    41 SDL_Surface *screen;
    41 SDL_Surface *screen;
       
    42 SDL_Window *window;
    42 SDL_bool quitting = SDL_FALSE;
    43 SDL_bool quitting = SDL_FALSE;
    43 
    44 
    44 typedef struct {
    45 typedef struct {
    45   float x,y;
    46   float x,y;
    46 } Point;
    47 } Point;
   159 {
   160 {
   160   if (!window) {
   161   if (!window) {
   161     window = SDL_CreateWindow("Gesture Test",
   162     window = SDL_CreateWindow("Gesture Test",
   162                               SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
   163                               SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
   163                               width, height, SDL_WINDOW_RESIZABLE);
   164                               width, height, SDL_WINDOW_RESIZABLE);
   164   }
       
   165   if (!window) {
       
   166     return NULL;
       
   167   }
   165   }
   168   return window;
   166   return window;
   169 }
   167 }
   170 
   168 
   171 void loop()
   169 void loop()
   285   {
   283   {
   286       SDL_Quit();
   284       SDL_Quit();
   287       return 1;
   285       return 1;
   288   }
   286   }
   289 
   287 
       
   288   if (!(window = initWindow(NULL,WIDTH,HEIGHT)))
       
   289   {
       
   290       SDL_Quit();
       
   291       return 1;
       
   292   }
       
   293 
   290 #ifdef __EMSCRIPTEN__
   294 #ifdef __EMSCRIPTEN__
   291     emscripten_set_main_loop(loop, 0, 1);
   295     emscripten_set_main_loop(loop, 0, 1);
   292 #else
   296 #else
   293     while(!quitting) {
   297     while(!quitting) {
   294         loop();
   298         loop();