ManaPlus
|
Go to the source code of this file.
Data Structures | |
struct | FPSmanager |
Structure holding the state and timing information of the framerate controller. More... | |
Macros | |
#define | FPS_UPPER_LIMIT 200 |
Highest possible rate supported by framerate controller in Hz (1/s). More... | |
#define | FPS_LOWER_LIMIT 1 |
Lowest possible rate supported by framerate controller in Hz (1/s). More... | |
#define | FPS_DEFAULT 30 |
Default rate of framerate controller in Hz (1/s). More... | |
#define | SDL2_FRAMERATE_SCOPE extern |
Functions | |
void | SDL_initFramerate (FPSmanager *manager) |
Initialize the framerate manager. More... | |
int | SDL_setFramerate (FPSmanager *manager, Uint32 rate) |
Set the framerate in Hz. More... | |
int | SDL_getFramerate (FPSmanager *manager) |
Return the current target framerate in Hz. More... | |
int | SDL_getFramecount (FPSmanager *manager) |
Return the current framecount. More... | |
Uint32 | SDL_framerateDelay (FPSmanager *manager) |
Delay execution to maintain a constant framerate and calculate fps. More... | |
#define FPS_DEFAULT 30 |
Default rate of framerate controller in Hz (1/s).
Definition at line 65 of file SDL2_framerate.h.
#define FPS_LOWER_LIMIT 1 |
Lowest possible rate supported by framerate controller in Hz (1/s).
Definition at line 60 of file SDL2_framerate.h.
#define FPS_UPPER_LIMIT 200 |
Highest possible rate supported by framerate controller in Hz (1/s).
Definition at line 55 of file SDL2_framerate.h.
#define SDL2_FRAMERATE_SCOPE extern |
Definition at line 91 of file SDL2_framerate.h.
Uint32 SDL_framerateDelay | ( | FPSmanager * | manager | ) |
Delay execution to maintain a constant framerate and calculate fps.
Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.
manager | Pointer to the framerate manager. |
Definition at line 162 of file SDL2_framerate.cpp.
References _getTicks(), FPSmanager::baseticks, FPSmanager::framecount, FPSmanager::lastticks, FPSmanager::rateticks, and SDL_initFramerate().
Referenced by Client::gameExec().
int SDL_getFramecount | ( | FPSmanager * | manager | ) |
Return the current framecount.
Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.
manager | Pointer to the framerate manager. |
Definition at line 139 of file SDL2_framerate.cpp.
References FPSmanager::framecount.
int SDL_getFramerate | ( | FPSmanager * | manager | ) |
Return the current target framerate in Hz.
Get the currently set framerate of the manager.
manager | Pointer to the framerate manager. |
Definition at line 117 of file SDL2_framerate.cpp.
References FPSmanager::rate.
Referenced by WindowManager::getFramerate().
void SDL_initFramerate | ( | FPSmanager * | manager | ) |
Initialize the framerate manager.
Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.
manager | Pointer to the framerate manager. |
Definition at line 69 of file SDL2_framerate.cpp.
References _getTicks(), FPSmanager::baseticks, FPS_DEFAULT, FPSmanager::framecount, FPSmanager::lastticks, FPSmanager::rate, and FPSmanager::rateticks.
Referenced by Client::gameInit(), and SDL_framerateDelay().
int SDL_setFramerate | ( | FPSmanager * | manager, |
Uint32 | rate | ||
) |
Set the framerate in Hz.
Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.
manager | Pointer to the framerate manager. |
rate | The new framerate in Hz (frames per second). |
Definition at line 93 of file SDL2_framerate.cpp.
References FPS_LOWER_LIMIT, FPS_UPPER_LIMIT, FPSmanager::framecount, FPSmanager::rate, and FPSmanager::rateticks.
Referenced by WindowManager::setFramerate().