Implemented TitleScreen::init()
This commit is contained in:
parent
6a4b1c4cf2
commit
7e17865c2a
1
game.cpp
1
game.cpp
|
@ -16,6 +16,7 @@ Game::Game(SDL_Surface* display)
|
||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
{
|
{
|
||||||
|
if (background != NULL)
|
||||||
SDL_FreeSurface(background);
|
SDL_FreeSurface(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "titlescreen.h"
|
#include "titlescreen.h"
|
||||||
|
#include "drawutils.h"
|
||||||
|
|
||||||
TitleScreen::TitleScreen(SDL_Surface* display)
|
TitleScreen::TitleScreen(SDL_Surface* display)
|
||||||
: GameState(display)
|
: GameState(display)
|
||||||
|
@ -20,7 +21,25 @@ GameState::~GameState()
|
||||||
|
|
||||||
bool TitleScreen::init()
|
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