rework of textures, finalization of basic opengl rendering

This commit is contained in:
2024-07-14 16:04:12 +03:00
parent 55d85399e9
commit bd53a931c0
10 changed files with 243 additions and 245 deletions

View File

@@ -48,7 +48,9 @@ void *ccalloc(size_t num, size_t size);
#define MAX SDL_max
#define MIN SDL_min
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
/* sets buf_out to a pointer to a byte buffer which must be freed. */
/* returns the size of this buffer. */
@@ -94,6 +96,7 @@ typedef struct 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);
@@ -122,6 +125,17 @@ typedef struct shvec2 {
} t_shvec2;
/* 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);
t_fvec2 fvec2_from_shvec2(t_shvec2 vec);
#define m_to_fvec2(p_any_vec2) (_Generic((p_any_vec2), \
t_vec2: fvec2_from_vec2, \
t_shvec2: fvec2_from_shvec2 \
)(p_any_vec2))
/* decrements an lvalue (which should be an int), stopping at 0 */
/* meant for tick-based timers in game logic */
/*
@@ -130,7 +144,6 @@ typedef struct shvec2 {
*/
void tick_timer(int *value);
/* decrements a floating point second-based timer, stopping at 0.0 */
/* meant for poll based real time logic in game logic */
/* note that it should be decremented only on the next tick after its creation */