80f4348e21
Builds out uikeyboard/uikeyboardqwerty from placeholders into a working controller-navigable text entry dialog: title/current-text labels, a flat QWERTY key grid (letters, space, backspace), and confirm/cancel buttons in one combined menu so d-pad navigation flows across all of it. uikeyboardopen_t configures each dialog: onInput/onKeyPress callbacks, optional cancel button, maxLength (auto-focuses confirm once full), lineCount for multi-line entry (adds a NEWLINE key, reserves vertical space up front), a second "are you sure" uiConfirm step, and trimmed/allowBlank validation on confirm. Back now deletes the last character first, falling through to close only when cancel is allowed and the buffer is empty - this needed a general cancel-intercept callback added to uifocusitem_t/uimenu_t (uiMenuSetCancelCallback), since the focus system previously only supported popping or fully swallowing back. Wired a temporary "LOAD GAME (TEST)" entry into the main menu with console-logging test callbacks for interactive testing; marked TODO for removal once the keyboard is wired up somewhere real. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
159 lines
4.7 KiB
C
159 lines
4.7 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "uielementlist.h"
|
|
#include "ui/widget/uiframe.h"
|
|
#include "ui/debug/uifps.h"
|
|
#include "ui/overlay/uifullbox.h"
|
|
#include "ui/overlay/uiloading.h"
|
|
#include "ui/debug/uiplayerpos.h"
|
|
#include "ui/overlay/uicrop.h"
|
|
#include "ui/transition/uitransition.h"
|
|
#include "ui/debug/uiconsole.h"
|
|
#include "ui/screen/game/uigamemenu.h"
|
|
#include "ui/screen/mainmenu/uimainmenu.h"
|
|
#include "ui/screen/battle/uibattlemenu.h"
|
|
#include "ui/screen/battle/uibattlehud.h"
|
|
#include "ui/screen/backpack/uibackpack.h"
|
|
#include "ui/dialog/uiconfirm.h"
|
|
#include "ui/widget/uimodal.h"
|
|
#include "ui/dialog/keyboard/uikeyboard.h"
|
|
#include "ui/dialog/save/uiselectsave.h"
|
|
#include "ui/rpg/textbox/uitextboxmain.h"
|
|
#include "ui/rpg/textbox/uitextboxminilist.h"
|
|
#include "ui/rpg/uiemoji.h"
|
|
|
|
uielement_t UI_ELEMENTS[] = {
|
|
// ===========================================================================
|
|
// Non-Rendered Components, just needs init and deinit
|
|
// ===========================================================================
|
|
{
|
|
.init = uiFrameInit,
|
|
.dispose = uiFrameDispose
|
|
},
|
|
|
|
// ===========================================================================
|
|
// In-World Gameplay Components, sits below all UI but above gameplay.
|
|
// ===========================================================================
|
|
{
|
|
.init = uiEmojiInit,
|
|
.update = uiEmojiUpdate,
|
|
.draw = uiEmojiDraw,
|
|
.dispose = uiEmojiDispose
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Low rendered components, usually gameplay non-world components.
|
|
// ===========================================================================
|
|
{
|
|
.init = uiFullboxUnderInit,
|
|
.update = uiFullboxUnderUpdate,
|
|
.draw = uiFullboxUnderDraw
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Most menus and non-gameplay components. Hierarchy is very important.
|
|
// ===========================================================================
|
|
{
|
|
.init = uiGameMenuInit,
|
|
.draw = uiGameMenuDraw,
|
|
.dispose = uiGameMenuDispose
|
|
},
|
|
{
|
|
.init = uiMainMenuInit,
|
|
.draw = uiMainMenuDraw,
|
|
.dispose = uiMainMenuDispose
|
|
},
|
|
{
|
|
.init = uiBattleHudInit,
|
|
.draw = uiBattleHudDraw
|
|
},
|
|
{
|
|
.init = uiBattleMenuInit,
|
|
.update = uiBattleMenuUpdate,
|
|
.draw = uiBattleMenuDraw
|
|
},
|
|
{
|
|
.init = uiBackpackInit,
|
|
.draw = uiBackpackDraw,
|
|
.dispose = uiBackpackDispose
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Modals, Popups and Dialogs, above most other UI things.
|
|
// ===========================================================================
|
|
{
|
|
.init = uiSelectSaveInit,
|
|
.draw = uiSelectSaveDraw,
|
|
.dispose = uiSelectSaveDispose
|
|
},
|
|
{
|
|
.init = uiTextboxMainInit,
|
|
.update = uiTextboxMainUpdate,
|
|
.draw = uiTextboxMainDraw
|
|
},
|
|
{
|
|
.init = uiTextboxMiniListInit,
|
|
.update = uiTextboxMiniListUpdate,
|
|
.draw = uiTextboxMiniListDraw
|
|
},
|
|
{
|
|
.init = uiKeyboardInit,
|
|
.draw = uiKeyboardDraw,
|
|
.dispose = uiKeyboardDispose
|
|
},
|
|
{
|
|
.init = uiModalInit,
|
|
.draw = uiModalDraw,
|
|
.dispose = uiModalDispose
|
|
},
|
|
{
|
|
.init = uiConfirmInit,
|
|
.dispose = uiConfirmDispose
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Overlayed components, can even outdraw all UI things.
|
|
// ===========================================================================
|
|
{
|
|
.init = uiTransitionInit,
|
|
.update = uiTransitionUpdate,
|
|
.draw = uiTransitionDraw
|
|
},
|
|
{
|
|
.init = uiFullboxOverInit,
|
|
.update = uiFullboxOverUpdate,
|
|
.draw = uiFullboxOverDraw
|
|
},
|
|
|
|
{
|
|
.init = uiLoadingInit,
|
|
.update = uiLoadingUpdate,
|
|
.draw = uiLoadingDraw
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Important rendering components, lives outside the primary game engine
|
|
// ===========================================================================
|
|
{
|
|
.init = uiCropInit,
|
|
.draw = uiCropDraw
|
|
},
|
|
|
|
// ===========================================================================
|
|
// Debug components, disregards everything else.
|
|
// ===========================================================================
|
|
{ .init = uiConsoleInit, .draw = uiConsoleDraw },
|
|
{ .init = uiFPSInit, .draw = uiFPSDraw },
|
|
{ .init = uiPlayerPosInit, .draw = uiPlayerPosDraw },
|
|
|
|
// ===========================================================================
|
|
// Null terminator
|
|
// ===========================================================================
|
|
{ 0 }
|
|
};
|