Skip to content

Get typed characters and key repeats from Lua #848

Description

@Gopmyc

Problem this feature should fix

Scripts can only check if a key is pressed or released, so there's no way to know which character was actually typed. Anything that takes text input (a name field, a chat box, a debug console) has to map key codes to characters by hand, which only works for one keyboard layout and can't handle accents or Caps Lock.

Holding a key doesn't repeat either: Window::BindKeyCallback ignores GLFW_REPEAT, so holding Backspace or an arrow key does nothing after the first press unless each script builds its own timer.

Expected solution

  • Bind glfwSetCharCallback and expose the characters typed during the frame, for example with Inputs.GetTypedText() returning them as a UTF-8 string.
  • Forward GLFW_REPEAT events, for example with Inputs.GetKeyRepeat(key) returning true when the key repeats during the frame

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions