Hi, I have problem with al_draw_text, I can draw it perfectly, but I want to draw UTF8 characters such as ěščřžýáíé. Is it possible to draw these characters in Allegro 5?
Tahnk you
I've had the problem of the text editor used on the source files not saving as UTF-8, double check it with a hex editor or something.
I'm using visual studio 2010 express, i think it saves everythig in utf8 or not?
I don't know, I use mingw with the SciTech editor on windows.
too bad
.... i've searched internet anf found this:
stackoverflow.com/questions/279673/save-all-files-in-visual-studio-project-as-utf-8
but didn't helped
From the other thread Allegro 5 Unicode Textdraw
So, unfortunately, for portability to MSVC, we have to externalise UTF-8
strings or write them out using escape codes.
So load your strings in from a file saved as utf8.
i can't because strings are generated in run time
How are they generated at run time? Are any parts of them embedded in the source? Allegro itself is pure UTF8, so if you pass it UTF8 text, it'll draw it. If any of the text is in the source file, your editor could be messing with it.
If what you're doing is concatenating bits of text at run time, take those bits of text from a file.
Or if you want to, I think you can use escape codes in your literal strings, ie: "\xCDFEBA01" to encode the utf8 directly into a literal string, and get around the fact that MSVC is broken. But its a royal pain to have to hand encode the utf8 into hex escape codes.
it's history of changes
Meaning what exactly?
i'm programming board game and it shows hystiry of moves and some words are still the same, do you think that it would be good to load those words from file like suggested other guys?
i would like to avoid that way
Unfortunately it doesn't look like you can avoid that, if you want to include non ASCII characters.
One bonus to loading from a file, is it'll be easier to translate the game into other languages.
All you really need to do is load the file into an array of strings at program startup, and use that array.
Here is the simple language manager for my game:
It looks like a.cc's code blocks don't support unicode so
nav.back = ←
nav.sound = ♪
chat.emoticon = ☺
look empty.
thank you for your answers, i will use the file
You can save the file in UTF8 in Visual Studio by going to File->Advanced Save Options... and selecting Encoding Unicode (UTF-8 without signature) - Codepage 65001.
That works for me.