SDL 2.0
|
Go to the source code of this file.
Data Structures | |
struct | SDLTest_TextWindow |
Data used for multi-line text output. More... | |
Macros | |
#define | FONT_CHARACTER_SIZE 8 |
#define | FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2) |
Functions | |
int | SDLTest_DrawCharacter (SDL_Renderer *renderer, int x, int y, Uint32 c) |
Draw a string in the currently set font. | |
int | SDLTest_DrawString (SDL_Renderer *renderer, int x, int y, const char *s) |
Draw a UTF-8 string in the currently set font. | |
SDLTest_TextWindow * | SDLTest_TextWindowCreate (int x, int y, int w, int h) |
Create a multi-line text output window. | |
void | SDLTest_TextWindowDisplay (SDLTest_TextWindow *textwin, SDL_Renderer *renderer) |
Display a multi-line text output window. | |
void | SDLTest_TextWindowAddText (SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(2) |
Add text to a multi-line text output window. | |
void | SDLTest_TextWindowAddTextWithLength (SDLTest_TextWindow *textwin, const char *text, size_t len) |
Add text to a multi-line text output window. | |
void | SDLTest_TextWindowClear (SDLTest_TextWindow *textwin) |
Clear the text in a multi-line text output window. | |
void | SDLTest_TextWindowDestroy (SDLTest_TextWindow *textwin) |
Free the storage associated with a multi-line text output window. | |
void | SDLTest_CleanupTextDrawing (void) |
Cleanup textures used by font drawing functions. | |
Include file for SDL test framework.
This code is a part of the SDL2_test library, not the main SDL library.
Definition in file SDL_test_font.h.
#define FONT_CHARACTER_SIZE 8 |
Definition at line 41 of file SDL_test_font.h.
#define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2) |
Definition at line 42 of file SDL_test_font.h.
void SDLTest_CleanupTextDrawing | ( | void | ) |
Cleanup textures used by font drawing functions.
int SDLTest_DrawCharacter | ( | SDL_Renderer * | renderer, |
int | x, | ||
int | y, | ||
Uint32 | c | ||
) |
Draw a string in the currently set font.
renderer | The renderer to draw on. |
x | The X coordinate of the upper left corner of the character. |
y | The Y coordinate of the upper left corner of the character. |
c | The character to draw. |
int SDLTest_DrawString | ( | SDL_Renderer * | renderer, |
int | x, | ||
int | 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.
renderer | The renderer to draw on. |
x | The X coordinate of the upper left corner of the string. |
y | The Y coordinate of the upper left corner of the string. |
s | The string to draw. |
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.
textwin | The text output window |
fmt | A printf() style format string |
... | additional parameters matching % tokens in the fmt string, if any |
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.
textwin | The text output window |
text | The text to add to the window |
len | The length, in bytes, of the text to add to the window |
void SDLTest_TextWindowClear | ( | SDLTest_TextWindow * | textwin | ) |
Clear the text in a multi-line text output window.
textwin | The text output window |
SDLTest_TextWindow * SDLTest_TextWindowCreate | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Create a multi-line text output window.
x | The X coordinate of the upper left corner of the window. |
y | The Y coordinate of the upper left corner of the window. |
w | The width of the window (currently ignored) |
h | The height of the window (currently ignored) |
void SDLTest_TextWindowDestroy | ( | SDLTest_TextWindow * | textwin | ) |
Free the storage associated with a multi-line text output window.
textwin | The text output window |
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
textwin | The text output window |
renderer | The renderer to use for display |