mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-07 14:51:08 +00:00
Fix font bounds calculation
BitmapFont::getActualWidth() is still a bit less than getStringWidth(), but won't fix that now since it shouldn't cause any issues... hopefully.
This commit is contained in:
parent
d41375d5d2
commit
26549f84b7
11 changed files with 118 additions and 73 deletions
|
@ -56,10 +56,10 @@ class BitmapText : public BaseText
|
|||
public:
|
||||
BitmapText(BmpFont *bmpFont);
|
||||
void setText(const std::string &text);
|
||||
void setWidth(int width);
|
||||
int getSetWidth(); // get the width that was set
|
||||
void setWidth(float width);
|
||||
float getSetWidth(); // get the width that was set
|
||||
void scrollText(const std::string &text, float scrollSpeed);
|
||||
void setFontSize(int sz);
|
||||
void setFontSize(float sz);
|
||||
bool isScrollingText();
|
||||
void stopScrollingText();
|
||||
bool isEmpty();
|
||||
|
@ -75,7 +75,8 @@ public:
|
|||
virtual float getHeight();
|
||||
void unloadDevice();
|
||||
void reloadDevice();
|
||||
virtual float getStringWidth(const std::string& text);
|
||||
float getStringWidth(const std::string& text);
|
||||
float getActualWidth() { return maxW; }
|
||||
|
||||
int getNumLines();
|
||||
protected:
|
||||
|
@ -89,18 +90,19 @@ protected:
|
|||
int currentScrollLine;
|
||||
int currentScrollChar;
|
||||
Align align;
|
||||
int alignWidth;
|
||||
float alignWidth;
|
||||
typedef std::map<char, float> SpacingMap;
|
||||
SpacingMap spacingMap;
|
||||
void formatText();
|
||||
int fontDrawSize;
|
||||
float fontDrawSize;
|
||||
void onRender();
|
||||
typedef std::vector<std::string> Lines;
|
||||
Lines lines;
|
||||
typedef std::vector<Vector> ColorIndices;
|
||||
std::vector<ColorIndices> colorIndices;
|
||||
std::string text;
|
||||
int textWidth;
|
||||
float textWidth;
|
||||
float maxW;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue