gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/include/gbdk/font.h
1 /** @file gbdk/font.h
2 Multiple font support for the GameBoy
3 Michael Hope, 1999
4 michaelh@earthling.net
5 */
6 #ifndef __FONT_H
7 #define __FONT_H
8
9 #include <types.h>
10 #include <stdint.h>
11
12 /** Various flags in the font header.
13 */
14 #define FONT_256ENCODING 0
15 #define FONT_128ENCODING 1
16 #define FONT_NOENCODING 2
17
18 #define FONT_COMPRESSED 4
19
20 /* See gb.h/M_NO_SCROLL and gb.h/M_NO_INTERP */
21
22 /** font_t is a handle to a font loaded by font_load().
23 It can be used with @ref font_set() */
24 typedef uint16_t font_t;
25
26
27 /*! \defgroup gbdk_fonts List of gbdk fonts
28 @{
29 */
30
31 /** The default fonts */
32 extern uint8_t font_spect[], font_italic[], font_ibm[], font_min[];
33
34 /** Backwards compatible font */
35 extern uint8_t font_ibm_fixed[];
36
37 /*! @} End of gbdk_fonts */
38
39
40 /** Initializes the font system.
41 Should be called before other font functions.
42 */
43 void font_init(void);
44
45 /** Load a font and set it as the current font.
46 @param font Pointer to a font to load (usually a gbdk font)
47
48 @return Handle to the loaded font, which can be used with @ref font_set()
49 @see font_init(), font_set(), gbdk_fonts
50 */
51 font_t font_load(void *font) OLDCALL;
52
53 /** Set the current font.
54 @param font_handle handle of a font returned by @ref font_load()
55
56 @return The previously used font handle.
57 @see font_init(), font_load()
58 */
59 font_t font_set(font_t font_handle) OLDCALL;
60
61 /* Use mode() and color() to set the font modes and colours */
62
63 /** Internal representation of a font.
64 What a font_t really is */
65 typedef struct sfont_handle mfont_handle;
66 typedef struct sfont_handle *pmfont_handle;
67
68 /** Font handle structure
69 */
70 struct sfont_handle {
71 uint8_t first_tile; /**< First tile used for font */
72 void *font; /**< Pointer to the base of the font */
73 };
74
75 /** Set the current __foreground__ colour (for pixels), __background__ colour */
76 void font_color(uint8_t forecolor, uint8_t backcolor) OLDCALL;
77
78 #endif /* __FONT_H */
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.