SHARE
TWEET

Untitled

a guest Feb 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SDL.h>
  2. #include <cstdio>
  3. #include <iostream>
  4.  
  5. const int SCREEN_WIDTH = 640;
  6. const int SCREEN_HEIGHT = 480;
  7.  
  8.  
  9. int main(int argc, char* args[])
  10. {
  11.     SDL_Window* window = NULL;
  12.     SDL_Surface* screenSurface = NULL;
  13.    
  14.  
  15.     if (SDL_Init(SDL_INIT_VIDEO) < 0)
  16.     {
  17.         printf("Ошибка при запуске SDL! SDL Error: %s\n", SDL_GetError());
  18.     }
  19.     else
  20.     {
  21.         window = SDL_CreateWindow("Parkhomenko", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
  22.         if (window == NULL)
  23.         {
  24.             printf("Окно не может быть создано! SDL Error: %s\n", SDL_GetError());
  25.         }
  26.         else
  27.         {
  28.             screenSurface = SDL_GetWindowSurface(window);
  29.             SDL_FillRect (screenSurface, NULL, SDL_MapRGB(screenSurface->format, 146, 208, 80));
  30.             SDL_UpdateWindowSurface(window);
  31.             SDL_Surface *myImage = SDL_LoadBMP("Burger.bmp");
  32.             if (myImage == NULL)
  33.             {
  34.                 printf("error");
  35.             }
  36.             SDL_Rect dest;
  37.             dest.x = 160;
  38.             dest.y = 160;
  39.             SDL_BlitSurface(myImage, NULL, screenSurface, &dest);
  40.             SDL_Delay(2000);
  41.         }
  42.     }
  43.     SDL_DestroyWindow(window);
  44.     SDL_Quit();
  45.  
  46.     return 0;
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top