The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Functions
timer.hpp File Reference

Contains the gui2 timer routines. More...

#include "utils/functional.hpp"
#include <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
 A class inherited from ttext_box that displays its input as stars.
 

Functions

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...
 

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.