Loading...
Searching...
No Matches
rectangle.h File Reference
`#include <stdint.h>`
`#include "point.h"`
`#include "vector2.h"`

Go to the source code of this file.

## Data Structures

struct | ARC_Rect
struct | ARC_URect
struct | ARC_FRect

## Typedefs

typedef struct ARC_Rect | ARC_Rect
typedef struct ARC_URect | ARC_URect
typedef struct ARC_FRect | ARC_FRect

## Functions

void | ARC_Rect_CenterOn (ARC_Rect *rect, ARC_Rect *bounds)
| centers rect on given bounds
void | ARC_FRect_CenterOn (ARC_FRect *rect, ARC_FRect *bounds)
| centers rect on given bounds
ARC_FRect | ARC_Rect_CastToFRect (ARC_Rect *rect)
| casts Rect to FRect
ARC_Rect | ARC_FRect_CastToRect (ARC_FRect *rect)
| casts FRect to Rect
int32_t | ARC_Rect_Intersects (ARC_Rect *rect1, ARC_Rect *rect2)
| checks if two ARC_Rects intersect
int32_t | ARC_FRect_Intersects (ARC_FRect *rect1, ARC_FRect *rect2)
| checks if two ARC_FRects intersect
int32_t | ARC_Rect_IntersectsPoint (ARC_Rect *rect, ARC_Point *point)
| checks if ARC_Rect intersects with point
int32_t | ARC_FRect_IntersectsPoint (ARC_FRect *rect, ARC_Point *point)
| checks if ARC_FRect intersects with point
int32_t | ARC_Rect_LineIntersects (ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2)
| checks if ARC_Rect intersects a line
void | ARC_FRect_CollideAndSlide (ARC_FRect *rect, ARC_Vector2 *velocity, ARC_FRect *wall)
| checks for a ARC_Rect on ARC_Rect collision and slides on collision

## Typedef Documentation

## ARC_FRect

typedef struct ARC_FRect ARC_FRect

## ARC_Rect

typedef struct ARC_Rect ARC_Rect

## ARC_URect

typedef struct ARC_URect ARC_URect

## Function Documentation

## ARC_FRect_CastToRect()

ARC_Rect ARC_FRect_CastToRect | ( | ARC_FRect * | rect | ) |

casts FRect to Rect

Parameters

  rect | ARC_FRect to be casted

Returns
  ARC_Rect

## ARC_FRect_CenterOn()

void ARC_FRect_CenterOn | ( | ARC_FRect * | rect,
|  | ARC_FRect * | bounds )

centers rect on given bounds

Parameters

  rect | ARC_FRect to be centered
  bounds | ARC_FRect area to center rect on

## ARC_FRect_CollideAndSlide()

void ARC_FRect_CollideAndSlide | ( | ARC_FRect * | rect,
|  | ARC_Vector2 * | velocity,
|  | ARC_FRect * | wall )

checks for a ARC_Rect on ARC_Rect collision and slides on collision

Note
  need to update this documenation to word it better

Parameters

  rect | ARC_Rect that might collide with the wall
  velocity | the ammount ARC_Rect will move
  wall | ARC_Rect that might have collision with rect

Note
  velocity is updated based on colliding, rect's values are not changed, velocity should be applied after

## ARC_FRect_Intersects()

int32_t ARC_FRect_Intersects | ( | ARC_FRect * | rect1,
|  | ARC_FRect * | rect2 )

checks if two ARC_FRects intersect

Parameters

  rect1 | ARC_FRect that will be checked against rect2
  rect2 | ARC_FRect that will be checked against rect1

Returns
  1 if they intersect, 0 if they don't intersect

## ARC_FRect_IntersectsPoint()

int32_t ARC_FRect_IntersectsPoint | ( | ARC_FRect * | rect,
|  | ARC_Point * | point )

checks if ARC_FRect intersects with point

Parameters

  rect | ARC_FRect that will be checked against point
  point | ARC_Point that will be checked against rect

Returns
  1 if they intersect, 0 if they don't intersect

## ARC_Rect_CastToFRect()

ARC_FRect ARC_Rect_CastToFRect | ( | ARC_Rect * | rect | ) |

casts Rect to FRect

Parameters

  rect | ARC_Rect to be casted

Returns
  ARC_FRect

## ARC_Rect_CenterOn()

void ARC_Rect_CenterOn | ( | ARC_Rect * | rect,
|  | ARC_Rect * | bounds )

centers rect on given bounds

Parameters

  rect | ARC_Rect to be centered
  bounds | ARC_Rect area to center rect on

## ARC_Rect_Intersects()

int32_t ARC_Rect_Intersects | ( | ARC_Rect * | rect1,
|  | ARC_Rect * | rect2 )

checks if two ARC_Rects intersect

Parameters

  rect1 | ARC_Rect that will be checked against rect2
  rect2 | ARC_Rect that will be checked against rect1

Returns
  1 if they intersect, 0 if they don't intersect

## ARC_Rect_IntersectsPoint()

int32_t ARC_Rect_IntersectsPoint | ( | ARC_Rect * | rect,
|  | ARC_Point * | point )

checks if ARC_Rect intersects with point

Parameters

  rect | ARC_Rect that will be checked against point
  point | ARC_Point that will be checked against rect

Returns
  1 if they intersect, 0 if they don't intersect

## ARC_Rect_LineIntersects()

int32_t ARC_Rect_LineIntersects | ( | ARC_Rect * | rect,
|  | int32_t * | x1,
|  | int32_t * | y1,
|  | int32_t * | x2,
|  | int32_t * | y2 )

checks if ARC_Rect intersects a line

Note
  need to update this documenation to word it better

Parameters

  rect | ARC_Rect that will be checked against line
  x1 | first point's x value
  y1 | first point's y value
  y2 | second point's x value
  y2 | second point's y value

Returns
  1 if they intersect, 0 if they don't intersect