This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Tortuga/client/splash.cpp
T
2013-05-15 23:20:47 +10:00

57 lines
1.2 KiB
C++

#include "splash.hpp"
#include <iostream>
using namespace std;
//-------------------------
//Public access members
//-------------------------
Splash::Splash() {
#ifdef DEBUG
cout << "entering Splash" << endl;
#endif
loaded = false;
start = clock();
configUtil = GetSingletonPtr<ConfigUtility>();
surfaceMgr = GetSingletonPtr<SurfaceManager>();
logo = new Image(surfaceMgr->Load("logo", configUtil->String("logos") + "/krstudios.bmp"));
}
Splash::~Splash() {
delete logo;
surfaceMgr->Free("logo");
#ifdef DEBUG
cout << "leaving Splash" << endl;
#endif
}
void Splash::RunFrame() {
//skip any event handling here
SDL_Event event;
while(SDL_PollEvent(&event));
//draw the logo in the middle of the screen
int x = (GetScreen()->w - logo->GetClipW()) / 2;
int y = (GetScreen()->h - logo->GetClipH()) / 2;
logo->DrawTo(GetScreen(),x,y);
SDL_Flip(GetScreen());
if (!loaded) {
LoadResources();
loaded = true;
}
if (clock() - start > CLOCKS_PER_SEC*3) {
SetNextScene(SceneList::MAINMENU);
}
}
void Splash::LoadResources() {
//load the global resources here
surfaceMgr->Load("font", configUtil->String("fonts") + "/pokemon_dark_font.bmp");
//TODO
}