test/testshape.c
changeset 11111 0841489fa4df
parent 11080 1677ac34c68c
child 11811 5d94cb6b24d3
equal deleted inserted replaced
11110:db5c09aa4fd4 11111:0841489fa4df
   152     SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name);
   152     SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name);
   153     SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
   153     SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
   154     SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
   154     SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
   155     SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
   155     SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
   156     while(should_exit == 0) {
   156     while(should_exit == 0) {
   157         if (SDL_PollEvent(&event)) {
   157         while (SDL_PollEvent(&event)) {
   158             if(event.type == SDL_KEYDOWN) {
   158             if(event.type == SDL_KEYDOWN) {
   159                 button_down = 1;
   159                 button_down = 1;
   160                 if(event.key.keysym.sym == SDLK_ESCAPE) {
   160                 if(event.key.keysym.sym == SDLK_ESCAPE) {
   161                     should_exit = 1;
   161                     should_exit = 1;
   162                     break;
   162                     break;
   170                 SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name);
   170                 SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name);
   171                 SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
   171                 SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
   172                 SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
   172                 SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
   173                 SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
   173                 SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
   174             }
   174             }
   175             if(event.type == SDL_QUIT)
   175             if (event.type == SDL_QUIT) {
   176                 should_exit = 1;
   176                 should_exit = 1;
       
   177                 break;
       
   178             }
   177         }
   179         }
   178         render(renderer,pictures[current_picture].texture,texture_dimensions);
   180         render(renderer,pictures[current_picture].texture,texture_dimensions);
   179         SDL_Delay(10);
   181         SDL_Delay(10);
   180     }
   182     }
   181 
   183