Advertisement
Kitomas

sdl test main.c

Aug 4th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. //main.c
  2. #define SDL_MAIN_HANDLED
  3. #include <SDL2/SDL.h>
  4. extern int printf(const char* fmt,...);
  5.  
  6. int main(int argc, char** argv){
  7.   if(SDL_Init(SDL_INIT_VIDEO)){
  8.     printf("SDL failed to initialize: \"%s\"\n",SDL_GetError());
  9.     return 1;
  10.   };
  11.  
  12.   //(occurs only if init above succeeds)
  13.   SDL_Window* window=SDL_CreateWindow("Hello World!",
  14.                                       SDL_WINDOWPOS_CENTERED,
  15.                                       SDL_WINDOWPOS_CENTERED,
  16.                                       640,480, 0);
  17.  
  18.   SDL_Delay(1000);
  19.  
  20.   if(window != NULL) SDL_DestroyWindow(window);
  21.  
  22.   SDL_Quit();
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement