Implemented TitleScreen::init()
This commit is contained in:
parent
6a4b1c4cf2
commit
7e17865c2a
3
game.cpp
3
game.cpp
|
@ -16,7 +16,8 @@ Game::Game(SDL_Surface* display)
|
|||
|
||||
Game::~Game()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
if (background != NULL)
|
||||
SDL_FreeSurface(background);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user