diff --git a/src/menu/landing_menu.c b/src/menu/landing_menu.c index be82dc8..3a8c1bb 100644 --- a/src/menu/landing_menu.c +++ b/src/menu/landing_menu.c @@ -72,6 +72,10 @@ enum MainMenuState landingMenuUpdate(struct LandingMenu* landingMenu) { case 0: return MainMenuStateNewGame; break; + + case 2: + return MainMenuStateOptions; + break; } } diff --git a/src/menu/main_menu.c b/src/menu/main_menu.c index 2e64255..a0ee1a3 100644 --- a/src/menu/main_menu.c +++ b/src/menu/main_menu.c @@ -22,6 +22,7 @@ void mainMenuInit(struct MainMenu* mainMenu) { landingMenuInit(&mainMenu->landingMenu); newGameInit(&mainMenu->newGameMenu); + optionsMenuInit(&mainMenu->optionsMenu); mainMenu->state = MainMenuStateLanding; @@ -51,6 +52,9 @@ void mainMenuUpdate(struct MainMenu* mainMenu) { case MainMenuStateNewGame: mainMenu->state = newGameUpdate(&mainMenu->newGameMenu); break; + case MainMenuStateOptions: + mainMenu->state = optionsMenuUpdate(&mainMenu->optionsMenu); + break; } } @@ -84,5 +88,8 @@ void mainMenuRender(struct MainMenu* mainMenu, struct RenderState* renderState, case MainMenuStateNewGame: newGameRender(&mainMenu->newGameMenu, renderState, task); break; + case MainMenuStateOptions: + optionsMenuRender(&mainMenu->optionsMenu, renderState, task); + break; } } \ No newline at end of file diff --git a/src/menu/main_menu.h b/src/menu/main_menu.h index cdd0f67..560570c 100644 --- a/src/menu/main_menu.h +++ b/src/menu/main_menu.h @@ -7,11 +7,13 @@ #include "./landing_menu.h" #include "./new_game_menu.h" +#include "./options_menu.h" struct MainMenu { enum MainMenuState state; struct LandingMenu landingMenu; struct NewGameMenu newGameMenu; + struct OptionsMenu optionsMenu; }; void mainMenuInit(struct MainMenu* mainMenu); diff --git a/src/menu/menu_state.h b/src/menu/menu_state.h index 77738e6..74d6d32 100644 --- a/src/menu/menu_state.h +++ b/src/menu/menu_state.h @@ -4,6 +4,7 @@ enum MainMenuState { MainMenuStateLanding, MainMenuStateNewGame, + MainMenuStateOptions, }; #endif \ No newline at end of file diff --git a/src/menu/options_menu.c b/src/menu/options_menu.c index e69de29..36aa3ea 100644 --- a/src/menu/options_menu.c +++ b/src/menu/options_menu.c @@ -0,0 +1,37 @@ +#include "options_menu.h" + +#include "../font/font.h" +#include "../font/dejavusans.h" + +#include "../build/assets/materials/ui.h" + +#include "../controls/controller.h" + +#define OPTIONS_LEFT 40 +#define OPTIONS_TOP 45 + +void optionsMenuInit(struct OptionsMenu* options) { + options->menuOutline = menuBuildBorder(OPTIONS_LEFT, OPTIONS_TOP, SCREEN_WD - OPTIONS_LEFT * 2, SCREEN_HT - OPTIONS_TOP * 2); + + options->optionsText = menuBuildText(&gDejaVuSansFont, "OPTIONS", 48, 48); +} + +enum MainMenuState optionsMenuUpdate(struct OptionsMenu* options) { + if (controllerGetButtonDown(0, B_BUTTON)) { + return MainMenuStateLanding; + } + + return MainMenuStateOptions; +} + +void optionsMenuRender(struct OptionsMenu* options, struct RenderState* renderState, struct GraphicsTask* task) { + gSPDisplayList(renderState->dl++, ui_material_list[DEFAULT_UI_INDEX]); + + gSPDisplayList(renderState->dl++, ui_material_list[SOLID_TRANSPARENT_OVERLAY_INDEX]); + gDPFillRectangle(renderState->dl++, 0, 0, SCREEN_WD, SCREEN_HT); + gSPDisplayList(renderState->dl++, ui_material_revert_list[SOLID_TRANSPARENT_OVERLAY_INDEX]); + + gSPDisplayList(renderState->dl++, ui_material_list[ROUNDED_CORNERS_INDEX]); + gSPDisplayList(renderState->dl++, options->menuOutline); + gSPDisplayList(renderState->dl++, ui_material_revert_list[ROUNDED_CORNERS_INDEX]); +} \ No newline at end of file diff --git a/src/menu/options_menu.h b/src/menu/options_menu.h index e69de29..31c7681 100644 --- a/src/menu/options_menu.h +++ b/src/menu/options_menu.h @@ -0,0 +1,17 @@ +#ifndef __MENU_OPTIONS_MENU_H__ +#define __MENU_OPTIONS_MENU_H__ + +#include "../graphics/graphics.h" +#include "./menu.h" +#include "./menu_state.h" + +struct OptionsMenu { + Gfx* menuOutline; + Gfx* optionsText; +}; + +void optionsMenuInit(struct OptionsMenu* options); +enum MainMenuState optionsMenuUpdate(struct OptionsMenu* options); +void optionsMenuRender(struct OptionsMenu* options, struct RenderState* renderState, struct GraphicsTask* task); + +#endif \ No newline at end of file