SDL_KEYDOWN and SDL_KeyDownEvent

Hi Sam.

I wrote a little code to catch Keydown-Events. I wanted to know, whether
I can catch as many events I like, but it seems that after 4 keydowns
there is no space anymore.

If I press I receive a scancode 24 so i keep it pressed…

…now I press and I receive a scancode 25, so I go on up tp the
, receiving a 27. but if I try to press a 5th key the I receive
the following output:

X11: Unknown key, keycode 135

my own output is a printf(“Key pressed %i\n”,event.keysym.scancode); and
a printf(“Key released %i\n”,event.keysym.scancode);

So the output looks like this :
Key pressed 24
Key pressed 25
Key pressed 26
Key pressed 27
-RENARK ---------------------------------------------------------
X11 : Unknown key, keycode 135
X11 : Unknown key, keycode 135
Key pressed 135
Key released 135
X11 : Unknown key, keycode 135
X11 : Unknown key, keycode 135
Key pressed 135
Key released 135
X11 : Unknown key, keycode 135
X11 : Unknown key, keycode 135
Key pressed 135
Key released 135
—this part keeps being put out, until I release the 5th key.—

then it stops and after this I receive as expected :
Key released 27
Key released 26
Key released 25
Key released 24

If I do this with keys like , , or and so on, it is
between 2and 4 keys that I can press, before it happens.

Is it thought to be like this ?

(using SDL 1.1.5).

CyA

Sascha

> If I press I receive a scancode 24 so i keep it pressed... > > ...now I press and I receive a scancode 25, so I go on up tp the > , receiving a 27. but if I try to press a 5th key the I receive > the following output: > > X11: Unknown key, keycode 135

This could be an issue with PC keyboards, or the Kernel or X, maybe.
I don’t know, but I do remember in the past I had problems when trying
to write a game using arrows for movement and SPACE for fire…

If you tried to do certain diagonal moves (say, LEFT, and UP at once)
and tried to fire (SPACE), the SPACE key wouldn’t ever show up…
This was using straight X11. Kernel 2.0.something, I think…

Also, I’ve seen other games do errors similar to this:

X11: Unknown key, keycode 135

I recently bought Terminus and Heavy Gear (which my roommate’s cats
promptly destroyed <:^( ). One or both would have those errors on the
xterm I ran the program from. (I’d not see them til after, of course,
since the games are by default fullscreen.)

-bill!

I wrote a little code to catch Keydown-Events. I wanted to know, whether
I can catch as many events I like, but it seems that after 4 keydowns
there is no space anymore.

That’s probably a limit of the keyboard.
My old keyboard (8 years old and from Escom) couldn’t handle
, which was quite annoying when
playing Doom , because you couldn’t run around a corner :slight_smile:

My new Cherry G80 keyboard doesn’t have this limitation, but I made
some tests years ago and found there is a limit too, with something
like a maximum of 4 - 8 keys pressed simultaneously, can’t remember the
details any more… I made the tests under DOS with directly reading
the keyboard controller port, so no software could interfere.

Bye,
MartinOn Fri, 06 Oct 2000 18:39:00 +0200, Sascha G?nther wrote:

-----Urspr?ngliche Nachricht-----Von: “Martin Bickel”
An:
Gesendet: Freitag, 6. Oktober 2000 19:33
Betreff: Re: [SDL] SDL_KEYDOWN and SDL_KeyDownEvent

On Fri, 06 Oct 2000 18:39:00 +0200, Sascha G?nther wrote:

I wrote a little code to catch Keydown-Events. I wanted to know, whether
I can catch as many events I like, but it seems that after 4 keydowns
there is no space anymore.

(Most) Keys in a computer keyboard are switches in a matrix
consisting of rows and columns. When you close the switches
at, say, position (1,1), (3,1) and (1,3), the controller in the
keyboard has no way to determine whether (3,3) is closed
or open. This could be avoided by putting a diode in line with
every switch, but it would make keyboards more expensive.

An exception are keys like Shift, control, ALT - they are meant to
be pressed simultanteously with alphanumerical keys, and so
a properly designed keyboard does not have them in the matrix, but
each one has an own connection to an I/O pin of the keyboard
controller.

HTH

Dipl.Inform. Dirk-Ulrich Heise
@Dirk-Ulrich_Heise
dheise at debitel.net