2007-02-06 05:30:46 -08:00
|
|
|
|
2007-01-15 12:09:25 -08:00
|
|
|
/*
|
2007-02-06 05:30:46 -08:00
|
|
|
|
|
|
|
SDL_framerate: framerate manager
|
2006-07-05 13:39:13 -07:00
|
|
|
|
|
|
|
LGPL (c) A. Schiffler
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SDL_framerate_h
|
|
|
|
#define _SDL_framerate_h
|
|
|
|
|
2010-08-05 10:27:00 -07:00
|
|
|
#include <SDL.h>
|
2006-07-05 13:39:13 -07:00
|
|
|
|
|
|
|
/* --------- Definitions */
|
|
|
|
|
|
|
|
/* Some rates in Hz */
|
|
|
|
|
2010-12-28 15:24:45 -08:00
|
|
|
#define FPS_UPPER_LIMIT 500
|
2006-07-05 13:39:13 -07:00
|
|
|
#define FPS_LOWER_LIMIT 1
|
|
|
|
#define FPS_DEFAULT 30
|
|
|
|
|
|
|
|
/* --------- Structure variables */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Uint32 framecount;
|
|
|
|
float rateticks;
|
|
|
|
Uint32 lastticks;
|
|
|
|
Uint32 rate;
|
|
|
|
} FPSmanager;
|
|
|
|
|
|
|
|
/* Functions return 0 or value for sucess and -1 for error */
|
|
|
|
|
2006-07-05 15:19:23 -07:00
|
|
|
void SDL_initFramerate(FPSmanager * manager);
|
|
|
|
int SDL_setFramerate(FPSmanager * manager, int rate);
|
|
|
|
int SDL_getFramerate(FPSmanager * manager);
|
|
|
|
void SDL_framerateDelay(FPSmanager * manager);
|
2006-07-05 13:39:13 -07:00
|
|
|
|
|
|
|
/* --- */
|
|
|
|
|
|
|
|
#endif /* _SDL_framerate_h */
|