summaryrefslogtreecommitdiff
path: root/include/Font.h
blob: e2f1d125dd42ced351b1831c103a4cab59b804e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef FONT_H
#define FONT_H

/* *************************************
 * 	Includes
 * *************************************/

#include "Font.h"
#include <psxgpu.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>

enum
{
    FONT_DEFAULT_CHAR_SIZE = 16,
    FONT_DEFAULT_INIT_CHAR = '!'
};

enum font_flags
{
	FONT_NOFLAGS,
	FONT_CENTERED		= 0x01,
	FONT_WRAP_LINE		= 0x02,
	FONT_BLEND_EFFECT	= 0x04,
	FONT_1HZ_FLASH		= 0x08,
	FONT_2HZ_FLASH		= 0x10,
    FONT_H_CENTERED     = 0x20
};

struct font
{
	GsSprite spr;
	short char_spacing;
	short char_w;
    short char_w_bitshift;
	short char_h;
	char init_ch;
	uint8_t char_per_row;
	uint8_t max_ch_wrap;
	enum font_flags flags;
	short spr_w;
	short spr_h;
	short spr_u;
	short spr_v;
};

bool FontLoadImage(const char *path, struct font *font);
void FontSetSize(struct font *font, short size, short bitshift);
void FontPrintText(struct font *font, short x, short y, char* str, ...);
void FontSetInitChar(struct font *font, char c);
void FontSetFlags(struct font *font, enum font_flags flags);
void FontCyclic(void);
void FontSetSpacing(struct font *font, short spacing);

/* *************************************
 * 	Global variables
 * *************************************/

extern struct font RadioFont;
extern struct font SmallFont;

#endif /* FONT_H */