Main Page | Data Structures | File List | Data Fields | Globals

collision/collision.h File Reference

Pixel precise collision routine. More...

#include <sprite.h>

Defines

#define COLLISION_COLLIDE   0x8000
#define COLLISION_INTERSECT   0x80
#define COLLISION_Y1_LE_Y2   0x1
#define COLLISION_X1_LE_X2   0x2

Functions

void * init_collision_routine (void *addr)
void launch_collision_test (sprite *s1, sprite *s2)
long is_collision_done ()
long get_collision_result (short int *y, short int *h, short int *x, short int *w)


Detailed Description

Pixel precise collision routine.


Define Documentation

#define COLLISION_COLLIDE   0x8000
 

The two sprites collide.

#define COLLISION_INTERSECT   0x80
 

The bounding boxes of the two sprites intersect.

#define COLLISION_X1_LE_X2   0x2
 

The first sprite is on the left of the second one.

#define COLLISION_Y1_LE_Y2   0x1
 

The first sprite is above the second one.


Function Documentation

long get_collision_result short int *  y,
short int *  h,
short int *  x,
short int *  w
 

Returns the result of the collision test.

If COLLISION_INTERSECT then the two bounding boxes intersect. In this case, it returns the coordinates of the intersection box.

If COLLISION_Y1_LE_Y2 then y is relative to first sprite, otherwise relative to the second sprite.

If COLLISION_X1_LE_X2 then xis relative to first sprite, otherwise relative to the second sprite.

Parameters:
y  Y coordinate of the intersection box
h  Height of the intersection box
x  X coordinate of the intersection box
w  Width of the intersection box

void* init_collision_routine void *  addr  ) 
 

Initialise the GPU collision routine.

The given address must be an address in GPU ram where to load the GPU routine.

It returns the address of the end of the collision routine in GPU ram (which is long aligned).

Parameters:
addr  Address where to load the GPU routine. It should be long aligned.

long is_collision_done  ) 
 

Checks whether the collision test launched with launch_collision_test has finished.

void launch_collision_test sprite s1,
sprite s2
 

Run the collision test between the two given sprites.

The collision routine works only with 16 bit sprites that are not scaled and not reflected.

The result of the test can be read with get_collision_result.

Parameters:
s1  Address of the first sprite. It should be long aligned.
s2  Address of the second sprite sprite. It should be long aligned.


Generated on Wed Jan 10 03:11:03 2007 for The Removers Libraries by  doxygen 1.4.4