add reset_display function to manager, pump (allows late binding)

This makes it possible to move the game_events manager to the
game_state and construct it before the game_display.
This commit is contained in:
Chris Beck 2014-12-22 05:03:30 -05:00
parent 70ac93b9d8
commit 7ea08820c6
4 changed files with 16 additions and 0 deletions

View file

@ -241,4 +241,10 @@ game_events::t_pump & manager::pump()
return *pump_;
}
void manager::reset_display(game_display * gd)
{
resources_.screen = gd;
pump_->reset_display(gd);
}
} //end namespace game_events

View file

@ -134,6 +134,8 @@ namespace game_events {
void write_events(config& cfg);
game_events::t_pump & pump();
void reset_display(game_display *);
};
}

View file

@ -609,6 +609,11 @@ size_t t_pump::wml_tracking()
return impl_->internal_wml_tracking;
}
void t_pump::reset_display(game_display * gd)
{
impl_->resources.screen = gd;
}
t_pump::t_pump(manager & man, const t_context & res)
: impl_(new pump_impl(man, res))
{}

View file

@ -36,6 +36,7 @@
#include<string>
#include<sstream>
class game_display;
class vconfig;
namespace lg { class logger; }
@ -106,6 +107,8 @@ namespace game_events
*/
size_t wml_tracking();
void reset_display(game_display *);
private:
bool filter_event(const event_handler& handler, const queued_event& ev);