Index: [thread] [date] [subject] [author]
  From: Evan Martin <txs@concentric.net>
  To  : ggi-develop@eskimo.com
  Date: Wed, 10 Feb 1999 17:41:17 -0800

Keyboard input

I'm developing a game using ggi. (Let's see if I ever finish!)

The main loop checks and responds to keyboard events, using
ggiEventPoll.

My problem is, I need to determine whether a key is down on each
iteration of the loop.

If I use ggiEventPoll followed by ggiEventRead, it is possible for
multiple key events to become queued up, making control unusable.

Currently, I do the following:

if (ggiEventPoll(vis, emKey, &tv)) {
	ggi_event ev;
	do {
		ggiEventRead(vis, &ev, emKey);  //eat multiple events
		tv.tv_sec = tv.tv_usec = 0;
	} while (ggiEventPoll(vis, emKey, &tv));
	
	// parse key 

But even with this, holding down a key causes an inital event (KeyPress)
followed by a delay, and then a succession of events (KeyRepeat).

The delay makes the control seem laggy.  

I'm using the X target.  I fear this problem may be caused by X 
handling events...

Is there a better way, or way around this?

-- 
Evan Martin - http://e.x0r.ml.org - txs@concentric.net

Index: [thread] [date] [subject] [author]