Add background layer from IngameScene, not the base class.

This commit is contained in:
King_DuckZ 2017-03-15 21:58:24 +00:00
parent 9428e63fc2
commit b60bbf3739
2 changed files with 8 additions and 10 deletions

View File

@ -22,7 +22,6 @@
#include "sdlmain.hpp"
#include "rect.hpp"
#include "drawing_queue.hpp"
#include "draw_layer_names.hpp"
#include <cassert>
#include <SDL2/SDL.h>
#include <algorithm>
@ -79,9 +78,6 @@ namespace curry {
m_wants_to_quit(false)
{
assert(m_sdlmain);
const bool layer_added = m_drawing_queue->add_layer(DrawaLayerNames::Background);
assert(layer_added);
static_cast<void>(layer_added);
}
GameSceneBase::~GameSceneBase() noexcept = default;

View File

@ -45,6 +45,11 @@
namespace curry {
namespace {
void add_layer_assert_done (DrawingQueue& parDQ, DrawaLayerNames parName) {
const bool layer_added = parDQ.add_layer(parName);
assert(layer_added);
static_cast<void>(layer_added);
}
} //unnamed namespace
struct IngameScene::LocalData {
@ -62,9 +67,6 @@ namespace curry {
MovingObject player;
Character character;
WorldItems moveable_items;
#if !defined(NDEBUG)
std::size_t debug_layer_id;
#endif
};
IngameScene::IngameScene (cloonel::SDLMain* parSDLMain) :
@ -79,10 +81,10 @@ namespace curry {
inp.AddAction(ActionUp, Key(InputDevice_Keyboard, SDL_SCANCODE_UP), "Move up");
inp.AddAction(ActionRight, Key(InputDevice_Keyboard, SDL_SCANCODE_RIGHT), "Move right");
inp.AddAction(ActionDown, Key(InputDevice_Keyboard, SDL_SCANCODE_DOWN), "Move down");
add_layer_assert_done(drawing_queue(), DrawaLayerNames::Background);
#if !defined(NDEBUG)
const bool layer_added = drawing_queue().add_layer(DrawaLayerNames::Debug);
assert(layer_added);
static_cast<void>(layer_added);
add_layer_assert_done(drawing_queue(), DrawaLayerNames::Debug);
#endif
}