mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-07 11:27:44 +00:00
WINTERMUTE: Rename FuncName->funcName in the Font-classes.
This commit is contained in:
parent
e1597f38ff
commit
b46750869c
@ -2056,10 +2056,10 @@ HRESULT CAdGame::DisplayDebugInfo() {
|
||||
char str[100];
|
||||
if (Game->_dEBUG_DebugMode) {
|
||||
sprintf(str, "Mouse: %d, %d (scene: %d, %d)", _mousePos.x, _mousePos.y, _mousePos.x + _scene->getOffsetLeft(), _mousePos.y + _scene->getOffsetTop());
|
||||
_systemFont->DrawText((byte *)str, 0, 90, _renderer->_width, TAL_RIGHT);
|
||||
_systemFont->drawText((byte *)str, 0, 90, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
sprintf(str, "Scene: %s (prev: %s)", (_scene && _scene->_name) ? _scene->_name : "???", _prevSceneName ? _prevSceneName : "???");
|
||||
_systemFont->DrawText((byte *)str, 0, 110, _renderer->_width, TAL_RIGHT);
|
||||
_systemFont->drawText((byte *)str, 0, 110, _renderer->_width, TAL_RIGHT);
|
||||
}
|
||||
return CBGame::DisplayDebugInfo();
|
||||
}
|
||||
|
@ -413,11 +413,11 @@ HRESULT CAdItem::display(int X, int Y) {
|
||||
|
||||
CBFont *Font = _font ? _font : Game->_systemFont;
|
||||
if (Font) {
|
||||
if (_amountString) Font->DrawText((byte *)_amountString, AmountX, AmountY, Width, _amountAlign);
|
||||
if (_amountString) Font->drawText((byte *)_amountString, AmountX, AmountY, Width, _amountAlign);
|
||||
else {
|
||||
char Str[256];
|
||||
sprintf(Str, "%d", _amount);
|
||||
Font->DrawText((byte *)Str, AmountX, AmountY, Width, _amountAlign);
|
||||
Font->drawText((byte *)Str, AmountX, AmountY, Width, _amountAlign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ void CAdObject::talk(const char *Text, const char *Sound, uint32 Duration, const
|
||||
} else width = Game->_renderer->_width / 2;
|
||||
}
|
||||
|
||||
height = _sentence->_font->GetTextHeight((byte *)_sentence->_text, width);
|
||||
height = _sentence->_font->getTextHeight((byte *)_sentence->_text, width);
|
||||
|
||||
y = y - height - getHeight() - 5;
|
||||
if (_subtitlesModRelative) {
|
||||
|
@ -187,7 +187,7 @@ HRESULT CAdSentence::display() {
|
||||
x = MIN(x, Game->_renderer->_width - _width);
|
||||
y = MAX(y, 0);
|
||||
|
||||
_font->DrawText((byte *)_text, x, y, _width, _align);
|
||||
_font->drawText((byte *)_text, x, y, _width, _align);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -54,18 +54,18 @@ CBFont::~CBFont() {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CBFont::DrawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int MaxLenght) {
|
||||
void CBFont::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int MaxLenght) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CBFont::GetTextHeight(byte *text, int width) {
|
||||
int CBFont::getTextHeight(byte *text, int width) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CBFont::GetTextWidth(byte *text, int MaxLenght) {
|
||||
int CBFont::getTextWidth(byte *text, int MaxLenght) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ HRESULT CBFont::loadBuffer(byte * Buffer)
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFont::GetLetterHeight() {
|
||||
int CBFont::getLetterHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -152,8 +152,8 @@ HRESULT CBFont::persist(CBPersistMgr *persistMgr) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBFont *CBFont::CreateFromFile(CBGame *Game, const char *Filename) {
|
||||
if (IsTrueType(Game, Filename)) {
|
||||
CBFont *CBFont::createFromFile(CBGame *Game, const char *Filename) {
|
||||
if (isTrueType(Game, Filename)) {
|
||||
CBFontTT *Font = new CBFontTT(Game);
|
||||
if (Font) {
|
||||
if (FAILED(Font->loadFile(Filename))) {
|
||||
@ -180,7 +180,7 @@ TOKEN_DEF(FONT)
|
||||
TOKEN_DEF(TTFONT)
|
||||
TOKEN_DEF_END
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBFont::IsTrueType(CBGame *Game, const char *Filename) {
|
||||
bool CBFont::isTrueType(CBGame *Game, const char *Filename) {
|
||||
TOKEN_TABLE_START(commands)
|
||||
TOKEN_TABLE(FONT)
|
||||
TOKEN_TABLE(TTFONT)
|
||||
|
@ -38,22 +38,22 @@ namespace WinterMute {
|
||||
class CBFont: public CBObject {
|
||||
public:
|
||||
DECLARE_PERSISTENT(CBFont, CBObject)
|
||||
virtual int GetTextWidth(byte *text, int MaxLenght = -1);
|
||||
virtual int GetTextHeight(byte *text, int width);
|
||||
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
|
||||
virtual int GetLetterHeight();
|
||||
virtual int getTextWidth(byte *text, int MaxLenght = -1);
|
||||
virtual int getTextHeight(byte *text, int width);
|
||||
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
|
||||
virtual int getLetterHeight();
|
||||
|
||||
virtual void InitLoop() {};
|
||||
virtual void AfterLoad() {};
|
||||
virtual void initLoop() {};
|
||||
virtual void afterLoad() {};
|
||||
CBFont(CBGame *inGame);
|
||||
virtual ~CBFont();
|
||||
|
||||
static CBFont *CreateFromFile(CBGame *Game, const char *Filename);
|
||||
static CBFont *createFromFile(CBGame *Game, const char *Filename);
|
||||
|
||||
private:
|
||||
//HRESULT loadBuffer(byte * Buffer);
|
||||
//HRESULT loadFile(const char* Filename);
|
||||
static bool IsTrueType(CBGame *Game, const char *Filename);
|
||||
static bool isTrueType(CBGame *Game, const char *Filename);
|
||||
};
|
||||
|
||||
} // end of namespace WinterMute
|
||||
|
@ -70,19 +70,19 @@ CBFontBitmap::~CBFontBitmap() {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CBFontBitmap::DrawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int MaxLenght) {
|
||||
TextHeightDraw(text, x, y, width, align, true, max_height, MaxLenght);
|
||||
void CBFontBitmap::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int MaxLenght) {
|
||||
textHeightDraw(text, x, y, width, align, true, max_height, MaxLenght);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CBFontBitmap::GetTextHeight(byte *text, int width) {
|
||||
return TextHeightDraw(text, 0, 0, width, TAL_LEFT, false);
|
||||
int CBFontBitmap::getTextHeight(byte *text, int width) {
|
||||
return textHeightDraw(text, 0, 0, width, TAL_LEFT, false);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CBFontBitmap::GetTextWidth(byte *text, int MaxLength) {
|
||||
int CBFontBitmap::getTextWidth(byte *text, int MaxLength) {
|
||||
AnsiString str;
|
||||
|
||||
if (Game->_textEncoding == TEXT_UTF8) {
|
||||
@ -98,7 +98,7 @@ int CBFontBitmap::GetTextWidth(byte *text, int MaxLength) {
|
||||
|
||||
int TextWidth = 0;
|
||||
for (size_t i = 0; i < str.size(); i++) {
|
||||
TextWidth += GetCharWidth(str[i]);
|
||||
TextWidth += getCharWidth(str[i]);
|
||||
}
|
||||
|
||||
return TextWidth;
|
||||
@ -106,7 +106,7 @@ int CBFontBitmap::GetTextWidth(byte *text, int MaxLength) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int CBFontBitmap::TextHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height, int MaxLenght) {
|
||||
int CBFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height, int MaxLenght) {
|
||||
if (MaxLenght == 0) return 0;
|
||||
|
||||
if (text == NULL || text[0] == '\0') return _tileHeight;
|
||||
@ -159,7 +159,7 @@ int CBFontBitmap::TextHeightDraw(byte *text, int x, int y, int width, TTextAlig
|
||||
new_line = true;
|
||||
}
|
||||
|
||||
if (LineLength + GetCharWidth(str[index]) > width && last_end == end) {
|
||||
if (LineLength + getCharWidth(str[index]) > width && last_end == end) {
|
||||
end = index - 1;
|
||||
RealLength = LineLength;
|
||||
new_line = true;
|
||||
@ -170,10 +170,10 @@ int CBFontBitmap::TextHeightDraw(byte *text, int x, int y, int width, TTextAlig
|
||||
done = true;
|
||||
if (!new_line) {
|
||||
end = index;
|
||||
LineLength += GetCharWidth(str[index]);
|
||||
LineLength += getCharWidth(str[index]);
|
||||
RealLength = LineLength;
|
||||
}
|
||||
} else LineLength += GetCharWidth(str[index]);
|
||||
} else LineLength += getCharWidth(str[index]);
|
||||
|
||||
if ((LineLength > width) || done || new_line) {
|
||||
if (end < 0) done = true;
|
||||
@ -193,8 +193,8 @@ int CBFontBitmap::TextHeightDraw(byte *text, int x, int y, int width, TTextAlig
|
||||
break;
|
||||
}
|
||||
for (i = start; i < end + 1; i++) {
|
||||
if (draw) DrawChar(str[i], StartX, y);
|
||||
StartX += GetCharWidth(str[i]);
|
||||
if (draw) drawChar(str[i], StartX, y);
|
||||
StartX += getCharWidth(str[i]);
|
||||
}
|
||||
y += _tileHeight;
|
||||
last_end = end;
|
||||
@ -215,7 +215,7 @@ int CBFontBitmap::TextHeightDraw(byte *text, int x, int y, int width, TTextAlig
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CBFontBitmap::DrawChar(byte c, int x, int y) {
|
||||
void CBFontBitmap::drawChar(byte c, int x, int y) {
|
||||
if (_fontextFix) c--;
|
||||
|
||||
int row, col;
|
||||
@ -424,7 +424,7 @@ HRESULT CBFontBitmap::loadBuffer(byte *Buffer) {
|
||||
|
||||
if (AutoWidth) {
|
||||
// calculate characters width
|
||||
GetWidths();
|
||||
getWidths();
|
||||
|
||||
// do we need to modify widths?
|
||||
if (ExpandWidth != 0) {
|
||||
@ -482,14 +482,14 @@ HRESULT CBFontBitmap::persist(CBPersistMgr *persistMgr) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFontBitmap::GetCharWidth(byte Index) {
|
||||
int CBFontBitmap::getCharWidth(byte Index) {
|
||||
if (_fontextFix) Index--;
|
||||
return _widths[Index];
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CBFontBitmap::GetWidths() {
|
||||
HRESULT CBFontBitmap::getWidths() {
|
||||
CBSurface *surf = NULL;
|
||||
|
||||
if (_sprite) {
|
||||
@ -535,7 +535,7 @@ HRESULT CBFontBitmap::GetWidths() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFontBitmap::GetLetterHeight() {
|
||||
int CBFontBitmap::getLetterHeight() {
|
||||
return _tileHeight;
|
||||
}
|
||||
|
||||
|
@ -39,16 +39,16 @@ public:
|
||||
DECLARE_PERSISTENT(CBFontBitmap, CBFont)
|
||||
HRESULT loadBuffer(byte *Buffer);
|
||||
HRESULT loadFile(const char *Filename);
|
||||
virtual int GetTextWidth(byte *text, int MaxLength = -1);
|
||||
virtual int GetTextHeight(byte *text, int width);
|
||||
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
|
||||
virtual int GetLetterHeight();
|
||||
virtual int getTextWidth(byte *text, int MaxLength = -1);
|
||||
virtual int getTextHeight(byte *text, int width);
|
||||
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
|
||||
virtual int getLetterHeight();
|
||||
|
||||
CBFontBitmap(CBGame *inGame);
|
||||
virtual ~CBFontBitmap();
|
||||
|
||||
|
||||
HRESULT GetWidths();
|
||||
HRESULT getWidths();
|
||||
CBSprite *_sprite;
|
||||
int _widthsFrame;
|
||||
bool _fontextFix;
|
||||
@ -60,10 +60,10 @@ public:
|
||||
bool _wholeCell;
|
||||
|
||||
private:
|
||||
int GetCharWidth(byte Index);
|
||||
void DrawChar(byte c, int x, int y);
|
||||
int getCharWidth(byte Index);
|
||||
void drawChar(byte c, int x, int y);
|
||||
|
||||
int TextHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height = -1, int MaxLenght = -1);
|
||||
int textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height = -1, int MaxLenght = -1);
|
||||
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ HRESULT CBFontStorage::cleanup(bool Warn) {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CBFontStorage::InitLoop() {
|
||||
for (int i = 0; i < _fonts.GetSize(); i++) {
|
||||
_fonts[i]->InitLoop();
|
||||
_fonts[i]->initLoop();
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@ -114,7 +114,7 @@ CBFont *CBFontStorage::AddFont(const char *Filename) {
|
||||
return font;
|
||||
}
|
||||
*/
|
||||
CBFont *font = CBFont::CreateFromFile(Game, Filename);
|
||||
CBFont *font = CBFont::createFromFile(Game, Filename);
|
||||
if (font) {
|
||||
font->_refCount = 1;
|
||||
_fonts.Add(font);
|
||||
|
@ -71,7 +71,7 @@ CBFontTT::CBFontTT(CBGame *inGame): CBFont(inGame) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBFontTT::~CBFontTT(void) {
|
||||
ClearCache();
|
||||
clearCache();
|
||||
|
||||
for (int i = 0; i < _layers.GetSize(); i++) {
|
||||
delete _layers[i];
|
||||
@ -96,7 +96,7 @@ CBFontTT::~CBFontTT(void) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::ClearCache() {
|
||||
void CBFontTT::clearCache() {
|
||||
for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
|
||||
if (_cachedTexts[i]) delete _cachedTexts[i];
|
||||
_cachedTexts[i] = NULL;
|
||||
@ -105,7 +105,7 @@ void CBFontTT::ClearCache() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::InitLoop() {
|
||||
void CBFontTT::initLoop() {
|
||||
// we need more aggressive cache management on iOS not to waste too much memory on fonts
|
||||
if (Game->_constrainedMemory) {
|
||||
// purge all cached images not used in the last frame
|
||||
@ -121,7 +121,7 @@ void CBFontTT::InitLoop() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFontTT::GetTextWidth(byte *Text, int MaxLength) {
|
||||
int CBFontTT::getTextWidth(byte *Text, int MaxLength) {
|
||||
WideString text;
|
||||
|
||||
if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
|
||||
@ -132,13 +132,13 @@ int CBFontTT::GetTextWidth(byte *Text, int MaxLength) {
|
||||
//text = text.substr(0, MaxLength); // TODO: Remove
|
||||
|
||||
int textWidth, textHeight;
|
||||
MeasureText(text, -1, -1, textWidth, textHeight);
|
||||
measureText(text, -1, -1, textWidth, textHeight);
|
||||
|
||||
return textWidth;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFontTT::GetTextHeight(byte *Text, int Width) {
|
||||
int CBFontTT::getTextHeight(byte *Text, int Width) {
|
||||
WideString text;
|
||||
|
||||
if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
|
||||
@ -146,14 +146,14 @@ int CBFontTT::GetTextHeight(byte *Text, int Width) {
|
||||
|
||||
|
||||
int textWidth, textHeight;
|
||||
MeasureText(text, Width, -1, textWidth, textHeight);
|
||||
measureText(text, Width, -1, textWidth, textHeight);
|
||||
|
||||
return textHeight;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::DrawText(byte *Text, int X, int Y, int Width, TTextAlign Align, int MaxHeight, int MaxLength) {
|
||||
void CBFontTT::drawText(byte *Text, int X, int Y, int Width, TTextAlign Align, int MaxHeight, int MaxLength) {
|
||||
if (Text == NULL || strcmp((char *)Text, "") == 0) return;
|
||||
|
||||
WideString text = (char *)Text;
|
||||
@ -197,7 +197,7 @@ void CBFontTT::DrawText(byte *Text, int X, int Y, int Width, TTextAlign Align,
|
||||
// not found, create one
|
||||
if (!Surface) {
|
||||
warning("Draw text: %s", Text);
|
||||
Surface = RenderTextToTexture(text, Width, Align, MaxHeight, textOffset);
|
||||
Surface = renderTextToTexture(text, Width, Align, MaxHeight, textOffset);
|
||||
if (Surface) {
|
||||
// write surface to cache
|
||||
if (_cachedTexts[MinIndex] != NULL) delete _cachedTexts[MinIndex];
|
||||
@ -237,7 +237,7 @@ void CBFontTT::DrawText(byte *Text, int X, int Y, int Width, TTextAlign Align,
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset) {
|
||||
CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset) {
|
||||
//TextLineList lines;
|
||||
// TODO
|
||||
//WrapText(text, width, maxHeight, lines);
|
||||
@ -374,7 +374,7 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect) {
|
||||
void CBFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect) {
|
||||
//SDL_BlitSurface(src, NULL, target, targetRect);
|
||||
warning("CBFontTT::BlitSurface - not ported yet");
|
||||
#if 0
|
||||
@ -398,8 +398,8 @@ void CBFontTT::BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Co
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBFontTT::GetLetterHeight() {
|
||||
return (int)GetLineHeight();
|
||||
int CBFontTT::getLetterHeight() {
|
||||
return (int)getLineHeight();
|
||||
}
|
||||
|
||||
|
||||
@ -519,7 +519,7 @@ HRESULT CBFontTT::loadBuffer(byte *Buffer) {
|
||||
|
||||
case TOKEN_LAYER: {
|
||||
CBTTFontLayer *Layer = new CBTTFontLayer;
|
||||
if (Layer && SUCCEEDED(ParseLayer(Layer, (byte *)params))) _layers.Add(Layer);
|
||||
if (Layer && SUCCEEDED(parseLayer(Layer, (byte *)params))) _layers.Add(Layer);
|
||||
else {
|
||||
delete Layer;
|
||||
Layer = NULL;
|
||||
@ -544,12 +544,12 @@ HRESULT CBFontTT::loadBuffer(byte *Buffer) {
|
||||
|
||||
if (!_fontFile) CBUtils::SetString(&_fontFile, "arial.ttf");
|
||||
|
||||
return InitFont();
|
||||
return initFont();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CBFontTT::ParseLayer(CBTTFontLayer *Layer, byte *Buffer) {
|
||||
HRESULT CBFontTT::parseLayer(CBTTFontLayer *Layer, byte *Buffer) {
|
||||
TOKEN_TABLE_START(commands)
|
||||
TOKEN_TABLE(OFFSET_X)
|
||||
TOKEN_TABLE(OFFSET_Y)
|
||||
@ -629,12 +629,12 @@ HRESULT CBFontTT::persist(CBPersistMgr *persistMgr) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::AfterLoad() {
|
||||
InitFont();
|
||||
void CBFontTT::afterLoad() {
|
||||
initFont();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CBFontTT::InitFont() {
|
||||
HRESULT CBFontTT::initFont() {
|
||||
if (!_fontFile) return E_FAIL;
|
||||
|
||||
Common::SeekableReadStream *file = Game->_fileManager->openFile(_fontFile);
|
||||
@ -833,7 +833,7 @@ void CBFontTT::WrapText(const WideString &text, int maxWidth, int maxHeight, Tex
|
||||
}
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBFontTT::MeasureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
|
||||
void CBFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
|
||||
//TextLineList lines;
|
||||
// TODO: This function gets called a lot, so warnings like these drown out the usefull information
|
||||
static bool hasWarned = false;
|
||||
@ -852,7 +852,7 @@ void CBFontTT::MeasureText(const WideString &text, int maxWidth, int maxHeight,
|
||||
|
||||
//WrapText(text, maxWidth, maxHeight, lines);
|
||||
|
||||
textHeight = (int)(lines.size() * GetLineHeight());
|
||||
textHeight = (int)(lines.size() * getLineHeight());
|
||||
} else {
|
||||
textWidth = _font->getStringWidth(text);
|
||||
textHeight = _fontHeight;
|
||||
|
@ -118,34 +118,34 @@ public:
|
||||
CBFontTT(CBGame *inGame);
|
||||
virtual ~CBFontTT(void);
|
||||
|
||||
virtual int GetTextWidth(byte *text, int maxLenght = -1);
|
||||
virtual int GetTextHeight(byte *text, int width);
|
||||
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLenght = -1);
|
||||
virtual int GetLetterHeight();
|
||||
virtual int getTextWidth(byte *text, int maxLenght = -1);
|
||||
virtual int getTextHeight(byte *text, int width);
|
||||
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLenght = -1);
|
||||
virtual int getLetterHeight();
|
||||
|
||||
HRESULT loadBuffer(byte *buffer);
|
||||
HRESULT loadFile(const char *filename);
|
||||
|
||||
float GetLineHeight() const {
|
||||
float getLineHeight() const {
|
||||
return _lineHeight;
|
||||
}
|
||||
|
||||
void AfterLoad();
|
||||
void InitLoop();
|
||||
void afterLoad();
|
||||
void initLoop();
|
||||
|
||||
private:
|
||||
HRESULT ParseLayer(CBTTFontLayer *layer, byte *buffer);
|
||||
HRESULT parseLayer(CBTTFontLayer *layer, byte *buffer);
|
||||
|
||||
void WrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines);
|
||||
void MeasureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);
|
||||
void wrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines);
|
||||
void measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);
|
||||
|
||||
CBSurface *RenderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset);
|
||||
void BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect);
|
||||
CBSurface *renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset);
|
||||
void blitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect);
|
||||
|
||||
|
||||
CBCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS];
|
||||
|
||||
HRESULT InitFont();
|
||||
HRESULT initFont();
|
||||
|
||||
Graphics::Font *_deletableFont;
|
||||
const Graphics::Font *_font;
|
||||
@ -171,7 +171,7 @@ public:
|
||||
char *_fontFile;
|
||||
|
||||
CBArray<CBTTFontLayer *, CBTTFontLayer *> _layers;
|
||||
void ClearCache();
|
||||
void clearCache();
|
||||
|
||||
};
|
||||
|
||||
|
@ -2777,8 +2777,8 @@ HRESULT CBGame::DisplayQuickMsg() {
|
||||
|
||||
// display
|
||||
for (i = 0; i < _quickMessages.GetSize(); i++) {
|
||||
_systemFont->DrawText((byte *)_quickMessages[i]->GetText(), 0, PosY, _renderer->_width);
|
||||
PosY += _systemFont->GetTextHeight((byte *)_quickMessages[i]->GetText(), _renderer->_width);
|
||||
_systemFont->drawText((byte *)_quickMessages[i]->GetText(), 0, PosY, _renderer->_width);
|
||||
PosY += _systemFont->getTextHeight((byte *)_quickMessages[i]->GetText(), _renderer->_width);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@ -3350,7 +3350,7 @@ HRESULT CBGame::InitAfterLoad() {
|
||||
CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadScript, "CScScript", NULL);
|
||||
|
||||
_scEngine->RefreshScriptBreakpoints();
|
||||
if (_store) _store->AfterLoad();
|
||||
if (_store) _store->afterLoad();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -3374,12 +3374,12 @@ void CBGame::AfterLoadSound(void *Sound, void *Data) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBGame::AfterLoadFont(void *Font, void *Data) {
|
||||
((CBFont *)Font)->AfterLoad();
|
||||
((CBFont *)Font)->afterLoad();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBGame::AfterLoadScript(void *script, void *data) {
|
||||
((CScScript *)script)->AfterLoad();
|
||||
((CScScript *)script)->afterLoad();
|
||||
}
|
||||
|
||||
|
||||
@ -4408,7 +4408,7 @@ HRESULT CBGame::DisplayDebugInfo() {
|
||||
|
||||
if (_dEBUG_ShowFPS) {
|
||||
sprintf(str, "FPS: %d", Game->_fps);
|
||||
_systemFont->DrawText((byte *)str, 0, 0, 100, TAL_LEFT);
|
||||
_systemFont->drawText((byte *)str, 0, 0, 100, TAL_LEFT);
|
||||
}
|
||||
|
||||
if (Game->_dEBUG_DebugMode) {
|
||||
@ -4420,23 +4420,23 @@ HRESULT CBGame::DisplayDebugInfo() {
|
||||
strcat(str, " (");
|
||||
strcat(str, _renderer->getName());
|
||||
strcat(str, ")");
|
||||
_systemFont->DrawText((byte *)str, 0, 0, _renderer->_width, TAL_RIGHT);
|
||||
_systemFont->drawText((byte *)str, 0, 0, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
_renderer->displayDebugInfo();
|
||||
|
||||
int ScrTotal, ScrRunning, ScrWaiting, ScrPersistent;
|
||||
ScrTotal = _scEngine->GetNumScripts(&ScrRunning, &ScrWaiting, &ScrPersistent);
|
||||
sprintf(str, "Running scripts: %d (r:%d w:%d p:%d)", ScrTotal, ScrRunning, ScrWaiting, ScrPersistent);
|
||||
_systemFont->DrawText((byte *)str, 0, 70, _renderer->_width, TAL_RIGHT);
|
||||
_systemFont->drawText((byte *)str, 0, 70, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
|
||||
sprintf(str, "Timer: %d", _timer);
|
||||
Game->_systemFont->DrawText((byte *)str, 0, 130, _renderer->_width, TAL_RIGHT);
|
||||
Game->_systemFont->drawText((byte *)str, 0, 130, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
if (_activeObject != NULL) _systemFont->DrawText((byte *)_activeObject->_name, 0, 150, _renderer->_width, TAL_RIGHT);
|
||||
if (_activeObject != NULL) _systemFont->drawText((byte *)_activeObject->_name, 0, 150, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
sprintf(str, "GfxMem: %dMB", _usedMem / (1024 * 1024));
|
||||
_systemFont->DrawText((byte *)str, 0, 170, _renderer->_width, TAL_RIGHT);
|
||||
_systemFont->drawText((byte *)str, 0, 170, _renderer->_width, TAL_RIGHT);
|
||||
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ HRESULT CSXStore::persist(CBPersistMgr *persistMgr) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSXStore::AfterLoad() {
|
||||
void CSXStore::afterLoad() {
|
||||
if (_eventsEnabled) {
|
||||
SetEventsEnabled(NULL, true);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
virtual CScValue *scGetProperty(const char *Name);
|
||||
virtual HRESULT scCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisStack, const char *Name);
|
||||
|
||||
void AfterLoad();
|
||||
void afterLoad();
|
||||
void OnObjectDestroyed(CBScriptHolder *obj);
|
||||
|
||||
bool IsAvailable();
|
||||
|
@ -1581,7 +1581,7 @@ bool CScScript::DbgGetTracingMode() {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CScScript::AfterLoad() {
|
||||
void CScScript::afterLoad() {
|
||||
if (_buffer == NULL) {
|
||||
byte *buffer = _engine->GetCompiledScript(_filename, &_bufferSize);
|
||||
if (!buffer) {
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
HRESULT FinishThreads();
|
||||
HRESULT CopyParameters(CScStack *Stack);
|
||||
|
||||
void AfterLoad();
|
||||
void afterLoad();
|
||||
|
||||
#ifdef __WIN32__
|
||||
static uint32 Call_cdecl(const void *args, size_t sz, uint32 func, bool *StackCorrupt);
|
||||
|
@ -565,8 +565,8 @@ void CUIButton::CorrectSize() {
|
||||
|
||||
if (_text) {
|
||||
int text_height;
|
||||
if (_font) text_height = _font->GetTextHeight((byte *)_text, _width);
|
||||
else text_height = Game->_systemFont->GetTextHeight((byte *)_text, _width);
|
||||
if (_font) text_height = _font->getTextHeight((byte *)_text, _width);
|
||||
else text_height = Game->_systemFont->getTextHeight((byte *)_text, _width);
|
||||
|
||||
if (text_height > _height) _height = text_height;
|
||||
}
|
||||
@ -634,8 +634,8 @@ HRESULT CUIButton::display(int OffsetX, int OffsetY) {
|
||||
if (image) image->Draw(ImageX + ((_press || _oneTimePress) && back ? 1 : 0), ImageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
|
||||
|
||||
if (font && _text) {
|
||||
int text_offset = (_height - font->GetTextHeight((byte *)_text, _width)) / 2;
|
||||
font->DrawText((byte *)_text, OffsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), OffsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
|
||||
int text_offset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
|
||||
font->drawText((byte *)_text, OffsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), OffsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
|
||||
}
|
||||
|
||||
if (!_pixelPerfect || !_image) Game->_renderer->_rectList.Add(new CBActiveRect(Game, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
|
||||
|
@ -573,13 +573,13 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
_selEnd = MIN((size_t)_selEnd, strlen(_text));
|
||||
|
||||
//int CursorWidth = font->GetCharWidth(_cursorChar[0]);
|
||||
int CursorWidth = font->GetTextWidth((byte *)_cursorChar);
|
||||
int CursorWidth = font->getTextWidth((byte *)_cursorChar);
|
||||
|
||||
int s1, s2;
|
||||
bool CurFirst;
|
||||
// modify scroll offset
|
||||
if (_selStart >= _selEnd) {
|
||||
while (font->GetTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - CursorWidth - 2 * _frameWidth) {
|
||||
while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - CursorWidth - 2 * _frameWidth) {
|
||||
_scrollOffset++;
|
||||
if (_scrollOffset >= (int)strlen(_text)) break;
|
||||
}
|
||||
@ -590,8 +590,8 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
s2 = _selStart;
|
||||
CurFirst = true;
|
||||
} else {
|
||||
while (font->GetTextWidth((byte *)_text + _scrollOffset, MAX(0, _selStart - _scrollOffset)) +
|
||||
sfont->GetTextWidth((byte *)(_text + MAX(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart))
|
||||
while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selStart - _scrollOffset)) +
|
||||
sfont->getTextWidth((byte *)(_text + MAX(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart))
|
||||
|
||||
> _width - CursorWidth - 2 * _frameWidth) {
|
||||
_scrollOffset++;
|
||||
@ -616,7 +616,7 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
yyy = _posY + _frameWidth + OffsetY;
|
||||
|
||||
width = _posX + _width + OffsetX - _frameWidth;
|
||||
height = MAX(font->GetLetterHeight(), sfont->GetLetterHeight());
|
||||
height = MAX(font->getLetterHeight(), sfont->getLetterHeight());
|
||||
|
||||
if (Game->_textRTL) xxx += AlignOffset;
|
||||
|
||||
@ -625,9 +625,9 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
|
||||
// unselected 1
|
||||
if (s1 > _scrollOffset) {
|
||||
if (Count) font->DrawText((byte *)_text + _scrollOffset, xxx, yyy, width - xxx, Align, height, s1 - _scrollOffset);
|
||||
xxx += font->GetTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
|
||||
AlignOffset += font->GetTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
|
||||
if (Count) font->drawText((byte *)_text + _scrollOffset, xxx, yyy, width - xxx, Align, height, s1 - _scrollOffset);
|
||||
xxx += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
|
||||
AlignOffset += font->getTextWidth((byte *)_text + _scrollOffset, s1 - _scrollOffset);
|
||||
}
|
||||
|
||||
// cursor
|
||||
@ -638,7 +638,7 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
_cursorVisible = !_cursorVisible;
|
||||
}
|
||||
if (_cursorVisible)
|
||||
font->DrawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
|
||||
font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
|
||||
}
|
||||
xxx += CursorWidth;
|
||||
AlignOffset += CursorWidth;
|
||||
@ -648,9 +648,9 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
int s3 = MAX(s1, _scrollOffset);
|
||||
|
||||
if (s2 - s3 > 0) {
|
||||
if (Count) sfont->DrawText((byte *)_text + s3, xxx, yyy, width - xxx, Align, height, s2 - s3);
|
||||
xxx += sfont->GetTextWidth((byte *)_text + s3, s2 - s3);
|
||||
AlignOffset += sfont->GetTextWidth((byte *)_text + s3, s2 - s3);
|
||||
if (Count) sfont->drawText((byte *)_text + s3, xxx, yyy, width - xxx, Align, height, s2 - s3);
|
||||
xxx += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
|
||||
AlignOffset += sfont->getTextWidth((byte *)_text + s3, s2 - s3);
|
||||
}
|
||||
|
||||
// cursor
|
||||
@ -661,15 +661,15 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
|
||||
_cursorVisible = !_cursorVisible;
|
||||
}
|
||||
if (_cursorVisible)
|
||||
font->DrawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
|
||||
font->drawText((byte *)_cursorChar, xxx, yyy, width - xxx, Align, height, 1);
|
||||
}
|
||||
xxx += CursorWidth;
|
||||
AlignOffset += CursorWidth;
|
||||
}
|
||||
|
||||
// unselected 2
|
||||
if (Count) font->DrawText((byte *)_text + s2, xxx, yyy, width - xxx, Align, height);
|
||||
AlignOffset += font->GetTextWidth((byte *)_text + s2);
|
||||
if (Count) font->drawText((byte *)_text + s2, xxx, yyy, width - xxx, Align, height);
|
||||
AlignOffset += font->getTextWidth((byte *)_text + s2);
|
||||
|
||||
AlignOffset = (_width - 2 * _frameWidth) - AlignOffset;
|
||||
if (AlignOffset < 0) AlignOffset = 0;
|
||||
|
@ -79,12 +79,12 @@ HRESULT CUIText::display(int OffsetX, int OffsetY) {
|
||||
text_offset = 0;
|
||||
break;
|
||||
case VAL_BOTTOM:
|
||||
text_offset = _height - font->GetTextHeight((byte *)_text, _width);
|
||||
text_offset = _height - font->getTextHeight((byte *)_text, _width);
|
||||
break;
|
||||
default:
|
||||
text_offset = (_height - font->GetTextHeight((byte *)_text, _width)) / 2;
|
||||
text_offset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
|
||||
}
|
||||
font->DrawText((byte *)_text, OffsetX + _posX, OffsetY + _posY + text_offset, _width, _textAlign, _height);
|
||||
font->drawText((byte *)_text, OffsetX + _posX, OffsetY + _posY + text_offset, _width, _textAlign, _height);
|
||||
}
|
||||
|
||||
//Game->_renderer->_rectList.Add(new CBActiveRect(Game, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
|
||||
@ -392,7 +392,7 @@ HRESULT CUIText::scCallMethod(CScScript *Script, CScStack *Stack, CScStack *This
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
else if (strcmp(Name, "HeightToFit") == 0) {
|
||||
Stack->CorrectParams(0);
|
||||
if (_font && _text) _height = _font->GetTextHeight((byte *)_text, _width);
|
||||
if (_font && _text) _height = _font->getTextHeight((byte *)_text, _width);
|
||||
Stack->PushNULL();
|
||||
return S_OK;
|
||||
}
|
||||
@ -480,8 +480,8 @@ HRESULT CUIText::persist(CBPersistMgr *persistMgr) {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT CUIText::SizeToFit() {
|
||||
if (_font && _text) {
|
||||
_width = _font->GetTextWidth((byte *)_text);
|
||||
_height = _font->GetTextHeight((byte *)_text, _width);
|
||||
_width = _font->getTextWidth((byte *)_text);
|
||||
_height = _font->getTextHeight((byte *)_text, _width);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ HRESULT CUIWindow::display(int OffsetX, int OffsetY) {
|
||||
if (image) image->Draw(_posX + OffsetX, _posY + OffsetY, _transparent ? NULL : this);
|
||||
|
||||
if (!CBPlatform::IsRectEmpty(&_titleRect) && font && _text) {
|
||||
font->DrawText((byte *)_text, _posX + OffsetX + _titleRect.left, _posY + OffsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
|
||||
font->drawText((byte *)_text, _posX + OffsetX + _titleRect.left, _posY + OffsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
|
||||
}
|
||||
|
||||
if (!_transparent && !image) Game->_renderer->_rectList.Add(new CBActiveRect(Game, this, NULL, _posX + OffsetX, _posY + OffsetY, _width, _height, 100, 100, false));
|
||||
|
@ -286,7 +286,7 @@ HRESULT CVidPlayer::display() {
|
||||
if (m_ShowSubtitle) {
|
||||
CBFont *font = Game->_videoFont ? Game->_videoFont : Game->_systemFont;
|
||||
int Height = font->GetTextHeight((BYTE *)m_Subtitles[_currentSubtitle]->_text, Game->_renderer->_width);
|
||||
font->DrawText((byte *)_subtitles[m_CurrentSubtitle]->_text, 0, Game->_renderer->_height - Height - 5, Game->_renderer->_width, TAL_CENTER);
|
||||
font->drawText((byte *)_subtitles[m_CurrentSubtitle]->_text, 0, Game->_renderer->_height - Height - 5, Game->_renderer->_width, TAL_CENTER);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
Loading…
x
Reference in New Issue
Block a user