Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / How to listen to keys like semicolon and quote?
- - By ucode Date 2012-07-04 22:16
I've been playing with gosu and chingu and I can't figure out how to do something when a user hits the semicolon or quote keys.  I see you can check if the key pressed was the left arrow with Gosu::KbLeft, but where can I view for all the other key mappings?
Parent - - By Omegas7 Date 2012-07-04 22:52
The window has a method called button_down(id) and button_up(id) I believe. You can check what key is being pressed according to the id being passed.

To find out the id of the key pressed, just print id. That way you'll find out the key code for the semicolon, and then in the future you can check if the semicolon is being pressed or not.

Note that, it seems that between Windows and Mac, the key codes are different.
Parent - By erisdiscord Date 2012-07-05 03:43
Yes, if you want to use punctuation keys you'll need to have some way for users to configure the keys themselves if you want it to work cross-platform.
Parent - By jlnr (dev) Date 2012-07-05 06:15
There is no semicolon key on German keyboards, that's why it's missing. I think it is either of ÄÖÜ here. I should add it though, in the spirit of the KbZ id (that is a 'Y' on German keyboards). Patches welcome. :)
Parent - By Spooner Date 2012-07-05 10:34
chingu has a nice key-detector application in the examples folder. Easiest way to get Gosu and/or Chingu key codes (Gosu uses not terribly friendly constants; Chingu uses nicer symbols).
Up Topic Gosu / Gosu Exchange / How to listen to keys like semicolon and quote?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill