HeadBall  1.0
A game
TimeManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SFML/Graphics.hpp>
4 #include <sstream>
5 
6 namespace HeadBall {
11  class TimeManager {
12  public:
17  TimeManager ( );
18 
23  ~TimeManager ( ) { }
24 
29  void processTime ( );
30 
36  std::string displayTimer ( );
37 
43  int getTime ( );
44 
49  void resetTimer ( );
50 
55  void pause ( );
56 
61  void resume ( );
62 
68  void setTime (sf::Time timer);
69 
74  void zero ( );
75 
76  private:
77  sf::Clock _clock;
78  sf::Time T;
79  sf::Time tempTime;
80 
81  std::stringstream ss;
82 
83  //The integers used during processsing of time
84  int t;
85  int vt;
86  int s;
87  int m;
88  };
89 }
The class that manages the game time.
Definition: TimeManager.hpp:11
void pause()
Pause the timer.
Definition: TimeManager.cpp:46
sf::Time tempTime
The temporary object used for storing time while paused, goal scored or during half time.
Definition: TimeManager.hpp:79
int getTime()
Get the time in minutes as an integer.
Definition: TimeManager.cpp:24
void zero()
Set the time as zero.
Definition: TimeManager.cpp:58
void processTime()
Process the time in the game.
Definition: TimeManager.cpp:16
void resetTimer()
Reset the clock.
Definition: TimeManager.cpp:12
int vt
Definition: TimeManager.hpp:85
int t
Definition: TimeManager.hpp:84
sf::Time T
The Game time.
Definition: TimeManager.hpp:78
TimeManager()
Construct a new Time Manager object.
Definition: TimeManager.cpp:5
void resume()
Resume the paused timer.
Definition: TimeManager.cpp:50
~TimeManager()
Destroy the Time Manager object.
Definition: TimeManager.hpp:23
std::stringstream ss
The string stream used for returning the game time as a string.
Definition: TimeManager.hpp:81
std::string displayTimer()
Return the game time as a string that can simply be displayed.
Definition: TimeManager.cpp:28
void setTime(sf::Time timer)
Set the Time.
Definition: TimeManager.cpp:54
int s
Definition: TimeManager.hpp:86
int m
Definition: TimeManager.hpp:87
sf::Clock _clock
The clock for getting the current time.
Definition: TimeManager.hpp:77
Custom namespace used throughout the project.
Definition: AboutState.cpp:6