Broken '\': how to solve that?

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Broken '\': how to solve that?

Post by Kaks »

After reading this topic I vaguely remember the issue cropping up time and again in the forum (that's how I got the advanced compass to work on my pc many moons ago).

But it doesn't feel right to fiddle with the standard key settings in the land of Oolite's birth!
I've done some looking around in the code, and I can get that key to work:

The problem
On windows ( not on mac or linux, they're fine! ) the code has no way to tell which keyboard is being used, and assumes everybody is using a US keyboard, where the \ key is in the same place as # on a prop..british keyboard.

The solution
We could either agree with these guys, or add some support for the unlucky non-US windows users amongst us... I'm quite happy to go with the second option myself, but I've got no idea how good a job I need to do: would it be ok to just switch between UK/US keyboards or do we need more options than that?

If we need more options, I need information: how many of you windows people needed to change key_next_compass_mode
inside keyconfig.plist? Or change the standard key configuration because one or more keys were 'broken' on your PC? And what's your keyboard layout like?
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Broken '\': how to solve that?

Post by Gimi »

Kaks wrote:
After reading this topic I vaguely remember the issue cropping up time and again in the forum (that's how I got the advanced compass to work on my pc many moons ago).

But it doesn't feel right to fiddle with the standard key settings in the land of Oolite's birth!
I've done some looking around in the code, and I can get that key to work:

The problem
On windows ( not on mac or linux, they're fine! ) the code has no way to tell which keyboard is being used, and assumes everybody is using a US keyboard, where the \ key is in the same place as # on a prop..british keyboard.

The solution
We could either agree with these guys, or add some support for the unlucky non-US windows users amongst us... I'm quite happy to go with the second option myself, but I've got no idea how good a job I need to do: would it be ok to just switch between UK/US keyboards or do we need more options than that?

If we need more options, I need information: how many of you windows people needed to change key_next_compass_mode
inside keyconfig.plist? Or change the standard key configuration because one or more keys were 'broken' on your PC? And what's your keyboard layout like?
I would really love a solution for this. I use a Norwegian keyboard, and although I have had no problems so far, as more keys are put to use, it is a good idea to make the game more future proof.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

There really should be a way to deal with key mappings in the game… but I’m reluctant to even try without first writing a better system to deal with UI in general. (I have it all mapped out in my head, but, well, feature list creep.)

Incidentally, I also consider this a prerequisite for reintroducing the JavaScript key callback mechanism from dajt’s original JS branch. Hard-coding key mappings in scripts is simply not acceptable.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

I wasn't thinking as far ahead as that, more along the lines of a smaller "let's cope with m$" thing.

I've had a look around and found out that a stable version of SDL 1.3 ( a library used by Oolite I/O ) should just be round the corner, and it looks promising! It's got internationalisation support, so it can pick up both scancodes & keymapped characters.
What I was thinking of was to dynamically generate a scancode/character lookup table & then only deal with scancodes... Ok, this is getting technical...

The minimal change I've done so far limits itself to noticing if the scancode for the UK backslash is pressed and uses it as an extra backslash key. Safe enough to use since that key is not present on US keyboards, and a few other countries (Brazil & Belgium too) use it too.

I'll polish up my work-in-progress patch, and even if the new version of SDL isn't ready at the time, we could still have the right backslash key for Windows' UK keyboards for 1.73.
'Course, to do more than that now would be overkill... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply