Circumflexes missing (MacOS)

BlitzMax Forums/BlitzMax Programming/Circumflexes missing (MacOS)

Pierrou(Posted 2010) [#1]
Hello,
I am working on a French game for speech & language therapists. At some point the player can type a few lines of text using some Waitevent-based interface. It works perfectly on my various Windows PCs, I mean, every accent us French use and every punctuation mark typed is seen on the screen and the character can be stored in an array and so on. On my 2006 Intel IMac running under SnowLeopard everything works the same except for the circumflexes (ê, î, ô, û) and "umlaut" (ë, ï, ö, ü) which is a shame for a game which is supposed to help children to learn how to read and write :)

The loop more or less begins like this

WaitEvent
If (CurrentEvent.id= EVENT_KEYDOWN)
Local characterasciinumber:Int=GetChar()
.....

Do you have any idea how to get the same as what I get on my PC?

Thanks in advance...

Last edited 2010


Leon Drake(Posted 2010) [#2]



Pierrou(Posted 2010) [#3]
:D

Since one can play Half Life 2 nowadays on a Mac and I have a "^" key on my keyboard I am quite optimistic about finding or getting a solution...


Pierrou(Posted 2010) [#4]
I must add that when key "^" is pressed the ascii code returned by getchar() is 0 on the Mac :o
(usually when you want to use that key first you press that key and then you press the vowel to get vowel+circumflex (= press "^" and then "e" ==> you'll get "ê"))


DrDeath(Posted 2010) [#5]
I'm not completely sure if I understand what you want to achieve: do you want the circumflex separately (^) or do you want the diacritics (â, ê, û, etc.)?


Pierrou(Posted 2010) [#6]
On Mac I don't get the diacritics (when pressing the "^" key the ascii code returned is 0 and nothing special happens, and if I press any vowel then, then I get the standard vowel without "^" (and if that vowel is a "e" for example I get the ascii code for a "e", not a "ê")...


Pierrou(Posted 2010) [#7]
I need those diacritics because one can find them in many French words. You can get é, è, à, ù by pressing a single key on a French Azerty keyboard and there is no problem with them, but for ^ and ¨ you need to press two keys one after the other, which doesn't work (yet) on the Mac in my game...


DrDeath(Posted 2010) [#8]
I see. I guess just getting the ASCII codes of the pressed keys is a bit too simple, especially when dealing with diacritics.

I assume the problem lies in the way GetChar and the input under MacOS X work. As long as you haven't pressed another key, OS X does not seem to actually submit anything to BlitzMax's character queue – but the way you poll the keystrokes seems to prevent this, hence "0" is returned.

I would suggest getting the key codes of the pressed keys instead of character code. That's a bit more complicated but should be more reliable when trying to determine which key is actually been hit.

Last edited 2010


Pierrou(Posted 2010) [#9]
Thanks! I was thinking about something like that... Without having any idea of how to do it...


TomToad(Posted 2010) [#10]
CurrentEvent.data holds the scancode of the key currently pressed. You can check it to see if the ^ key was pressed, then on the next EVENT_KEYDOWN, modify the ascii code returned.


Pierrou(Posted 2010) [#11]
I'll try that, thanks a lot!


DrDeath(Posted 2010) [#12]
A little word of warning, though: the keycode is independent of the symbol assigned to that key. That means that the key that gives you the circumflex on a French keyboard can give you a completely different symbol on keyboards with another international layout (e.g. US English or German). But I think that doesn't really matter for your program.


Pierrou(Posted 2010) [#13]
(silly answer edited :)) )
The users will probably all have French keyboards and if they don't they won't be able to use the game properly.
Thanks

Last edited 2010