Font.c File Reference
#include <SDL.h>
#include <SDL_ttf.h>
#include "Font.h"
Include dependency graph for Font.c:

Functions

void Font_Free (Font *pstFont)
 Free font. More...
 
Sint8 Font_Init (const char *pacFileName, Font **pstFont)
 Initialise font. More...
 
Sint8 Font_PrintNumber (const Sint32 s32Number, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
 Print number. More...
 
Sint8 Font_PrintText (const char *pacText, const Sint32 s32PosX, const Sint32 s32PosY, const Font *pstFont, SDL_Renderer *pstRenderer)
 Print text. More...
 
void Font_SetColour (const Uint8 u8Red, const Uint8 u8Green, const Uint8 u8Blue, Font *pstFont)
 Set font colour. More...
 

Function Documentation

◆ Font_Free()

void Font_Free ( Font pstFont)

Free font.

Frees up allocated memory and unloads font

Parameters
pstFontPointer to font handle

◆ Font_Init()

Sint8 Font_Init ( const char *  pacFileName,
Font **  pstFont 
)

Initialise font.

Initialises font

Parameters
pacFileNameFull path and filename of file
pstFontPointer to font handle
Returns
Error code
Return values
0OK
-1Error

◆ Font_PrintNumber()

Sint8 Font_PrintNumber ( const Sint32  s32Number,
const Sint32  s32PosX,
const Sint32  s32PosY,
const Font pstFont,
SDL_Renderer *  pstRenderer 
)

Print number.

Prints number on screen

Parameters
s32NumberThe number to print
s32PosXPosition along the x-axis
s32PosYPosition along the y-axis
pstFontPointer to font handle
pstRendererPointer to SDL2 rendering context
Returns
Error code
Return values
0OK
-1Error
Here is the call graph for this function:

◆ Font_PrintText()

Sint8 Font_PrintText ( const char *  pacText,
const Sint32  s32PosX,
const Sint32  s32PosY,
const Font pstFont,
SDL_Renderer *  pstRenderer 
)

Print text.

Prints a string on screen

Parameters
pacTextThe text to print
s32PosXPosition along the x-axis
s32PosYPosition along the y-axis
pstFontPointer to font handle
pstRendererPointer to SDL2 rendering context
Returns
Error code
Return values
0OK
-1Error
Here is the caller graph for this function:

◆ Font_SetColour()

void Font_SetColour ( const Uint8  u8Red,
const Uint8  u8Green,
const Uint8  u8Blue,
Font pstFont 
)

Set font colour.

Sets the colour (RGB) of a font

Parameters
u8RedRed colour
u8GreenGreen colour
u8BlueBlue colour
pstFontPointer to font handle