-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
64 lines (44 loc) · 1.07 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "defines.h"
#include <gb/gb.h>
#include <stdio.h>
#include <string.h>
uint8_t playerY = 60;
uint8_t playerX = 60;
int playerHealth = 10;
int playerDead = 0;
uint8_t enemyX = 20;
uint8_t enemyY = 20;
char enemyXvel = 0;
char enemyYvel = 0;
bool running = false;
uint8_t * sprites = (uint8_t *)spriteAttributes;
int counter = 0;
#include "characters.c"
#include "utilities.c"
#include "controls.c"
#include "sprites.c"
void main(void){
SPRITES_8x16;
printf("A");
disable_interrupts();
DISPLAY_OFF;
LCDC_REG = 0x47;
BGP_REG = OBP0_REG = OBP1_REG = 0xE4U;
memcpy((void*)VRAM, PlayerSprites, sizeof(PlayerSprites));
memcpy((void*)(VRAM + sizeof(PlayerSprites)), Enemy, sizeof(Enemy));
DISPLAY_ON;
enable_interrupts();
SHOW_SPRITES;
printfTileMap("Press Start");
while(1){
updatePlayer();
updateEnemy();
HandleControls(joypad());
if(counter >= 10)
counter = 0;
else
counter++;
wait_vbl_done(); // wait for VBlank
delay(10);
}
}