-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
122 lines (91 loc) · 1.93 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <gb/gb.h>
#include "blankScreen.c"
#include "corvid.c"
#include "menu.c"
#include "weather.c"
#include "repent.c"
#include "news.c"
#include "search.c"
#include "gaems.c"
void init();
void checkInput();
void updateSwitches();
UBYTE i;
void main() {
init();
while(1) {
checkInput(); // Check for user input (and act on it)
updateSwitches(); // Make sure the SHOW_SPRITES and SHOW_BKG switches are on each loop
wait_vbl_done(); // Wait until VBLANK to avoid corrupting memory
}
}
void init() {
DISPLAY_ON;// Turn on the display
// Switch to VRAM
VBK_REG = 1;
// Switch out of VRAM
VBK_REG = 0;
// Set screen x,y pos to 0,0 and draw the map 20,18(size of the screen)
set_bkg_data(0,255,birdTitle_tile_data);
set_bkg_tiles(0,0,20,18,birdTitle_map_data);
// Show the background
SHOW_BKG;
i = 0;
}
void updateSwitches() {
HIDE_WIN;
SHOW_SPRITES;
SHOW_BKG;
}
void menu() {
set_bkg_data(0,255,birdWelcomeSM_tile_data);
set_bkg_tiles(0,0,20,18,birdWelcomeSM_map_data);
}
void weather() {
i = 0;
set_bkg_data(0,255,sun2_tile_data);
set_bkg_tiles(0,0,20,18,sun2_map_data);
while(i == 0){
set_bkg_data(0,255,sun2_tile_data);
set_bkg_tiles(0,0,20,18,sun2_map_data);
delay(500);
set_bkg_data(0,255,sun3_tile_data);
set_bkg_tiles(0,0,20,18,sun3_map_data);
delay(500);
//checkInput();
if (joypad() & J_B) {
menu();
i = 2;
break;
}
}
}
void news() {
set_bkg_data(0,255,news2_tile_data);
set_bkg_tiles(0,0,20,18,news2_map_data);
}
void search() {
set_bkg_data(0,255,search_tile_data);
set_bkg_tiles(0,0,20,18,search_map_data);
}
void gaems() {
set_bkg_data(0,255,gaems_tile_data);
set_bkg_tiles(0,0,20,18,gaems_map_data);
}
void checkInput() {
if (joypad() & J_B) {
menu();
}
if (joypad() & J_RIGHT) {
weather();
}
if (joypad() & J_UP) {
news();
}
if (joypad() & J_LEFT) {
search();
}
if (joypad() & J_DOWN) {
gaems();
}
}