haskell-game / sdl2

Haskell bindings to the SDL2 library
Other
363 stars 87 forks source link

The plus keycode is not working #308

Open llsaull opened 3 months ago

llsaull commented 3 months ago

Hello everybody, thanks in advance for the attention.

I am having a problem reading the plus key. I have tried different keyboards and the problem persists. I use the following code to check the pressing of a key:

checkKeyPressedEvent :: Event -> Keycode -> Bool
checkKeyPressedEvent event code = 
  case SDL.eventPayload event of
    SDL.KeyboardEvent kevent -> SDL.keyboardEventKeyMotion kevent == SDL.Pressed
        && SDL.keysymKeycode (SDL.keyboardEventKeysym kevent) == code
    _anyOtherEvent -> False

It works if I check for other keys, but It does not work for the plus key.

Looking at the definitions, I suspect that maybe it is related to the fact that the plus key does not have a scancode? It is just a guess though. Any help would be greatly appreciated.