[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.142,1.143 dialogs.h,1.52,1.53
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Fri May 27 06:15:04 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17266/scumm
Modified Files:
dialogs.cpp dialogs.h
Log Message:
Made ValueDisplayDialog scale itself.
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- dialogs.cpp 20 May 2005 15:03:26 -0000 1.142
+++ dialogs.cpp 27 May 2005 13:14:39 -0000 1.143
@@ -839,24 +839,38 @@
: 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();
- _x = (320 - width) / 2;
+ 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 = (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);
Index: dialogs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- dialogs.h 18 May 2005 09:41:13 -0000 1.52
+++ dialogs.h 27 May 2005 13:14:39 -0000 1.53
@@ -198,11 +198,14 @@
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;
};
More information about the Scummvm-git-logs
mailing list