The Battle for Wesnoth  1.19.0-dev
countdown_clock.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2024
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 #include "events.hpp"
17 #include <SDL2/SDL_timer.h>
18 
19 class team;
21 {
22 public:
25  /**
26  * @returns ticks passed since last update
27  * @param new_timestamp latest result of SDL_GetTicks()
28  */
29  int update_timestamp(int new_timestamp);
30  /** @param new_timestamp latest result of SDL_GetTicks() */
31  void update_team(int new_timestamp);
33  /**
34  * @return whether there is time left
35  * @param new_timestamp latest result of SDL_GetTicks()
36  */
37  bool update(int new_timestamp = SDL_GetTicks());
38  void maybe_play_sound();
39 private:
43 };
countdown_clock(team &team)
void update_team(int new_timestamp)
void process(events::pump_info &info)
int update_timestamp(int new_timestamp)
bool update(int new_timestamp=SDL_GetTicks())
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:74
logger & info()
Definition: log.cpp:314