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

@ -34,7 +34,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

@ -5,9 +5,8 @@
#include "twn_game_api.h"
#include <SDL2/SDL.h>
#include <stdio.h>
#include <stdlib.h>
static void title_tick(State *state) {
@ -26,8 +25,9 @@ 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);
free(text_str);
const char *font = "fonts/kenney-pixel.ttf";
float text_h = 32;
@ -64,7 +64,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;