Keyboard troubles in games devel



Hi there,

I trying to develop a "Space Invaders"-like in C with GTK and right now, the results are not that bad...
but I've got a few problems with the management of the keyboard :

What I would like :
if the user press the rigth arrow, and hold it
  -> move quickly many times to the right.
if the user press the right arrow, hold it plus press space
  -> move and shoot !

What I've got :
if the user press the rigth arrow, and hold it
  -> move SLOWLY many times to the right.
if the user press the right arrow, hold it plus press space
  -> move then stop and shoot.

To resolve the probleme of the speed, I used what I would call an old dirty bast' method :
I execute my programme via the script
xset -r rate 100 100
./my_exec
xset rate 660 25

It works fine, but i'm looking for a much more elegant (less global and more portable) way of solving this.

I've had one tip from the archives of the list :
It seems that gdk_key_repeat_disable would help for my troubles,
but this function does not appear in gdk.h nor in the gdk manual from http://developer.gnome.org/doc/API/2.0/gdk/gdk-General.html
And, of course, gcc complains...
it seems deprecated (?)

 Any idea ? Thanks a lot.
  Vincent Page.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]