On 03/19/2012 03:34 AM, Chris Vine wrote: > > Since GtkWidget objects have key-press-event and a key-release-event > signals that you can connect to (and from your explanation, clearly you > have connected to), you will probably need to explain why these don't do > what you want in order to get a meaningful answer. Most people would > monitor these in conjunction with gdk_event_get_keyval() or > gdk_event_get_keycode() and keep state. > > Chris
I'm currently attempting to code a simple space combat game. In my game it is possible (quite likely) that two keys will be held down at the same time (especially the up arrow and another arrow) e.g. to turn and to accelerate at the same time. Currently I monitor for key press events as you say; the problem is that key press events are only being generated for the last key that was pressed. So if a user attempts to turn and accelerate at the same time, he will actually only do one or the other, depending on which key he happened to press last. If I could just check whether or not a key is currently depressed, then I could check both keys between a main loop iteration and handle them appropriately. This is precisely what I used to do back when I was using ClanLib, which had a function just for this purpose. An additional problem is that, although key press events do get repeated, they do not get repeated immediately; it seems that there is a brief delay (half a second or so, but noticeable) between the first key press event and the subsequent stream of them. This is the same effect I notice when using a word processor. -- frigidcode.com indicium.us
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list