-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
156 lines (114 loc) · 3.43 KB
/
main.cpp
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#include <3ds.h>
#include <stdio.h>
#include <string.h>
#include "Environment.c"
#include "Tree.c"
// Main runtime for the game
float startGame();
// Activated based on initial user input
void noGame();
void misunderstoodGame();
// MAIIN METHOD, prompts what the user wants to do
int main()
{
// Initiliazes graphics, apt, and hid modules
gfxInitDefault();
aptInit();
hidInit();
// Creates a console on the top screen for us to print to
consoleInit(GFX_TOP, NULL);
// Well do they want to?
printf("Play the Game? Start - Yes; B - No");
// Main loop for prompting someone to play the game
while(true){
// Scans for what button is being what
hidScanInput();
u32 kDown = hidKeysDown();
// What to do based on key selection, start game, say "o" then wait for them to press a/b to exit, or feeling like the user doesn't understand
// Me sometimes
if (kDown & KEY_START)
startGame();
else if (kDown & KEY_B) {
noGame();
}
else {
misunderstoodGame();
}
// Flush and swap buffers
gfxFlushBuffers();
gfxSwapBuffers();
// Wait for VBlank to respond
gspWaitForVBlank();
}
hidScanInput();
kDown = hidKeysDown();
while (!kDown & KEY_A){
printf("How did you get here?")
// Seriously what
gfxFlushBuffers();
gfxSwapBuffers();
// Take a seat while we wait why don't you, you've already broken my program
// so why shouldn't you break my chair?
gspWaitForVBlank();
}
gfxExit();
hidExit();
aptExit();
return 0;
}
//THIS IS WHERE THE REAL GAME BEGINS
float startGame()
{
// Starts your Environment
Environment home();
// Creates your tree
Tree yourTree();
// All save loading will happen here, too; will be implemented later
// Real Main Loop. hopefully this doesn't break anything
while (aptMainLoop()){
hidScanInput();
kDown = hidKeysDown();
// Aging the tree
yourTree.updateTreeAge(home.getTime());
// Waits uNtIL THE VBLANK ARRIIIIVEEEESSS OOOO
gspWaitForVBlank();
// o shit whaddup
printf("Your %s %s is %s."
,yourTree.blossomDesc().c_str(), yourTree.treeAge().c_str()
, yourTree.treeHealth().c_str());
// User input will happen here once I get the rest of this program working
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxExit();
hidExit();
aptExit();
return 0;
}
void noGame(){
do {
hidScanInput();
kDown = hidKeysDown();
printf("o");
// Flush and swap buffers
gfxFlushBuffers();
gfxSwapBuffers();
// Wait for VBlank
gspWaitForVBlank();
} while (!kDown & KEY_A || !kDown & KEY_B);
// Closes down modules, brings user back to the home screen/homebrew menu
gfxExit();
hidExit();
aptExit();
return 0;
}
void misunderstoodGame(){
do {
hidScanInput();
kDown = hidKeysDown();
printf("o");
printf("I feel like we just don't understand each other sometims");
} while (kDown & KEY_A);
printf("I feel like we just don't understand each other sometims");
}