SFML community forums

Bindings - other languages => DotNet => Topic started by: Gonzilla on June 12, 2012, 04:00:33 pm

Title: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: Gonzilla on June 12, 2012, 04:00:33 pm
How can I detect if the user press the circumflex-key [^]?

When I press the [^]-Key I got following Code:
{[KeyEventArgs] Code(BackSlash) Alt(False) Control(False) Shift(False) System(False)}

The other dead keys like the ยด (LBrackets) and ` (RBrackets) working fine.
Title: Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: Laurent on June 12, 2012, 04:04:03 pm
Why do you want to detect these keys?
Title: Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: eXpl0it3r on June 13, 2012, 12:43:32 am
Unfortunatly SFML isn't able to detect all possible key combinations with all the diffrent keyboard layouts.

I guess you'll have to find another way if you need to use the [^] key.

Additionally it could be helpfull if you'd tell us which keyboard layout you're using.
Title: Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: Gonzilla on June 13, 2012, 09:21:21 am
@Laurent:
In many games you can show a game console with that key. I would like to have a such functionality in my game too.

@eXpl0it3r:
I use the QWERTZ / german layout.

But I see "the problem":
http://en.wikipedia.org/wiki/Keyboard_layout#United_States (http://en.wikipedia.org/wiki/Keyboard_layout#United_States) the key is tilde
http://en.wikipedia.org/wiki/Keyboard_layout#Austria_and_Germany (http://en.wikipedia.org/wiki/Keyboard_layout#Austria_and_Germany) the key is circumflex

This explaine why it work with some games, but how they are "transforming" the keys that they work with us and german layout?
Title: Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: Laurent on June 13, 2012, 09:30:09 am
Keyboard layouts are indeed not handled perfectly.

https://github.com/SFML/SFML/issues/7
Title: Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
Post by: Gonzilla on June 13, 2012, 09:37:25 am
Ah okay, already reported  ;) Maybe this article help you with this problem http://www.luminance.org/blog/gruedorf/2009/08/14/supporting-alternate-keyboard-layouts-in-xna-games (http://www.luminance.org/blog/gruedorf/2009/08/14/supporting-alternate-keyboard-layouts-in-xna-games). Although it is about XNA but maybe it helps.