annotate touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/include/SDL_rect.h @ 4689:f9ab8df6d45a

Added README.touch and README.gesture. Moved touchtest/gestureSDLTest to test/testgesture
author Jim Grandpre <jim.tla@gmail.com>
date Sun, 15 Aug 2010 00:36:28 -0400
parents 31607094315c
children
rev   line source
4677
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
1 /*
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
4
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
7 License as published by the Free Software Foundation; either
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
9
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
13 Lesser General Public License for more details.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
14
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
18
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
19 Sam Lantinga
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
20 slouken@libsdl.org
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
21 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
22
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
23 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
24 * \file SDL_rect.h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
25 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
26 * Header file for SDL_rect definition and management functions.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
27 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
28
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
29 #ifndef _SDL_rect_h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
30 #define _SDL_rect_h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
31
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
32 #include "SDL_stdinc.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
33 #include "SDL_error.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
34 #include "SDL_pixels.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
35 #include "SDL_rwops.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
36
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
37 #include "begin_code.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
38 /* Set up for C function definitions, even when using C++ */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
39 #ifdef __cplusplus
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
40 /* *INDENT-OFF* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
41 extern "C" {
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
42 /* *INDENT-ON* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
43 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
44
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
45 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
46 * \brief The structure that defines a point
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
47 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
48 * \sa SDL_EnclosePoints
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
49 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
50 typedef struct
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
51 {
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
52 int x;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
53 int y;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
54 } SDL_Point;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
55
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
56 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
57 * \brief A rectangle, with the origin at the upper left.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
58 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
59 * \sa SDL_RectEmpty
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
60 * \sa SDL_RectEquals
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
61 * \sa SDL_HasIntersection
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
62 * \sa SDL_IntersectRect
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
63 * \sa SDL_UnionRect
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
64 * \sa SDL_EnclosePoints
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
65 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
66 typedef struct SDL_Rect
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
67 {
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
68 int x, y;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
69 int w, h;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
70 } SDL_Rect;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
71
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
72 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
73 * \brief Returns true if the rectangle has no area.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
74 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
75 #define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
76
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
77 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
78 * \brief Returns true if the two rectangles are equal.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
79 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
80 #define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
81 ((A)->w == (B)->w) && ((A)->h == (B)->h))
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
82
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
83 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
84 * \brief Determine whether two rectangles intersect.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
85 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
86 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
87 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
88 extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
89 const SDL_Rect * B);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
90
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
91 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
92 * \brief Calculate the intersection of two rectangles.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
93 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
94 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
95 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
96 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
97 const SDL_Rect * B,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
98 SDL_Rect * result);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
99
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
100 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
101 * \brief Calculate the union of two rectangles.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
102 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
103 extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
104 const SDL_Rect * B,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
105 SDL_Rect * result);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
106
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
107 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
108 * \brief Calculate a minimal rectangle enclosing a set of points
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
109 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
110 * \return SDL_TRUE if any points were within the clipping rect
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
111 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
112 extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
113 int count,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
114 const SDL_Rect * clip,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
115 SDL_Rect * result);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
116
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
117 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
118 * \brief Calculate the intersection of a rectangle and line segment.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
119 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
120 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
121 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
122 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
123 rect, int *X1,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
124 int *Y1, int *X2,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
125 int *Y2);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
126
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
127 /* Ends C function definitions when using C++ */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
128 #ifdef __cplusplus
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
129 /* *INDENT-OFF* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
130 }
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
131 /* *INDENT-ON* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
132 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
133 #include "close_code.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
134
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
135 #endif /* _SDL_rect_h */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
136
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
137 /* vi: set ts=4 sw=4 expandtab: */