Advertisement
Guest User

Splash Class

a guest
Aug 7th, 2012
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include "splash.h"
  2.  
  3. using namespace std;
  4.  
  5. bool Splash::Init(){
  6.     // Init TTF for splash screen
  7.     if(TTF_Init() == -1)
  8.         return false;
  9.     // At top left for white background
  10.     background.x = background.y = 0;
  11.     background.w = gameScreen->w;
  12.     background.h = gameScreen->h;
  13.     whiteColor = SDL_MapRGB(gameScreen->format, 255, 255, 255);
  14.     return true;
  15. }
  16.  
  17. void Splash::Event(SDL_Event* Event){
  18.     if(Event->type == SDL_QUIT) // Quit Properly
  19.         running = false;
  20. }
  21.  
  22. void Splash::Loop(){
  23.     // Clear screen to prevent ghosting
  24.     SDL_FillRect(gameScreen, NULL, SDL_MapRGB(gameScreen->format, 0, 0, 0));
  25.     SDL_FillRect(gameScreen, &background, whiteColor);
  26.     ps->show();
  27.     ps->showParticles();
  28. }
  29.  
  30. void Splash::Render(){
  31.     // Display the surface
  32.     SDL_Flip(gameScreen);
  33. }
  34.  
  35. void Splash::Cleanup(){
  36.     TTF_Quit();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement