Want more features on Pastebin? Sign Up, it's FREE!
Guest

Splash Class

By: a guest on Aug 7th, 2012  |  syntax: C++  |  size: 0.80 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data