GameKit  0.0.1a
C++ gamedev tools
Public Member Functions | Private Attributes | List of all members
gk::Timer Class Reference

Very basic timer. More...

#include <Timer.hpp>

Public Member Functions

 Timer (bool useRealTime=false)
 Constructor. More...
 
void stop ()
 Stop the timer. More...
 
void start ()
 Start the timer. More...
 
void reset ()
 Reset the timer. More...
 
u32 time () const
 Get time. More...
 
void setTime (u32 time)
 Set time. More...
 
bool isStarted () const
 Check if the timer is started. More...
 

Private Attributes

bool m_useRealTime = false
 The timer will use system time instead of simulated time if set to true. More...
 
bool m_isStarted = false
 Is true if the timer is running. More...
 
u32 m_t = 0
 
u32 m_tick = 0
 

Detailed Description

Very basic timer.

This class is a very basic timer to help making animations, timed movements, and more.

Definition at line 25 of file Timer.hpp.

Constructor & Destructor Documentation

§ Timer()

gk::Timer::Timer ( bool  useRealTime = false)

Constructor.

Parameters
useRealTimeUse simulated time if true and by default, otherwise use system time.

Definition at line 19 of file Timer.cpp.

Member Function Documentation

§ isStarted()

bool gk::Timer::isStarted ( ) const
inline

Check if the timer is started.

Returns
True if the timer is started, false otherwise.

Definition at line 75 of file Timer.hpp.

§ reset()

void gk::Timer::reset ( )

Reset the timer.

Definition at line 38 of file Timer.cpp.

§ setTime()

void gk::Timer::setTime ( u32  time)

Set time.

Parameters
timeThe new time value for this timer

Definition at line 52 of file Timer.cpp.

§ start()

void gk::Timer::start ( )

Start the timer.

Definition at line 31 of file Timer.cpp.

§ stop()

void gk::Timer::stop ( )

Stop the timer.

Definition at line 24 of file Timer.cpp.

§ time()

u32 gk::Timer::time ( ) const

Get time.

Returns
The time elapsed since last call to start() (in milliseconds)

Definition at line 44 of file Timer.cpp.

Member Data Documentation

§ m_isStarted

bool gk::Timer::m_isStarted = false
private

Is true if the timer is running.

Definition at line 83 of file Timer.hpp.

§ m_t

u32 gk::Timer::m_t = 0
private

Definition at line 85 of file Timer.hpp.

§ m_tick

u32 gk::Timer::m_tick = 0
private

Definition at line 86 of file Timer.hpp.

§ m_useRealTime

bool gk::Timer::m_useRealTime = false
private

The timer will use system time instead of simulated time if set to true.

Definition at line 81 of file Timer.hpp.


The documentation for this class was generated from the following files: