src/text.c

changeset 36
e26b4ac1661c
parent 33
e7ddb52facd3
child 37
8a8cc6725b48
equal deleted inserted replaced
35:674eb53c12f3 36:e26b4ac1661c
97 97
98 // Free the surface 98 // Free the surface
99 SDL_FreeSurface(surface); 99 SDL_FreeSurface(surface);
100 } 100 }
101 101
102 AscText *asc_text(int x, int y, char const *text) { 102 AscSceneNode *asc_text(int x, int y, char const *text) {
103 AscText *node = calloc(1, sizeof(AscText)); 103 AscText *node = calloc(1, sizeof(AscText));
104 if (node == NULL) { 104 if (node == NULL) {
105 asc_error("Out of memory."); 105 asc_error("Out of memory.");
106 return NULL; 106 return NULL;
107 } 107 }
116 node->color = asc_context.ink; 116 node->color = asc_context.ink;
117 if (text != NULL) { 117 if (text != NULL) {
118 node->text = strdup(text); 118 node->text = strdup(text);
119 } 119 }
120 120
121 asc_scene_add(&asc_context.active_window->ui, &node->base); 121 return &node->base;
122
123 return node;
124 } 122 }
125 123
126 void asc_text_free(AscText *node) { 124 void asc_text_free(AscText *node) {
127 asc_dprintf("Release text node texture: %u", node->internal.tex_id); 125 asc_dprintf("Release text node texture: %u", node->internal.tex_id);
128 glDeleteTextures(1, &node->internal.tex_id); 126 glDeleteTextures(1, &node->internal.tex_id);

mercurial