aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-27 13:14:39 +0000
committerTorbjörn Andersson2005-05-27 13:14:39 +0000
commitd51198e2b4489ac19cde5f673dee396dcf3034a0 (patch)
treeb2a6c861070ded3d146d8d8522d5b23da4efb62c /scumm
parenteeab93cf0904734ccaffb0d79ce8f657b9846b4a (diff)
downloadscummvm-rg350-d51198e2b4489ac19cde5f673dee396dcf3034a0.tar.gz
scummvm-rg350-d51198e2b4489ac19cde5f673dee396dcf3034a0.tar.bz2
scummvm-rg350-d51198e2b4489ac19cde5f673dee396dcf3034a0.zip
Made ValueDisplayDialog scale itself.
svn-id: r18274
Diffstat (limited to 'scumm')
-rw-r--r--scumm/dialogs.cpp26
-rw-r--r--scumm/dialogs.h3
2 files changed, 23 insertions, 6 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 94009c2c62..387952ffb0 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -839,24 +839,38 @@ ValueDisplayDialog::ValueDisplayDialog(const Common::String& label, int minVal,
: GUI::Dialog(0, 80, 0, 16), _label(label), _min(minVal), _max(maxVal), _value(val), _incKey(incKey), _decKey(decKey) {
assert(_min <= _value && _value <= _max);
- int width = g_gui.getStringWidth(label) + 16 + kPercentBarWidth;
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+
+ if (screenW >= 400 && screenH >= 300) {
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ _percentBarWidth = kBigPercentBarWidth;
+ } else {
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ _percentBarWidth = kPercentBarWidth;
+ }
+
+ int width = _font->getStringWidth(label) + 16 + _percentBarWidth;
+ int height = _font->getFontHeight() + 4 * 2;
- _x = (320 - width) / 2;
+ _x = (screenW - width) / 2;
+ _y = (screenH - height) / 2;
_w = width;
+ _h = height;
}
void ValueDisplayDialog::drawDialog() {
g_gui.blendRect(_x, _y, _w, _h, g_gui._bgcolor);
g_gui.box(_x, _y, _w, _h, g_gui._color, g_gui._shadowcolor);
- const int labelWidth = _w - 8 - kPercentBarWidth;
+ const int labelWidth = _w - 8 - _percentBarWidth;
// Draw the label
- g_gui.drawString(_label, _x + 4, _y + 4, labelWidth, g_gui._textcolor);
+ g_gui.drawString(_font, _label, _x + 4, _y + 4, labelWidth, g_gui._textcolor);
// Draw the percentage bar
- g_gui.fillRect(_x + 4 + labelWidth, _y + 4, kPercentBarWidth * (_value - _min) / (_max - _min), 8, g_gui._textcolorhi);
- g_gui.frameRect(_x + 4 + labelWidth, _y + 4, kPercentBarWidth, 8, g_gui._textcolor);
+ g_gui.fillRect(_x + 4 + labelWidth, _y + 4, _percentBarWidth * (_value - _min) / (_max - _min), _h - 8, g_gui._textcolorhi);
+ g_gui.frameRect(_x + 4 + labelWidth, _y + 4, _percentBarWidth, _h - 8, g_gui._textcolor);
// Flag the draw area as dirty
g_gui.addDirtyRect(_x, _y, _w, _h);
diff --git a/scumm/dialogs.h b/scumm/dialogs.h
index b973f81883..3d7dc90a66 100644
--- a/scumm/dialogs.h
+++ b/scumm/dialogs.h
@@ -198,11 +198,14 @@ public:
protected:
enum {
kPercentBarWidth = 50,
+ kBigPercentBarWidth = 75,
kDisplayDelay = 1500
};
Common::String _label;
+ const Graphics::Font *_font;
const int _min, _max;
const uint16 _incKey, _decKey;
+ int _percentBarWidth;
int _value;
uint32 _timer;
};