SDL_framerate.h 1.1 KB

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