SDL_rect.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _SDL_rect_h
  2. #define _SDL_rect_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_error.h"
  5. #include "SDL_pixels.h"
  6. #include "SDL_rwops.h"
  7. #include "begin_code.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef struct
  12. {
  13. int x;
  14. int y;
  15. } SDL_Point;
  16. typedef struct SDL_Rect
  17. {
  18. int x, y;
  19. int w, h;
  20. } SDL_Rect;
  21. SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
  22. {
  23. return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
  24. }
  25. SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
  26. {
  27. return (a && b && (a->x == b->x) && (a->y == b->y) &&
  28. (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
  29. }
  30. typedef SDL_bool SDLCALL tSDL_HasIntersection(const SDL_Rect * A,
  31. const SDL_Rect * B);
  32. typedef SDL_bool SDLCALL tSDL_IntersectRect(const SDL_Rect * A,
  33. const SDL_Rect * B,
  34. SDL_Rect * result);
  35. typedef void SDLCALL tSDL_UnionRect(const SDL_Rect * A,
  36. const SDL_Rect * B,
  37. SDL_Rect * result);
  38. typedef SDL_bool SDLCALL tSDL_EnclosePoints(const SDL_Point * points,
  39. int count,
  40. const SDL_Rect * clip,
  41. SDL_Rect * result);
  42. typedef SDL_bool SDLCALL tSDL_IntersectRectAndLine(const SDL_Rect *
  43. rect, int *X1,
  44. int *Y1, int *X2,
  45. int *Y2);
  46. extern tSDL_HasIntersection *SDL_HasIntersection;
  47. extern tSDL_IntersectRect *SDL_IntersectRect;
  48. extern tSDL_UnionRect *SDL_UnionRect;
  49. extern tSDL_EnclosePoints *SDL_EnclosePoints;
  50. extern tSDL_IntersectRectAndLine *SDL_IntersectRectAndLine;
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #include "close_code.h"
  55. #endif