1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

Replace hack with correct font-map lookup function

This commit is contained in:
Daniel Evans 2016-08-16 00:52:13 +01:00
parent 222c3df68d
commit e449a25071
2 changed files with 4 additions and 37 deletions

View File

@ -8,42 +8,9 @@
/// @todo This is very rough
int charToIndex(char g)
{
if( g >= '0' && g <= '9' )
{
return 16 + (g - '0');
}
else if( g >= 'A' && g <= 'Z' )
{
return 33 + (g - 'A');
}
else if( g >= 'a' && g <= 'z' )
{
return 65 + (g - 'a');
}
switch(g)
{
default: return 0;
case '!': return 1;
case '"': return 2;
case '#': return 3;
case '$': return 4;
case '%': return 5;
case '&': return 6;
case '\'': return 7;
case '(': return 8;
case ')': return 9;
case '*': return 10;
case '+': return 11;
case ',': return 12;
case '-': return 13;
case '.': return 14;
case '/': return 15;
case ':': return 26;
case '[': return 59;
case ']': return 61;
// This is a guess.
case '@': return 91;
}
// Correct for the default font maps
/// @todo confirm for JA / RU font maps
return g - 32;
}
glm::vec4 indexToCoord(int font, int index)

View File

@ -101,7 +101,7 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, GameRenderer* re
{
std::stringstream ss;
ss << "@" << std::setw(3) << std::setfill('0')
ss << "{" << std::setw(3) << std::setfill('0')
<< (int)player->getCharacter()->getCurrentState().health;
ti.text = ss.str();
}