ManaPlus
Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes
Font Class Reference

#include <font.h>

Public Member Functions

 Font (std::string filename, int size, const int style)
 
 ~Font ()
 
void loadFont (std::string filename, const int size, const int style)
 
int getWidth (const std::string &text) const
 
int getHeight () const
 
const TextChunkListgetCache () const A_CONST
 
void drawString (Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
 
void clear ()
 
void doClean ()
 
void slowLogic (const int rnd)
 
unsigned int getCreateCounter () const
 
unsigned int getDeleteCounter () const
 
int getStringIndexAt (const std::string &text, const int x) const
 
void generate (TextChunk &chunk)
 
void insertChunk (TextChunk *const chunk)
 

Static Public Attributes

static bool mSoftMode
 

Static Private Member Functions

static TTF_Font * openFont (const char *const name, const int size)
 

Private Attributes

TTF_Font * mFont
 
unsigned int mCreateCounter
 
unsigned int mDeleteCounter
 
time_t mCleanTime
 
TextChunkList mCache [CACHES_NUMBER]
 

Detailed Description

A wrapper around SDL_ttf for allowing the use of TrueType fonts.

NOTE: This class initializes SDL_ttf as necessary.

Definition at line 88 of file font.h.

Constructor & Destructor Documentation

◆ Font()

Font::Font ( std::string  filename,
int  size,
const int  style 
)

Definition at line 105 of file font.cpp.

107  :
108  mFont(nullptr),
109  mCreateCounter(0),
110  mDeleteCounter(0),
112 {
113  if (fontCounter == 0)
114  {
116  if (TTF_Init() == -1)
117  {
118  logger->error("Unable to initialize SDL_ttf: " +
119  std::string(SDL_GetError()));
120  }
121  }
122 
123  if (size < 4)
124  {
125  reportAlways("Error: requested load font %s with size %d",
126  filename.c_str(),
127  size)
128  size = 4;
129  }
130 
131  if (fontCounter == 0)
132  {
133  strBuf = new char[65535];
134  memset(strBuf, 0, 65535);
135  }
136 
137  ++fontCounter;
138 
139  fixDirSeparators(filename);
140  logger->log("Attempt to load font: %s",
141  filename.c_str());
142  mFont = openFont(filename.c_str(), size);
143 
144  if (mFont == nullptr)
145  {
146  logger->log("Error normal loading font " + filename);
147 
148  filename = "fonts/dejavusans.ttf";
149  mFont = openFont(fixDirSeparators(filename).c_str(), size);
150  if (mFont == nullptr)
151  {
152 #ifdef UNITTESTS
153  reportAlways("Font load failed %s",
154  filename.c_str())
155 #endif // UNITTESTS
156  logger->error("Font::Font: " +
157  std::string(SDL_GetError()));
158  }
159  else
160  {
161  logger->log("Loaded fallback font %s, %d",
162  filename.c_str(),
163  size);
164  }
165  }
166  else
167  {
168  logger->log("Loaded font %s, %d",
169  filename.c_str(),
170  size);
171  }
172 
173  TTF_SetFontStyle(mFont, style);
174 }

References Logger::error(), fixDirSeparators(), fontCounter, imageHelper, Logger::log(), logger, mFont, mSoftMode, openFont(), RENDER_SOFTWARE, reportAlways, EmoteDB::size(), strBuf, and ImageHelper::useOpenGL().

◆ ~Font()

Font::~Font ( )

Definition at line 176 of file font.cpp.

177 {
178  TTF_CloseFont(mFont);
179  mFont = nullptr;
180  --fontCounter;
181  clear();
182 
183  if (fontCounter == 0)
184  {
185  TTF_Quit();
186  delete []strBuf;
187  }
188 }

References clear(), fontCounter, mFont, and strBuf.

Member Function Documentation

◆ clear()

void Font::clear ( )

Definition at line 247 of file font.cpp.

248 {
249  for (size_t f = 0; f < CACHES_NUMBER; f ++)
250  mCache[f].clear();
251 }

References CACHES_NUMBER, and mCache.

Referenced by Gui::clearFonts(), loadFont(), and ~Font().

◆ doClean()

void Font::doClean ( )

Definition at line 366 of file font.cpp.

367 {
368  for (unsigned int f = 0; f < CACHES_NUMBER; f ++)
369  {
370  TextChunkList *const cache = &mCache[f];
371  const size_t size = CAST_SIZE(cache->size);
372 #ifdef DEBUG_FONT_COUNTERS
373  logger->log("ptr: %u, size: %ld", f, size);
374 #endif // DEBUG_FONT_COUNTERS
375 
376  if (size > CACHE_SIZE_SMALL3)
377  {
378 #ifdef DEBUG_FONT_COUNTERS
379  mDeleteCounter += 100;
380 #endif // DEBUG_FONT_COUNTERS
381 
382  cache->removeBack(100);
383 #ifdef DEBUG_FONT_COUNTERS
384  logger->log("delete3");
385 #endif // DEBUG_FONT_COUNTERS
386  }
387  else if (size > CACHE_SIZE_SMALL2)
388  {
389 #ifdef DEBUG_FONT_COUNTERS
390  mDeleteCounter += 20;
391 #endif // DEBUG_FONT_COUNTERS
392 
393  cache->removeBack(20);
394 #ifdef DEBUG_FONT_COUNTERS
395  logger->log("delete2");
396 #endif // DEBUG_FONT_COUNTERS
397  }
398  else if (size > CACHE_SIZE_SMALL1)
399  {
400 #ifdef DEBUG_FONT_COUNTERS
401  mDeleteCounter ++;
402 #endif // DEBUG_FONT_COUNTERS
403 
404  cache->removeBack();
405 #ifdef DEBUG_FONT_COUNTERS
406  logger->log("delete1");
407 #endif // DEBUG_FONT_COUNTERS
408  }
409  }
410 }

References CACHE_SIZE_SMALL1, CACHE_SIZE_SMALL2, CACHE_SIZE_SMALL3, CACHES_NUMBER, CAST_SIZE, Logger::log(), logger, mCache, mDeleteCounter, TextChunkList::removeBack(), TextChunkList::size, and EmoteDB::size().

Referenced by slowLogic().

◆ drawString()

void Font::drawString ( Graphics *const  graphics,
Color  col,
const Color col2,
const std::string &  text,
const int  x,
const int  y 
)
See also
Font::drawString

Definition at line 253 of file font.cpp.

258 {
259  BLOCK_START("Font::drawString")
260  if (text.empty())
261  {
262  BLOCK_END("Font::drawString")
263  return;
264  }
265 
266 // Color col = graphics->getColor();
267 // const Color &col2 = graphics->getColor2();
268  const float alpha = static_cast<float>(col.a) / 255.0F;
269 
270  /* The alpha value is ignored at string generation so avoid caching the
271  * same text with different alpha values.
272  */
273  col.a = 255;
274 
275  const unsigned char chr = text[0];
276  TextChunkList *const cache = &mCache[chr];
277 
278  std::map<TextChunkSmall, TextChunk*> &search = cache->search;
279  std::map<TextChunkSmall, TextChunk*>::iterator i
280  = search.find(TextChunkSmall(text, col, col2));
281  if (i != search.end())
282  {
283  TextChunk *const chunk2 = (*i).second;
284  cache->moveToFirst(chunk2);
285  Image *const image = chunk2->img;
286  if (image != nullptr)
287  {
288  image->setAlpha(alpha);
289  graphics->drawImage(image, x, y);
290  }
291  }
292  else
293  {
294  if (cache->size >= CACHE_SIZE)
295  {
296 #ifdef DEBUG_FONT_COUNTERS
297  mDeleteCounter ++;
298 #endif // DEBUG_FONT_COUNTERS
299 
300  cache->removeBack();
301  }
302 #ifdef DEBUG_FONT_COUNTERS
303  mCreateCounter ++;
304 #endif // DEBUG_FONT_COUNTERS
305 
306  TextChunk *chunk2 = new TextChunk(text, col, col2, this);
307 
308  chunk2->generate(mFont, alpha);
309  cache->insertFirst(chunk2);
310 
311  const Image *const image = chunk2->img;
312  if (image != nullptr)
313  graphics->drawImage(image, x, y);
314  }
315  BLOCK_END("Font::drawString")
316 }

References Color::a, BLOCK_END, BLOCK_START, CACHE_SIZE, Graphics::drawImage(), TextChunk::generate(), TextChunk::img, TextChunkList::insertFirst(), mCache, mCreateCounter, mDeleteCounter, mFont, TextChunkList::moveToFirst(), TextChunkList::removeBack(), TextChunkList::search, Image::setAlpha(), TextChunkList::size, x, and y.

Referenced by Game::addWatermark(), ColorPage::draw(), AvatarListBox::draw(), ExtendedListBox::draw(), ServersListBox::draw(), EmoteShortcutContainer::draw(), SpellShortcutContainer::draw(), ItemShortcutContainer::draw(), VirtShortcutContainer::draw(), ShopListBox::draw(), DropDown::draw(), FloorItem::draw(), EquipmentWindow::draw(), ItemContainer::draw(), MapItem::draw(), SkillListBox::draw(), TextPreview::draw(), StaticBrowserBox::draw(), ListBox::draw(), TextBox::draw(), BrowserBox::draw(), SkillRectangleListBox::draw(), Gui::draw(), Viewport::drawPath(), Being::drawPortalSpriteAt(), TouchManager::drawText(), AvatarListBox::safeDraw(), SpellShortcutContainer::safeDraw(), ItemShortcutContainer::safeDraw(), EmoteShortcutContainer::safeDraw(), VirtShortcutContainer::safeDraw(), EquipmentWindow::safeDraw(), ItemContainer::safeDraw(), and TestLauncher::testDraw().

◆ generate()

void Font::generate ( TextChunk chunk)

Definition at line 429 of file font.cpp.

430 {
431  const std::string &text = chunk.text;
432  if (text.empty())
433  return;
434 
435  const unsigned char chr = text[0];
436  TextChunkList *const cache = &mCache[chr];
437  Color &col = chunk.color;
438  Color &col2 = chunk.color2;
439  const int oldAlpha = col.a;
440  col.a = 255;
441 
442  TextChunkSmall key(text, col, col2);
443  std::map<TextChunkSmall, TextChunk*> &search = cache->search;
444  std::map<TextChunkSmall, TextChunk*>::iterator i = search.find(key);
445  if (i != search.end())
446  {
447  TextChunk *const chunk2 = (*i).second;
448  cache->moveToFirst(chunk2);
449 // search.erase(key);
450  cache->remove(chunk2);
451  chunk.img = chunk2->img;
452  chunk2->img = nullptr;
453  delete chunk2;
454 // logger->log("cached image: " + chunk.text);
455  }
456  else
457  {
458  if (cache->size >= CACHE_SIZE)
459  {
460 #ifdef DEBUG_FONT_COUNTERS
461  mDeleteCounter ++;
462 #endif // DEBUG_FONT_COUNTERS
463 
464  cache->removeBack();
465  }
466 #ifdef DEBUG_FONT_COUNTERS
467  mCreateCounter ++;
468 #endif // DEBUG_FONT_COUNTERS
469 
470  const float alpha = static_cast<float>(chunk.color.a) / 255.0F;
471  chunk.generate(mFont, alpha);
472 // logger->log("generate image: " + chunk.text);
473  }
474  col.a = oldAlpha;
475 }

References Color::a, CACHE_SIZE, TextChunk::color, TextChunk::color2, TextChunk::generate(), TextChunk::img, mCache, mCreateCounter, mDeleteCounter, mFont, TextChunkList::moveToFirst(), TextChunkList::remove(), TextChunkList::removeBack(), TextChunkList::search, TextChunkList::size, and TextChunk::text.

Referenced by ProgressBar::draw(), Text::draw(), TextField::draw(), CheckBox::draw(), Label::draw(), RadioButton::draw(), Window::draw(), Button::draw(), ProgressBar::safeDraw(), Window::safeDraw(), and Button::safeDraw().

◆ getCache()

const TextChunkList * Font::getCache ( ) const

Definition at line 424 of file font.cpp.

425 {
426  return mCache;
427 }

References mCache.

◆ getCreateCounter()

unsigned int Font::getCreateCounter ( ) const
inline

Definition at line 126 of file font.h.

127  { return mCreateCounter; }

References mCreateCounter.

◆ getDeleteCounter()

unsigned int Font::getDeleteCounter ( ) const
inline

Definition at line 129 of file font.h.

130  { return mDeleteCounter; }

References mDeleteCounter.

◆ getHeight()

int Font::getHeight ( ) const

◆ getStringIndexAt()

int Font::getStringIndexAt ( const std::string &  text,
const int  x 
) const

Definition at line 412 of file font.cpp.

413 {
414  const size_t sz = text.size();
415  for (size_t i = 0; i < sz; ++i)
416  {
417  if (getWidth(text.substr(0, i)) > x)
418  return CAST_S32(i);
419  }
420 
421  return CAST_S32(sz);
422 }

References CAST_S32, getWidth(), and x.

Referenced by TextField::mousePressed(), and TextBox::mousePressed().

◆ getWidth()

int Font::getWidth ( const std::string &  text) const

Definition at line 333 of file font.cpp.

334 {
335  if (text.empty())
336  return 0;
337 
338  const unsigned char chr = text[0];
339  TextChunkList *const cache = &mCache[chr];
340 
341  std::map<std::string, TextChunk*> &search = cache->searchWidth;
342  std::map<std::string, TextChunk*>::iterator i = search.find(text);
343  if (i != search.end())
344  {
345  TextChunk *const chunk = (*i).second;
346  cache->moveToFirst(chunk);
347  const Image *const image = chunk->img;
348  if (image != nullptr)
349  return image->getWidth();
350  return 0;
351  }
352 
353  // if string was not drawed
354  int w;
355  int h;
356  getSafeUtf8String(text, strBuf);
357  TTF_SizeUTF8(mFont, strBuf, &w, &h);
358  return w;
359 }

References getSafeUtf8String(), Image::getWidth(), TextChunk::img, mCache, mFont, TextChunkList::moveToFirst(), TextChunkList::searchWidth, and strBuf.

Referenced by StaticBrowserBox::addRow(), BrowserBox::addRow(), Label::adjustSize(), RadioButton::adjustSize(), Button::adjustSize(), TextBox::adjustSize(), BrowserBox::calcHeight(), ColorPage::draw(), ExtendedListBox::draw(), ServersListBox::draw(), ItemShortcutContainer::draw(), VirtShortcutContainer::draw(), EquipmentWindow::draw(), ItemContainer::draw(), ProgressBar::draw(), SkillListBox::draw(), TextPreview::draw(), TextField::draw(), ListBox::draw(), TextBox::draw(), Label::draw(), Window::draw(), SkillRectangleListBox::draw(), Gui::draw(), Button::draw(), Viewport::drawPath(), TouchManager::drawText(), TextField::fixScroll(), SliderList::getMaxLabelWidth(), SetupItemSlider2::getMaxWidth(), getStringIndexAt(), InventoryWindow::InventoryWindow(), Label::Label(), ServerDialog::loadServers(), NpcDialog::NpcDialog(), OkDialog::OkDialog(), PincodeDialog::PincodeDialog(), ConfirmDialog::postInit(), Label::resizeTo(), ItemShortcutContainer::safeDraw(), VirtShortcutContainer::safeDraw(), EquipmentWindow::safeDraw(), ItemContainer::safeDraw(), ProgressBar::safeDraw(), Window::safeDraw(), Button::safeDraw(), TextBox::scrollToCaret(), TextBox::setTextWrapped(), Setup_Colors::Setup_Colors(), ServersListModel::setVersionString(), SkillRectangleListBox::SkillRectangleListBox(), TextDialog::TextDialog(), TradeWindow::TradeWindow(), and StaticBrowserBox::updateHeight().

◆ insertChunk()

void Font::insertChunk ( TextChunk *const  chunk)

Definition at line 477 of file font.cpp.

478 {
479  if ((chunk == nullptr) || chunk->text.empty() || (chunk->img == nullptr))
480  return;
481 // logger->log("insert chunk: text=%s, color: %d,%d,%d",
482 // chunk->text.c_str(), chunk->color.r, chunk->color.g, chunk->color.b);
483  const unsigned char chr = chunk->text[0];
484  TextChunkList *const cache = &mCache[chr];
485 
486  std::map<TextChunkSmall, TextChunk*> &search = cache->search;
487  std::map<TextChunkSmall, TextChunk*>::iterator i
488  = search.find(TextChunkSmall(chunk->text,
489  chunk->color, chunk->color2));
490  if (i != search.end())
491  {
492  delete2(chunk->img)
493  return;
494  }
495 
496  TextChunk *const chunk2 = new TextChunk(chunk->text,
497  chunk->color, chunk->color2, chunk->textFont);
498  chunk2->img = chunk->img;
499  cache->insertFirst(chunk2);
500 }

References TextChunk::color, TextChunk::color2, delete2, TextChunk::img, TextChunkList::insertFirst(), mCache, TextChunkList::search, TextChunk::text, and TextChunk::textFont.

Referenced by TextChunk::deleteImage().

◆ loadFont()

void Font::loadFont ( std::string  filename,
const int  size,
const int  style 
)

Definition at line 218 of file font.cpp.

221 {
222  if (fontCounter == 0 && TTF_Init() == -1)
223  {
224  logger->log("Unable to initialize SDL_ttf: " +
225  std::string(SDL_GetError()));
226  return;
227  }
228 
229  fixDirSeparators(filename);
230  TTF_Font *const font = openFont(filename.c_str(), size);
231 
232  if (font == nullptr)
233  {
234  logger->log("Font::Font: " +
235  std::string(SDL_GetError()));
236  return;
237  }
238 
239  if (mFont != nullptr)
240  TTF_CloseFont(mFont);
241 
242  mFont = font;
243  TTF_SetFontStyle(mFont, style);
244  clear();
245 }

References clear(), fixDirSeparators(), fontCounter, Logger::log(), logger, mFont, openFont(), and EmoteDB::size().

Referenced by Gui::updateFonts().

◆ openFont()

TTF_Font * Font::openFont ( const char *const  name,
const int  size 
)
staticprivate

Definition at line 190 of file font.cpp.

192 {
193 #ifdef USE_SDL2
194  SDL_RWops *const rw = VirtFs::rwopsOpenRead(name);
195  if (rw)
196  {
197  logger->log("Loading virtfs font file: %s",
198  name);
199  return TTF_OpenFontIndexRW(rw, 1, size, 0);
200  }
201 #endif
202  const std::string path = VirtFs::getPath(name);
203  if (Files::existsLocal(path) == false)
204  {
205 #ifndef UNITTESTS
206  // +++ in future need trigger assert in unit tests here too
207  reportAlways("Font::openFont font not exists: %s",
208  path.c_str())
209 #endif // UNITTESTS
210  return nullptr;
211  }
212  logger->log("Loading physical font file: %s",
213  path.c_str());
214  return TTF_OpenFontIndex(path.c_str(),
215  size, 0);
216 }

References Files::existsLocal(), VirtFs::getPath(), Logger::log(), logger, reportAlways, VirtFs::rwopsOpenRead(), and EmoteDB::size().

Referenced by Font(), and loadFont().

◆ slowLogic()

void Font::slowLogic ( const int  rnd)

Definition at line 318 of file font.cpp.

319 {
320  BLOCK_START("Font::slowLogic")
321  if (mCleanTime == 0)
322  {
323  mCleanTime = cur_time + CLEAN_TIME + rnd;
324  }
325  else if (mCleanTime < cur_time)
326  {
327  doClean();
328  mCleanTime = cur_time + CLEAN_TIME + rnd;
329  }
330  BLOCK_END("Font::slowLogic")
331 }

References BLOCK_END, BLOCK_START, CLEAN_TIME, cur_time, doClean(), and mCleanTime.

Referenced by Gui::slowLogic().

Field Documentation

◆ mCache

TextChunkList Font::mCache[CACHES_NUMBER]
mutableprivate

Definition at line 151 of file font.h.

Referenced by clear(), doClean(), drawString(), generate(), getCache(), getWidth(), and insertChunk().

◆ mCleanTime

time_t Font::mCleanTime
private

Definition at line 150 of file font.h.

Referenced by slowLogic().

◆ mCreateCounter

unsigned int Font::mCreateCounter
private

Definition at line 146 of file font.h.

Referenced by drawString(), generate(), and getCreateCounter().

◆ mDeleteCounter

unsigned int Font::mDeleteCounter
private

Definition at line 147 of file font.h.

Referenced by doClean(), drawString(), generate(), and getDeleteCounter().

◆ mFont

TTF_Font* Font::mFont
private

Definition at line 145 of file font.h.

Referenced by drawString(), Font(), generate(), getHeight(), getWidth(), loadFont(), and ~Font().

◆ mSoftMode

bool Font::mSoftMode
static

Definition at line 139 of file font.h.

Referenced by Font(), and TextChunkSmall::operator<().


The documentation for this class was generated from the following files:
Files::existsLocal
bool existsLocal(const std::string &path)
Definition: files.cpp:208
reportAlways
#define reportAlways(...)
Definition: checkutils.h:252
CACHES_NUMBER
const unsigned int CACHES_NUMBER
Definition: font.h:81
Font::mSoftMode
static bool mSoftMode
Definition: font.h:139
Font::mCache
TextChunkList mCache[CACHES_NUMBER]
Definition: font.h:151
CAST_SIZE
#define CAST_SIZE
Definition: cast.h:33
Font::clear
void clear()
Definition: font.cpp:247
VirtFs::getPath
std::string getPath(const std::string &file)
Definition: tools.cpp:96
TextChunk::img
Image * img
Definition: textchunk.h:62
Font::doClean
void doClean()
Definition: font.cpp:366
TextChunk::color
Color color
Definition: textchunk.h:65
imageHelper
ImageHelper * imageHelper
Definition: imagehelper.cpp:43
Image::setAlpha
virtual void setAlpha(const float alpha)
Definition: image.cpp:286
CACHE_SIZE_SMALL2
const unsigned int CACHE_SIZE_SMALL2
Definition: font.cpp:95
CACHE_SIZE_SMALL3
const unsigned int CACHE_SIZE_SMALL3
Definition: font.cpp:96
VirtFs::rwopsOpenRead
SDL_RWops * rwopsOpenRead(const std::string &fname)
Definition: rwops.cpp:105
Image
Definition: image.h:67
TextChunkList::size
uint32_t size
Definition: textchunklist.h:55
cur_time
volatile time_t cur_time
Definition: timer.cpp:57
Font::mFont
TTF_Font * mFont
Definition: font.h:145
TextChunkList::remove
void remove(const TextChunk *const item)
Definition: textchunklist.cpp:73
TextChunk::generate
void generate(TTF_Font *const font, const float alpha)
Definition: textchunk.cpp:96
delete2
#define delete2(var)
Definition: delete2.h:24
CACHE_SIZE_SMALL1
const unsigned int CACHE_SIZE_SMALL1
Definition: font.cpp:94
TextChunkSmall
Definition: textchunksmall.h:30
getSafeUtf8String
const char * getSafeUtf8String(const std::string &text)
Definition: stringutils.cpp:307
logger
Logger * logger
Definition: logger.cpp:88
AttributesEnum::find
bool find(const std::string &key)
Definition: attributesstrings.cpp:32
if
if(!vert) return
TextChunkList::removeBack
void removeBack()
Definition: textchunklist.cpp:95
CLEAN_TIME
const unsigned int CLEAN_TIME
Definition: font.cpp:97
Font::mCreateCounter
unsigned int mCreateCounter
Definition: font.h:146
x
x
Definition: graphics_calcImageRect.hpp:72
TextChunkList::moveToFirst
void moveToFirst(TextChunk *const item)
Definition: textchunklist.cpp:52
TextChunk
Definition: textchunk.h:41
Font::getWidth
int getWidth(const std::string &text) const
Definition: font.cpp:333
fixDirSeparators
std::string & fixDirSeparators(std::string &str)
Definition: paths.cpp:148
CACHE_SIZE
const unsigned int CACHE_SIZE
Definition: font.cpp:93
RENDER_SOFTWARE
@ RENDER_SOFTWARE
Definition: rendertype.h:26
EmoteDB::size
int size()
Definition: emotedb.cpp:305
empty
std::string empty
Definition: podict.cpp:25
TextChunkList::searchWidth
std::map< std::string, TextChunk * > searchWidth
Definition: textchunklist.h:57
TextChunkList::search
std::map< TextChunkSmall, TextChunk * > search
Definition: textchunklist.h:56
Font::mCleanTime
time_t mCleanTime
Definition: font.h:150
std
Definition: mseprimitives.h:398
Font::mDeleteCounter
unsigned int mDeleteCounter
Definition: font.h:147
TextChunkList
Definition: textchunklist.h:32
BLOCK_START
#define BLOCK_START(name)
Definition: perfomance.h:78
BLOCK_END
#define BLOCK_END(name)
Definition: perfomance.h:79
CAST_S32
#define CAST_S32
Definition: cast.h:29
Graphics::drawImage
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
new
#define new
Definition: debug_new.h:147
TextChunk::color2
Color color2
Definition: textchunk.h:66
ImageHelper::useOpenGL
virtual RenderType useOpenGL() const
Definition: imagehelper.h:106
TextChunk::text
std::string text
Definition: textchunk.h:64
strBuf
char * strBuf
Definition: textchunk.cpp:45
Logger::error
void error(const std::string &error_text) __attribute__((noreturn))
Definition: logger.cpp:471
Font::openFont
static TTF_Font * openFont(const char *const name, const int size)
Definition: font.cpp:190
Color
Definition: color.h:74
y
y
Definition: graphics_calcImageRect.hpp:72
Image::getWidth
int getWidth() const A_INLINE
Definition: image.h:122
Color::a
unsigned int a
Definition: color.h:250
Logger::log
void log(const char *const log_text,...)
Definition: logger.cpp:268
fontCounter
static int fontCounter
Definition: font.cpp:103