summaryrefslogtreecommitdiff
path: root/source/main.c
blob: d0a60b18ed1a0914bb29b515267e3073de2bcfe1 (plain)
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
#include <string.h>
#include "../include/input.h"
#include "../include/toolbox.h"
#include "../include/memmap.h"
#include "../include/types.h"
#include "../include/memdef.h"

#include "../include/point.h"
#include "../include/velocity.h"
#include "../include/playerObject.h"
#include "../sprites/player.h"

OBJ_ATTR obj_buffer[128];
OBJ_AFFINE *obj_aff_buffer= (OBJ_AFFINE*)obj_buffer; // Object affine-buffer

int main() {
    memcpy(&tile_mem[4][0], playerTiles, playerTilesLen);
    memcpy(pal_obj_mem, playerPal, playerPalLen);

    oam_init(obj_buffer, 128);

    REG_DISPCNT= DCNT_OBJ | DCNT_OBJ_1D;

	playerObject player = createPlayerObject(&obj_buffer[0], &obj_aff_buffer[0],0, 0);

    while(1) {
		vid_vsync();
		key_poll();

		if ((key_is_down(KEY_A) || key_hit(KEY_A)) && !player.isJumping) {
			player.vel.dy -= 9 << FIX_SHIFT;
		}

		updatePlayer(&player, 120);
		obj_affine_copy(obj_aff_mem, player.affine, 1);
		obj_copy(obj_mem, player.obj, 1);
	}

    return 0;
}