1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*
SDL_collide: A 2D collision detection library for use with SDL
Copyright (C) 2005 Amir Taaki
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Amir Taaki
genjix@gmail.com
Rob Loach
http://robloach.net
*/
/* A simple library for collision detection using SDL */
#ifndef _SDL_COLLIDE_h
#define _SDL_COLLIDE_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* SDL surface test if offset (u,v) is a transparent pixel
*/
int SDL_CollideTransparentPixelTest(SDL_Surface *surface , int u , int v)
/**
* Pixel-perfect collision between two surfaces.
*
* @param SA the first surface to check
* @param Ax1 the top-left X-coordinate of surface @a SA
* @param Ay1 the top-left Y-coordinate of surface @a SA
* @param SB the second surface to check
* @param Bx1 the top-left X-coordinate of surface @a SB
* @param By1 the top-left Y-coordinate of surface @a SB
*
* @return non-zero on collision, 0 otherwise
*/
int SDL_CollidePixel(SDL_Surface *as , int ax , int ay ,
SDL_Surface *bs , int bx , int by)
/**
* Bounding-box collision between two surfaces.
*
* @param SA the first surface to check
* @param Ax1 the top-left X-coordinate of surface @a SA
* @param Ay1 the top-left Y-coordinate of surface @a SA
* @param SB the second surface to check
* @param Bx1 the top-left X-coordinate of surface @a SB
* @param By1 the top-left Y-coordinate of surface @a SB
*
* @return non-zero on collision, 0 otherwise
*/
// ERREUR ICI !!!
int SDL_CollideBoundingBox(SDL_Surface *sa , int ax , int ay ,
SDL_Surface *sb , int bx , int by)
/**
* Bounding-box collision between two rectangles.
*
* @param A the first rectangle to check
* @param B the second rectangle to check
*
* @return non-zero on collision, 0 otherwise
*/
int SDL_CollideBoundingBox(SDL_Rect a , SDL_Rect b)
/**
* tests whether 2 circles intersect
*
* circle1 : centre (x1,y1) with radius r1
* circle2 : centre (x2,y2) with radius r2
*
* (allow distance between circles of offset)
*/
int SDL_CollideBoundingCircle(int x1 , int y1 , int r1 ,
int x2 , int y2 , int r2 , int offset)
/**
* a circle intersection detection algorithm that will use
* the position of the centre of the surface as the centre of
* the circle and approximate the radius using the width and height
* of the surface (for example a rect of 4x6 would have r = 2.5).
*/
int SDL_CollideBoundingCircle(SDL_Surface *a , int x1 , int y1 ,
SDL_Surface *b , int x2 , int y2 ,
int offset)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_COLLIDE_h */ |
Partager