Advertisement
Combreal

dumpRendererPicture.cpp

Dec 20th, 2020
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. switch (event.type)
  2. {
  3.     case SDL_KEYDOWN:
  4.         if (event.key.keysym.scancode == SDL_SCANCODE_S)
  5.         {
  6.             SDL_Surface* screenShot = SDL_CreateRGBSurface(0, 800, 600, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
  7.             if (screenShot)
  8.             {
  9.                 SDL_RenderReadPixels(renderer, NULL, SDL_GetWindowPixelFormat(window), screenShot->pixels, screenShot->pitch);
  10.                 SDL_SaveBMP(screenShot, "map.bmp");
  11.                 SDL_FreeSurface(screenShot);
  12.             }
  13.         }
  14.     case SDL_QUIT:
  15.         break;
  16.     default:
  17.         break;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement