Advertisement
Guest User

Untitled

a guest
May 25th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. int Game::Init()
  2. {
  3.    
  4.    
  5.     if (SDL_Init(SDL_INIT_VIDEO) < 0)
  6.     {//If video fails, send failure signal.
  7.         return -1;
  8.     }
  9.  
  10.     win = SDL_CreateWindow ("Space Warriors",
  11.     /*Make windows for game
  12.      * 800x600 screen
  13.      * Position = center
  14.     */                      SDL_WINDOWPOS_UNDEFINED,
  15.                             SDL_WINDOWPOS_UNDEFINED,
  16.                             800,600,
  17.                             SDL_WINDOW_SHOWN);
  18.    
  19.     if (win == NULL)
  20.     {
  21.         return -1;
  22.     }
  23.    
  24.     screen = SDL_GetWindowSurface(win);
  25.    
  26.     SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255) );
  27.    
  28.     if (playerShip.Init() == -1)
  29.     {
  30.         return -1;
  31.     }
  32.  
  33.     Asteroid t;
  34.     asteroids.push_back(t);
  35.    
  36.     if(asteroids[0].Init() == -1)
  37.     {
  38.         return 1;
  39.     }    
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement