From ba4a36ffe5bc565ae65632aaa5ab438c12610bd0 Mon Sep 17 00:00:00 2001 From: herbglitch Date: Tue, 3 Jan 2023 19:21:27 -0700 Subject: [PATCH] fixed rectangles layout --- include/arc/graphics/rect.h | 23 ----------------------- include/arc/math/rectangle.h | 4 ++++ src/graphics/sdl/rect.c | 23 ----------------------- 3 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 include/arc/graphics/rect.h delete mode 100644 src/graphics/sdl/rect.c diff --git a/include/arc/graphics/rect.h b/include/arc/graphics/rect.h deleted file mode 100644 index ad52bf2..0000000 --- a/include/arc/graphics/rect.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ARC_GRAPHICS_RECT_H_ -#define ARC_GRAPHICS_RECT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "arc/graphics/color.h" -#include "arc/graphics/renderer.h" -#include "arc/math/rectangle.h" -#include - -void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color); - -int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2); - -int32_t ARC_Rect_LineIntersects(ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2); - -#ifdef __cplusplus -} -#endif - -#endif // !ARC_GRAPHICS_RECT_H_ diff --git a/include/arc/math/rectangle.h b/include/arc/math/rectangle.h index c35f2d7..b132609 100644 --- a/include/arc/math/rectangle.h +++ b/include/arc/math/rectangle.h @@ -17,4 +17,8 @@ typedef struct ARC_URect { uint32_t h; } ARC_URect; +int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2); + +int32_t ARC_Rect_LineIntersects(ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2); + #endif // ARC_MATH_POINT_H_ diff --git a/src/graphics/sdl/rect.c b/src/graphics/sdl/rect.c deleted file mode 100644 index b327467..0000000 --- a/src/graphics/sdl/rect.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "arc/graphics/rect.h" -#ifdef ARC_SDL -#include "arc/graphics/sdl/renderer.h" -#include - -void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){ - SDL_SetRenderDrawColor(renderer->renderer, color->r, color->g, color->b, color->a); - SDL_RenderDrawRect(renderer->renderer, (SDL_Rect *) rect); -} - -int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2){ - if(rect1->x <= rect2->x + rect2->w && rect1->x + rect1->w >= rect2->x && - rect1->y <= rect2->y + rect2->h && rect1->y + rect1->h >= rect2->y){ - return 1; - } - return 0; -} - -int32_t ARC_Rect_LineIntersects(ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2){ - return SDL_IntersectRectAndLine((SDL_Rect *) rect, x1, y1, x2, y2); -} - -#endif // ARC_SDL \ No newline at end of file