From 897a153d290ed4d3647ad9e0100d1b717f580b5f Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Tue, 12 May 2026 16:41:37 -0400 Subject: typedef all structs and rename to Ada_Case There isn't really a technical reason that I made this change. I just wanted to use Ada_Case. All types were prefixed with ty_, e.g. ty_Image. --- dc/dc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'dc/dc.c') diff --git a/dc/dc.c b/dc/dc.c index 99f9cf1..b90cca7 100644 --- a/dc/dc.c +++ b/dc/dc.c @@ -12,8 +12,8 @@ #define TILE_SIZE 16 -struct ty_image img; -struct ty_font font = {}; +ty_Image img; +ty_Font font = {}; double last_frame = 0; @@ -57,11 +57,11 @@ void tick(void) int y = 5; ty_draw_rect( - (struct ty_recti){ + (ty_Recti){ 5, 5, ms_width, 8, }, - TY_COLOR_BLACK + TY_COLOR_GRAY ); ty_draw_text_fmt( &font, @@ -75,11 +75,11 @@ void tick(void) int fps_width = ty_font_width(&font, fps_fmt, (int)(1.0 / frame_time)); ty_draw_rect( - (struct ty_recti){ + (ty_Recti){ 5, 5 + 8, fps_width, 8, }, - TY_COLOR_BLACK + TY_COLOR_GRAY ); ty_draw_text_fmt( &font, @@ -124,13 +124,13 @@ void tick(void) } -struct ty_image load_qoi_image(const char *path) +ty_Image load_qoi_image(const char *path) { qoi_desc desc; void *data = qoi_read(path, &desc, 3); if (!data) ty_log_fatal(TY_ERR_IO, "failed to read image"); - struct ty_image img = ty_create_image(desc.width, desc.height, data); + ty_Image img = ty_create_image(desc.width, desc.height, data); free(data); return img; @@ -138,7 +138,7 @@ struct ty_image load_qoi_image(const char *path) int main(void) { - struct ty_hints hints = { + ty_Hints hints = { .scr_width = SCREEN_WIDTH, .scr_height = SCREEN_HEIGHT, .game_title = "Demonchime", @@ -152,12 +152,12 @@ int main(void) "abcdefghijklmnopqrstuvwxyz0123456789" "!\"'#$%&()*+,-./@[]\\^_`{}|~:;<>=? " ; - struct ty_image font_img = load_qoi_image("font.qoi"); + ty_Image font_img = load_qoi_image("font.qoi"); int glyph_height = 8; for (int i = 0; font_chars[i] != '\0'; i++) { - struct ty_image glyph = ty_create_image( + ty_Image glyph = ty_create_image( font_img.width, glyph_height, font_img.data + font_img.width * glyph_height * i @@ -185,7 +185,7 @@ int main(void) for (int i = 0; i < CHAR_MAX; i++) { if (i >= 'a' && i <= 'z') continue; - struct ty_image glyph = font.glyphs[i]; + ty_Image glyph = font.glyphs[i]; if (glyph.width * glyph.height == 0) continue; ty_free_image(glyph); -- cgit v1.3-2-g0d8e