Add a main menu scene with Start/Hard Mode/Music options

The game now boots into a menu (Start Game, Hard Mode toggle, Music
toggle) navigated with Up/Down and A/Start, instead of dropping
straight into a match. B returns to the menu from a paused or
game-over state.
This commit is contained in:
phillip committed 2026-09-03 22:27:49 +02:00
1 parent 0e7477031f
commit 8bf999c33b
5 files changed
+85 -7

No files matched your search

+8 -7
View File
@@ -57,6 +57,7 @@ void setup() {
videoSetMode(MODE_0_2D);
videoSetModeSub(MODE_0_2D);
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG);
vramSetBankD(VRAM_D_SUB_SPRITE);
consoleInit(&topScreen, 3,BgType_Text4bpp, BgSize_T_256x256, X_MAX, 0, true, true);
@@ -115,14 +116,16 @@ void setup() {
}
void handle_vblank() {
frame++;
consoleSelect(&topScreen);
draw_stats(gameState, internals, audio_is_music_enabled(audioContext), frame);
if (gameState.scene == Scene::Playing) {
consoleSelect(&topScreen);
draw_stats(gameState, internals, audio_is_music_enabled(audioContext), frame);
}
oamUpdate(&oamSub);
//flashy_colors();
}
void do_tick() {
if (!paused) {
if (gameState.scene == Scene::Playing && !paused) {
ticks++;
if (!gameOver){
const bool wasGameOver = gameOver;
@@ -211,9 +214,7 @@ int main(void) {
irqSet(IRQ_VBLANK, handle_vblank);
setup();
init_game();
// Start timer for game ticks
draw_menu(gameState, renderAssets, audio_is_music_enabled(audioContext));
InputContext inputContext;
inputContext.state = &gameState;
@@ -223,7 +224,7 @@ int main(void) {
inputContext.topScreen = &topScreen;
inputContext.init_game = init_game;
while(1) {
if (!handle_input_frame(inputContext)) {
break;