|
Can't display infinity symbol |
Bingocat
Member #15,424
December 2013
|
I am just trying to display an infinity symbol for ammo in my game, but I can't get it to work. Can Allegro not display special characters like that? Here is one of the things I tried. 1string text = player.defaultWeaponNames[player.type] + ":";
2text.push_back(char(236));
3al_draw_filled_rectangle(cameraPos[0] + screenWidth / 2 - 100, cameraPos[1] + 5, cameraPos[0] + screenWidth / 2 + 100, cameraPos[1] + 25, al_map_rgb(255, 90, 0));
4al_draw_rectangle(cameraPos[0] + screenWidth / 2 - 100, cameraPos[1] + 5, cameraPos[0] + screenWidth / 2 + 100, cameraPos[1] + 25, al_map_rgb(0, 0, 0), 2);
5al_draw_text(font18, al_map_rgb(255, 255, 255), cameraPos[0] + screenWidth / 2, cameraPos[1] + 5, ALLEGRO_ALIGN_CENTRE, text.c_str());
|
Thomas Fjellstrom
Member #476
June 2000
|
It can display non ASCII characters, but you need to use UTF-8 encoding and a font that has that character in it. -- |
Bingocat
Member #15,424
December 2013
|
So would I have to do something with an ALLEGRO_USTR? Why can't it just display the character? |
Elias
Member #358
May 2000
|
char(236) is -20, the range of char is -128 to 127 only. What you can do is this: al_draw_text(..., "∞"); or al_draw_text(..., "\u221e");
-- |
|