Sun, 21 Jan 2024 13:31:51 +0100
rename AscTextNode to just AscText
src/ascension/text.h | file | annotate | diff | comparison | revisions | |
src/text.c | file | annotate | diff | comparison | revisions | |
test/sandbox.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/ascension/text.h Thu Jan 18 21:58:58 2024 +0100 1.2 +++ b/src/ascension/text.h Sun Jan 21 13:31:51 2024 +0100 1.3 @@ -32,7 +32,7 @@ 1.4 #include "datatypes.h" 1.5 #include <cx/buffer.h> 1.6 1.7 -typedef struct AscTextNode { 1.8 +typedef struct AscText { 1.9 char *text; 1.10 AscFont const *font; 1.11 asc_vec2i position; 1.12 @@ -44,7 +44,7 @@ 1.13 asc_vec2i dimension; 1.14 unsigned tex_id; 1.15 } internal; 1.16 -} AscTextNode; 1.17 +} AscText; 1.18 1.19 1.20 /** 1.21 @@ -61,7 +61,7 @@ 1.22 * @see asc_ink() 1.23 * @see asc_font() 1.24 */ 1.25 -AscTextNode *asc_text(int x, int y, char const* text); 1.26 +AscText *asc_text(int x, int y, char const* text); 1.27 1.28 /** 1.29 * Updates the internal state of the text node. 1.30 @@ -71,20 +71,20 @@ 1.31 * 1.32 * @param node the text node 1.33 */ 1.34 -void asc_text_update(AscTextNode *node); 1.35 +void asc_text_update(AscText *node); 1.36 1.37 /** 1.38 * Draws the text node in the current frame. 1.39 * 1.40 * @param node the text node 1.41 */ 1.42 -void asc_text_draw(AscTextNode *node); 1.43 +void asc_text_draw(AscText *node); 1.44 1.45 /** 1.46 * Releases all the memory of this node. 1.47 * 1.48 * @param node the text node 1.49 */ 1.50 -void asc_text_free(AscTextNode *node); 1.51 +void asc_text_free(AscText *node); 1.52 1.53 #endif //ASCENSION_TEXT_H
2.1 --- a/src/text.c Thu Jan 18 21:58:58 2024 +0100 2.2 +++ b/src/text.c Sun Jan 21 13:31:51 2024 +0100 2.3 @@ -32,8 +32,8 @@ 2.4 2.5 #include <GL/glew.h> 2.6 2.7 -AscTextNode *asc_text(int x, int y, char const *text) { 2.8 - AscTextNode *node = calloc(1, sizeof(AscTextNode)); 2.9 +AscText *asc_text(int x, int y, char const *text) { 2.10 + AscText *node = calloc(1, sizeof(AscText)); 2.11 if (node == NULL) { 2.12 asc_error("Out of memory."); 2.13 return NULL; 2.14 @@ -49,7 +49,7 @@ 2.15 return node; 2.16 } 2.17 2.18 -void asc_text_update(AscTextNode *node) { 2.19 +void asc_text_update(AscText *node) { 2.20 // short circuit if fully transparent or hidden, we don't need anything 2.21 if (node->color.alpha == 0 || node->hidden) { 2.22 return; 2.23 @@ -93,7 +93,7 @@ 2.24 SDL_FreeSurface(surface); 2.25 } 2.26 2.27 -void asc_text_draw(AscTextNode *node) { 2.28 +void asc_text_draw(AscText *node) { 2.29 if (node->color.alpha == 0 || node->hidden) { 2.30 return; 2.31 } 2.32 @@ -128,7 +128,7 @@ 2.33 asc_primitives_draw_plane(); 2.34 } 2.35 2.36 -void asc_text_free(AscTextNode *node) { 2.37 +void asc_text_free(AscText *node) { 2.38 asc_dprintf("Release text node texture: %u", node->internal.tex_id); 2.39 glDeleteTextures(1, &node->internal.tex_id); 2.40 free(node->text);
3.1 --- a/test/sandbox.c Thu Jan 18 21:58:58 2024 +0100 3.2 +++ b/test/sandbox.c Sun Jan 21 13:31:51 2024 +0100 3.3 @@ -54,7 +54,7 @@ 3.4 3.5 asc_set_font(asc_font(ASC_FONT_REGULAR, 24)); 3.6 asc_ink_rgb(255, 0, 0); 3.7 - AscTextNode *fps_counter = asc_text(50, 50, "9999 FPS"); 3.8 + AscText *fps_counter = asc_text(50, 50, "9999 FPS"); 3.9 unsigned last_fps = 0; 3.10 3.11 while (asc_loop_next()) {