Gama C Library
Gama C API Documentation
Loading...
Searching...
No Matches
collision.h File Reference
#include "body.h"
#include "system.h"
#include <math.h>

Go to the source code of this file.

Functions

gmCollisiongm_collision_detect (gmBody *a, gmBody *b)
 Detects collision between two bodies.
int gm_body_contains (gmBody *body, double x, double y)
 Checks if a point is contained within a body's collider.
int gm_mouse_in_rect (const double x, const double y, const double w, const double h)
int gm_mouse_in_circle (const double x, const double y, const double r)

Function Documentation

◆ gm_body_contains()

int gm_body_contains ( gmBody * body,
double x,
double y )

Checks if a point is contained within a body's collider.

Parameters
bodyPointer to the body to check.
xThe x-coordinate of the point.
yThe y-coordinate of the point.
Returns
1 if the point is inside the body, 0 otherwise.

◆ gm_collision_detect()

gmCollision * gm_collision_detect ( gmBody * a,
gmBody * b )

Detects collision between two bodies.

Parameters
aPointer to the first body.
bPointer to the second body.
Returns
A pointer to a gmCollision structure if collision occurs, NULL otherwise.

◆ gm_mouse_in_circle()

int gm_mouse_in_circle ( const double x,
const double y,
const double r )

◆ gm_mouse_in_rect()

int gm_mouse_in_rect ( const double x,
const double y,
const double w,
const double h )