|
Banjo API 1.0.0-rc.2
Low-level C99 game development API
|
#include <banjo/api.h>Go to the source code of this file.
Data Structures | |
| struct | bj_rect |
Functions | |
| bj_bool | bj_rect_intersection (const struct bj_rect *rect_a, const struct bj_rect *rect_b, struct bj_rect *result) |
| void | bj_rect_union (const struct bj_rect *rect_a, const struct bj_rect *rect_b, struct bj_rect *result) |
Axis-aligned rectangle in pixel coordinates.
A bj_rect describes an axis-aligned rectangle in pixel space: a top-left corner (x, y) and a size (w, h). The coordinate system matches the rest of Banjo's 2D APIs: origin at the top-left of the surface, X increasing to the right, Y increasing downward.
Position is signed (a rectangle can extend off the top-left of the surface and be clipped by drawing or blit routines); size is unsigned. The full rectangle covers pixels in [x, x + w) horizontally and [y, y + h) vertically.
Used as a region selector by the bitmap drawing and blit functions (bj_blit, bj_blit_stretched, ...). bj_rect_intersection computes the overlap of two rectangles for clipping or hit-testing.
Definition in file rect.h.