Mercurial > sdl-ios-xcode
comparison include/SDL_poly.h @ 4771:c500594c4246
Added management and drawing functions for ellipses and polygons.
author | Eli Gottlieb <eligottlieb@gmail.com> |
---|---|
date | Thu, 03 Jun 2010 14:43:38 -0400 |
parents | |
children | 590e680cc4e4 |
comparison
equal
deleted
inserted
replaced
4770:cf7976fd3258 | 4771:c500594c4246 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 2010 Eli Gottlieb | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Eli Gottlieb | |
20 eligottlieb@gmail.com | |
21 */ | |
22 | |
23 /** | |
24 * \file SDL_poly.h | |
25 * | |
26 * Header file for SDL_poly definition and management functions. | |
27 */ | |
28 | |
29 #ifndef _SDL_poly_h | |
30 #define _SDL_poly_h | |
31 | |
32 #include "SDL_stdinc.h" | |
33 #include "SDL_error.h" | |
34 #include "SDL_pixels.h" | |
35 #include "SDL_rwops.h" | |
36 #include "SDL_rect.h" | |
37 | |
38 #include "begin_code.h" | |
39 /* Set up for C function definitions, even when using C++ */ | |
40 #ifdef __cplusplus | |
41 /* *INDENT-OFF* */ | |
42 extern "C" { | |
43 /* *INDENT-ON* */ | |
44 #endif | |
45 | |
46 /** | |
47 * \brief The structure that defines an polygon. | |
48 * | |
49 * \sa SDL_PolyEmpty | |
50 * \sa SDL_PolyEquals | |
51 * \sa SDL_PolysIntersect | |
52 * \sa SDL_IntersectPoly | |
53 * \sa SDL_WrapPoints | |
54 * \sa SDL_IntersectPolyAndLine | |
55 */ | |
56 typedef struct SDL_Poly { | |
57 SDL_Point *vertices; | |
58 int count; | |
59 } SDL_Poly; | |
60 | |
61 /** | |
62 * \brief Returns true if the polygon has no area. | |
63 */ | |
64 #define SDL_PolyEmpty(X) (((X)->vertices == NULL) || ((X)->count <= 2)) | |
65 | |
66 /** | |
67 * \brief Determine whether two polygons are equal. | |
68 * | |
69 * \return SDL_TRUE if the polygons are equal, SDL_FALSE otherwise. | |
70 */ | |
71 extern DECLSPEC SDL_bool SDLCALL SDL_PolyEquals(const SDL_Poly *A,const SDL_Poly *A); | |
72 | |
73 /** | |
74 * \brief Determine whether two rectangles intersect. | |
75 * | |
76 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. | |
77 */ | |
78 extern DECLSPEC SDL_bool SDLCALL SDL_PolysIntersect(const SDL_Poly * A,const SDL_Poly * B); | |
79 | |
80 /** | |
81 * \brief Calculate the intersection of two rectangles. | |
82 * | |
83 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. | |
84 */ | |
85 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectPoly(const SDL_Poly * A,const SDL_Poly * B,SDL_Poly * result); | |
86 | |
87 /** | |
88 * \brief Calculate a minimal polygon wrapping a set of points | |
89 * | |
90 * \return 0 on success, -1 if the parameters were invalid, and -2 if an insufficient number of points were supplied | |
91 * in the output polygon. | |
92 */ | |
93 extern DECLSPEC int SDLCALL SDL_WrapPoints(const SDL_Point * points,int count,SDL_Poly *result); | |
94 | |
95 /** | |
96 * \brief Calculate the intersection of a polygon and line segment. | |
97 * | |
98 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. | |
99 */ | |
100 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectPolyAndLine(const SDL_Poly *poly,int *X1,int *Y1,int *X2,int *Y2); | |
101 | |
102 /* Ends C function definitions when using C++ */ | |
103 #ifdef __cplusplus | |
104 /* *INDENT-OFF* */ | |
105 } | |
106 /* *INDENT-ON* */ | |
107 #endif | |
108 #include "close_code.h" | |
109 | |
110 #endif /* _SDL_poly_h */ |