Merge branch 'video' into next
This commit is contained in:
commit
fb87c292ed
32
src/main.c
32
src/main.c
|
@ -1,19 +1,31 @@
|
|||
#include <tonc.h>
|
||||
#include "gbfs.h"
|
||||
|
||||
int main(void) {
|
||||
// wait for vsync (necessary for this? probably not, but good practice)
|
||||
int main (void)
|
||||
{
|
||||
const GBFS_FILE *gbfs_start = find_first_gbfs_file(find_first_gbfs_file);
|
||||
|
||||
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.pal.bin", NULL), &pal_bg_mem[0]);
|
||||
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.img.bin", NULL), &tile_mem[0][0]);
|
||||
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.map.bin", NULL), &se_mem[30][0]);
|
||||
|
||||
vid_vsync();
|
||||
|
||||
// bitmap mode 3, enable bg2 (bitmap layer)
|
||||
REG_DISPCNT = DCNT_MODE3 | DCNT_BG2;
|
||||
REG_BG0CNT= BG_CBB(0) | BG_SBB(30) | BG_4BPP | BG_REG_64x32;
|
||||
REG_DISPCNT = DCNT_BG0;
|
||||
|
||||
// plot rgb points
|
||||
m3_plot(119, 80, RGB15(31, 0, 0)); // Red
|
||||
m3_plot(120, 80, RGB15(0, 31, 0)); // Green
|
||||
m3_plot(121, 80, RGB15(0, 0, 31)); // Blue
|
||||
int x = 0, y = 0;
|
||||
while (1) {
|
||||
vid_vsync();
|
||||
key_poll();
|
||||
|
||||
while (1); // loop so you don't get nasal demons
|
||||
x += key_tri_horz();
|
||||
y += key_tri_vert();
|
||||
x = clamp(x, 0, 512-SCREEN_WIDTH);
|
||||
y = clamp(y, 0, 256-SCREEN_HEIGHT);
|
||||
|
||||
return 0;
|
||||
REG_BG0HOFS = x;
|
||||
REG_BG0VOFS = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue