62 texture.getTexture().rebuild();
92 for (
uint32 i = 0; i < 128; i++)
104 std::map<uint32, Char>::const_iterator m =
_chars.find(
'm');
117 std::map<uint32, Char>::const_iterator cC =
_chars.find(c);
121 return cC->second.width;
134 glVertex2f(0.0f , 0.0f);
135 glVertex2f(width, 0.0f);
140 glTranslatef(width + 1.0f, 0.0f, 0.0f);
144 std::map<uint32, Char>::const_iterator cC =
_chars.find(c);
154 size_t page = cC->second.page;
155 assert(page <
_pages.size());
160 for (
int i = 0; i < 4; i++) {
161 glTexCoord2f(cC->second.tX[i], cC->second.tY[i]);
162 glVertex2f (cC->second.vX[i], cC->second.vY[i]);
166 glTranslatef(cC->second.width, 0.0f, 0.0f);
177 for (std::vector<Page *>::iterator p =
_pages.begin(); p !=
_pages.end(); ++p)
182 std::map<uint32, Char>::iterator cC =
_chars.find(c);
186 if (!
_ttf->hasChar(c))
200 if (
_pages.back()->widthLeft < cWidth) {
223 std::pair<std::map<uint32, Char>::iterator,
bool> result;
225 result =
_chars.insert(std::make_pair(c,
Char()));
229 Char &ch = cC->second;
235 ch.
vX[0] = 0.00f; ch.
vY[0] = 0.00f;
236 ch.
vX[1] = cWidth; ch.
vY[1] = 0.00f;
242 const float tW = (float) cWidth / (
float)
kPageWidth;
245 ch.
tX[0] = tX; ch.
tY[0] = tY + tH;
246 ch.
tX[1] = tX + tW; ch.
tY[1] = tY + tH;
247 ch.
tX[2] = tX + tW; ch.
tY[2] = tY;
248 ch.
tX[3] = tX; ch.
tY[3] = tY;
250 _pages.back()->widthLeft -= cWidth;
251 _pages.back()->curX += cWidth;
252 _pages.back()->needRebuild =
true;
#define ResMan
Shortcut for accessing the sound manager.
A texture page filled with characters.
A class holding an UTF-8 string.
#define TextureMan
Shortcut for accessing the texture manager.
static Texture * create(const Common::UString &name, bool deswizzle=false)
Create a texture from this image resource.
The Aurora texture manager.
void fill(byte r, byte g, byte b, byte a)
A simple TTF renderer outputting BGRA.
Common::ScopedPtr< TTFRenderer > _ttf
static const uint32 kPageWidth
void buildChars(const Common::UString &str)
Build all necessary characters to display this string.
Virtual base class of a texture.
float getHeight() const
Return the height of a character.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
Basic exceptions to throw.
utf8::iterator< std::string::const_iterator > iterator
const char * c_str() const
Return the (utf8 encoded) string data.
Utility templates and functions.
float getWidth(uint32 c) const
Return the width of a character.
void draw(uint32 c) const
Draw this character.
TTFFont(Common::SeekableReadStream *ttf, int height)
An image surface, in BGRA format.
A texture as used in the Aurora engines.
std::map< uint32, Char >::const_iterator _missingChar
Common::PtrVector< Page > _pages
void load(Common::SeekableReadStream *ttf, int height)
std::map< uint32, Char > _chars
static const uint32 kPageHeight
Interface for a seekable & readable data stream.
The global resource manager for Aurora resources.