Converting allegro_key_xxx to the same character
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?
Allegro 5 has ALLEGRO_EVENT_KEY_CHAR for this. Check the unichar field.
Thread #612163. Printed from Allegro.cc
converting the unichar field to char works fine for the english characters. But not special characters like "æ ø å". I've been trying to figure out the ALLEGRO_USTR, but it's a bit confusing. I can't a tutorial on it on the wiki either. The documentation did help me understand UTF-8, I'll probably start using it all the time once I figure out how to work with it.
I assume I can use the event.keyboard.unichar with the ALLEGRO_USTR? I've tried doing:
it didn't work, so it's obviously wrong. I also tried using al_ustr_append_chr(input, ev.keyboard.unichar);
it worked if I did
I dunno why I thought the textf function would work with a ALLEGRO_USTR.