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 "sdlmain.hpp"
#include "rect.hpp" #include "rect.hpp"
#include "drawing_queue.hpp" #include "drawing_queue.hpp"
#include "draw_layer_names.hpp"
#include <cassert> #include <cassert>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <algorithm> #include <algorithm>
@ -79,9 +78,6 @@ namespace curry {
m_wants_to_quit(false) m_wants_to_quit(false)
{ {
assert(m_sdlmain); 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; GameSceneBase::~GameSceneBase() noexcept = default;

View file

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