1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-04 13:27:14 +00:00

Add script functions:

+ createArialTextBig()
+ createArialTextSmall()
+ quad_getTexOffset()
+ quad_setTexOffset()
This commit is contained in:
fgenesis 2015-08-15 21:15:42 +02:00
commit e8dc99b30d
3 changed files with 61 additions and 8 deletions

View file

@ -56,7 +56,7 @@ void TTFFont::create(const unsigned char *data, unsigned long datalen, int sz)
font->FaceSize(sz);
}
TTFText::TTFText(TTFFont *font) : RenderObject(), font(font)
TTFText::TTFText(TTFFont *f) : font(f)
{
align = ALIGN_LEFT;
hw = 0;
@ -97,9 +97,7 @@ void TTFText::updateAlign()
float TTFText::getWidth()
{
float llx, lly, llz, urx, ury, urz;
font->font->BBox(originalText.c_str(), llx, lly, llz, urx, ury, urz);
return urx - llx;
return getStringWidth(originalText);
}
float TTFText::getHeight()
@ -109,6 +107,13 @@ float TTFText::getHeight()
return ury - lly;
}
float TTFText::getStringWidth(const std::string& s)
{
float llx, lly, llz, urx, ury, urz;
font->font->BBox(s.c_str(), llx, lly, llz, urx, ury, urz);
return urx - llx;
}
float TTFText::getFullHeight()
{
/*
@ -127,6 +132,10 @@ void TTFText::setWidth(int width)
updateFormatting();
}
void TTFText::setFontSize(int)
{
}
void TTFText::updateFormatting()
{
int start = 0, lastSpace = -1;

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BBGE_TTFFONT_H
#include "Base.h"
#include "RenderObject.h"
#include "BaseText.h"
#include <ft2build.h>
#include FT_FREETYPE_H
@ -43,7 +43,7 @@ struct TTFFont
FTGLTextureFont *font;
};
class TTFText : public RenderObject
class TTFText : public BaseText
{
public:
TTFText(TTFFont *font);
@ -53,6 +53,8 @@ public:
float getWidth();
float getHeight();
float getFullHeight();
void setFontSize(int); // dummy
float getStringWidth(const std::string& s);
bool shadow;
int findLine(const std::string &label);
int getLineHeight();