Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "splash.h"
- using namespace std;
- bool Splash::Init(){
- // Init TTF for splash screen
- if(TTF_Init() == -1)
- return false;
- // At top left for white background
- background.x = background.y = 0;
- background.w = gameScreen->w;
- background.h = gameScreen->h;
- whiteColor = SDL_MapRGB(gameScreen->format, 255, 255, 255);
- return true;
- }
- void Splash::Event(SDL_Event* Event){
- if(Event->type == SDL_QUIT) // Quit Properly
- running = false;
- }
- void Splash::Loop(){
- // Clear screen to prevent ghosting
- SDL_FillRect(gameScreen, NULL, SDL_MapRGB(gameScreen->format, 0, 0, 0));
- SDL_FillRect(gameScreen, &background, whiteColor);
- ps->show();
- ps->showParticles();
- }
- void Splash::Render(){
- // Display the surface
- SDL_Flip(gameScreen);
- }
- void Splash::Cleanup(){
- TTF_Quit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement