Implemented TitleScreen::init()

This commit is contained in:
Anna Rose 2011-06-28 21:44:28 -04:00
parent 6a4b1c4cf2
commit 7e17865c2a
2 changed files with 21 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Game::Game(SDL_Surface* display)
Game::~Game()
{
if (background != NULL)
SDL_FreeSurface(background);
}

View File

@ -1,4 +1,5 @@
#include "titlescreen.h"
#include "drawutils.h"
TitleScreen::TitleScreen(SDL_Surface* display)
: GameState(display)
@ -20,7 +21,25 @@ GameState::~GameState()
bool TitleScreen::init()
{
background = DrawUtils::load("background.bmp");
if (background == NULL)
{
#ifdef DEBUG
std::cerr << "debug: TitleScreen::init(): error: Couldn't load background image\n";
#endif
return false;
}
title_banner = DrawUtils::load("title.bmp");
if (title_banner == NULL)
{
#ifdef DEBUG
std::cerr << "debug: TitleScreen::init(): error: Couldn't load title banner\n";
#endif
return false;
}
}