-
Notifications
You must be signed in to change notification settings - Fork 2
/
gfx.c
50 lines (39 loc) · 1.14 KB
/
gfx.c
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
#include "gfx.h"
static u16 vdp_offset = TILE_USERINDEX;
//static u16 vdp_offset = 1;
u16 draw_img(Image *img) {
u16 tmp_offset = vdp_offset;
VDP_drawImageEx(BG_B, img, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, vdp_offset), 0, 0, FALSE, TRUE);
vdp_offset += img->tileset->numTile;
return tmp_offset;
}
u16 load_img(Image* img) {
u16 tmp_offset = vdp_offset;
VDP_loadTileSet(img->tileset, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, vdp_offset) & TILE_INDEX_MASK, 1);
//VDP_loadTileData(img->tileset->tiles, vdp_offset, img->tileset->numTile, TRUE);
vdp_offset += img->tileset->numTile;
return tmp_offset;
}
u16 load_bmp(u32* data, u16 w, u16 h) {
u16 tmp_offset = vdp_offset;
VDP_loadBMPTileData(
data,
vdp_offset,
w/8,
h/8,
w/8
);
vdp_offset += ((w/8) * (h/8));
return tmp_offset;
}
u16 load_tile(u32 *data, u16 w, u16 h) {
u16 tmp_offset = vdp_offset;
VDP_loadTileData(
data,
vdp_offset,
((w/8) * (h/8)),
1
);
vdp_offset += ((w/8) * (h/8));
return tmp_offset;
}