Advertisement
J3st3rs_j0k3

323

Sep 20th, 2022
876
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 1
  1. #include<SDL.h>
  2.  
  3. const int SCREEN_WIDTH = 640;
  4. const int SCREEN_HEIGHT = 480;
  5.  
  6. int main(int argc, char* argv[])
  7. {
  8.     if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
  9.     {
  10.         return 1;
  11.     }
  12.  
  13.     SDL_Surface* screen_surface = NULL;
  14.  
  15.     SDL_Window* window = NULL;
  16.  
  17.     window = SDL_CreateWindow("Hello, SDL 2!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
  18.  
  19.     if (window == NULL) {
  20.  
  21.         return 1;
  22.  
  23.     }
  24.     screen_surface = SDL_GetWindowSurface(window);
  25.     SDL_FillRect(screen_surface, NULL, SDL_MapRGB(screen_surface->format, 0, 255, 0));
  26.     SDL_UpdateWindowSurface(window);
  27.     SDL_Delay(2000);
  28.     SDL_DestroyWindow(window);
  29.     SDL_Quit();
  30.     return 0;
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement