rendering.c: sprite rotation

This commit is contained in:
2024-07-27 16:55:38 +03:00
parent 687e42ddfd
commit 79bc261ccd
5 changed files with 135 additions and 58 deletions

View File

@@ -77,29 +77,6 @@ typedef struct color {
} t_color;
/* a rectangle with the origin at the upper left (integer) */
typedef struct rect {
int x, y;
int w, h;
} t_rect;
bool intersect_rect(const t_rect *a, const t_rect *b, t_rect *result);
/* a rectangle with the origin at the upper left (floating point) */
typedef struct frect {
float x, y;
float w, h;
} t_frect;
bool intersect_frect(const t_frect *a, const t_frect *b, t_frect *result);
/* TODO: generics and specials (see m_to_fvec2() for an example)*/
t_frect to_frect(t_rect rect);
/* a point in some space (integer) */
typedef struct vec2 {
int x, y;
@@ -125,6 +102,30 @@ typedef struct shvec2 {
} t_shvec2;
/* a rectangle with the origin at the upper left (integer) */
typedef struct rect {
int x, y;
int w, h;
} t_rect;
/* a rectangle with the origin at the upper left (floating point) */
typedef struct frect {
float x, y;
float w, h;
} t_frect;
bool intersect_rect(const t_rect *a, const t_rect *b, t_rect *result);
bool intersect_frect(const t_frect *a, const t_frect *b, t_frect *result);
/* TODO: generics and specials (see m_to_fvec2() for an example)*/
t_frect to_frect(t_rect rect);
t_fvec2 frect_center(t_frect rect);
/* aren't macros to prevent double evaluation with side effects */
/* maybe could be inlined? i hope LTO will resolve this */
t_fvec2 fvec2_from_vec2(t_vec2 vec);