libc8
CHIP-8 utility library
font.c File Reference
#include "font.h"
#include "chip8.h"
#include "private/exception.h"
#include <stdint.h>
#include <string.h>

Macros

#define SMALLFONT_OCTO   0
 
#define SMALLFONT_VIP   1
 
#define SMALLFONT_DREAM6800   2
 
#define SMALLFONT_ETI660   3
 
#define SMALLFONT_FISH   4
 
#define BIGFONT_OCTO   0
 
#define BIGFONT_SCHIP   1
 
#define BIGFONT_FISH   2
 
#define OCTO_S   "octo"
 
#define VIP_S   "vip"
 
#define DREAM6800_S   "dream6800"
 
#define ETI660_S   "eti660"
 
#define FISH_S   "fish"
 
#define SCHIP_S   "schip"
 

Functions

void c8_set_fonts (c8_t *c8, int small, int big)
 Loads small and/or big fonts in c8 More...
 
int c8_set_fonts_s (c8_t *c8, char *s)
 Set fonts from string. More...
 
int c8_set_small_font (c8_t *c8, const char *s)
 Set small font from s (fontNames name) More...
 
int c8_set_big_font (c8_t *c8, const char *s)
 Set big font from s (fontNames name) More...
 
void print_fonts (c8_t *c8)
 Print fonts (for debug) More...
 

Variables

const char * c8_fontNames [2][5]
 
const uint8_t smallFonts [5][80]
 
const uint8_t bigFonts [3][160]
 

Detailed Description

Stuff related to loading fonts.

Macro Definition Documentation

◆ BIGFONT_FISH

#define BIGFONT_FISH   2

◆ BIGFONT_OCTO

#define BIGFONT_OCTO   0

◆ BIGFONT_SCHIP

#define BIGFONT_SCHIP   1

◆ DREAM6800_S

#define DREAM6800_S   "dream6800"

◆ ETI660_S

#define ETI660_S   "eti660"

◆ FISH_S

#define FISH_S   "fish"

◆ OCTO_S

#define OCTO_S   "octo"

◆ SCHIP_S

#define SCHIP_S   "schip"

◆ SMALLFONT_DREAM6800

#define SMALLFONT_DREAM6800   2

◆ SMALLFONT_ETI660

#define SMALLFONT_ETI660   3

◆ SMALLFONT_FISH

#define SMALLFONT_FISH   4

◆ SMALLFONT_OCTO

#define SMALLFONT_OCTO   0

◆ SMALLFONT_VIP

#define SMALLFONT_VIP   1

◆ VIP_S

#define VIP_S   "vip"

Function Documentation

◆ c8_set_big_font()

int c8_set_big_font ( c8_t c8,
const char *  s 
)

Set big font from s (fontNames name)

Parameters
c8c8_t to set font from
sstring to get font from
Returns
1 if success, 0 otherwise

◆ c8_set_fonts()

void c8_set_fonts ( c8_t c8,
int  small,
int  big 
)

Loads small and/or big fonts in c8

Parameters
c8c8_t to set fonts
smallsmall font identifier (-1 to not set)
bigbig font identifier (-1 to not set)

◆ c8_set_fonts_s()

int c8_set_fonts_s ( c8_t c8,
char *  s 
)

Set fonts from string.

Parameters
c8c8_t to set fonts
sstring to get fonts from (comma-separated fontNames names)
Returns
1 if success, 0 otherwise

◆ c8_set_small_font()

int c8_set_small_font ( c8_t c8,
const char *  s 
)

Set small font from s (fontNames name)

Parameters
c8c8_t to set font from
sstring to get font from
Returns
1 if success, 0 otherwise

◆ print_fonts()

void print_fonts ( c8_t c8)

Print fonts (for debug)

Parameters
c8c8_t to get fonts from

Variable Documentation

◆ bigFonts

const uint8_t bigFonts[3][160]

Big fonts.

From Octo (https://github.com/JohnEarnest/Octo).

◆ c8_fontNames

const char* c8_fontNames[2][5]
Initial value:
= {
{
},
{
},
}
#define FISH_S
Definition: font.c:29
#define ETI660_S
Definition: font.c:28
#define SCHIP_S
Definition: font.c:30
#define OCTO_S
Definition: font.c:25
#define DREAM6800_S
Definition: font.c:27
#define VIP_S
Definition: font.c:26

◆ smallFonts

const uint8_t smallFonts[5][80]

Small fonts.

From Octo (https://github.com/JohnEarnest/Octo).