[Scummvm-cvs-logs] CVS: scummvm/gui newgui.cpp,1.110,1.111 newgui.h,1.57,1.58 widget.cpp,1.45,1.46
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Thu May 12 08:49:56 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.87,1.88 interface.h,1.46,1.47 saveload.cpp,1.6,1.7 sthread.cpp,1.80,1.81
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.h,1.47,1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30041
Modified Files:
newgui.cpp newgui.h widget.cpp
Log Message:
Quick fix to make button texts etc. draw at the correct position. (They
were being drawn at unscaled coordinates.) I don't know if this is the
correct fix, but the change is small and easy to revert, if need be.
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- newgui.cpp 8 May 2005 21:49:41 -0000 1.110
+++ newgui.cpp 12 May 2005 15:46:02 -0000 1.111
@@ -464,6 +464,10 @@
getFont().drawString(&_screen, s, x * _scaleFactor, y * _scaleFactor, w * _scaleFactor, color, align, deltax, useEllipsis);
}
+void NewGui::drawString(const Graphics::Font *font, const String &s, int x, int y, int w, OverlayColor color, TextAlignment valign) {
+ font->drawString(&_screen, s, x * _scaleFactor, y * _scaleFactor, w * _scaleFactor, color, valign);
+}
+
//
// Draw an 8x8 bitmap at location (x,y)
//
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- newgui.h 11 May 2005 19:30:29 -0000 1.57
+++ newgui.h 12 May 2005 15:46:02 -0000 1.58
@@ -154,6 +154,7 @@
void drawChar(byte c, int x, int y, OverlayColor color, const Graphics::Font *font = 0);
void drawString(const String &str, int x, int y, int w, OverlayColor color, Graphics::TextAlignment align = Graphics::kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
+ void drawString(const Graphics::Font *font, const String &str, int x, int y, int w, OverlayColor color, Graphics::TextAlignment valign = Graphics::kTextAlignLeft);
int getStringWidth(const String &str) const;
int getCharWidth(byte c) const;
Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- widget.cpp 11 May 2005 19:30:28 -0000 1.45
+++ widget.cpp 12 May 2005 15:46:03 -0000 1.46
@@ -150,7 +150,7 @@
void StaticTextWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
- _font->drawString(&gui->getScreen(), _label, _x, _y, _w, isEnabled() ? gui->_textcolor : gui->_color, _align);
+ gui->drawString(_font, _label, _x, _y, _w, isEnabled() ? gui->_textcolor : gui->_color, _align);
}
#pragma mark -
@@ -169,7 +169,11 @@
void ButtonWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
- _font->drawString(&gui->getScreen(), _label, _x, _y + (_h - (_font->getFontHeight() + 2))/2 + 1, _w,
+ // HACK: Subtracting 1 from _y isn't very nice when we don't know
+ // anything about the size of the font. But we can't use the size of
+ // the font either, because we don't know how the coordinates will be
+ // scaled.
+ gui->drawString(_font, _label, _x, _y - 1, _w,
!isEnabled() ? gui->_color :
hilite ? gui->_textcolorhi : gui->_textcolor, _align);
}
@@ -221,7 +225,7 @@
gui->drawBitmap(checked_img, _x + 4, _y + 3, isEnabled() ? gui->_textcolor : gui->_color);
// Finally draw the label
- _font->drawString(&g_gui.getScreen(), _label, _x + 20, _y + 3, _w, isEnabled() ? gui->_textcolor : gui->_color);
+ gui->drawString(_font, _label, _x + 20, _y + 3, _w, isEnabled() ? gui->_textcolor : gui->_color);
}
#pragma mark -
@@ -269,7 +273,7 @@
// Draw the label, if any
if (_labelWidth > 0)
- _font->drawString(&g_gui.getScreen(), _label, _x, _y + 2, _labelWidth, isEnabled() ? gui->_textcolor : gui->_color, kTextAlignRight);
+ gui->drawString(_font, _label, _x, _y + 2, _labelWidth, isEnabled() ? gui->_textcolor : gui->_color, kTextAlignRight);
// Draw the box
gui->box(_x + _labelWidth, _y, _w - _labelWidth, _h, gui->_color, gui->_shadowcolor);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.87,1.88 interface.h,1.46,1.47 saveload.cpp,1.6,1.7 sthread.cpp,1.80,1.81
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga interface.h,1.47,1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list