Font.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: Beerware
6 #pragma once
7 
8 #include <SDL.h>
9 #include <SDL_ttf.h>
10 
17 typedef struct Font_t
18 {
19  TTF_Font* pstTTF;
20  SDL_Colour stColour;
21 
22 } Font;
23 
24 void Font_Free(Font* pstFont);
25 Sint8 Font_Init(const char* pacFileName, Font** pstFont);
26 
27 Sint8 Font_PrintNumber(
28  const Sint32 s32Number,
29  const Sint32 s32PosX,
30  const Sint32 s32PosY,
31  const Font* pstFont,
32  SDL_Renderer* pstRenderer);
33 
34 Sint8 Font_PrintText(
35  const char* pacText,
36  const Sint32 s32PosX,
37  const Sint32 s32PosY,
38  const Font* pstFont,
39  SDL_Renderer* pstRenderer);
40 
41 void Font_SetColour(const Uint8 u8Red, const Uint8 u8Green, const Uint8 u8Blue, Font* pstFont);
Font handle data.
Definition: Font.h:17
Sint8 Font_Init(const char *pacFileName, Font **pstFont)
Initialise font.
Definition: Font.c:39
void Font_SetColour(const Uint8 u8Red, const Uint8 u8Green, const Uint8 u8Blue, Font *pstFont)
Set font colour.
Definition: Font.c:210
TTF_Font * pstTTF
Pointer to SDL2 TTF handle.
Definition: Font.h:19
Sint8 Font_PrintText(const char *pacText, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
Print text.
Definition: Font.c:128
void Font_Free(Font *pstFont)
Free font.
Definition: Font.c:20
SDL_Colour stColour
Font colour.
Definition: Font.h:20
void Font_SetColour(const Uint8 u8Red, const Uint8 u8Green, const Uint8 u8Blue, Font *pstFont)
Set font colour.
Definition: Font.c:210
Sint8 Font_PrintNumber(const Sint32 s32Number, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
Print number.
Definition: Font.c:83
struct Font_t Font
Font handle type.
Sint8 Font_PrintNumber(const Sint32 s32Number, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
Print number.
Definition: Font.c:83
Sint8 Font_PrintText(const char *pacText, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
Print text.
Definition: Font.c:128
void Font_Free(Font *pstFont)
Free font.
Definition: Font.c:20
Sint8 Font_Init(const char *pacFileName, Font **pstFont)
Initialise font.
Definition: Font.c:39