Move uimodal to ui/widget, make main menu its own scene
uimodal.c/.h now live in ui/widget alongside the other widgets rather than ui/frame. The main menu now has a real scene (scene/mainmenu) whose init just calls the new uiMainMenuOpen(), replacing the SCENE.current-polling uiMainMenuUpdate with an explicit open call like uiGameMenuOpen/uiBackpackOpen. Also renames the ui.main_menu.* locale keys to main_menu.* and groups them under a Main Menu Scene heading in en_US.po, alongside the existing Initial Scene keys. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+10
-20
@@ -5,6 +5,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n==2 ? 1 : (n<7 ? 2 : 3));\n"
|
||||
|
||||
# Initial Scene
|
||||
msgid "initial.checking_save.title"
|
||||
msgstr "Checking for save data"
|
||||
|
||||
@@ -23,13 +24,18 @@ msgstr "Try again"
|
||||
msgid "initial.no_device.continue"
|
||||
msgstr "Continue without saving"
|
||||
|
||||
# Main Menu Scene
|
||||
msgid "main_menu.new_game"
|
||||
msgstr "New Game"
|
||||
|
||||
msgid "main_menu.load_game"
|
||||
msgstr "Load Game"
|
||||
|
||||
msgid "main_menu.options"
|
||||
msgstr "Options"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
msgid "main_menu.quit"
|
||||
msgstr "Quit Game"
|
||||
|
||||
#: ui/menu.c:10
|
||||
msgid "ui.title"
|
||||
@@ -141,22 +147,6 @@ msgstr "Yes"
|
||||
msgid "ui.initial.create_save.no"
|
||||
msgstr "No"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.new_game"
|
||||
msgstr "New Game"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.load_game"
|
||||
msgstr "Load Game"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.options"
|
||||
msgstr "Options"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.quit"
|
||||
msgstr "Quit Game"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.confirm"
|
||||
msgstr "Confirm"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "rpg/cutscene/item/cutsceneitem.h"
|
||||
#include "rpg/cutscene/cutscenesystem.h"
|
||||
#include "assert/assert.h"
|
||||
#include "ui/frame/uimodal.h"
|
||||
#include "ui/widget/uimodal.h"
|
||||
|
||||
void cutsceneModalStart(
|
||||
const cutsceneitem_t *item,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "display/screen/screen.h"
|
||||
#include "console/console.h"
|
||||
#include "save/save.h"
|
||||
#include "ui/frame/uimodal.h"
|
||||
#include "ui/widget/uimodal.h"
|
||||
#include "rpg/cutscene/cutscene.h"
|
||||
#include "rpg/cutscene/cutscenesystem.h"
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
*/
|
||||
|
||||
#include "scenemainmenu.h"
|
||||
#include "ui/frame/mainmenu/uimainmenu.h"
|
||||
|
||||
errorret_t sceneMainMenuInit(scenedata_t *sceneData) {
|
||||
uiMainMenuOpen();
|
||||
errorOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,16 +8,14 @@
|
||||
#pragma once
|
||||
#include "scene/scenebase.h"
|
||||
|
||||
// Empty for now -- the menu itself lives in ui/frame/mainmenu/uimainmenu.c,
|
||||
// driven by the global UI element pipeline (see uimainmenu.c's own
|
||||
// SCENE.current check for when it shows itself). A byte placeholder keeps
|
||||
// the struct non-empty for portability.
|
||||
// Empty - the menu itself lives in ui/frame/mainmenu/uimainmenu.c. A byte
|
||||
// placeholder keeps the struct non-empty for portability.
|
||||
typedef struct {
|
||||
uint8_t reserved;
|
||||
} scenemainmenu_t;
|
||||
|
||||
/**
|
||||
* Initializes the main menu scene.
|
||||
* Initializes the main menu scene by opening the main menu panel.
|
||||
*
|
||||
* @param sceneData The scene data used for this scene.
|
||||
* @return An error if the init failed, or errorOk() if it succeeded.
|
||||
@@ -25,7 +23,7 @@ typedef struct {
|
||||
errorret_t sceneMainMenuInit(scenedata_t *sceneData);
|
||||
|
||||
/**
|
||||
* Updates the main menu scene. Currently a no-op -- the menu drives
|
||||
* Updates the main menu scene. Currently a no-op - the menu drives
|
||||
* itself via the global UI element pipeline.
|
||||
*
|
||||
* @param sceneData The scene data used for this scene.
|
||||
@@ -34,7 +32,7 @@ errorret_t sceneMainMenuInit(scenedata_t *sceneData);
|
||||
errorret_t sceneMainMenuUpdate(scenedata_t *sceneData);
|
||||
|
||||
/**
|
||||
* Renders the main menu scene. Currently a no-op -- the menu draws
|
||||
* Renders the main menu scene. Currently a no-op - the menu draws
|
||||
* itself via the global UI element pipeline.
|
||||
*
|
||||
* @param sceneData The scene data used for this scene.
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
uiconfirm.c
|
||||
uimodal.c
|
||||
)
|
||||
|
||||
add_subdirectory(game)
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "uimainmenu.h"
|
||||
#include "ui/widget/uiframe.h"
|
||||
#include "scene/scene.h"
|
||||
#include "engine/engine.h"
|
||||
#include "rpg/battle/testbattle/testbattle.h"
|
||||
#include "util/memory.h"
|
||||
@@ -58,28 +57,28 @@ errorret_t uiMainMenuInit(void) {
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.new_game",
|
||||
"main_menu.new_game",
|
||||
0,
|
||||
UI_MAIN_MENU.newGameLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.load_game",
|
||||
"main_menu.load_game",
|
||||
0,
|
||||
UI_MAIN_MENU.loadGameLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.options",
|
||||
"main_menu.options",
|
||||
0,
|
||||
UI_MAIN_MENU.optionsLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.quit",
|
||||
"main_menu.quit",
|
||||
0,
|
||||
UI_MAIN_MENU.quitLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
@@ -97,12 +96,9 @@ errorret_t uiMainMenuInit(void) {
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t uiMainMenuUpdate(void) {
|
||||
if(SCENE.current != SCENE_TYPE_MAIN_MENU) errorOk();
|
||||
if(uiMenuIsActive(&UI_MAIN_MENU.menu)) errorOk();
|
||||
|
||||
void uiMainMenuOpen(void) {
|
||||
if(uiMenuIsActive(&UI_MAIN_MENU.menu)) return;
|
||||
uiMenuOpen(&UI_MAIN_MENU.menu);
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t uiMainMenuDraw(void) {
|
||||
|
||||
@@ -33,12 +33,9 @@ extern uimainmenu_t UI_MAIN_MENU;
|
||||
errorret_t uiMainMenuInit(void);
|
||||
|
||||
/**
|
||||
* Updates the main menu panel: opens it whenever SCENE_TYPE_MAIN_MENU
|
||||
* becomes active and it isn't already open.
|
||||
*
|
||||
* @return Any error that occurs.
|
||||
* Opens the main menu panel. No-op when already open.
|
||||
*/
|
||||
errorret_t uiMainMenuUpdate(void);
|
||||
void uiMainMenuOpen(void);
|
||||
|
||||
/**
|
||||
* Draws the main menu panel, centered on screen. No-op when not active.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "ui/frame/battle/uibattlehud.h"
|
||||
#include "ui/frame/backpack/uibackpack.h"
|
||||
#include "ui/frame/uiconfirm.h"
|
||||
#include "ui/frame/uimodal.h"
|
||||
#include "ui/widget/uimodal.h"
|
||||
#include "ui/rpg/textbox/uitextboxmain.h"
|
||||
#include "ui/rpg/textbox/uitextboxminilist.h"
|
||||
#include "ui/rpg/uiemoji.h"
|
||||
@@ -63,7 +63,6 @@ uielement_t UI_ELEMENTS[] = {
|
||||
},
|
||||
{
|
||||
.init = uiMainMenuInit,
|
||||
.update = uiMainMenuUpdate,
|
||||
.draw = uiMainMenuDraw,
|
||||
.dispose = uiMainMenuDispose
|
||||
},
|
||||
|
||||
@@ -16,4 +16,5 @@ target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
uiitem.c
|
||||
uiitemlist.c
|
||||
uimenu.c
|
||||
uimodal.c
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user