include/SDL_rect.h
changeset 2275 12ea0fdc0df2
child 2859 99210400e8b9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_rect.h	Mon Sep 10 12:20:02 2007 +0000
     1.3 @@ -0,0 +1,117 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997-2006 Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Lesser General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2.1 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Lesser General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Lesser General Public
    1.19 +    License along with this library; if not, write to the Free Software
    1.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@libsdl.org
    1.24 +*/
    1.25 +
    1.26 +/**
    1.27 + * \file SDL_rect.h
    1.28 + *
    1.29 + * Header file for SDL_rect definition and management functions
    1.30 + */
    1.31 +
    1.32 +#ifndef _SDL_rect_h
    1.33 +#define _SDL_rect_h
    1.34 +
    1.35 +#include "SDL_stdinc.h"
    1.36 +#include "SDL_error.h"
    1.37 +#include "SDL_pixels.h"
    1.38 +#include "SDL_rwops.h"
    1.39 +
    1.40 +#include "begin_code.h"
    1.41 +/* Set up for C function definitions, even when using C++ */
    1.42 +#ifdef __cplusplus
    1.43 +/* *INDENT-OFF* */
    1.44 +extern "C" {
    1.45 +/* *INDENT-ON* */
    1.46 +#endif
    1.47 +
    1.48 +/**
    1.49 + * \struct SDL_Rect
    1.50 + *
    1.51 + * \brief A rectangle, with the origin at the upper left.
    1.52 + *
    1.53 + * \sa SDL_RectEmpty
    1.54 + * \sa SDL_RectEquals
    1.55 + * \sa SDL_HasIntersection
    1.56 + * \sa SDL_IntersectRect
    1.57 + * \sa SDL_UnionRect
    1.58 + */
    1.59 +typedef struct SDL_Rect
    1.60 +{
    1.61 +    int x, y;
    1.62 +    int w, h;
    1.63 +} SDL_Rect;
    1.64 +
    1.65 +/**
    1.66 + * \def SDL_RectEmpty()
    1.67 + *
    1.68 + * \brief Returns true if the rectangle has no area.
    1.69 + */
    1.70 +#define SDL_RectEmpty(X)    (((X)->w <= 0) || ((X)->h <= 0))
    1.71 +
    1.72 +/**
    1.73 + * \def SDL_RectEquals()
    1.74 + *
    1.75 + * \brief Returns true if the two rectangles are equal.
    1.76 + */
    1.77 +#define SDL_RectEquals(A, B)   (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
    1.78 +                                ((A)->w == (B)->w) && ((A)->h == (B)->h))
    1.79 +
    1.80 +/**
    1.81 + * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
    1.82 + *
    1.83 + * \brief Determine whether two rectangles intersect.
    1.84 + *
    1.85 + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
    1.86 + */
    1.87 +extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
    1.88 +                                                     const SDL_Rect * B);
    1.89 +
    1.90 +/**
    1.91 + * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
    1.92 + *
    1.93 + * \brief Calculate the intersection of two rectangles.
    1.94 + *
    1.95 + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
    1.96 + */
    1.97 +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
    1.98 +                                                   const SDL_Rect * B,
    1.99 +                                                   SDL_Rect * result);
   1.100 +
   1.101 +/**
   1.102 + * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
   1.103 + *
   1.104 + * \brief Calculate the union of two rectangles
   1.105 + */
   1.106 +extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
   1.107 +                                           const SDL_Rect * B,
   1.108 +                                           SDL_Rect * result);
   1.109 +
   1.110 +/* Ends C function definitions when using C++ */
   1.111 +#ifdef __cplusplus
   1.112 +/* *INDENT-OFF* */
   1.113 +}
   1.114 +/* *INDENT-ON* */
   1.115 +#endif
   1.116 +#include "close_code.h"
   1.117 +
   1.118 +#endif /* _SDL_rect_h */
   1.119 +
   1.120 +/* vi: set ts=4 sw=4 expandtab: */