On a french keyboard, I don't understand how read the "ô" character (with glfwSetCharCallback, I receive GLFW_PRESS only for the basic "o"),
I do not have access to a French keyboard, so I cannot test this out, but I think you are using the wrong function. If you wish to support non-ascii keys, such as that "ô", which are Unicode characters, then you will need to use the glfwSetCharCallback function instead: http://www.drewbenton.net/programming/glfw.html#glfwSetCharCallback
The function selects which function to be called upon a keyboard character event. The callback function is called every time a key that results in a printable Unicode character is pressed or released. Characters are affected by modifiers (such as shift or alt).
If all works out well, you should be getting that character in. Make sure you follow the additional function note:
The Unicode character set supports character codes above 255, so never
cast a Unicode character to an eight bit data type (e.g. the C language
'char' type) without first checking that the character code is less than
Thank you for your answer :o) , but I use already glfwSetCharCallback function. It work for "é", "è" but not "ô". I think it's because for the "ô", we must write "^" then "o". You can test it under windows xp, if you change your language setting. In the same way, in Chinese, you must type more than one key per letter, and glfwSetCharCallback don't work again.
Whoops! For some reason I though I read that you were using the other function, sorry about that.
If you have to type ^ then o, then what I think you'd need to do is handle that specifically. Once again, I don't use these extended characters, so I am not sure if there is an easy way or not. The way I see how to do it is to handle an '^' press, then a 'o' press.
Here's an example of what I would do:
It's not a complete example, I just have the program quit on when the user presses '6' followed by a 'o' (which is read as a 'O').
The idea for you would be then to find if ^ was pressed, directly followed by an 'o' character. You would probabally want to add in some sort of timer that sets the lastkey to 0, so if the user hits ^ then nothing for a bit then hits o, it wont give you that character (I'm not sure how it works on keyboards in terms of delay)
Once again, not sure if this is the best way, but it's what comes to mind if you have to chain keys to get that specific character.
The 'ô' character is actually ASCII 244... can't you just test for that?
Pressing '^' then 'o' is a shortcut so you don't have to type Alt+0244 everytime. In Windows you can add an international keyboard in the Regional and Languages Control panel, which allows you to 'build' these characters by typing the corresponding symbols: ^ & o = ô ; ` & a,e,i,o,u = à,è,ì,ò,ù ; ~ + n = ñ ; etc.
BTW, all of the standard latin characters with diacritical marks are part of the ASCII standard.
> The 'ô' character is actually ASCII 244... can't you just test for that?
> BTW, all of the standard latin characters with diacritical marks are part of the ASCII standard.
I don't mean to be offensive, but your understanding of character sets is sorely lacking.
ASCII character 244 *does*not*exist*. ASCII is a 7-bit character set, it has 128 characters. What you are talking about is ISO-8859-1, which is probably the most common (at least in western countries) 8-bit extension to ASCII.
But just to point out to you how unreliable "just testing for ASCII 244" can be, here's a screenshot of how your message looked in my e-mail:
Note that the character in question looks nothing like an o. You can get the same effect by forcing your browser to display the post assuming ISO-8859-1 encoding (in firefox, View->Character Encoding->Western (ISO-8859-1)).
Why is that? It's because the ô in your post is *NOT* encoded as the number 244 in any way, shape or form. In fact, your post is encoded as UTF-8, where ô is represented in not one, but two bytes: 0xc3 followed by 0xb4 (195 followed by 180). Note that in ISO-8859-1, character 195 is an A with a tilde on top and character 180 is an upward sloping accent - the very two characters ô appears as in my screenshot. So, the reason my e-mail looks funny is because for some reason sourceforge is sending me a UTF-8 message and claiming it's encoded as ISO-8859-1 (Content-Type: text/plain; charset="ISO-8859-1").
Anyway, hopefully I've convinced you that you can't simply assume ô is represented as a single 0xf4 byte if you want any hope of portability.
Geez, I feel stupid now. I blame my foolish statements on being a typical sheltered U.S. citizen, ignorant of the wider world. I forgot that there's more than one extended ASCII character set. Thank you for bringing me back to reality. I'm going to crawl under a rock for a while...
I'm not sure, but I Think it's not a problem of character encoding. glfwSetCharCallback probably use WM_SYSKEYUP and WM_SYSKEYDOWN for know if a key is pressed or released. I think this Windows callback can't read key combinaison like WM_SYSCHAR, but only one key. I don't know if some peoples work actually on the Windows verions of GLFW, and if they can help me,
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.