/project/jni/sdl_gfx/include/SDL_framerate.h

https://github.com/aichunyu/FFPlayer · C Header · 79 lines · 36 code · 17 blank · 26 comment · 0 complexity · d3e7162d422b0382d794d96855a86de2 MD5 · raw file

  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. /*!
  15. \brief Highest possible rate supported by framerate controller in Hz (1/s).
  16. */
  17. #define FPS_UPPER_LIMIT 200
  18. /*!
  19. \brief Lowest possible rate supported by framerate controller in Hz (1/s).
  20. */
  21. #define FPS_LOWER_LIMIT 1
  22. /*!
  23. \brief Default rate of framerate controller in Hz (1/s).
  24. */
  25. #define FPS_DEFAULT 30
  26. /*!
  27. \brief Structure holding the state and timing information of the framerate controller.
  28. */
  29. typedef struct {
  30. Uint32 framecount;
  31. float rateticks;
  32. Uint32 lastticks;
  33. Uint32 rate;
  34. } FPSmanager;
  35. /* --------- Function prototypes */
  36. #ifdef WIN32
  37. # ifdef DLL_EXPORT
  38. # define SDL_FRAMERATE_SCOPE __declspec(dllexport)
  39. # else
  40. # ifdef LIBSDL_GFX_DLL_IMPORT
  41. # define SDL_FRAMERATE_SCOPE __declspec(dllimport)
  42. # endif
  43. # endif
  44. #endif
  45. #ifndef SDL_FRAMERATE_SCOPE
  46. # define SDL_FRAMERATE_SCOPE extern
  47. #endif
  48. /* Functions return 0 or value for sucess and -1 for error */
  49. SDL_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager * manager);
  50. SDL_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager * manager, int rate);
  51. SDL_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager * manager);
  52. SDL_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager * manager);
  53. SDL_FRAMERATE_SCOPE void SDL_framerateDelay(FPSmanager * manager);
  54. /* --- */
  55. /* Ends C function definitions when using C++ */
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* _SDL_framerate_h */