From ddf0ef6a0cf6c4032cfdc385946d4af05ac9836f Mon Sep 17 00:00:00 2001 From: wanp Date: Fri, 20 Sep 2024 22:57:55 -0300 Subject: [PATCH] twn_util.c: use more appropriate SDL functions for intersect_(f)rect --- src/twn_util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/twn_util.c b/src/twn_util.c index 2ff26ce..da55790 100644 --- a/src/twn_util.c +++ b/src/twn_util.c @@ -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); }