test/testshape.c
changeset 7678 286c42d7c5ed
parent 7677 871d43c6968a
child 7720 f9a649383362
equal deleted inserted replaced
7677:871d43c6968a 7678:286c42d7c5ed
    27     SDL_WindowShapeMode mode;
    27     SDL_WindowShapeMode mode;
    28 } LoadedPicture;
    28 } LoadedPicture;
    29 
    29 
    30 void render(SDL_Renderer *renderer,SDL_Texture *texture,SDL_Rect texture_dimensions)
    30 void render(SDL_Renderer *renderer,SDL_Texture *texture,SDL_Rect texture_dimensions)
    31 {
    31 {
    32     /*Clear render-target to blue. */
    32     /* Clear render-target to blue. */
    33     SDL_SetRenderDrawColor(renderer,0x00,0x00,0xff,0xff);
    33     SDL_SetRenderDrawColor(renderer,0x00,0x00,0xff,0xff);
    34     SDL_RenderClear(renderer);
    34     SDL_RenderClear(renderer);
    35 
    35 
    36     /*Render the texture. */
    36     /* Render the texture. */
    37     SDL_RenderCopy(renderer,texture,&texture_dimensions,&texture_dimensions);
    37     SDL_RenderCopy(renderer,texture,&texture_dimensions,&texture_dimensions);
    38 
    38 
    39     SDL_RenderPresent(renderer);
    39     SDL_RenderPresent(renderer);
    40 }
    40 }
    41 
    41 
   186         render(renderer,pictures[current_picture].texture,texture_dimensions);
   186         render(renderer,pictures[current_picture].texture,texture_dimensions);
   187         SDL_Delay(time_left());
   187         SDL_Delay(time_left());
   188         next_time += TICK_INTERVAL;
   188         next_time += TICK_INTERVAL;
   189     }
   189     }
   190 
   190 
   191     /*Free the textures. */
   191     /* Free the textures. */
   192     for(i=0;i<num_pictures;i++)
   192     for(i=0;i<num_pictures;i++)
   193         SDL_DestroyTexture(pictures[i].texture);
   193         SDL_DestroyTexture(pictures[i].texture);
   194     SDL_DestroyRenderer(renderer);
   194     SDL_DestroyRenderer(renderer);
   195     /*Destroy the window. */
   195     /* Destroy the window. */
   196     SDL_DestroyWindow(window);
   196     SDL_DestroyWindow(window);
   197     /*Free the original surfaces backing the textures. */
   197     /* Free the original surfaces backing the textures. */
   198     for(i=0;i<num_pictures;i++)
   198     for(i=0;i<num_pictures;i++)
   199         SDL_FreeSurface(pictures[i].surface);
   199         SDL_FreeSurface(pictures[i].surface);
   200     SDL_free(pictures);
   200     SDL_free(pictures);
   201     /*Call SDL_VideoQuit() before quitting. */
   201     /* Call SDL_VideoQuit() before quitting. */
   202     SDL_VideoQuit();
   202     SDL_VideoQuit();
   203 
   203 
   204     return 0;
   204     return 0;
   205 }
   205 }
   206 
   206