SDL 3.0
SDL_test_font.h File Reference
+ Include dependency graph for SDL_test_font.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDLTest_TextWindow
 

Macros

#define FONT_LINE_HEIGHT   (FONT_CHARACTER_SIZE + 2)
 

Functions

int SDLTest_DrawCharacter (SDL_Renderer *renderer, float x, float y, Uint32 c)
 
int SDLTest_DrawString (SDL_Renderer *renderer, float x, float y, const char *s)
 
SDLTest_TextWindowSDLTest_TextWindowCreate (float x, float y, float w, float h)
 
void SDLTest_TextWindowDisplay (SDLTest_TextWindow *textwin, SDL_Renderer *renderer)
 
void SDLTest_TextWindowAddText (SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(2)
 
void SDLTest_TextWindowAddTextWithLength (SDLTest_TextWindow *textwin, const char *text, size_t len)
 
void SDLTest_TextWindowClear (SDLTest_TextWindow *textwin)
 
void SDLTest_TextWindowDestroy (SDLTest_TextWindow *textwin)
 
void SDLTest_CleanupTextDrawing (void)
 

Variables

int FONT_CHARACTER_SIZE
 

Detailed Description

Font related functions of SDL test framework.

This code is a part of the SDL test library, not the main SDL library.

Definition in file SDL_test_font.h.

Macro Definition Documentation

◆ FONT_LINE_HEIGHT

#define FONT_LINE_HEIGHT   (FONT_CHARACTER_SIZE + 2)

Definition at line 43 of file SDL_test_font.h.

Function Documentation

◆ SDLTest_CleanupTextDrawing()

void SDLTest_CleanupTextDrawing ( void  )

Cleanup textures used by font drawing functions.

◆ SDLTest_DrawCharacter()

int SDLTest_DrawCharacter ( SDL_Renderer renderer,
float  x,
float  y,
Uint32  c 
)

Draw a string in the currently set font.

Parameters
rendererThe renderer to draw on.
xThe X coordinate of the upper left corner of the character.
yThe Y coordinate of the upper left corner of the character.
cThe character to draw.
Returns
0 on success, -1 on failure.

◆ SDLTest_DrawString()

int SDLTest_DrawString ( SDL_Renderer renderer,
float  x,
float  y,
const char *  s 
)

Draw a UTF-8 string in the currently set font.

The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets.

Parameters
rendererThe renderer to draw on.
xThe X coordinate of the upper left corner of the string.
yThe Y coordinate of the upper left corner of the string.
sThe string to draw.
Returns
0 on success, -1 on failure.

◆ SDLTest_TextWindowAddText()

void SDLTest_TextWindowAddText ( SDLTest_TextWindow textwin,
SDL_PRINTF_FORMAT_STRING const char *  fmt,
  ... 
)

Add text to a multi-line text output window

Adds UTF-8 text to the end of the current text. The newline character starts a new line of text. The backspace character deletes the last character or, if the line is empty, deletes the line and goes to the end of the previous line.

Parameters
textwinThe text output window
fmtA printf() style format string
...additional parameters matching % tokens in the fmt string, if any
Since
This function is available since SDL 3.0.0.

◆ SDLTest_TextWindowAddTextWithLength()

void SDLTest_TextWindowAddTextWithLength ( SDLTest_TextWindow textwin,
const char *  text,
size_t  len 
)

Add text to a multi-line text output window

Adds UTF-8 text to the end of the current text. The newline character starts a new line of text. The backspace character deletes the last character or, if the line is empty, deletes the line and goes to the end of the previous line.

Parameters
textwinThe text output window
textThe text to add to the window
lenThe length, in bytes, of the text to add to the window
Since
This function is available since SDL 3.0.0.

◆ SDLTest_TextWindowClear()

void SDLTest_TextWindowClear ( SDLTest_TextWindow textwin)

Clear the text in a multi-line text output window

Parameters
textwinThe text output window
Since
This function is available since SDL 3.0.0.

◆ SDLTest_TextWindowCreate()

SDLTest_TextWindow * SDLTest_TextWindowCreate ( float  x,
float  y,
float  w,
float  h 
)

Create a multi-line text output window

Parameters
xThe X coordinate of the upper left corner of the window.
yThe Y coordinate of the upper left corner of the window.
wThe width of the window (currently ignored)
hThe height of the window (currently ignored)
Returns
the new window, or NULL on failure.
Since
This function is available since SDL 3.0.0.

◆ SDLTest_TextWindowDestroy()

void SDLTest_TextWindowDestroy ( SDLTest_TextWindow textwin)

Free the storage associated with a multi-line text output window

Parameters
textwinThe text output window
Since
This function is available since SDL 3.0.0.

◆ SDLTest_TextWindowDisplay()

void SDLTest_TextWindowDisplay ( SDLTest_TextWindow textwin,
SDL_Renderer renderer 
)

Display a multi-line text output window

This function should be called every frame to display the text

Parameters
textwinThe text output window
rendererThe renderer to use for display
Since
This function is available since SDL 3.0.0.

Variable Documentation

◆ FONT_CHARACTER_SIZE

int FONT_CHARACTER_SIZE
extern