SDL_gfx
2.0.25
|
00001 /* 00002 00003 SDL_framerate.h: framerate manager 00004 00005 Copyright (C) 2001-2012 Andreas Schiffler 00006 00007 This software is provided 'as-is', without any express or implied 00008 warranty. In no event will the authors be held liable for any damages 00009 arising from the use of this software. 00010 00011 Permission is granted to anyone to use this software for any purpose, 00012 including commercial applications, and to alter it and redistribute it 00013 freely, subject to the following restrictions: 00014 00015 1. The origin of this software must not be misrepresented; you must not 00016 claim that you wrote the original software. If you use this software 00017 in a product, an acknowledgment in the product documentation would be 00018 appreciated but is not required. 00019 00020 2. Altered source versions must be plainly marked as such, and must not be 00021 misrepresented as being the original software. 00022 00023 3. This notice may not be removed or altered from any source 00024 distribution. 00025 00026 Andreas Schiffler -- aschiffler at ferzkopp dot net 00027 00028 */ 00029 00030 #ifndef _SDL_framerate_h 00031 #define _SDL_framerate_h 00032 00033 /* Set up for C function definitions, even when using C++ */ 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 /* --- */ 00039 00040 #include "SDL.h" 00041 00042 /* --------- Definitions */ 00043 00047 #define FPS_UPPER_LIMIT 200 00048 00052 #define FPS_LOWER_LIMIT 1 00053 00057 #define FPS_DEFAULT 30 00058 00062 typedef struct { 00063 Uint32 framecount; 00064 float rateticks; 00065 Uint32 baseticks; 00066 Uint32 lastticks; 00067 Uint32 rate; 00068 } FPSmanager; 00069 00070 /* ---- Function Prototypes */ 00071 00072 #ifdef _MSC_VER 00073 # if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT) 00074 # define SDL_FRAMERATE_SCOPE __declspec(dllexport) 00075 # else 00076 # ifdef LIBSDL_GFX_DLL_IMPORT 00077 # define SDL_FRAMERATE_SCOPE __declspec(dllimport) 00078 # endif 00079 # endif 00080 #endif 00081 #ifndef SDL_FRAMERATE_SCOPE 00082 # define SDL_FRAMERATE_SCOPE extern 00083 #endif 00084 00085 /* Functions return 0 or value for sucess and -1 for error */ 00086 00087 SDL_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager * manager); 00088 SDL_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager * manager, Uint32 rate); 00089 SDL_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager * manager); 00090 SDL_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager * manager); 00091 SDL_FRAMERATE_SCOPE Uint32 SDL_framerateDelay(FPSmanager * manager); 00092 00093 /* --- */ 00094 00095 /* Ends C function definitions when using C++ */ 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 00100 #endif /* _SDL_framerate_h */