nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
Timer Class Reference

Public Member Functions

void start ()
 Sets a starting point for the timer.
 
void pause ()
 Temporarily stops the timer.
 
void unpause ()
 Restarts the timer if it was paused.
 
bool isRunning ()
 Tells if the timer's still running (hasn't called stop())
 
bool isPaused ()
 Tells if the timer's paused.
 
suseconds_t delta_us ()
 Returns the whole timer's difference in milisseconds.
 
suseconds_t delta_ms ()
 Returns the milisseconds part of the timer's difference.
 
suseconds_t delta_s ()
 Returns the seconds part of the timer's difference.
 

Protected Attributes

suseconds_t startMark
 
suseconds_t stopMark
 
suseconds_t pausedMark
 
bool running
 
bool paused
 

Detailed Description

Definition at line 7 of file Timer.hpp.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )

Definition at line 19 of file Timer.cpp.

Member Function Documentation

◆ delta_ms()

suseconds_t Timer::delta_ms ( )

Returns the milisseconds part of the timer's difference.

Definition at line 75 of file Timer.cpp.

◆ delta_s()

suseconds_t Timer::delta_s ( )

Returns the seconds part of the timer's difference.

Definition at line 79 of file Timer.cpp.

◆ delta_us()

suseconds_t Timer::delta_us ( )

Returns the whole timer's difference in milisseconds.

Definition at line 61 of file Timer.cpp.

◆ isPaused()

bool Timer::isPaused ( )

Tells if the timer's paused.

Definition at line 57 of file Timer.cpp.

◆ isRunning()

bool Timer::isRunning ( )

Tells if the timer's still running (hasn't called stop())

Definition at line 53 of file Timer.cpp.

◆ pause()

void Timer::pause ( )

Temporarily stops the timer.

Definition at line 34 of file Timer.cpp.

◆ start()

void Timer::start ( )

Sets a starting point for the timer.

If called multiple times, will restart.

Definition at line 26 of file Timer.cpp.

◆ unpause()

void Timer::unpause ( )

Restarts the timer if it was paused.

Definition at line 43 of file Timer.cpp.

Member Data Documentation

◆ paused

bool Timer::paused
protected

Definition at line 44 of file Timer.hpp.

◆ pausedMark

suseconds_t Timer::pausedMark
protected

Definition at line 41 of file Timer.hpp.

◆ running

bool Timer::running
protected

Definition at line 43 of file Timer.hpp.

◆ startMark

suseconds_t Timer::startMark
protected

Definition at line 39 of file Timer.hpp.

◆ stopMark

suseconds_t Timer::stopMark
protected

Definition at line 40 of file Timer.hpp.


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