ManaPlus
|
Go to the source code of this file.
Functions | |
static Uint32 | _getTicks () |
Internal wrapper to SDL_GetTicks that ensures a non-zero return value. More... | |
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... | |
|
static |
Internal wrapper to SDL_GetTicks that ensures a non-zero return value.
Definition at line 41 of file SDL2_framerate.cpp.
Referenced by SDL_framerateDelay(), and SDL_initFramerate().
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().