/src/GFX/GFX.xs

http://github.com/PerlGameDev/SDL · Unknown · 60 lines · 44 code · 16 blank · 0 comment · 0 complexity · afb6ad92147464b743f66eccd79b1d35 MD5 · raw file

  1. #include "EXTERN.h"
  2. #include "perl.h"
  3. #include "XSUB.h"
  4. #include <SDL.h>
  5. #ifdef HAVE_SDL_GFX_PRIMITIVES
  6. #include <SDL_gfxPrimitives.h>
  7. #endif
  8. SDL_version *linked_version = NULL;
  9. #ifndef SDL_GFXPRIMITIVES_MAJOR
  10. #define SDL_GFXPRIMITIVES_MAJOR 0
  11. #endif
  12. #ifndef SDL_GFXPRIMITIVES_MINOR
  13. #define SDL_GFXPRIMITIVES_MINOR 0
  14. #endif
  15. #ifndef SDL_GFXPRIMITIVES_MICRO
  16. #define SDL_GFXPRIMITIVES_MICRO 0
  17. #endif
  18. #ifndef SDL_GFXPRIMITIVES_VERSION
  19. #define SDL_GFXPRIMITIVES_VERSION(X) \
  20. { \
  21. (X)->major = SDL_GFXPRIMITIVES_MAJOR; \
  22. (X)->minor = SDL_GFXPRIMITIVES_MINOR; \
  23. (X)->patch = SDL_GFXPRIMITIVES_MICRO; \
  24. }
  25. #endif
  26. MODULE = SDL::GFX PACKAGE = SDL::GFX PREFIX = gfx_
  27. =for documentation
  28. The Following are XS bindings to the SDL_gfx Library
  29. Described here:
  30. See: L<http:/*www.ferzkopp.net/joomla/content/view/19/14/> */
  31. =cut
  32. const SDL_version *
  33. gfx_linked_version()
  34. PREINIT:
  35. char* CLASS = "SDL::Version";
  36. CODE:
  37. if(linked_version == NULL)
  38. {
  39. linked_version = safemalloc(sizeof(SDL_version));
  40. }
  41. SDL_GFXPRIMITIVES_VERSION(linked_version);
  42. RETVAL = linked_version;
  43. OUTPUT:
  44. RETVAL