blob: 7c4abd4c68b5d48f8fab2f34e7f62c7c18978791 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "font.h"
#include "TZR.h"
static TZR_Uint ___font_spr = 0;
int font_init(const char *path)
{
___font_spr = TZR_LoadResourceTyped(TZR_RES_IMAGE, path);
if (___font_spr == 0)
return 1;
return 0;
}
void font_draw(int x, int y, const char *s)
{
for (; *s != '\0'; s++) {
const int ix = *s % 16 * 8;
const int iy = *s / 16 * 16;
TZR_DrawImage(___font_spr, x*8, y*16, ix, iy, 8, 16);
x += 1;
}
}
|