fix mixing up of SDL and libc allocators, proper flushing of quad build buffers

This commit is contained in:
veclavtalica
2025-01-30 21:57:20 +03:00
parent 7074e7499a
commit bd89c4b938
16 changed files with 33 additions and 26 deletions

View File

@ -13,7 +13,7 @@
#define TERRAIN_FREQUENCY 0.15f
#define TERRAIN_DISTANCE 100
#define TERRAIN_DISTANCE 64
#define HALF_TERRAIN_DISTANCE ((float)TERRAIN_DISTANCE / 2)
#define PLAYER_HEIGHT 0.6f
@ -237,7 +237,7 @@ static void ingame_end(State *state) {
Scene *ingame_scene(State *state) {
(void)state;
SceneIngame *new_scene = ccalloc(1, sizeof *new_scene);
SceneIngame *new_scene = calloc(1, sizeof *new_scene);
new_scene->base.tick = ingame_tick;
new_scene->base.end = ingame_end;

View File

@ -23,7 +23,7 @@ static void title_tick(State *state) {
/* draw the tick count as an example of dynamic text */
size_t text_str_len = snprintf(NULL, 0, "%llu", (unsigned long long)state->ctx->frame_number) + 1;
char *text_str = cmalloc(text_str_len);
char *text_str = malloc(text_str_len);
snprintf(text_str, text_str_len, "%llu", (unsigned long long)state->ctx->frame_number);
const char *font = "/fonts/kenney-pixel.ttf";
@ -34,8 +34,8 @@ static void title_tick(State *state) {
(Rect) {
.x = 0,
.y = 0,
.w = text_w,
.h = text_h,
.w = (float)text_w,
.h = (float)text_h,
},
(Color) { 0, 0, 0, 255 }
);
@ -53,7 +53,7 @@ static void title_end(State *state) {
Scene *title_scene(State *state) {
(void)state;
SceneTitle *new_scene = ccalloc(1, sizeof *new_scene);
SceneTitle *new_scene = calloc(1, sizeof *new_scene);
new_scene->base.tick = title_tick;
new_scene->base.end = title_end;