File: SDL_framerate.h

package info (click to toggle)
sdlgfx 2.0.9-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,012 kB
  • ctags: 288
  • sloc: ansic: 10,471; sh: 7,935; makefile: 85
file content (65 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

/*

 SDL_framerate: framerate manager
 
 LGPL (c) A. Schiffler
 
 */

#ifndef _SDL_framerate_h
#define _SDL_framerate_h

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* --- */

#include <SDL/SDL.h>

/* --------- Definitions */

/* Some rates in Hz */

#define FPS_UPPER_LIMIT		200
#define FPS_LOWER_LIMIT		1
#define FPS_DEFAULT		30

/* --------- Structure variables */

    typedef struct {
	Uint32 framecount;
	float rateticks;
	Uint32 lastticks;
	Uint32 rate;
    } FPSmanager;

/* --------- Function prototypes */

#ifdef WIN32
#ifdef BUILD_DLL
#define DLLINTERFACE __declspec(dllexport)
#else
#define DLLINTERFACE __declspec(dllimport)
#endif
#else
#define DLLINTERFACE
#endif

/* Functions return 0 or value for sucess and -1 for error */

    DLLINTERFACE void SDL_initFramerate(FPSmanager * manager);
    DLLINTERFACE int SDL_setFramerate(FPSmanager * manager, int rate);
    DLLINTERFACE int SDL_getFramerate(FPSmanager * manager);
    DLLINTERFACE void SDL_framerateDelay(FPSmanager * manager);

/* --- */

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif

#endif				/* _SDL_framerate_h */