]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | /* | |
3 | ||
4 | SDL_framerate: framerate manager | |
5 | ||
6 | LGPL (c) A. Schiffler | |
7 | ||
8 | */ | |
9 | ||
10 | #ifndef _SDL_framerate_h | |
11 | #define _SDL_framerate_h | |
12 | ||
13 | /* Set up for C function definitions, even when using C++ */ | |
14 | #ifdef __cplusplus | |
15 | extern "C" { | |
16 | #endif | |
17 | ||
18 | /* --- */ | |
19 | ||
20 | #include "SDL.h" | |
21 | ||
22 | /* --------- Definitions */ | |
23 | ||
24 | /* Some rates in Hz */ | |
25 | ||
26 | #define FPS_UPPER_LIMIT 200 | |
27 | #define FPS_LOWER_LIMIT 1 | |
28 | #define FPS_DEFAULT 30 | |
29 | ||
30 | /* --------- Structure variables */ | |
31 | ||
32 | typedef struct { | |
33 | Uint32 framecount; | |
34 | float rateticks; | |
35 | Uint32 lastticks; | |
36 | Uint32 rate; | |
37 | } FPSmanager; | |
38 | ||
39 | /* --------- Function prototypes */ | |
40 | ||
41 | #ifdef WIN32 | |
42 | #ifdef BUILD_DLL | |
43 | #define DLLINTERFACE __declspec(dllexport) | |
44 | #else | |
45 | #define DLLINTERFACE __declspec(dllimport) | |
46 | #endif | |
47 | #else | |
48 | #define DLLINTERFACE | |
49 | #endif | |
50 | ||
51 | /* Functions return 0 or value for sucess and -1 for error */ | |
52 | ||
53 | DLLINTERFACE void SDL_initFramerate(FPSmanager * manager); | |
54 | DLLINTERFACE int SDL_setFramerate(FPSmanager * manager, int rate); | |
55 | DLLINTERFACE int SDL_getFramerate(FPSmanager * manager); | |
56 | DLLINTERFACE void SDL_framerateDelay(FPSmanager * manager); | |
57 | ||
58 | /* --- */ | |
59 | ||
60 | /* Ends C function definitions when using C++ */ | |
61 | #ifdef __cplusplus | |
62 | } | |
63 | #endif | |
64 | ||
65 | #endif /* _SDL_framerate_h */ |