Rename events::pump to events::run_event_loop

To make its purpose clearer.
This commit is contained in:
Charles Dang 2018-03-20 11:26:54 +11:00
parent 123dd952c0
commit 625135eb0d
10 changed files with 16 additions and 16 deletions

View File

@ -142,7 +142,7 @@ namespace
animator.start_animations(); animator.start_animations();
animator.wait_for_end(); animator.wait_for_end();
animator.set_all_standing(); animator.set_all_standing();
events::pump(); events::run_event_loop();
} }
return true; return true;

View File

@ -255,7 +255,7 @@ void controller_base::play_slice(bool is_delay_enabled)
l->play_slice(); l->play_slice();
} }
events::pump(); events::run_event_loop();
events::raise_process_event(); events::raise_process_event();
// Update sound sources before scrolling // Update sound sources before scrolling

View File

@ -1593,7 +1593,7 @@ void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_ty
double velocity = 0.0; double velocity = 0.0;
while (dist_moved < dist_total) { while (dist_moved < dist_total) {
events::pump(); events::run_event_loop();
int t = SDL_GetTicks(); int t = SDL_GetTicks();
double dt = (t - t_prev) / 1000.0; double dt = (t - t_prev) / 1000.0;

View File

@ -417,7 +417,7 @@ void finalize()
// TODO: I'm uncertain if this is always safe to call at static init; maybe set in main() instead? // TODO: I'm uncertain if this is always safe to call at static init; maybe set in main() instead?
static const boost::thread::id main_thread = boost::this_thread::get_id(); static const boost::thread::id main_thread = boost::this_thread::get_id();
void pump() void run_event_loop()
{ {
if(boost::this_thread::get_id() != main_thread) { if(boost::this_thread::get_id() != main_thread) {
// Can only call this on the main thread! // Can only call this on the main thread!
@ -620,7 +620,7 @@ void pump()
video.render_screen(); video.render_screen();
// Inform the pump monitors that an events::pump() has occurred // Inform the pump monitors that an events::run_event_loop() has occurred
for(auto monitor : pump_monitors) { for(auto monitor : pump_monitors) {
monitor->process(info); monitor->process(info);
} }

View File

@ -128,7 +128,7 @@ struct event_context
}; };
//causes events to be dispatched to all handler objects. //causes events to be dispatched to all handler objects.
void pump(); void run_event_loop();
//look for resize events and update references to the screen area //look for resize events and update references to the screen area
void peek_for_resize(); void peek_for_resize();
@ -142,7 +142,7 @@ private:
}; };
class pump_monitor { class pump_monitor {
//pump_monitors receive notification after an events::pump() occurs //pump_monitors receive notification after an events::run_event_loop() occurs
public: public:
pump_monitor(); pump_monitor();
virtual ~pump_monitor(); virtual ~pump_monitor();

View File

@ -70,7 +70,7 @@ static uint32_t timer_sdl_poll_events(uint32_t, void*)
{ {
try try
{ {
events::pump(); events::run_event_loop();
} }
catch(CVideo::quit&) catch(CVideo::quit&)
{ {

View File

@ -469,7 +469,7 @@ void window::show_non_modal(/*const unsigned auto_close_timeout*/)
invalidate_layout(); invalidate_layout();
suspend_drawing_ = false; suspend_drawing_ = false;
events::pump(); events::run_event_loop();
} }
int window::show(const unsigned auto_close_timeout) int window::show(const unsigned auto_close_timeout)
@ -518,7 +518,7 @@ int window::show(const unsigned auto_close_timeout)
for(status_ = SHOWING; status_ != CLOSED;) { for(status_ = SHOWING; status_ != CLOSED;) {
// process installed callback if valid, to allow e.g. network // process installed callback if valid, to allow e.g. network
// polling // polling
events::pump(); events::run_event_loop();
if(!mouse_button_state_initialized) { if(!mouse_button_state_initialized) {
/* /*

View File

@ -94,7 +94,7 @@ static void teleport_unit_between(const map_location& a, const map_location& b,
temp_unit.anim_comp().set_standing(); temp_unit.anim_comp().set_standing();
disp.draw_debugging_aids(); disp.draw_debugging_aids();
events::pump(); events::run_event_loop();
} }
/** /**

View File

@ -167,8 +167,8 @@ private:
/** Renders the screen. */ /** Renders the screen. */
void render_screen(); void render_screen();
/** events::pump() is the only place that should call render_screen(). */ /** events::run_event_loop() is the only place that should call render_screen(). */
friend void events::pump(); friend void events::run_event_loop();
public: public:
void render_copy(const texture& txt, void render_copy(const texture& txt,

View File

@ -677,7 +677,7 @@ static int do_gameloop(const std::vector<std::string>& args)
} }
events::initialise(); events::initialise();
events::pump(); events::run_event_loop();
res = image::update_from_preferences(); res = image::update_from_preferences();
if(res == false) { if(res == false) {
@ -685,7 +685,7 @@ static int do_gameloop(const std::vector<std::string>& args)
return 1; return 1;
} }
events::pump(); events::run_event_loop();
if(preferences::joystick_support_enabled()) { if(preferences::joystick_support_enabled()) {
res = game->init_joystick(); res = game->init_joystick();
@ -698,7 +698,7 @@ static int do_gameloop(const std::vector<std::string>& args)
const cursor::manager cursor_manager; const cursor::manager cursor_manager;
cursor::set(cursor::WAIT); cursor::set(cursor::WAIT);
events::pump(); events::run_event_loop();
#if(defined(_X11) && !defined(__APPLE__)) || defined(_WIN32) #if(defined(_X11) && !defined(__APPLE__)) || defined(_WIN32)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);