Route remaining hardcoded UI strings through the locale system
Main menu buttons, the confirm dialog, battle menu/HUD text, backpack tab labels, the loading/autosave indicators, and the settings tab placeholders were all raw English literals bypassing translation. Loads each through assetLocaleGetString like the rest of the UI, adding new Init hooks for uibattlehud/uiautosave/uiloading where none existed, and adds the corresponding message ids to en_US/es_MX/jp_JP.po. Also widens the settings placeholder buffers to 64 bytes - the es_MX and jp_JP translations overflowed the previous 32-byte size. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -112,6 +112,74 @@ 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"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.cancel"
|
||||
msgstr "Cancel"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.attack"
|
||||
msgstr "Attack"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.flee"
|
||||
msgstr "Flee"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.target_format"
|
||||
msgstr "Enemy %u (%u/%u HP)"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.hp_format"
|
||||
msgstr "HP %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.mp_format"
|
||||
msgstr "MP %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsaudio.c
|
||||
msgid "ui.settings.audio.placeholder"
|
||||
msgstr "No audio settings yet"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsdisplay.c
|
||||
msgid "ui.settings.display.placeholder"
|
||||
msgstr "No display settings yet"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsinput.c
|
||||
msgid "ui.settings.input.placeholder"
|
||||
msgstr "No input settings yet"
|
||||
|
||||
#: src/dusk/ui/frame/backpack/uibackpack.c
|
||||
msgid "ui.backpack.category_format"
|
||||
msgstr "Category %u"
|
||||
|
||||
#: src/dusk/ui/overlay/uiloading.c
|
||||
msgid "ui.loading.text"
|
||||
msgstr "loading"
|
||||
|
||||
#: src/dusk/ui/overlay/uiautosave.c
|
||||
msgid "ui.autosave.saving"
|
||||
msgstr "SAVING"
|
||||
|
||||
msgid "item.potion.name"
|
||||
msgstr "Potion"
|
||||
|
||||
|
||||
@@ -113,6 +113,74 @@ msgstr "Sí"
|
||||
msgid "ui.initial.create_save.no"
|
||||
msgstr "No"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.new_game"
|
||||
msgstr "Nueva Partida"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.load_game"
|
||||
msgstr "Cargar Partida"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.options"
|
||||
msgstr "Opciones"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.quit"
|
||||
msgstr "Salir del Juego"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.confirm"
|
||||
msgstr "Confirmar"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.attack"
|
||||
msgstr "Atacar"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.flee"
|
||||
msgstr "Huir"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.target_format"
|
||||
msgstr "Enemigo %u (%u/%u PS)"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.hp_format"
|
||||
msgstr "PS %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.mp_format"
|
||||
msgstr "PM %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsaudio.c
|
||||
msgid "ui.settings.audio.placeholder"
|
||||
msgstr "Aún no hay opciones de audio"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsdisplay.c
|
||||
msgid "ui.settings.display.placeholder"
|
||||
msgstr "Aún no hay opciones de pantalla"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsinput.c
|
||||
msgid "ui.settings.input.placeholder"
|
||||
msgstr "Aún no hay opciones de entrada"
|
||||
|
||||
#: src/dusk/ui/frame/backpack/uibackpack.c
|
||||
msgid "ui.backpack.category_format"
|
||||
msgstr "Categoría %u"
|
||||
|
||||
#: src/dusk/ui/overlay/uiloading.c
|
||||
msgid "ui.loading.text"
|
||||
msgstr "cargando"
|
||||
|
||||
#: src/dusk/ui/overlay/uiautosave.c
|
||||
msgid "ui.autosave.saving"
|
||||
msgstr "GUARDANDO"
|
||||
|
||||
#: src/dusk/rpg/item/item.json
|
||||
msgid "item.potion.name"
|
||||
msgstr "Poción"
|
||||
|
||||
@@ -113,6 +113,74 @@ msgstr "はい"
|
||||
msgid "ui.initial.create_save.no"
|
||||
msgstr "いいえ"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.new_game"
|
||||
msgstr "ニューゲーム"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.load_game"
|
||||
msgstr "ロードゲーム"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.options"
|
||||
msgstr "オプション"
|
||||
|
||||
#: src/dusk/ui/frame/mainmenu/uimainmenu.c
|
||||
msgid "ui.main_menu.quit"
|
||||
msgstr "ゲームを終了"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.confirm"
|
||||
msgstr "確認"
|
||||
|
||||
#: src/dusk/ui/frame/uiconfirm.c
|
||||
msgid "ui.confirm.cancel"
|
||||
msgstr "キャンセル"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.attack"
|
||||
msgstr "攻撃"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.flee"
|
||||
msgstr "逃げる"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlemenu.c
|
||||
msgid "ui.battle.menu.target_format"
|
||||
msgstr "敵%u (%u/%u HP)"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.hp_format"
|
||||
msgstr "HP %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/battle/uibattlehud.c
|
||||
msgid "ui.battle.hud.mp_format"
|
||||
msgstr "MP %u/%u"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsaudio.c
|
||||
msgid "ui.settings.audio.placeholder"
|
||||
msgstr "オーディオ設定はまだありません"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsdisplay.c
|
||||
msgid "ui.settings.display.placeholder"
|
||||
msgstr "表示設定はまだありません"
|
||||
|
||||
#: src/dusk/ui/frame/settings/uisettingsinput.c
|
||||
msgid "ui.settings.input.placeholder"
|
||||
msgstr "入力設定はまだありません"
|
||||
|
||||
#: src/dusk/ui/frame/backpack/uibackpack.c
|
||||
msgid "ui.backpack.category_format"
|
||||
msgstr "カテゴリー%u"
|
||||
|
||||
#: src/dusk/ui/overlay/uiloading.c
|
||||
msgid "ui.loading.text"
|
||||
msgstr "読み込み中"
|
||||
|
||||
#: src/dusk/ui/overlay/uiautosave.c
|
||||
msgid "ui.autosave.saving"
|
||||
msgstr "保存中"
|
||||
|
||||
#: src/dusk/rpg/item/item.json
|
||||
msgid "item.potion.name"
|
||||
msgstr "ポーション"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "display/screen/screen.h"
|
||||
#include "display/text/text.h"
|
||||
#include "assert/assert.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
uibackpack_t UI_BACKPACK;
|
||||
|
||||
@@ -41,6 +43,14 @@ void uiBackpackTabSelected(
|
||||
errorret_t uiBackpackInit(void) {
|
||||
memoryZero(&UI_BACKPACK, sizeof(uibackpack_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.backpack.category_format",
|
||||
0,
|
||||
UI_BACKPACK.categoryFormat,
|
||||
UI_BACKPACK_CATEGORY_FORMAT_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&UI_BACKPACK.tabsMenu, UI_BACKPACK.tabs,
|
||||
uiBackpackTabSelected, NULL, uiBackpackTabChanged
|
||||
@@ -48,7 +58,7 @@ errorret_t uiBackpackInit(void) {
|
||||
for(uint8_t i = 0; i < UI_BACKPACK_TAB_COUNT; i++) {
|
||||
stringFormat(
|
||||
UI_BACKPACK.tabLabels[i], UI_BACKPACK_TAB_LABEL_MAX - 1,
|
||||
"Category %u", i + 1
|
||||
UI_BACKPACK.categoryFormat, i + 1
|
||||
);
|
||||
MENU_TAB(UI_BACKPACK.tabLabels[i]);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#define UI_BACKPACK_TAB_COUNT (ITEM_TYPE_COUNT - 1)
|
||||
#define UI_BACKPACK_TAB_LABEL_MAX 32
|
||||
#define UI_BACKPACK_CATEGORY_FORMAT_MAX 32
|
||||
#define UI_BACKPACK_ITEM_LIST_COLUMNS 4
|
||||
#define UI_BACKPACK_ITEM_LIST_ROWS 5
|
||||
|
||||
@@ -20,6 +21,7 @@ typedef struct {
|
||||
uimenu_t tabsMenu;
|
||||
uimenuitem_t tabs[UI_BACKPACK_TAB_COUNT];
|
||||
char_t tabLabels[UI_BACKPACK_TAB_COUNT][UI_BACKPACK_TAB_LABEL_MAX];
|
||||
char_t categoryFormat[UI_BACKPACK_CATEGORY_FORMAT_MAX];
|
||||
|
||||
uiitemlist_t itemList;
|
||||
} uibackpack_t;
|
||||
|
||||
@@ -13,10 +13,36 @@
|
||||
#include "display/color.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "util/string.h"
|
||||
#include "util/memory.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
#define UI_BATTLE_HUD_TEXT_MAX 32
|
||||
#define UI_BATTLE_HUD_LINE_HEIGHT 12.0f
|
||||
|
||||
uibattlehud_t UI_BATTLE_HUD;
|
||||
|
||||
errorret_t uiBattleHudInit(void) {
|
||||
memoryZero(&UI_BATTLE_HUD, sizeof(uibattlehud_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.battle.hud.hp_format",
|
||||
0,
|
||||
UI_BATTLE_HUD.hpFormat,
|
||||
UI_BATTLE_HUD_FORMAT_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.battle.hud.mp_format",
|
||||
0,
|
||||
UI_BATTLE_HUD.mpFormat,
|
||||
UI_BATTLE_HUD_FORMAT_MAX
|
||||
));
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t uiBattleHudDraw(void) {
|
||||
if(BATTLE.state == BATTLE_STATE_NONE) errorOk();
|
||||
|
||||
@@ -35,14 +61,14 @@ errorret_t uiBattleHudDraw(void) {
|
||||
|
||||
char_t hpText[UI_BATTLE_HUD_TEXT_MAX];
|
||||
stringFormat(
|
||||
hpText, UI_BATTLE_HUD_TEXT_MAX - 1, "HP %u/%u",
|
||||
hpText, UI_BATTLE_HUD_TEXT_MAX - 1, UI_BATTLE_HUD.hpFormat,
|
||||
fighter->health, fighter->healthMax
|
||||
);
|
||||
errorChain(textDraw(screenPos[0], screenPos[1], hpText, COLOR_WHITE, NULL));
|
||||
|
||||
char_t mpText[UI_BATTLE_HUD_TEXT_MAX];
|
||||
stringFormat(
|
||||
mpText, UI_BATTLE_HUD_TEXT_MAX - 1, "MP %u/%u",
|
||||
mpText, UI_BATTLE_HUD_TEXT_MAX - 1, UI_BATTLE_HUD.mpFormat,
|
||||
fighter->mp, fighter->mpMax
|
||||
);
|
||||
errorChain(textDraw(
|
||||
|
||||
@@ -8,6 +8,22 @@
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
|
||||
#define UI_BATTLE_HUD_FORMAT_MAX 32
|
||||
|
||||
typedef struct {
|
||||
char_t hpFormat[UI_BATTLE_HUD_FORMAT_MAX];
|
||||
char_t mpFormat[UI_BATTLE_HUD_FORMAT_MAX];
|
||||
} uibattlehud_t;
|
||||
|
||||
extern uibattlehud_t UI_BATTLE_HUD;
|
||||
|
||||
/**
|
||||
* Loads the HP/MP format strings from the active locale.
|
||||
*
|
||||
* @return Any error that occurs.
|
||||
*/
|
||||
errorret_t uiBattleHudInit(void);
|
||||
|
||||
/**
|
||||
* Draws each living battle fighter's HP/MP as text above its position in
|
||||
* the battle scene. No-op if no battle is active.
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "util/string.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "display/screen/screen.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
uibattlemenu_t UI_BATTLE_MENU;
|
||||
|
||||
@@ -46,7 +48,7 @@ void uiBattleMenuOpenTargets(void) {
|
||||
stringFormat(
|
||||
UI_BATTLE_MENU.targetLabels[menuIndex],
|
||||
UI_BATTLE_MENU_TARGET_LABEL_MAX - 1,
|
||||
"Enemy %u (%u/%u HP)",
|
||||
UI_BATTLE_MENU.targetFormat,
|
||||
candidate->id, candidate->health, candidate->healthMax
|
||||
);
|
||||
UI_BATTLE_MENU.targetFighterIndex[menuIndex] = i;
|
||||
@@ -81,12 +83,34 @@ void uiBattleMenuActionSelected(
|
||||
errorret_t uiBattleMenuInit(void) {
|
||||
memoryZero(&UI_BATTLE_MENU, sizeof(uibattlemenu_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.battle.menu.attack",
|
||||
0,
|
||||
UI_BATTLE_MENU.attackLabel,
|
||||
UI_BATTLE_MENU_ACTION_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.battle.menu.flee",
|
||||
0,
|
||||
UI_BATTLE_MENU.fleeLabel,
|
||||
UI_BATTLE_MENU_ACTION_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.battle.menu.target_format",
|
||||
0,
|
||||
UI_BATTLE_MENU.targetFormat,
|
||||
UI_BATTLE_MENU_TARGET_FORMAT_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&UI_BATTLE_MENU.actionMenu, UI_BATTLE_MENU.actionItems,
|
||||
uiBattleMenuActionSelected, NULL, NULL
|
||||
);
|
||||
MENU_BUTTON("Attack");
|
||||
MENU_BUTTON("Flee");
|
||||
MENU_BUTTON(UI_BATTLE_MENU.attackLabel);
|
||||
MENU_BUTTON(UI_BATTLE_MENU.fleeLabel);
|
||||
MENU_END(UI_BATTLE_MENU.actionItems, 1);
|
||||
|
||||
errorOk();
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
#define UI_BATTLE_MENU_ACTION_ITEM_COUNT 2
|
||||
#define UI_BATTLE_MENU_ACTION_INDEX_ATTACK 0
|
||||
#define UI_BATTLE_MENU_ACTION_INDEX_FLEE 1
|
||||
#define UI_BATTLE_MENU_ACTION_LABEL_MAX 32
|
||||
|
||||
#define UI_BATTLE_MENU_TARGET_ITEM_COUNT BATTLE_FIGHTER_COUNT_MAX
|
||||
#define UI_BATTLE_MENU_TARGET_LABEL_MAX 32
|
||||
#define UI_BATTLE_MENU_TARGET_FORMAT_MAX 48
|
||||
|
||||
#define UI_BATTLE_MENU_WIDTH 160.0f
|
||||
#define UI_BATTLE_MENU_HEIGHT 96.0f
|
||||
@@ -23,12 +25,15 @@
|
||||
typedef struct {
|
||||
uimenu_t actionMenu;
|
||||
uimenuitem_t actionItems[UI_BATTLE_MENU_ACTION_ITEM_COUNT];
|
||||
char_t attackLabel[UI_BATTLE_MENU_ACTION_LABEL_MAX];
|
||||
char_t fleeLabel[UI_BATTLE_MENU_ACTION_LABEL_MAX];
|
||||
|
||||
uimenu_t targetMenu;
|
||||
uimenuitem_t targetItems[UI_BATTLE_MENU_TARGET_ITEM_COUNT];
|
||||
uint8_t targetFighterIndex[UI_BATTLE_MENU_TARGET_ITEM_COUNT];
|
||||
char_t targetLabels[UI_BATTLE_MENU_TARGET_ITEM_COUNT]
|
||||
[UI_BATTLE_MENU_TARGET_LABEL_MAX];
|
||||
char_t targetFormat[UI_BATTLE_MENU_TARGET_FORMAT_MAX];
|
||||
} uibattlemenu_t;
|
||||
|
||||
extern uibattlemenu_t UI_BATTLE_MENU;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "display/screen/screen.h"
|
||||
#include "assert/assert.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
#define UI_MAIN_MENU_INDEX_NEW_GAME 0
|
||||
#define UI_MAIN_MENU_INDEX_LOAD_GAME 1
|
||||
@@ -58,13 +60,42 @@ void uiMainMenuSelected(
|
||||
errorret_t uiMainMenuInit(void) {
|
||||
memoryZero(&UI_MAIN_MENU, sizeof(uimainmenu_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.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",
|
||||
0,
|
||||
UI_MAIN_MENU.loadGameLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.options",
|
||||
0,
|
||||
UI_MAIN_MENU.optionsLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.main_menu.quit",
|
||||
0,
|
||||
UI_MAIN_MENU.quitLabel,
|
||||
UI_MAIN_MENU_LABEL_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&UI_MAIN_MENU.menu, UI_MAIN_MENU.items, uiMainMenuSelected, NULL, NULL
|
||||
);
|
||||
MENU_BUTTON("New Game");
|
||||
MENU_BUTTON("Load Game");
|
||||
MENU_BUTTON("Options");
|
||||
MENU_BUTTON("Quit Game");
|
||||
MENU_BUTTON(UI_MAIN_MENU.newGameLabel);
|
||||
MENU_BUTTON(UI_MAIN_MENU.loadGameLabel);
|
||||
MENU_BUTTON(UI_MAIN_MENU.optionsLabel);
|
||||
MENU_BUTTON(UI_MAIN_MENU.quitLabel);
|
||||
MENU_END(UI_MAIN_MENU.items, 1);
|
||||
|
||||
errorOk();
|
||||
|
||||
@@ -12,10 +12,15 @@
|
||||
#define UI_MAIN_MENU_ITEM_COUNT 4
|
||||
#define UI_MAIN_MENU_WIDTH 200.0f
|
||||
#define UI_MAIN_MENU_HEIGHT 160.0f
|
||||
#define UI_MAIN_MENU_LABEL_MAX 32
|
||||
|
||||
typedef struct {
|
||||
uimenu_t menu;
|
||||
uimenuitem_t items[UI_MAIN_MENU_ITEM_COUNT];
|
||||
char_t newGameLabel[UI_MAIN_MENU_LABEL_MAX];
|
||||
char_t loadGameLabel[UI_MAIN_MENU_LABEL_MAX];
|
||||
char_t optionsLabel[UI_MAIN_MENU_LABEL_MAX];
|
||||
char_t quitLabel[UI_MAIN_MENU_LABEL_MAX];
|
||||
} uimainmenu_t;
|
||||
|
||||
extern uimainmenu_t UI_MAIN_MENU;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "uisettings.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
void uiSettingsAudioSelected(
|
||||
const uimenu_t *menu,
|
||||
@@ -23,11 +25,19 @@ errorret_t uiSettingsAudioInit(uisettingsdata_t *data) {
|
||||
uisettingsaudio_t *audio = &data->audio;
|
||||
memoryZero(audio, sizeof(uisettingsaudio_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.settings.audio.placeholder",
|
||||
0,
|
||||
audio->placeholderLabel,
|
||||
UI_SETTINGS_AUDIO_PLACEHOLDER_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&audio->menu, audio->items,
|
||||
uiSettingsAudioSelected, uiSettingsDiscardMenuClosed, NULL
|
||||
);
|
||||
MENU_LABEL("No audio settings yet");
|
||||
MENU_LABEL(audio->placeholderLabel);
|
||||
MENU_BUTTON(UI_SETTINGS.applyLabel);
|
||||
|
||||
MENU_END(audio->items, 1);
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct {
|
||||
|
||||
#define UI_SETTINGS_INPUT_ITEM_COUNT 2
|
||||
#define UI_SETTINGS_INPUT_LABEL_MAX 32
|
||||
#define UI_SETTINGS_INPUT_PLACEHOLDER_MAX 64
|
||||
#define UI_SETTINGS_INPUT_INDEX_DEADZONE 0
|
||||
#define UI_SETTINGS_INPUT_INDEX_APPLY 1
|
||||
|
||||
@@ -34,22 +35,27 @@ typedef struct {
|
||||
uimenu_t menu;
|
||||
uimenuitem_t items[UI_SETTINGS_INPUT_ITEM_COUNT];
|
||||
char_t deadzoneLabel[UI_SETTINGS_INPUT_LABEL_MAX];
|
||||
char_t placeholderLabel[UI_SETTINGS_INPUT_PLACEHOLDER_MAX];
|
||||
} uisettingsinput_t;
|
||||
|
||||
#define UI_SETTINGS_DISPLAY_ITEM_COUNT 2
|
||||
#define UI_SETTINGS_DISPLAY_INDEX_APPLY 1
|
||||
#define UI_SETTINGS_DISPLAY_PLACEHOLDER_MAX 64
|
||||
|
||||
typedef struct {
|
||||
uimenu_t menu;
|
||||
uimenuitem_t items[UI_SETTINGS_DISPLAY_ITEM_COUNT];
|
||||
char_t placeholderLabel[UI_SETTINGS_DISPLAY_PLACEHOLDER_MAX];
|
||||
} uisettingsdisplay_t;
|
||||
|
||||
#define UI_SETTINGS_AUDIO_ITEM_COUNT 2
|
||||
#define UI_SETTINGS_AUDIO_INDEX_APPLY 1
|
||||
#define UI_SETTINGS_AUDIO_PLACEHOLDER_MAX 64
|
||||
|
||||
typedef struct {
|
||||
uimenu_t menu;
|
||||
uimenuitem_t items[UI_SETTINGS_AUDIO_ITEM_COUNT];
|
||||
char_t placeholderLabel[UI_SETTINGS_AUDIO_PLACEHOLDER_MAX];
|
||||
} uisettingsaudio_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "uisettings.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
void uiSettingsDisplaySelected(
|
||||
const uimenu_t *menu,
|
||||
@@ -23,11 +25,19 @@ errorret_t uiSettingsDisplayInit(uisettingsdata_t *data) {
|
||||
uisettingsdisplay_t *display = &data->display;
|
||||
memoryZero(display, sizeof(uisettingsdisplay_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.settings.display.placeholder",
|
||||
0,
|
||||
display->placeholderLabel,
|
||||
UI_SETTINGS_DISPLAY_PLACEHOLDER_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&display->menu, display->items,
|
||||
uiSettingsDisplaySelected, uiSettingsDiscardMenuClosed, NULL
|
||||
);
|
||||
MENU_LABEL("No display settings yet");
|
||||
MENU_LABEL(display->placeholderLabel);
|
||||
MENU_BUTTON(UI_SETTINGS.applyLabel);
|
||||
|
||||
MENU_END(display->items, 1);
|
||||
|
||||
@@ -46,7 +46,14 @@ errorret_t uiSettingsInputInit(uisettingsdata_t *data) {
|
||||
input->deadzoneLabel, SAVE_META_DEADZONE_DEFAULT, 0.0f, 1.0f, 0.05f
|
||||
);
|
||||
#else
|
||||
MENU_LABEL("No input settings yet");
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.settings.input.placeholder",
|
||||
0,
|
||||
input->placeholderLabel,
|
||||
UI_SETTINGS_INPUT_PLACEHOLDER_MAX
|
||||
));
|
||||
MENU_LABEL(input->placeholderLabel);
|
||||
#endif
|
||||
|
||||
MENU_BUTTON(UI_SETTINGS.applyLabel);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "display/texture/texture.h"
|
||||
#include "display/shader/shaderunlit.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
#define UI_CONFIRM_BACKDROP_COLOR color4b(0, 0, 0, 160)
|
||||
|
||||
@@ -40,11 +42,26 @@ void uiConfirmClosed(const uimenu_t *menu) {
|
||||
errorret_t uiConfirmInit(void) {
|
||||
memoryZero(&UI_CONFIRM, sizeof(uiconfirm_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.confirm.confirm",
|
||||
0,
|
||||
UI_CONFIRM.confirmLabel,
|
||||
UI_CONFIRM_LABEL_MAX
|
||||
));
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.confirm.cancel",
|
||||
0,
|
||||
UI_CONFIRM.cancelLabel,
|
||||
UI_CONFIRM_LABEL_MAX
|
||||
));
|
||||
|
||||
MENU_BEGIN(
|
||||
&UI_CONFIRM.menu, UI_CONFIRM.items, uiConfirmSelected, uiConfirmClosed, NULL
|
||||
);
|
||||
MENU_BUTTON("Confirm");
|
||||
MENU_BUTTON("Cancel");
|
||||
MENU_BUTTON(UI_CONFIRM.confirmLabel);
|
||||
MENU_BUTTON(UI_CONFIRM.cancelLabel);
|
||||
|
||||
MENU_END(UI_CONFIRM.items, menuIndex);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#define UI_CONFIRM_INDEX_CONFIRM 0
|
||||
#define UI_CONFIRM_INDEX_CANCEL 1
|
||||
#define UI_CONFIRM_ITEM_COUNT 2
|
||||
#define UI_CONFIRM_LABEL_MAX 32
|
||||
|
||||
/**
|
||||
* Callback invoked once a confirm dialog is dismissed.
|
||||
@@ -31,6 +32,8 @@ typedef struct {
|
||||
uiconfirmcallback_t callback;
|
||||
void *user;
|
||||
bool_t result;
|
||||
char_t confirmLabel[UI_CONFIRM_LABEL_MAX];
|
||||
char_t cancelLabel[UI_CONFIRM_LABEL_MAX];
|
||||
} uiconfirm_t;
|
||||
|
||||
extern uiconfirm_t UI_CONFIRM;
|
||||
|
||||
@@ -10,20 +10,36 @@
|
||||
#include "display/text/text.h"
|
||||
#include "display/screen/screen.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "util/memory.h"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
// TODO: Localize once this grows beyond a placeholder indicator.
|
||||
#define UI_AUTOSAVE_TEXT "SAVING"
|
||||
uiautosave_t UI_AUTO_SAVE;
|
||||
|
||||
errorret_t uiAutoSaveInit(void) {
|
||||
memoryZero(&UI_AUTO_SAVE, sizeof(uiautosave_t));
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.autosave.saving",
|
||||
0,
|
||||
UI_AUTO_SAVE.text,
|
||||
UI_AUTOSAVE_TEXT_MAX
|
||||
));
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t uiAutoSaveDraw(void) {
|
||||
if(!autoSaveIsSaving()) errorOk();
|
||||
|
||||
int32_t textW, textH;
|
||||
textMeasure(UI_AUTOSAVE_TEXT, &FONT_DEFAULT, &textW, &textH);
|
||||
textMeasure(UI_AUTO_SAVE.text, &FONT_DEFAULT, &textW, &textH);
|
||||
|
||||
float_t x = (float_t)SCREEN.scanX + UI_AUTOSAVE_MARGIN;
|
||||
float_t y = (float_t)(SCREEN.scanY + SCREEN.scanHeight) -
|
||||
(float_t)textH - UI_AUTOSAVE_MARGIN;
|
||||
|
||||
errorChain(textDraw(x, y, UI_AUTOSAVE_TEXT, COLOR_WHITE, &FONT_DEFAULT));
|
||||
errorChain(textDraw(x, y, UI_AUTO_SAVE.text, COLOR_WHITE, &FONT_DEFAULT));
|
||||
return spriteBatchFlush();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,20 @@
|
||||
#include "error/error.h"
|
||||
|
||||
#define UI_AUTOSAVE_MARGIN 8.0f
|
||||
#define UI_AUTOSAVE_TEXT_MAX 32
|
||||
|
||||
typedef struct {
|
||||
char_t text[UI_AUTOSAVE_TEXT_MAX];
|
||||
} uiautosave_t;
|
||||
|
||||
extern uiautosave_t UI_AUTO_SAVE;
|
||||
|
||||
/**
|
||||
* Loads the "Saving" indicator text from the active locale.
|
||||
*
|
||||
* @return Any error that occurs.
|
||||
*/
|
||||
errorret_t uiAutoSaveInit(void);
|
||||
|
||||
/**
|
||||
* Draws a "Saving" indicator in the bottom-left corner of the screen
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "display/screen/screen.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "uifullbox.h"
|
||||
|
||||
#define UI_LOADING_TEXT "loading"
|
||||
#include "locale/localemanager.h"
|
||||
#include "asset/loader/locale/assetlocaleloader.h"
|
||||
|
||||
uiloading_t UI_LOADING;
|
||||
|
||||
@@ -26,6 +26,15 @@ errorret_t uiLoadingInit(void) {
|
||||
UI_LOADING.onTransitionEndUsers,
|
||||
4
|
||||
);
|
||||
|
||||
errorChain(assetLocaleGetString(
|
||||
&LOCALE.entry->data.locale,
|
||||
"ui.loading.text",
|
||||
0,
|
||||
UI_LOADING.text,
|
||||
UI_LOADING_TEXT_MAX
|
||||
));
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -53,7 +62,7 @@ errorret_t uiLoadingDraw(void) {
|
||||
if(alpha <= 0.0f) errorOk();
|
||||
|
||||
int32_t textW, textH;
|
||||
textMeasure(UI_LOADING_TEXT, &FONT_DEFAULT, &textW, &textH);
|
||||
textMeasure(UI_LOADING.text, &FONT_DEFAULT, &textW, &textH);
|
||||
|
||||
float_t x = (float_t)(SCREEN.scanX + SCREEN.scanWidth) -
|
||||
(float_t)textW - UI_LOADING_MARGIN;
|
||||
@@ -63,7 +72,7 @@ errorret_t uiLoadingDraw(void) {
|
||||
color_t color = COLOR_WHITE;
|
||||
color.a = (uint8_t)(alpha * 255.0f);
|
||||
|
||||
errorChain(textDraw(x, y, UI_LOADING_TEXT, color, &FONT_DEFAULT));
|
||||
errorChain(textDraw(x, y, UI_LOADING.text, color, &FONT_DEFAULT));
|
||||
return spriteBatchFlush();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#define UI_LOADING_FADE_DURATION 0.5f
|
||||
#define UI_LOADING_MARGIN 8.0f
|
||||
#define UI_LOADING_TEXT_MAX 32
|
||||
|
||||
typedef struct {
|
||||
float_t fromAlpha;
|
||||
@@ -20,6 +21,7 @@ typedef struct {
|
||||
eventcallback_t onTransitionEndCallbacks[4];
|
||||
void *onTransitionEndUsers[4];
|
||||
event_t onTransitionEnd;
|
||||
char_t text[UI_LOADING_TEXT_MAX];
|
||||
} uiloading_t;
|
||||
|
||||
extern uiloading_t UI_LOADING;
|
||||
|
||||
@@ -65,7 +65,7 @@ uielement_t UI_ELEMENTS[] = {
|
||||
.dispose = uiMainMenuDispose
|
||||
},
|
||||
|
||||
{ .draw = uiBattleHudDraw },
|
||||
{ .init = uiBattleHudInit, .draw = uiBattleHudDraw },
|
||||
|
||||
{
|
||||
.init = uiBattleMenuInit,
|
||||
@@ -141,7 +141,7 @@ uielement_t UI_ELEMENTS[] = {
|
||||
.draw = uiCropDraw
|
||||
},
|
||||
|
||||
{ .draw = uiAutoSaveDraw },
|
||||
{ .init = uiAutoSaveInit, .draw = uiAutoSaveDraw },
|
||||
|
||||
// Debug items
|
||||
{ .draw = uiConsoleDraw },
|
||||
|
||||
Reference in New Issue
Block a user