OCRudoku  v1.0
Resolve word grid with ease
Loading...
Searching...
No Matches
EZ_text.c File Reference
#include <err.h>
#include <string.h>
#include "EZ_text.h"
Include dependency graph for EZ_text.c:

Functions

EZ_textEZ_create_text (char *text, TTF_Font *font, SDL_Color color, SDL_Renderer *renderer, anchore_point dst_anchore, int auto_aspect)
 Creates an EZ_text object with the given parameters.
 
void EZ_change_text (EZ_text *text_obj, char *text, TTF_Font *font, SDL_Color color, SDL_Renderer *renderer, int auto_aspect)
 Changes the text of an existing EZ_text object.
 

Function Documentation

◆ EZ_change_text()

void EZ_change_text ( EZ_text * text_obj,
char * text,
TTF_Font * font,
SDL_Color color,
SDL_Renderer * renderer,
int auto_aspect )

Changes the text of an existing EZ_text object.

This function updates the text of an existing EZ_text object. It creates a new surface and texture from the provided text, font, and color, and updates the EZ_text object with the new texture and source rectangle. If auto_aspect is non-zero, the aspect ratio of the destination anchore will be automatically set based on the new surface dimensions.

Parameters
text_objThe EZ_text object to be updated.
textThe new text to be rendered.
fontThe TTF_Font to be used for rendering the new text.
colorThe SDL_Color to be used for the new text.
rendererThe SDL_Renderer to be used for creating the new texture.
auto_aspectIf non-zero, the aspect ratio of the destination anchore will be automatically set based on the new surface dimensions.
Note
If the font is NULL, the function will terminate the program with an error.
If the surface or texture creation fails, the function will terminate the program with an error.

◆ EZ_create_text()

EZ_text * EZ_create_text ( char * text,
TTF_Font * font,
SDL_Color color,
SDL_Renderer * renderer,
anchore_point dst_anchore,
int auto_aspect )

Creates an EZ_text object with the given parameters.

This function creates an EZ_text object, which includes rendering the text to a surface and creating a texture from that surface. The resulting texture is then used to create an EZ_DRAWABLE structure, which is stored in the EZ_text object.

Parameters
textThe text to be rendered.
fontThe TTF_Font to be used for rendering the text.
colorThe SDL_Color to be used for the text.
rendererThe SDL_Renderer to be used for creating the texture.
dst_anchoreThe anchore_point for the destination.
auto_aspectIf non-zero, the aspect ratio of the destination anchore will be automatically set based on the surface dimensions.
Returns
A pointer to the created EZ_text object.
Note
If the font is NULL, the function will terminate the program with an error.
If the surface or texture creation fails, the function will terminate the program with an error.