InputPad
Menus, the on-screen touch pad, typed cheats and the help overlay: everything the player clicks, touches or types outside the 3D world.
Location
| Header | src/GalaxyEggbert/Game/InputPad.hpp |
|---|---|
| Sources | src/GalaxyEggbert/Game/InputPad.cpp; with ScreenKeyboard.hpp, CheatConfig.hpp, TextMetrics.hpp, QuadBatch.{hpp,cpp} in the same folder |
| Namespace | GalaxyEggbert::Game |
| Engine dependency | CNA (MouseState, KeyboardState, Texture2D, BasicEffect) and cna-engine's GpuMesh for drawing; the Update* hit-testing works without a graphics device |
Purpose
InputPad started as a port of the original Mobile Eggbert's InputPad class (its touch buttons) and
now owns every 2D screen of the game: the main menu with its three player slots, Setup, Pause, Resume, Win and Lost, the
ten demo positions, the loading and goodbye screens, the Play phase's on-screen pad, the list of active cheats, the
debug panel, the hidden cheat menu and the F1 help overlay. It also parses the typed cheat words.
Each screen has an Update… method that hit-tests the mouse (or touches) and returns a small struct of
"what was pressed", and a Draw… method. Layout is in the original's 640 x 480 reference space, scaled to the
window; where the original's rectangles do not fit that space (the five-button Pause row, the nine-button cheat menu) they
are proportionally adapted. InputPad never changes game state itself: it reports, and
GalaxyEggbertGame acts.
Collaborators
Uses
ScreenKeyboard(ScreenKeyboard.hpp): the on-screen keyboard used to name a demo; passed in throughDemoSlotsExtrasandUpdateDemoSlots.CheatConfig.hpp:kCheatsEnabled, from the CMake optionGALAXY_EGGBERT_ENABLE_CHEATS(defaultON).TextMetricsfor the original's proportional font;QuadBatchfor rectangles; sheets such aspad.png,text.pngand the menu backgrounds.
Used by
- GalaxyEggbertGame only: phase input in
GalaxyEggbertGameUpdate.cpp, drawing inGalaxyEggbertGameDraw.cpp, the demo positions inGalaxyEggbertGameDemo.cpp. The host'sFocusNavigator(arrow keys and d-pad choosing a lit button) works over InputPad's static rectangles such asDemoSlotRectandDemoListRowRect. - The help panel's open/close state is the small
ControlsHelpstruct inControlInput.hpp; InputPad only draws it.
Screens it handles
| Screen (phase) | Methods | Buttons reported |
|---|---|---|
Main menu (Init) | UpdateInit, DrawInit | Player A/B/C, Play, Setup, Editor, Exit, Fullscreen, Help, Demo, Galaxy, Demos |
Setup (MainSetup, PlaySetup) | UpdateSetup, DrawSetup | sounds, Jump side, zoom, accelerometer, 3D terrain, 3D effects, frame rate, textures, volume and sensitivity sliders, Reset, Return |
| Pause | UpdatePause, DrawPause | Home, Back, Setup, Restart, Continue, and Galaxy's Record and Original |
| Demo positions (over Pause or from the menu) | UpdateDemoSlots, DrawDemoSlots | a position, its Original, Cancel, Export, Import, Name, Import's file list (pages of kDemoListRows = 7) with a bin per row |
Resume | UpdateResume, DrawResume | Home, Continue |
Win, Lost | UpdateWinLost, DrawWinLost | Return |
Play | UpdatePlay, UpdatePlayTouches, DrawPlay | stick, Jump, Action, Pause, back up, crouch, vehicle Fire; Forward and Back in accelerometer mode |
| Play overlays | DrawActiveCheats, DrawDebug, DrawLabels, DrawControlsHelp, DrawCheatMenu | the hidden cheat menu's nine buttons (UpdateCheatMenu) |
| Start and quit | DrawGalaxyLoading, DrawGoodbye | none (drawn over the 3D title scene) |
Key members
A selection of the public API declared in InputPad.hpp (the header also has many static rectangle helpers
such as PauseRecordRect and DemoExportRect).
| Member | Signature | What it does |
|---|---|---|
LoadContent | void LoadContent(GraphicsDevice& device) | Loads the sheets and backgrounds. Hit-testing does not need it. |
ResetTouchState | void ResetTouchState() noexcept | Drops any press in flight; the host calls it on every phase change. |
UpdatePlay | bool UpdatePlay(const MouseState& mouse, int viewportW, int viewportH, PlayInput& outInput) noexcept | Mouse on the Play controls; returns whether the press landed on one (then the camera ignores it). |
UpdatePlayTouches | bool UpdatePlayTouches(const std::vector<TouchPoint>& touches, int viewportW, int viewportH, PlayInput& outInput) noexcept | Several fingers at once: a finger that lands on the stick keeps steering wherever it moves, Jump is held by any finger on it, Action and Pause fire when their finger lifts. |
UpdateInit | InitInput UpdateInit(const MouseState& mouse, int viewportW, int viewportH) noexcept | The main menu's buttons. |
UpdatePause | PauseInput UpdatePause(const MouseState& mouse, int viewportW, int viewportH, bool showBack, bool showRestart, bool showRecord = false, bool showOriginal = false) noexcept | The Pause row; hidden buttons cannot be pressed. |
UpdateDemoSlots | DemoSlotsInput UpdateDemoSlots(const MouseState& mouse, int viewportW, int viewportH, const std::vector<DemoSlotInfo>& slots, int listRows = -1, bool paged = false, const ScreenKeyboard* keyboard = nullptr) noexcept | The ten demo positions, Import's list, or the naming keyboard. |
UpdateTypedGhostCheat | TypedCheatResult UpdateTypedGhostCheat(const KeyboardState& keyboard, bool isPlayPhase, int orderedLetter = -1) noexcept | Feeds letters into the cheat buffer; reports the word completed this tick (TypedCheat), if any. |
FilterGameplayKeyboard | KeyboardState FilterGameplayKeyboard(const KeyboardState& keyboard) const | Removes letters that are being typed as a cheat, so typing does not also move Blupi. |
TypedCheatWords | static const TypedCheatWord* TypedCheatWords(int& count) noexcept | The word table (word, cheat, description); empty when cheats are compiled out. |
SetCheatEntryLocked, LockCheatEntryForRun, RestoreCheatEntryLock | void SetCheatEntryLocked(bool locked) noexcept | The fairplay lock and the stronger honest lock; restored exactly by a resume replay or a demo. |
UpdateCheatGesture, UpdateCheatMenu | bool UpdateCheatGesture(const MouseState& mouse, int viewportW, int viewportH) noexcept | The original's hidden unlock (ten taps over six invisible zones; F12 in the host does the same), then its nine-button menu (returns 1-9). |
DrawControlsHelp | void DrawControlsHelp(GraphicsDevice& device, int viewportW, int viewportH, bool cheats = false) | The F1 panel (keyboard, gamepad, mouse) or, with cheats, the list of cheat words. |
DrawActiveCheats | void DrawActiveCheats(GraphicsDevice& device, int viewportW, int viewportH, const std::vector<std::string>& names, float top = 0.0f) | The top-left list of active cheats; the host adds "Demo" or "REC" to it. |
DrawDebug | void DrawDebug(GraphicsDevice& device, int viewportW, int viewportH, const std::vector<std::string>& lines, bool touchControls) | The debug cheat's diagnostics panel (lines from DebugOverlayLines). |
SetJumpRight, SetAccelerometerMode, SetVehicleFireEnabled | void SetJumpRight(bool jumpRight) noexcept | Settings that change the Play pad's layout. |
How it is used
In Play the host merges the pad with the keyboard and gamepad. The mouse drives the visible pad only when CNA reports a
touch screen; on a desktop without one the clicks belong to the camera. An excerpt from
src/GalaxyEggbertCNA/GalaxyEggbertGameUpdate.cpp:
// Invisible desktop controls must not claim clicks intended for the camera.
if (tickInput_.touchControlsEnabled)
{
inputPadClaimedMouse = inputPad_.UpdatePlay(
mouse, viewport.getWidthProperty(), viewport.getHeightProperty(), padPlayInput);
}
else
{
inputPad_.ResetTouchState();
}
{
GalaxyEggbert::Game::InputPad::PlayInput touchInput;
if (inputPad_.UpdatePlayTouches(touches, viewport.getWidthProperty(),
viewport.getHeightProperty(), touchInput))
{
inputPadClaimedMouse = true;
}
...
}
Later in the same tick the host calls UpdateTypedGhostCheat and applies the returned TypedCheat
(ApplyTypedCheat); the effects live in the host, InteractionSystem and
BlupiController, which InputPad cannot reach.
Typed cheats
As in the original, letters typed during Play go into a rolling buffer of up to 32 letters, and a cheat fires when the
buffer ends with its word. The longest matching word wins, and the buffer is cleared after a word, except after
quick, so that quicklollypop can still be typed. The table has 33 words (as of 2026-11-10;
help and cheats are the same cheat), the original's 21 desktop words, help/cheats, the MODERN
build's words (ghost, quick, zoom, debug, fps, position,
honest), compass, fairplay and xnjttjpo (Speedy Blupi's word for editing a
mission; here it opens the world being played in the 3D editor). The full list is on Cheats & Diagnostics.
Letters arrive in order from CNA's KeyDownEXT presses (orderedLetter), so fast typing works on every
device; autoplay passes -1 and uses keyboard snapshots. While the buffer holds the start of a word, those letters
are filtered out of the gameplay keys until released (weelkeys no longer turns Blupi with its final S).
Rules and invariants
- Report, do not act. InputPad has no access to the simulation; every
Update…returns flags or an index and the host decides. - Press semantics follow the original: Jump is level-triggered (held while the pointer is on it); every other button fires once, on release over the same button.
- The stick is discrete: the offset from its centre is thresholded to -1, 0 or +1 per axis.
- The Play pad is drawn and mouse-hit-tested only when CNA reports a touch screen
(
TouchPanel::GetCapabilities()). - Typed cheats are accepted only in Play. With
fairplayon, onlyfairplayis accepted; afterhonest, nothing until the game quits. Resume log format v7 records the ordered letters and the lock, so a replay reproduces them. - With
-DGALAXY_EGGBERT_ENABLE_CHEATS=OFF,TypedCheatWordsis empty, the gesture and the cheat menu never open, and the help panel says "Cheats disabled".
Tests
VerifyGEInputPad (tools/VerifyGEInputPad.cpp, registered in CMakeLists.txt) runs without
a window or graphics device, driving InputPad with synthetic MouseState, touch and keyboard values. It checks
the Play stick, Jump, Action and Pause semantics, multi-touch and accelerometer controls, the Pause, Setup, Resume,
Win/Lost and main-menu rectangles (including Exit, Help, Demo, Galaxy and Demos), the demo positions and Import's list
(no two controls overlap), the cheat gesture and menu, typed cheat words, the active-cheat list's rectangle, the
debug panel's lines, the F1 help open/close behaviour (ControlsHelp), the WASD aliases, the
ScreenKeyboard and FocusNavigator.
Related pages
- Hud: the in-game information bar
- GalaxyEggbertGame: phases and the tick that calls InputPad
- ResumeLog, DemoReplay: recorded input, cheat letters and locks
- Input, Controls, Cheats & Diagnostics
- Demos & Recordings