#define RECT_H_
#include <SDL2/SDL.h>
-#include "./math/point.h"
-typedef enum rect_side_t {
+#include "math/point.h"
+
+typedef enum Rect_side {
RECT_SIDE_LEFT = 0,
RECT_SIDE_RIGHT,
RECT_SIDE_TOP,
RECT_SIDE_BOTTOM,
RECT_SIDE_N
-} rect_side_t;
+} Rect_side;
-typedef struct rect_t {
+typedef struct Rect {
float x, y, w, h;
-} rect_t;
+} Rect;
-typedef struct line_t {
- point_t p1;
- point_t p2;
-} line_t;
+typedef struct Line {
+ Point p1;
+ Point p2;
+} Line;
-rect_t rect(float x, float y, float w, float h);
-rect_t rect_from_vecs(point_t position, vec_t size);
-rect_t rect_from_sdl(const SDL_Rect *rect);
+Rect rect(float x, float y, float w, float h);
+Rect rect_from_vecs(Point position, Vec size);
+Rect rect_from_sdl(const SDL_Rect *rect);
-rect_t rects_overlap_area(rect_t rect1, rect_t rect2);
+Rect rects_overlap_area(Rect rect1, Rect rect2);
-int rect_contains_point(rect_t rect, point_t p);
+int rect_contains_point(Rect rect, Point p);
-int rects_overlap(rect_t rect1, rect_t rect2);
+int rects_overlap(Rect rect1, Rect rect2);
-void rect_object_impact(const rect_t *object,
- const rect_t *obstacle,
+void rect_object_impact(Rect object,
+ Rect obstacle,
int *sides);
-line_t rect_side(rect_t rect, rect_side_t side);
+Line rect_side(Rect rect, Rect_side side);
+
+Rect rect_from_point(Point p, float w, float h);
+
+float line_length(Line line);
-rect_t rect_from_point(point_t p, float w, float h);
+SDL_Rect rect_for_sdl(Rect rect);
-float line_length(line_t line);
+Vec rect_center(Rect rect);
-SDL_Rect rect_for_sdl(rect_t rect);
+Rect rect_snap(Rect pivot, Rect rect);
+void rect_impulse(Rect *r1, Rect *r2);
#endif // RECT_H_