Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Keyboard.IsKeyPressed: How to detect 'dead' keys?  (Read 3950 times)

0 Members and 1 Guest are viewing this topic.

Gonzilla

  • Newbie
  • *
  • Posts: 21
    • View Profile
Keyboard.IsKeyPressed: How to detect 'dead' keys?
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
« Reply #1 on: June 12, 2012, 04:04:03 pm »
Why do you want to detect these keys?
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
« Reply #2 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gonzilla

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
« Reply #3 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 the key is tilde
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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
« Reply #4 on: June 13, 2012, 09:30:09 am »
Keyboard layouts are indeed not handled perfectly.

https://github.com/SFML/SFML/issues/7
Laurent Gomila - SFML developer

Gonzilla

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Keyboard.IsKeyPressed: How to detect 'dead' keys?
« Reply #5 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. Although it is about XNA but maybe it helps.

 

anything