Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Crate psx_osk

Crate psx_osk 

Source
Expand description

A PS4-style on-screen keyboard: QWERTY, a Shift toggle for case, a symbols page, a wide Space bar, plus Backspace and OK keys, with a boxed selection. The D-pad moves the highlight; the caller feeds it Keyboard::activate.

Promoted from PSXcel, which built it for cell text entry; any game that names saves, enters high scores, or takes chat text wants the same thing (zelda3-psx hand-rolled a name-entry grid; gh-psx will want score names). Nav between rows maps by horizontal key centre so a wide key (Space) lines up sensibly with the narrow keys above it.

Rendering assumes a 320-wide display and psx-font’s 8x8 glyph cell; the keyboard occupies the bottom PANEL_HEIGHT pixels. Colors come from a caller-supplied Palette, so any game theme drops in.

ⓘ
let mut kb = Keyboard::new();
// per frame:
if pad.repeats(button::LEFT, 14, 3) { kb.step(Direction::Left); }
if pad.just_pressed(button::CROSS) {
    match kb.activate() {
        Action::Insert(ch) => text.push(ch),
        Action::Backspace => text.pop(),
        Action::Commit => return Some(text),
        Action::None => {}
    }
}
kb.draw(&font, &Palette::GRAY, "X:Type  SQ:Del  R2:OK");

Structs§

Keyboard
The keyboard state machine: highlight position + page/case toggles.
Palette
Colors for the keyboard panel; all (r, g, b).

Enums§

Action
What pressing the highlighted key does. Toggles (Shift/Sym) return None.
Direction
D-pad direction for Keyboard::step.

Constants§

PANEL_HEIGHT
Height of the whole panel as draw paints it: the hint line, the key rows and the margin below them, down to the bottom of a 240-line display.
PANEL_TOP
Top edge of the panel as draw paints it on a 240-line display. A game keeps its own content above this line.
Y0Deprecated
The top of the key rows, 14 pixels below PANEL_TOP. It was documented as the panel’s top edge and callers subtract the hint line from it (Y0 - 14); that is PANEL_TOP, so use PANEL_TOP and drop the subtraction.

Type Aliases§

DirDeprecated
Renamed to Direction.