mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 15:41:41 +00:00
Improved text handling.
Fixed About dialog scroll-out text. svn-id: r33257
This commit is contained in:
parent
4135134aea
commit
7f0aa32d51
@ -275,7 +275,7 @@ inline uint32 fp_sqroot(uint32 x) {
|
||||
template <typename PixelType, typename PixelFormat>
|
||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||
drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area,
|
||||
GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) {
|
||||
GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) {
|
||||
|
||||
int offset = 0;
|
||||
|
||||
@ -291,7 +291,7 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common:
|
||||
break;
|
||||
}
|
||||
|
||||
font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, 0, false);
|
||||
font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, false);
|
||||
}
|
||||
|
||||
/** LINES **/
|
||||
|
@ -407,7 +407,7 @@ public:
|
||||
*/
|
||||
virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) = 0;
|
||||
|
||||
virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) = 0;
|
||||
virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) = 0;
|
||||
|
||||
virtual void disableShadows() { _disableShadows = true; }
|
||||
virtual void enableShadows() { _disableShadows = false; }
|
||||
@ -486,7 +486,7 @@ public:
|
||||
|
||||
void drawString(const Graphics::Font *font, const Common::String &text,
|
||||
const Common::Rect &area, GUI::Theme::TextAlign alignH,
|
||||
GUI::Theme::TextAlignVertical alignV);
|
||||
GUI::Theme::TextAlignVertical alignV, int deltax);
|
||||
|
||||
/**
|
||||
* @see VectorRenderer::setFgColor()
|
||||
|
@ -270,10 +270,7 @@ bool ThemeRenderer::loadTheme(Common::String themeName) {
|
||||
|
||||
for (int i = 0; i < kDrawDataMAX; ++i) {
|
||||
if (_widgets[i] == 0) {
|
||||
#ifdef REQUIRE_ALL_DD_SETS
|
||||
warning("Error when parsing custom theme '%s': Missing data assets.", themeName.c_str());
|
||||
return false;
|
||||
#endif
|
||||
warning("Missing data asset: '%s'", kDrawDataDefaults[i].name);
|
||||
} else {
|
||||
calcBackgroundOffset((DrawData)i);
|
||||
|
||||
@ -341,7 +338,7 @@ void ThemeRenderer::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic
|
||||
}
|
||||
|
||||
void ThemeRenderer::queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg,
|
||||
bool elipsis, TextAlign alignH, TextAlignVertical alignV) {
|
||||
bool elipsis, TextAlign alignH, TextAlignVertical alignV, int deltax) {
|
||||
|
||||
if (_texts[type] == 0)
|
||||
return;
|
||||
@ -354,6 +351,7 @@ void ThemeRenderer::queueDDText(TextData type, const Common::Rect &r, const Comm
|
||||
q.alignH = alignH;
|
||||
q.alignV = alignV;
|
||||
q.restoreBg = restoreBg;
|
||||
q.deltax = deltax;
|
||||
|
||||
if (_buffering) {
|
||||
_textQueue.push_back(q);
|
||||
@ -389,7 +387,7 @@ void ThemeRenderer::drawDDText(const DrawQueueText &q) {
|
||||
restoreBackground(q.area);
|
||||
|
||||
_vectorRenderer->setFgColor(_texts[q.type]->_color.r, _texts[q.type]->_color.g, _texts[q.type]->_color.b);
|
||||
_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV);
|
||||
_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax);
|
||||
addDirtyRect(q.area);
|
||||
}
|
||||
|
||||
@ -567,21 +565,21 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
||||
|
||||
if (inverted) {
|
||||
queueDD(kDDTextSelectionBackground, r);
|
||||
queueDDText(kTextDataInverted, r, str, false, useEllipsis);
|
||||
queueDDText(kTextDataInverted, r, str, false, useEllipsis, align);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case kStateDisabled:
|
||||
queueDDText(kTextDataDisabled, r, str, true, useEllipsis);
|
||||
queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align);
|
||||
break;
|
||||
|
||||
case kStateHighlight:
|
||||
queueDDText(kTextDataHover, r, str, true, useEllipsis);
|
||||
queueDDText(kTextDataHover, r, str, true, useEllipsis, align);
|
||||
break;
|
||||
|
||||
case kStateEnabled:
|
||||
queueDDText(kTextDataDefault, r, str, true, useEllipsis);
|
||||
queueDDText(kTextDataDefault, r, str, true, useEllipsis, align);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +181,7 @@ protected:
|
||||
GUI::Theme::TextAlignVertical alignV;
|
||||
bool elipsis;
|
||||
bool restoreBg;
|
||||
int deltax;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -550,7 +551,7 @@ protected:
|
||||
*/
|
||||
inline void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0);
|
||||
inline void queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg,
|
||||
bool elipsis, TextAlign alignH = kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop);
|
||||
bool elipsis, TextAlign alignH = kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0);
|
||||
|
||||
/**
|
||||
* DEBUG: Draws a white square around the given position and writes the given next to it.
|
||||
|
@ -203,7 +203,7 @@ void AboutDialog::close() {
|
||||
}
|
||||
|
||||
void AboutDialog::drawDialog() {
|
||||
g_gui.theme()->setDrawArea(Common::Rect(_x, _y, _x+_w, _y+_h));
|
||||
// g_gui.theme()->setDrawArea(Common::Rect(_x, _y, _x+_w, _y+_h));
|
||||
Dialog::drawDialog();
|
||||
|
||||
// Draw text
|
||||
@ -265,10 +265,10 @@ void AboutDialog::drawDialog() {
|
||||
while (*str && *str == ' ')
|
||||
str++;
|
||||
|
||||
if (y > _y && y + g_gui.theme()->getFontHeight() < _y + _h)
|
||||
g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, false, 0, false);
|
||||
y += _lineHeight;
|
||||
}
|
||||
g_gui.theme()->resetDrawArea();
|
||||
}
|
||||
|
||||
void AboutDialog::handleTickle() {
|
||||
|
Loading…
Reference in New Issue
Block a user