comparison include/SDL_ellipse.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
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_ellipse.h
25 *
26 * Header file for SDL_ellipse definition and management functions.
27 */
28
29 #ifndef _SDL_ellipse_h
30 #define _SDL_ellipse_h
31
32 #include "SDL_stdinc.h"
33 #include "SDL_error.h"
34 #include "SDL_pixels.h"
35 #include "SDL_rwops.h"
36
37 #include "begin_code.h"
38 /* Set up for C function definitions, even when using C++ */
39 #ifdef __cplusplus
40 /* *INDENT-OFF* */
41 extern "C" {
42 /* *INDENT-ON* */
43 #endif
44
45 /**
46 * \brief The structure that defines an ellipse.
47 *
48 * \sa SDL_EllipseEmpty
49 * \sa SDL_EllipseEquals
50 * \sa SDL_EllipsesIntersect
51 * \sa SDL_IntersectEllipseAndLine
52 */
53 typedef struct SDL_Ellipse {
54 int x,y;
55 int a,b;
56 int r;
57 } SDL_Ellipse;
58
59 /**
60 * \brief Returns true if the ellipse has no area.
61 */
62 #define SDL_EllipseEmpty(X) ((X)->r <= 0)
63
64 /**
65 * \brief Returns true if the two ellipses are equal.
66 */
67 #define SDL_EllipseEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
68 ((A)->a == (B)->a) && ((A)->b == (B)->b) && ((A)->r == (B)->r))
69
70 /**
71 * \brief Determine whether two ellipses intersect.
72 *
73 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
74 */
75 extern DECLSPEC SDL_bool SDLCALL SDL_EllipsesIntersect(const SDL_Ellipse * A,const SDL_Ellipse * B);
76
77 /**
78 * \brief Calculate the intersection of an ellipse and line segment.
79 *
80 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
81 */
82 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectEllipseAndLine(const SDL_Ellipse *ellipse,int *X1,int *Y1,int *X2,int *Y2);
83
84 /* Ends C function definitions when using C++ */
85 #ifdef __cplusplus
86 /* *INDENT-OFF* */
87 }
88 /* *INDENT-ON* */
89 #endif
90 #include "close_code.h"
91
92 #endif /* _SDL_ellipse_h */