Page 1 of 1

Get Keyboard Keys?

Posted: Wed Jun 04, 2008 4:45 am
by GBeebe
I'm trying to write a gui for my game. The game uses SDL, but the gui part, for selecting a level, adjusting sound volume, and configuring keys, is just a normal window using openwindow() and gadgets.

What i need is a way to get what key is pressed after the user clicks on a button, for the key config section. Any ideas?

PS, I'm doing it this way, cause it's quicker than designing one inside the game screen.

Posted: Wed Jun 04, 2008 2:57 pm
by Trond
Maybe a GTK treeview with a GtkCellRendererAccel could be used?

meh.

Posted: Thu Jun 05, 2008 5:16 am
by GBeebe
meh. Sounds like it will just be easier to display a small SDL window displaying a "Press Button" message in it. And wait for an sdl keyboard event.

Posted: Thu Jun 05, 2008 7:42 am
by bembulak
It should not be a problem, setting the focus to a stringgadget() and catching the input.

nope

Posted: Fri Jun 06, 2008 4:52 am
by GBeebe
That won't work for special keys like Shift, Alt, Arrow keys, etc...