My Project
Loading...
Searching...
No Matches
SDL_test_font.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
30#ifndef SDL_test_font_h_
31#define SDL_test_font_h_
32
33#include "begin_code.h"
34/* Set up for C function definitions, even when using C++ */
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/* Function prototypes */
40
41#define FONT_CHARACTER_SIZE 8
42#define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2)
43
54int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
55
68int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
69
73typedef struct SDLTest_TextWindow
74{
75 SDL_Rect rect;
76 int current;
77 int numlines;
78 char **lines;
80
93SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
94
105void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
106
120void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
121
135void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
136
145
154
159
160/* Ends C function definitions when using C++ */
161#ifdef __cplusplus
162}
163#endif
164#include "close_code.h"
165
166#endif /* SDL_test_font_h_ */
167
168/* vi: set ts=4 sw=4 expandtab: */
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_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_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len)
Add text to a multi-line text output window.
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
Draw a string in the currently set font.
void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer)
Display a multi-line text output window.
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_CleanupTextDrawing(void)
Cleanup textures used by font drawing functions.
Definition: SDL_rect.h:79
Data used for multi-line text output.
Definition: SDL_test_font.h:74