|
Converting allegro_key_xxx to the same character |
Gnamra
Member #12,503
January 2011
|
I've usually only used the keys I've needed in my projects so far, but right now I'm working on a project with chatting, so needless to say I've got to support all keys. I do want to support multiple languages, can I use allegro for this? Or would it be easier to use a different library for this?
|
SiegeLord
Member #7,827
October 2006
|
Allegro 5 has ALLEGRO_EVENT_KEY_CHAR for this. Check the unichar field. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Gnamra
Member #12,503
January 2011
|
Oh, thanks edit: I assume I can use the event.keyboard.unichar with the ALLEGRO_USTR? I've tried doing: ALLEGRO_USTR *input = al_ustr_new(""); ... ... input += ev.keyboard.unichar ... ... al_draw_textf(font, al_map_rgb(255,0,0), 10, 30, 0, "%s", input); it didn't work, so it's obviously wrong. I also tried using al_ustr_append_chr(input, ev.keyboard.unichar); second edit: ALLEGRO_USTR *input = al_ustr_new(""); ... ... al_ustr_append_chr(input, ev.keyboard.unichar); ... ... al_draw_textf(font, al_map_rgb(255,0,0), 10, 30, 0, "%s", al_cstr(u)); I dunno why I thought the textf function would work with a ALLEGRO_USTR.
|
|