Splash screen loads and displays correctly

This commit is contained in:
Kayne Ruse
2013-06-12 19:15:37 +10:00
parent cbd388f4ed
commit f3ec4d4d8e
3 changed files with 52 additions and 46 deletions
+32 -36
View File
@@ -12,9 +12,11 @@ SplashScreen::SplashScreen() {
#ifdef DEBUG
cout << "entering SplashScreen" << endl;
#endif
logo.SetSurface(surfaceMgr->Load("splash-logo", configUtil->String("logos") + "/krstudios.bmp"));
}
SplashScreen::~SplashScreen() {
surfaceMgr->Free("splash-logo");
#ifdef DEBUG
cout << "leaving SplashScreen" << endl;
#endif
@@ -24,46 +26,40 @@ SplashScreen::~SplashScreen() {
//Frame loop
//-------------------------
void SplashScreen::FrameStart() {
//
}
void SplashScreen::RunFrame(double delta) {
HandleEvents();
if (!loaded) {
//never repeat this
loaded = true;
void SplashScreen::Update(double delta) {
//
}
//quick draw
RenderFrame();
void SplashScreen::FrameEnd() {
//
}
LoadResources();
}
void SplashScreen::Render(SDL_Surface* const screen) {
//
}
//-------------------------
//Event handlers
//-------------------------
void SplashScreen::MouseMotion(SDL_MouseMotionEvent const& motion) {
//
}
void SplashScreen::MouseButtonDown(SDL_MouseButtonEvent const& button) {
//
}
void SplashScreen::MouseButtonUp(SDL_MouseButtonEvent const& button) {
//
}
void SplashScreen::KeyDown(SDL_KeyboardEvent const& key) {
switch(key.keysym.sym) {
case SDLK_ESCAPE:
QuitEvent();
break;
if (Clock::now() - start > std::chrono::duration<int>(1)) {
SetNextScene(SceneList::MAINMENU);
}
}
void SplashScreen::KeyUp(SDL_KeyboardEvent const& key) {
//
void SplashScreen::RenderFrame() {
SDL_FillRect(GetScreen(), 0, 0);
int x = (GetScreen()->w - logo.GetClipW()) / 2;
int y = (GetScreen()->h - logo.GetClipH()) / 2;
logo.DrawTo(GetScreen(), x, y);
SDL_Flip(GetScreen());
}
void SplashScreen::LoadResources() {
//standard
surfaceMgr->Load("font", configUtil->String("fonts") + "/pokemon_dark_font.bmp");
surfaceMgr->Load("button", configUtil->String("interface") + "/button.bmp");
//debugging
surfaceMgr->Load("elliot", configUtil->String("sprites") + "/elliot2.bmp");
surfaceMgr->Load("coa", configUtil->String("sprites") + "/coa2.bmp");
surfaceMgr->Load("flower", configUtil->String("sprites") + "/aniflower.bmp");
surfaceMgr->Load("terrain", configUtil->String("tilesets") + "/terrain.bmp");
//TODO
}