1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-04-07 15:16:51 +00:00

remove unused code from BitmapFont

This commit is contained in:
fgenesis 2025-04-02 00:29:52 +02:00
parent 5fab8f4d81
commit 7e51dc55b7
2 changed files with 6 additions and 44 deletions

View file

@ -88,10 +88,6 @@ BitmapText::BitmapText(const BmpFont& bmpFont)
}
void BitmapText::autoKern()
{
}
int BitmapText::getWidthOnScreen()
{
return text.size()*(fontDrawSize/2);
@ -102,7 +98,7 @@ void BitmapText::setAlign(Align align)
this->align = align;
}
std::string BitmapText::getText()
const std::string& BitmapText::getText()
{
return this->text;
}
@ -179,23 +175,6 @@ void BitmapText::formatText()
{
lines.push_back(text);
}
colorIndices.clear();
}
void BitmapText::updateWordColoring()
{
colorIndices.resize(lines.size());
for (size_t i = 0; i < colorIndices.size(); i++)
{
colorIndices[i].resize(lines[i].size());
for (size_t j = 0; j < colorIndices[i].size(); j++)
{
colorIndices[i][j] = Vector(1,1,1);
}
}
}
bool BitmapText::isEmpty()
@ -255,22 +234,10 @@ void BitmapText::onUpdate(float dt)
}
}
Vector BitmapText::getColorIndex(size_t i, size_t j)
{
Vector c(1,1,1);
if ( i < colorIndices.size() && j < colorIndices[i].size())
{
c = colorIndices[i][j];
}
return c;
}
void BitmapText::onRender(const RenderState& rs) const
{
const Vector top = bmpFont.fontTopColor;
const Vector btm = bmpFont.fontBtmColor;
float top_color[3] = {top.x*color.x, top.y*color.y, top.z*color.z};
float bottom_color[3] = {btm.x*color.x, btm.y*color.y, btm.z*color.z};
const Vector top = bmpFont.fontTopColor * color;
const Vector btm = bmpFont.fontBtmColor * color;
glEnable(GL_TEXTURE_2D);
@ -304,7 +271,7 @@ void BitmapText::onRender(const RenderState& rs) const
float la = 1.0f-(scrollDelay/scrollSpeed);
font->DrawString(theLine, scale, x, y, top_color, bottom_color, alpha.x, la);
font->DrawString(theLine, scale, x, y, &top.x, &btm.x, alpha.x, la);
y += adj;
}
}
@ -319,7 +286,7 @@ void BitmapText::onRender(const RenderState& rs) const
font->GetStringSize(lines[i], &sz);
x = -sz.first*0.5f*scale;
}
font->DrawString(lines[i], scale, x, y, top_color, bottom_color, alpha.x, 1);
font->DrawString(lines[i], scale, x, y, &top.x, &btm.x, alpha.x, 1);
y += adj;
}
}

View file

@ -57,11 +57,8 @@ public:
void stopScrollingText();
bool isEmpty();
virtual void setAlign(Align align) OVERRIDE;
std::string getText();
const std::string& getText();
int getWidthOnScreen();
Vector getColorIndex(size_t i, size_t j);
void updateWordColoring();
void autoKern();
virtual float getHeight() const OVERRIDE;
void unloadDevice() OVERRIDE;
void reloadDevice() OVERRIDE;
@ -85,8 +82,6 @@ protected:
void onRender(const RenderState& rs) const OVERRIDE;
typedef std::vector<std::string> Lines;
Lines lines;
typedef std::vector<Vector> ColorIndices;
std::vector<ColorIndices> colorIndices;
std::string text;
float textWidth;
float maxW;