libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
font.c File Reference
#include "font.h"
#include "chip8.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>

Macros

#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 *c8, C8_SmallFont small, C8_BigFont big)
 Loads small and/or big fonts in c8
 
int c8_set_fonts_s (C8 *c8, char *s)
 Set fonts from string.
 
int c8_set_small_font (C8 *c8, const char *s)
 Set small font from s (fontNames name)
 
int c8_set_big_font (C8 *c8, const char *s)
 Set big font from s (fontNames name)
 
void c8_print_fonts (C8 *c8)
 Print fonts (for debug)
 

Variables

const char * c8_fontNames [2][5]
 Font names.
 
const uint8_t c8_smallFonts [5][80]
 
const uint8_t c8_bigFonts [3][160]
 

Detailed Description

Stuff related to loading fonts.

Macro Definition Documentation

◆ 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"

◆ VIP_S

#define VIP_S   "vip"

Function Documentation

◆ c8_print_fonts()

void c8_print_fonts ( C8 c8)

Print fonts (for debug)

Parameters
c8C8 to get fonts from

◆ c8_set_big_font()

int c8_set_big_font ( C8 c8,
const char *  s 
)

Set big font from s (fontNames name)

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

◆ c8_set_fonts()

void c8_set_fonts ( C8 c8,
C8_SmallFont  small,
C8_BigFont  big 
)

Loads small and/or big fonts in c8

Parameters
c8C8 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 c8,
char *  s 
)

Set fonts from string.

Parameters
c8C8 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 c8,
const char *  s 
)

Set small font from s (fontNames name)

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

Variable Documentation

◆ c8_bigFonts

const uint8_t c8_bigFonts[3][160]

Big fonts.

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

◆ c8_fontNames

const char* c8_fontNames[2][5]
Initial value:
= {
{
"octo" ,
"vip" ,
"dream6800" ,
"eti660" ,
"fish" ,
},
{
"octo" ,
"schip" ,
"fish" ,
},
}

Font names.

◆ c8_smallFonts

const uint8_t c8_smallFonts[5][80]

Small fonts.

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