start on options menu
This commit is contained in:
parent
e648add422
commit
b7d1404868
|
@ -72,6 +72,10 @@ enum MainMenuState landingMenuUpdate(struct LandingMenu* landingMenu) {
|
||||||
case 0:
|
case 0:
|
||||||
return MainMenuStateNewGame;
|
return MainMenuStateNewGame;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return MainMenuStateOptions;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ void mainMenuInit(struct MainMenu* mainMenu) {
|
||||||
|
|
||||||
landingMenuInit(&mainMenu->landingMenu);
|
landingMenuInit(&mainMenu->landingMenu);
|
||||||
newGameInit(&mainMenu->newGameMenu);
|
newGameInit(&mainMenu->newGameMenu);
|
||||||
|
optionsMenuInit(&mainMenu->optionsMenu);
|
||||||
|
|
||||||
mainMenu->state = MainMenuStateLanding;
|
mainMenu->state = MainMenuStateLanding;
|
||||||
|
|
||||||
|
@ -51,6 +52,9 @@ void mainMenuUpdate(struct MainMenu* mainMenu) {
|
||||||
case MainMenuStateNewGame:
|
case MainMenuStateNewGame:
|
||||||
mainMenu->state = newGameUpdate(&mainMenu->newGameMenu);
|
mainMenu->state = newGameUpdate(&mainMenu->newGameMenu);
|
||||||
break;
|
break;
|
||||||
|
case MainMenuStateOptions:
|
||||||
|
mainMenu->state = optionsMenuUpdate(&mainMenu->optionsMenu);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,5 +88,8 @@ void mainMenuRender(struct MainMenu* mainMenu, struct RenderState* renderState,
|
||||||
case MainMenuStateNewGame:
|
case MainMenuStateNewGame:
|
||||||
newGameRender(&mainMenu->newGameMenu, renderState, task);
|
newGameRender(&mainMenu->newGameMenu, renderState, task);
|
||||||
break;
|
break;
|
||||||
|
case MainMenuStateOptions:
|
||||||
|
optionsMenuRender(&mainMenu->optionsMenu, renderState, task);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,11 +7,13 @@
|
||||||
|
|
||||||
#include "./landing_menu.h"
|
#include "./landing_menu.h"
|
||||||
#include "./new_game_menu.h"
|
#include "./new_game_menu.h"
|
||||||
|
#include "./options_menu.h"
|
||||||
|
|
||||||
struct MainMenu {
|
struct MainMenu {
|
||||||
enum MainMenuState state;
|
enum MainMenuState state;
|
||||||
struct LandingMenu landingMenu;
|
struct LandingMenu landingMenu;
|
||||||
struct NewGameMenu newGameMenu;
|
struct NewGameMenu newGameMenu;
|
||||||
|
struct OptionsMenu optionsMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
void mainMenuInit(struct MainMenu* mainMenu);
|
void mainMenuInit(struct MainMenu* mainMenu);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
enum MainMenuState {
|
enum MainMenuState {
|
||||||
MainMenuStateLanding,
|
MainMenuStateLanding,
|
||||||
MainMenuStateNewGame,
|
MainMenuStateNewGame,
|
||||||
|
MainMenuStateOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -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]);
|
||||||
|
}
|
|
@ -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
|
Loading…
Reference in a new issue