# HG changeset patch # User Mike Becker # Date 1705840311 -3600 # Node ID 601b3f4e17a2bca9acf831a59449688c6c8892a8 # Parent 7183b4ae9b20de7e44525bc2a058b596652cde3d rename AscTextNode to just AscText diff -r 7183b4ae9b20 -r 601b3f4e17a2 src/ascension/text.h --- a/src/ascension/text.h Thu Jan 18 21:58:58 2024 +0100 +++ b/src/ascension/text.h Sun Jan 21 13:31:51 2024 +0100 @@ -32,7 +32,7 @@ #include "datatypes.h" #include -typedef struct AscTextNode { +typedef struct AscText { char *text; AscFont const *font; asc_vec2i position; @@ -44,7 +44,7 @@ asc_vec2i dimension; unsigned tex_id; } internal; -} AscTextNode; +} AscText; /** @@ -61,7 +61,7 @@ * @see asc_ink() * @see asc_font() */ -AscTextNode *asc_text(int x, int y, char const* text); +AscText *asc_text(int x, int y, char const* text); /** * Updates the internal state of the text node. @@ -71,20 +71,20 @@ * * @param node the text node */ -void asc_text_update(AscTextNode *node); +void asc_text_update(AscText *node); /** * Draws the text node in the current frame. * * @param node the text node */ -void asc_text_draw(AscTextNode *node); +void asc_text_draw(AscText *node); /** * Releases all the memory of this node. * * @param node the text node */ -void asc_text_free(AscTextNode *node); +void asc_text_free(AscText *node); #endif //ASCENSION_TEXT_H diff -r 7183b4ae9b20 -r 601b3f4e17a2 src/text.c --- a/src/text.c Thu Jan 18 21:58:58 2024 +0100 +++ b/src/text.c Sun Jan 21 13:31:51 2024 +0100 @@ -32,8 +32,8 @@ #include -AscTextNode *asc_text(int x, int y, char const *text) { - AscTextNode *node = calloc(1, sizeof(AscTextNode)); +AscText *asc_text(int x, int y, char const *text) { + AscText *node = calloc(1, sizeof(AscText)); if (node == NULL) { asc_error("Out of memory."); return NULL; @@ -49,7 +49,7 @@ return node; } -void asc_text_update(AscTextNode *node) { +void asc_text_update(AscText *node) { // short circuit if fully transparent or hidden, we don't need anything if (node->color.alpha == 0 || node->hidden) { return; @@ -93,7 +93,7 @@ SDL_FreeSurface(surface); } -void asc_text_draw(AscTextNode *node) { +void asc_text_draw(AscText *node) { if (node->color.alpha == 0 || node->hidden) { return; } @@ -128,7 +128,7 @@ asc_primitives_draw_plane(); } -void asc_text_free(AscTextNode *node) { +void asc_text_free(AscText *node) { asc_dprintf("Release text node texture: %u", node->internal.tex_id); glDeleteTextures(1, &node->internal.tex_id); free(node->text); diff -r 7183b4ae9b20 -r 601b3f4e17a2 test/sandbox.c --- a/test/sandbox.c Thu Jan 18 21:58:58 2024 +0100 +++ b/test/sandbox.c Sun Jan 21 13:31:51 2024 +0100 @@ -54,7 +54,7 @@ asc_set_font(asc_font(ASC_FONT_REGULAR, 24)); asc_ink_rgb(255, 0, 0); - AscTextNode *fps_counter = asc_text(50, 50, "9999 FPS"); + AscText *fps_counter = asc_text(50, 50, "9999 FPS"); unsigned last_fps = 0; while (asc_loop_next()) {