eventqueue private inheritance

main
Benjamin Kraft 2 years ago
parent 3aa8bd2a02
commit fc59c8ccb9
  1. 6
      src/Game.cpp
  2. 2
      src/Queue.h

@ -66,8 +66,12 @@ Game::Game() {
for (auto & spec : spectators) for (auto & spec : spectators)
Game::eventQueue->registerListener(&spec); Game::eventQueue->registerListener(&spec);
InputWindow::inputQueue->registerListener(&player); InputWindow::inputQueue->registerListener(&player);
Game::eventQueue->registerListener(new Logger); auto logger = new Logger;
Game::eventQueue->registerListener(logger);
Game::eventQueue->unregisterListener(logger);
Game::eventQueue->registerListener(logger);
Game::eventQueue->registerListener(new RecordTracker); Game::eventQueue->registerListener(new RecordTracker);
instance = this; instance = this;
} }

@ -53,7 +53,7 @@ public:
template <typename EventType> template <typename EventType>
class EventQueue : protected Queue<EventType>{ class EventQueue : private Queue<EventType>{
std::set<Listener<EventType> *> listeners; std::set<Listener<EventType> *> listeners;
void update() override { void update() override {
EventType * event = this->pop(); EventType * event = this->pop();

Loading…
Cancel
Save