Fixed UIText class for non-uniform scale
This commit is contained in:
@ -31,7 +31,7 @@ UIText::~UIText()
|
||||
{
|
||||
}
|
||||
|
||||
void UIText::ParseString(std::string inputText, int x, int y, int scale, std::string tag)
|
||||
void UIText::ParseString(std::string inputText, int x, int y, int letterScale, std::string tag)
|
||||
{
|
||||
//Parse input text into an array of char
|
||||
int posX = x;
|
||||
@ -64,18 +64,18 @@ void UIText::ParseString(std::string inputText, int x, int y, int scale, std::st
|
||||
posX = x;
|
||||
posY += letterHeight;
|
||||
}
|
||||
UIText::AddLetter(posX, posY, current, tag);
|
||||
UIText::AddLetter(posX, posY, current, tag, letterScale);
|
||||
current = inputText[i];
|
||||
} while ((strcmp(¤t,"\0"))!=0);
|
||||
}
|
||||
|
||||
|
||||
void UIText::AddLetter(int xpos, int ypos, char crnt, std::string tag)
|
||||
void UIText::AddLetter(int xpos, int ypos, char crnt, std::string tag, int lttrScale)
|
||||
{
|
||||
auto& letter(manager.addEntity());
|
||||
letter.addComponent<TransformComponent>(xpos*scale, ypos*scale, letterWidth, letterHeight, 1);
|
||||
letter.addComponent<TransformComponent>(xpos*lttrScale, ypos*lttrScale, letterWidth, letterHeight, 1);
|
||||
// printf("Scale: %d\n",scale);
|
||||
letter.addComponent<SpriteComponent>("font", SpriteComponent::spriteText, crnt, letterWidth, letterHeight, scale);
|
||||
letter.addComponent<SpriteComponent>("font", SpriteComponent::spriteText, crnt, letterWidth, letterHeight, lttrScale);
|
||||
letter.setTag(tag);
|
||||
letter.addGroup(Game::groupUI_Layer1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user