KeyboardLayout

Pages of keys plus the highlighted-key cursor for a BGE.UI.Keyboard. Build one with createAlphabeticalKeyboardLayout(), createQwertyKeyboardLayout() or createCompactKeyboardLayout(), or fill pages yourself.

Properties

  • id (integer) — Unique per layout, so a Keyboard can tell when its layout was replaced.
  • pages (Array.<BGE.UI.KeyboardPage>)
  • pageIndex (integer)
  • row (integer) — Highlighted key's row on the current page.
  • column (integer) — Highlighted key's index in its row.

Constructor

new KeyboardLayout(): KeyboardLayout

Instance Methods

currentPage(): BGE.UI.KeyboardPage

Returns

  • BGE.UI.KeyboardPage

currentKey(): BGE.UI.KeyboardKey

The highlighted key.

Returns

  • BGE.UI.KeyboardKey

move(dx: integer, dy: integer): void

Moves the highlight. Left/Right wrap within the row; Up/Down wrap top to bottom and land on the key whose centre is nearest the current key's centre (ties go left).

Parameters

  • dx (integer) — 1 left, 1 right
  • dy (integer) — 1 up, 1 down

Returns

  • void

setPage(index: integer): void

Switches page, keeping the highlight's row and column where they exist, else clamping.

Parameters

  • index (integer)

Returns

  • void

setCursor(row: integer, column: integer): void

Moves the highlight to a row and column, clamped to the current page.

Parameters

  • row (integer)
  • column (integer)

Returns

  • void

keyAt(x: float, y: float): dynamic

The key under a point on the current page.

Parameters

  • x (float) — in grid units from the left edge
  • y (float) — in rows from the top edge

Returns

  • dynamic — {row, column}, or invalid if no key is there

keyLeft(row: integer, column: integer): float

Left edge of a key on the current page, in grid units.

Parameters

  • row (integer)
  • column (integer)

Returns

  • float