resonance 1.0.1
Loading...
Searching...
No Matches
metkeyboardscreen.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "math/vector3.h"
6#include "met/metscreen.h"
7#include "os/hxstr.h"
8#include "rnd/text.h"
9#include "rnd/view.h"
10
11class MetKBUser;
13
14namespace Rnd {
15class Button;
16} // namespace Rnd
17
59public:
68 MetKeyboardScreen(MetRenderer *pRenderer, int nPriority);
69
75
87 static MetScreen *New(MetRenderer *pRenderer, int nPriority);
88
98 static void SetKeyboardReturnScreen(const HxStr &returnScreen);
99
111 static std::vector<HxStr> *GetDefaultMacros();
112
124 static HxStr DefaultMacro(int nIndex);
125
141 static void Open(const MetKeyboardRequest &request);
142
154
166 virtual void EnterAndShow();
167
177 virtual void BeginExit();
178
192 virtual void HandleCommand(const MetScreenCommand *pCommand);
193
204 virtual void PlaySlideSound(int nSelector);
205
215 virtual void PlayHighSound(int nSelector);
216
226 virtual void PlayCycleLeftSound(int nSelector);
227
237 virtual void PlayCycleRightSound(int nSelector);
238
250 virtual void UpdateIdle(float flTime);
251
266 virtual void
267 StartRepeatingSound(float flStartTime, float flInterval, Rnd::Button *pButton, int nCycles);
268
281 virtual void OnRepeatingSoundFinished(Rnd::Button *pButton);
282
291 virtual void OnEnterFinished();
292
304 virtual void OnExitFinished();
305
317 virtual void ResolveContainerViews();
318
319private:
329 void DispatchKeyName(const HxStr &name);
330
331#ifdef VIDEO_STANDARD_PAL
340 void LocalizeKeyLabels();
341#endif
342
351 void HighlightCurrentKey();
352
359 void MoveRight();
360
367 void MoveLeft();
368
376 void MoveDown();
377
384 void MoveUp();
385
392 void ShowMacro(const HxStr &key);
393
400 void InsertMacro(int nIndex);
401
411 Rnd::Button *FindKeyButton(const HxStr &key);
412
419 void OnShift();
420
427 void OnBackspace();
428
435 void OnCaretLeft();
436
443 void OnCaretRight();
444
451 void OnCaps();
452
459 void OnTab();
460
467 void OnSpace();
468
475 void OnDelete();
476
483 void OnCharacter(const HxStr &key);
484
493 void UpdateCursor();
494
501 void ResetCaret();
502
511 void OnDeparted();
512
521 HxStr *CurrentKey();
522
531 void UnhighlightKey(const HxStr &key);
532
541 void RemoveChar(int nIndex);
542
551 void AppendText(const HxStr &text);
552
561 void InsertText(const HxStr &text, unsigned nPos);
562
571 int TextEndX();
572
581 void HideMacro();
582
589 bool IsMacroKey(const HxStr &key);
590
597 void SetPendingCommand(const HxStr &key);
598
610 void SetTickerText(const HxStr &text);
611
618 void OnEnter();
619
620 // Press a key as the controller's shortcut commands do. Inline at each of HandleCommand()'s
621 // five sites, with no out-of-line copy.
622 void PressKey(const HxStr &key);
623
630 void OnMacro(int nIndex);
631
640 void SetText(const HxStr &text);
641
650 void SetPrompt(const HxStr &prompt);
651
660 void SetUser(MetKBUser *pUser);
661
670 void SetSelector(int nSelector);
671
680 void SetTicker(const HxStr &ticker);
681
688 void SetReturnScreen(const HxStr &returnScreen);
689
690 // The macro list the keyboard offers. Open() stores the request's list here, or the default
691 // list when the request has none. +0x8c
692 std::vector<HxStr> *mMacros;
693 Rnd::View *mpKeypanelRegular; // +0x90, `keypanel_regular.view`
694 Rnd::View *mpKeypanelShift; // +0x94, `keypanel_shift.view`
695 Rnd::View *mpKeypanelCaps; // +0x98, `keypanel_caps.view`
696 Rnd::Text *mpCursor; // +0x9c, `cursor.txt`
697 Rnd::Text *mpTextEntryWindow; // +0xa0, `text entry window.txt`
698 Rnd::Text *mpTitleBar; // +0xa4, `title bar.txt`
699 Rnd::Text *mpMacroDisplay; // +0xa8, `macro_display.txt`
700 // Registry key of the screen slot 36 departs to. +0xac
701 HxStr mReturnScreen;
702 // The entered text. +0xb4
703 HxStr mText;
704 // The prompt SetPrompt() assigns. +0xbc
705 HxStr mPrompt;
706 // The ticker text slot 33 posts. +0xc4
707 HxStr mTicker;
708 // The key a press is applying, empty while no press is pending. +0xcc
709 HxStr mPendingKey;
710 // The number of characters before the caret. +0xd4
711 int mCaret;
712 // Never read or written by any routine of the class.
713 unsigned char mReserved[0x08]; // +0xd8
714 // Offset of the caret from the character it precedes. +0xe0
715 Vector3 mCursorOffset;
716 // Offset of the macro caption from the character it follows. +0xf0
717 Vector3 mMacroOffset;
718 // When the caret next toggles, or zero while it does not blink. +0x100
719 float mBlinkTime;
720 // The receiver of the committed text, which SetUser() records. +0x104
721 MetKBUser *mUser;
722 // The rows of the active layout. +0x108
723 HxStr **mRows;
724 // The visible key panel. +0x10c
725 Rnd::View *mPanel;
726 int mRow; // +0x110
727 int mColumn; // +0x114
728 int mShiftState; // +0x118, a KeyboardShiftState
729 int mMacrosDisabled; // +0x11c, starts at 1
730 // The selector the four sound slots and slot 19 compare their argument against. A screen that
731 // records -1 accepts every value. SetSelector() is the one writer, and the constructor does not
732 // clear it.
733 int mSelector; // +0x120
734 // What the last key did, a KeyboardAction that slot 28 turns into a sound. Starts at 5.
735 int mLastAction; // +0x124
736};
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Mix-in for a screen that receives text from the front-end keyboard.
Definition metkbuser.h:24
virtual void OnEnterFinished()
Set the ticker from the recorded text.
virtual void OnRepeatingSoundFinished(Rnd::Button *pButton)
Restore the key buttons once a press has finished alternating.
static HxStr DefaultMacro(int nIndex)
Read one default keyboard macro from the configuration.
static void SetKeyboardReturnScreen(const HxStr &returnScreen)
Record the screen the registered keyboard departs to.
void ResetKeyStates()
Disable the twelve function keys.
virtual void BeginExit()
Clear the ticker and start the exit animation.
virtual ~MetKeyboardScreen()
virtual void EnterAndShow()
Show the keyboard and start its enter animation.
virtual void PlayHighSound(int nSelector)
Play the key sound that accompanies the emphasised selection.
static void Open(const MetKeyboardRequest &request)
Fill the registered keyboard from a request and bring it up over the requesting screen.
virtual void PlayCycleLeftSound(int nSelector)
Play the key sound that accompanies cycling a value to the left.
virtual void StartRepeatingSound(float flStartTime, float flInterval, Rnd::Button *pButton, int nCycles)
Apply the pending key and then start the base's alternation.
static std::vector< HxStr > * GetDefaultMacros()
Report the twelve default keyboard macros, filling the list on first use.
virtual void OnExitFinished()
Report the entered text and depart.
virtual void UpdateIdle(float flTime)
Blink the caret.
MetKeyboardScreen(MetRenderer *pRenderer, int nPriority)
Construct the screen.
virtual void PlayCycleRightSound(int nSelector)
Play the key sound that accompanies cycling a value to the right.
virtual void ResolveContainerViews()
Resolve the three key panels and the four text objects.
virtual void HandleCommand(const MetScreenCommand *pCommand)
Act on one navigation command.
static MetScreen * New(MetRenderer *pRenderer, int nPriority)
Produce a keyboard on the heap.
virtual void PlaySlideSound(int nSelector)
Play the key sound that accompanies sliding.
Front-end renderer that owns the screen stack and drives every MetScreen.
Definition metrenderer.h:68
MetScreen(MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
Construct a screen and start its container load.
Selectable widget, as one mesh and one text run plus a palette for each.
Definition button.h:39
Run of text drawn as a quad per glyph.
Definition text.h:57
Root of a loadable scene.
Definition view.h:47
The rendering engine.
Definition animhelper.h:3
What a screen asks of the on-screen keyboard.
Definition metkeyboardrequest.h:18
One navigation command delivered to a screen.
Definition metscreen.h:46
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12