The Battle for Wesnoth  1.19.0-dev
Namespaces | Functions
timer.hpp File Reference

Contains the gui2 timer routines. More...

#include <functional>
#include <SDL2/SDL_types.h>
Include dependency graph for timer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 gui2
 Generic file dialog.
 

Functions

std::size_t gui2::add_timer (const uint32_t interval, const std::function< void(std::size_t id)> &callback, const bool repeat=false)
 Adds a new timer. More...
 
bool gui2::remove_timer (const std::size_t id)
 Removes a timer. More...
 
bool gui2::execute_timer (const std::size_t id)
 Executes a timer. More...
 

Detailed Description

Contains the gui2 timer routines.

This code avoids the following problems with the sdl timers:

With these functions it's possible to remove the event between pushing in the queue and the actual execution. Since the callback is a std::function object it's possible to make the callback as fancy as wanted.

Definition in file timer.hpp.