The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Functions | Variables
timer.cpp File Reference
#include "gui/core/timer.hpp"
#include "events.hpp"
#include "gui/core/log.hpp"
#include <SDL_timer.h>
#include <map>
Include dependency graph for timer.cpp:

Go to the source code of this file.

Classes

struct  gui2::ttimer
 
class  gui2::texecutor
 Helper to make removing a timer in a callback safe. More...
 

Namespaces

 gui2
 A class inherited from ttext_box that displays its input as stars.
 

Functions

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

Variables

static size_t gui2::id = 0
 Ids for the timers. More...
 
static std::map< size_t, ttimer > gui2::timers
 The active timers. More...
 
static size_t gui2::executing_id = 0
 The id of the event being executed, 0 if none. More...
 
static bool gui2::executing_id_removed = false
 Did somebody try to remove the timer during its execution? More...