1. Anders Ruud
  2. love

Issues

Issue #717 resolved

Keyboard input design

hahawoo
created an issue

So, there may be no issues here at all, I just wanted to discuss keyboard input. :D

Currently it seems like this is how it works (correct me if I'm wrong, heh):

  • There are two callbacks for keyboard input: love.textinput (which is passed the unicode text entered) and love.keypressed.
  • Key repeating is "always on", and triggers love.textinput and love.keypressed repeatedly, with the second parameter of love.keypressed being whether or not it's a repeat.

I'm wondering, why is the design like this? I'm thinking that if love.keypressed is for keyboard "player" input, and love.textinput is for inputting text, shouldn't the key repeat status be in love.textinput instead of love.keypressed, since that's where key repeating is often useful? Wouldn't having key repeating not be a changable state but a parameter of love.keypressed result in a lot of this?:

function love.keypressed(key, repeat)
    if not repeat then
        -- etc.
    end
end

Comments (5)

  1. Log in to comment