Scale down speedometer text when speedometer is small

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13622 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-09-03 23:59:53 +00:00
parent d00e0397f3
commit 1f15257c57

@ -602,11 +602,11 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
} // drawEnergyMeter
//-----------------------------------------------------------------------------
void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
float minRatio = std::min(scaling.X, scaling.Y);
const int SPEEDWIDTH = 128;
int meter_width = (int)(SPEEDWIDTH*minRatio);
@ -722,7 +722,14 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
pos.LowerRightCorner.X=(int)(offset.X + 0.8f*meter_width);
pos.LowerRightCorner.Y=(int)(offset.X - 0.5f*meter_height);
gui::ScalableFont* font = GUIEngine::getLargeFont();
gui::ScalableFont* font;
if (pos.getWidth() > 55)
font = GUIEngine::getLargeFont();
else if (pos.getWidth() > 40)
font = GUIEngine::getFont();
else
font = GUIEngine::getSmallFont();
static video::SColor color = video::SColor(255, 255, 255, 255);
char str[256];