Key checking

Is there a way I can tell if a key (any key) has been pressed without
looping through all the events?

I have a GUI event handler, but I don’t want to ‘suck’ all the events out
because I check for keys being pressed at different locations in the code
during a single loop._________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

what i do is i keep an array of the key states, then when i need to check a
keypress, i check the array. When i process the events, i take keydown
messages and set the keys to down and keyup sets the keys to up…> ----- Original Message -----

From: trinitychaos50@hotmail.com (Robert Clayton)
To:
Sent: Thursday, August 29, 2002 8:51 PM
Subject: [SDL] Key checking

Is there a way I can tell if a key (any key) has been pressed without
looping through all the events?

I have a GUI event handler, but I don’t want to ‘suck’ all the events out
because I check for keys being pressed at different locations in the code
during a single loop.


MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Robert Clayton wrote:

Is there a way I can tell if a key (any key) has been pressed without
looping through all the events?

I have a GUI event handler, but I don’t want to ‘suck’ all the events
out because I check for keys being pressed at different locations in
the code during a single loop.

http://sdldoc.csn.ul.ie/sdlgetkeystate.php

RK.

Robert Clayton wrote:

Is there a way I can tell if a key (any key) has been pressed without
looping through all the events?

I have a GUI event handler, but I don’t want to ‘suck’ all the events
out because I check for keys being pressed at different locations in the
code during a single loop.

You should seriously consider restructuring your code so that you don’t
do that. It will cause problem after problem after problem. My guess is
that you could solve the code by rewriting sections as state machines
with a very small number of states.

	Bob Pendleton> 

MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-----------------------------------+