Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::Clock Class Reference

A pausable, restartable elapsed-time clock. More...

#include <flint/time/time.h>

+ Collaboration diagram for Flint::Clock:

Public Member Functions

FLINT_API void start ()
 Start the clock if it is currently stopped.
 
FLINT_API void stop ()
 Stop the clock, preserving the current elapsed time.
 
FLINT_API void restart ()
 Reset the elapsed time to zero and start the clock.
 
FLINT_API Uint64 getElapsedMilliseconds () const
 Return the elapsed time in milliseconds.
 
FLINT_API float getElapsedSeconds () const
 Return the elapsed time in seconds.
 
FLINT_API bool isRunning () const
 Return true if the clock is currently running.
 

Detailed Description

A pausable, restartable elapsed-time clock.

Tracks elapsed time in milliseconds using SDL_GetTicks(). The clock starts in a stopped state; call start() or restart() before querying.

Definition at line 16 of file time.h.

Member Function Documentation

◆ getElapsedMilliseconds()

FLINT_API Uint64 Flint::Clock::getElapsedMilliseconds ( ) const

Return the elapsed time in milliseconds.

Returns the accumulated time when stopped, or the live elapsed time when running.

◆ start()

FLINT_API void Flint::Clock::start ( )

Start the clock if it is currently stopped.

Has no effect if the clock is already running. Resumes from the time at which it was last stopped.

◆ stop()

FLINT_API void Flint::Clock::stop ( )

Stop the clock, preserving the current elapsed time.

Has no effect if the clock is not running.


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