yet another api rework, removal of integer types in public api, optionals at the end, some cleaning
This commit is contained in:
@ -198,19 +198,7 @@ bool strends(const char *str, const char *suffix) {
|
||||
|
||||
|
||||
/* TODO: have our own */
|
||||
Recti overlap_recti(const Recti a, const Recti b) {
|
||||
SDL_Rect a_sdl = { a.x, a.y, a.w, a.h };
|
||||
SDL_Rect b_sdl = { b.x, b.y, b.w, b.h };
|
||||
SDL_Rect result_sdl = { 0 };
|
||||
|
||||
(void)SDL_IntersectRect(&a_sdl, &b_sdl, &result_sdl);
|
||||
|
||||
return (Recti){ result_sdl.x, result_sdl.y, result_sdl.w, result_sdl.h };
|
||||
}
|
||||
|
||||
|
||||
/* TODO: have our own */
|
||||
Rect overlap_rect(const Rect a, const Rect b) {
|
||||
Rect rect_overlap(const Rect a, const Rect b) {
|
||||
SDL_FRect a_sdl = { a.x, a.y, a.w, a.h };
|
||||
SDL_FRect b_sdl = { b.x, b.y, b.w, b.h };
|
||||
SDL_FRect result_sdl = { 0 };
|
||||
@ -222,50 +210,14 @@ Rect overlap_rect(const Rect a, const Rect b) {
|
||||
|
||||
|
||||
/* TODO: have our own */
|
||||
bool intersect_recti(const Recti a, const Recti b) {
|
||||
SDL_Rect a_sdl = { a.x, a.y, a.w, a.h };
|
||||
SDL_Rect b_sdl = { b.x, b.y, b.w, b.h };
|
||||
return SDL_HasIntersection(&a_sdl, &b_sdl);
|
||||
}
|
||||
|
||||
|
||||
/* TODO: have our own */
|
||||
bool intersect_rect(const Rect a, const Rect b) {
|
||||
bool rect_intersects(const Rect a, const Rect b) {
|
||||
SDL_FRect a_sdl = { a.x, a.y, a.w, a.h };
|
||||
SDL_FRect b_sdl = { b.x, b.y, b.w, b.h };
|
||||
return SDL_HasIntersectionF(&a_sdl, &b_sdl);
|
||||
}
|
||||
|
||||
|
||||
Recti to_recti(Rect rect) {
|
||||
return (Recti) {
|
||||
.h = (int32_t)rect.h,
|
||||
.w = (int32_t)rect.w,
|
||||
.x = (int32_t)rect.x,
|
||||
.y = (int32_t)rect.y,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Rect to_rect(Recti rect) {
|
||||
return (Rect) {
|
||||
.h = (float)rect.h,
|
||||
.w = (float)rect.w,
|
||||
.x = (float)rect.x,
|
||||
.y = (float)rect.y,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vec2i center_recti(Recti rect) {
|
||||
return (Vec2i){
|
||||
.x = rect.x + rect.w / 2,
|
||||
.y = rect.y + rect.h / 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vec2 center_rect(Rect rect) {
|
||||
Vec2 rect_center(Rect rect) {
|
||||
return (Vec2){
|
||||
.x = rect.x + rect.w / 2,
|
||||
.y = rect.y + rect.h / 2,
|
||||
|
Reference in New Issue
Block a user