twn_util.c: use more appropriate SDL functions for intersect_(f)rect
This commit is contained in:
parent
e33a97294c
commit
ddf0ef6a0c
@ -202,16 +202,14 @@ bool overlap_frect(const t_frect *a, const t_frect *b, t_frect *result) {
|
||||
bool intersect_rect(const t_rect *a, const t_rect *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 };
|
||||
return SDL_IntersectRect(&a_sdl, &b_sdl, &result_sdl);
|
||||
return SDL_HasIntersection(&a_sdl, &b_sdl);
|
||||
}
|
||||
|
||||
|
||||
bool intersect_frect(const t_frect *a, const t_frect *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 };
|
||||
return SDL_IntersectFRect(&a_sdl, &b_sdl, &result_sdl);
|
||||
return SDL_HasIntersectionF(&a_sdl, &b_sdl);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user