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

Headersrc/GalaxyEggbert/Game/InputPad.hpp
Sourcessrc/GalaxyEggbert/Game/InputPad.cpp; with ScreenKeyboard.hpp, CheatConfig.hpp, TextMetrics.hpp, QuadBatch.{hpp,cpp} in the same folder
NamespaceGalaxyEggbert::Game
Engine dependencyCNA (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

Used by

Screens it handles

Screen (phase)MethodsButtons reported
Main menu (Init)UpdateInit, DrawInitPlayer A/B/C, Play, Setup, Editor, Exit, Fullscreen, Help, Demo, Galaxy, Demos
Setup (MainSetup, PlaySetup)UpdateSetup, DrawSetupsounds, Jump side, zoom, accelerometer, 3D terrain, 3D effects, frame rate, textures, volume and sensitivity sliders, Reset, Return
PauseUpdatePause, DrawPauseHome, Back, Setup, Restart, Continue, and Galaxy's Record and Original
Demo positions (over Pause or from the menu)UpdateDemoSlots, DrawDemoSlotsa position, its Original, Cancel, Export, Import, Name, Import's file list (pages of kDemoListRows = 7) with a bin per row
ResumeUpdateResume, DrawResumeHome, Continue
Win, LostUpdateWinLost, DrawWinLostReturn
PlayUpdatePlay, UpdatePlayTouches, DrawPlaystick, Jump, Action, Pause, back up, crouch, vehicle Fire; Forward and Back in accelerometer mode
Play overlaysDrawActiveCheats, DrawDebug, DrawLabels, DrawControlsHelp, DrawCheatMenuthe hidden cheat menu's nine buttons (UpdateCheatMenu)
Start and quitDrawGalaxyLoading, DrawGoodbyenone (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).

MemberSignatureWhat it does
LoadContentvoid LoadContent(GraphicsDevice& device)Loads the sheets and backgrounds. Hit-testing does not need it.
ResetTouchStatevoid ResetTouchState() noexceptDrops any press in flight; the host calls it on every phase change.
UpdatePlaybool UpdatePlay(const MouseState& mouse, int viewportW, int viewportH, PlayInput& outInput) noexceptMouse on the Play controls; returns whether the press landed on one (then the camera ignores it).
UpdatePlayTouchesbool UpdatePlayTouches(const std::vector<TouchPoint>& touches, int viewportW, int viewportH, PlayInput& outInput) noexceptSeveral 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.
UpdateInitInitInput UpdateInit(const MouseState& mouse, int viewportW, int viewportH) noexceptThe main menu's buttons.
UpdatePausePauseInput UpdatePause(const MouseState& mouse, int viewportW, int viewportH, bool showBack, bool showRestart, bool showRecord = false, bool showOriginal = false) noexceptThe Pause row; hidden buttons cannot be pressed.
UpdateDemoSlotsDemoSlotsInput UpdateDemoSlots(const MouseState& mouse, int viewportW, int viewportH, const std::vector<DemoSlotInfo>& slots, int listRows = -1, bool paged = false, const ScreenKeyboard* keyboard = nullptr) noexceptThe ten demo positions, Import's list, or the naming keyboard.
UpdateTypedGhostCheatTypedCheatResult UpdateTypedGhostCheat(const KeyboardState& keyboard, bool isPlayPhase, int orderedLetter = -1) noexceptFeeds letters into the cheat buffer; reports the word completed this tick (TypedCheat), if any.
FilterGameplayKeyboardKeyboardState FilterGameplayKeyboard(const KeyboardState& keyboard) constRemoves letters that are being typed as a cheat, so typing does not also move Blupi.
TypedCheatWordsstatic const TypedCheatWord* TypedCheatWords(int& count) noexceptThe word table (word, cheat, description); empty when cheats are compiled out.
SetCheatEntryLocked, LockCheatEntryForRun, RestoreCheatEntryLockvoid SetCheatEntryLocked(bool locked) noexceptThe fairplay lock and the stronger honest lock; restored exactly by a resume replay or a demo.
UpdateCheatGesture, UpdateCheatMenubool UpdateCheatGesture(const MouseState& mouse, int viewportW, int viewportH) noexceptThe 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).
DrawControlsHelpvoid DrawControlsHelp(GraphicsDevice& device, int viewportW, int viewportH, bool cheats = false)The F1 panel (keyboard, gamepad, mouse) or, with cheats, the list of cheat words.
DrawActiveCheatsvoid 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.
DrawDebugvoid 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, SetVehicleFireEnabledvoid SetJumpRight(bool jumpRight) noexceptSettings 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

Hardware not tested As of 2026-11-10 the touch pad and the gamepad have been checked with the verifier's synthetic input and with an SDL virtual gamepad under Xvfb only; no physical touch screen or gamepad has been tried.

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