Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline mc-kay  
#1 Posted : Wednesday, May 9, 2012 4:22:44 PM(UTC)
mc-kay

Medals: Admin

Joined: 8/24/2011(UTC)
Posts: 138
Location: Hannover

Thanks: 1 times
Was thanked: 12 time(s) in 7 post(s)
I'm just wondering where the "^" character is Confused

Wanna join the discussion?! Login to your forum accountregister a new account. Or Connect via Facebook Twitter Google

Offline Benjamin  
#2 Posted : Wednesday, May 9, 2012 4:39:21 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
There is no special key on English keyboards for the '^' key, it is just Shift+6.

The '^' German keyboards is used for the Tilde '~' key on English keyboards.

So the answer is: Use InputButton.Tilde, I guess you want to use it to open up a console in game?

For normal text input you don't need to worry about this, all text going through Input.Keyboard.HandleInput will work (you could check if a '^' was entered there, then it won't matter where it is on the keyboard).
Offline mc-kay  
#3 Posted : Wednesday, May 9, 2012 5:37:33 PM(UTC)
mc-kay

Medals: Admin

Joined: 8/24/2011(UTC)
Posts: 138
Location: Hannover

Thanks: 1 times
Was thanked: 12 time(s) in 7 post(s)
If I use InputButton.Tilde, pressing "Alt Gr" + "+" will be detected as InputButton.Plus.
Input.Keyboard.HandleInput show me the right character ("~").

Yes, I want to use the key for a console.

Edited by user Wednesday, May 9, 2012 5:38:31 PM(UTC)  | Reason: Not specified

Offline Benjamin  
#4 Posted : Wednesday, May 9, 2012 7:45:23 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
This is correct. Keep in mind that the InputButton enum is ONLY useful to detect each keycode. It has not much to do on what your system will show when you press that key (it will be different depending on your keyboard layout, if shift, control, alt, alt gr, etc. are pressed).

InputButton.Tilde will be pressed when you press the key below the Esc key, it does not matter which keyboard layout you use. As long as the keycode for Tilde (192 in this case) is returned from the keyboard, the InputButton will go into the Pressed state.

If you press InputButton.RightAlt (Alt Gr in Germany) and InputButton.Plus, then exactly those keys will go into the Pressed state. They will not set any other keys like InputButton.Tilde into the Pressed state because it was not pressed.

So maybe just write a helper method calling Input.Keyboard.HandleInput to check which key characters were pressed. Or write some custom code where you check for the keyboard settings and handle it differently (not recommended, almost no game does this anyway, instead you usually have slightly different input settings for different languages or games make no difference at all and users have to reconfigure if their keys are at different locations).
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.056 seconds.