aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/graphics.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-01-08 20:46:58 +0000
committerNicola Mettifogo2008-01-08 20:46:58 +0000
commite21fd496f837dc13a4c232e931767b14fef43940 (patch)
tree903b57f720bd1a277f4b14a15b9e42f8ab1ff8c6 /engines/parallaction/graphics.cpp
parent359f56cd359de69d32cafe3ee180248f21a14099 (diff)
downloadscummvm-rg350-e21fd496f837dc13a4c232e931767b14fef43940.tar.gz
scummvm-rg350-e21fd496f837dc13a4c232e931767b14fef43940.tar.bz2
scummvm-rg350-e21fd496f837dc13a4c232e931767b14fef43940.zip
Restructured label handling and moved all related code to Gfx.
svn-id: r30345
Diffstat (limited to 'engines/parallaction/graphics.cpp')
-rw-r--r--engines/parallaction/graphics.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index a63445117d..fb62c34e87 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -505,6 +505,43 @@ void Gfx::blit(const Common::Rect& r, uint16 z, byte *data, Graphics::Surface *s
}
+#define LABEL_TRANSPARENT_COLOR 0xFF
+
+Label *Gfx::renderFloatingLabel(Font *font, char *text) {
+
+ Label *label = new Label;
+ Graphics::Surface *cnv = &label->_cnv;
+
+ uint w, h;
+
+ if (_vm->getPlatform() == Common::kPlatformAmiga) {
+ w = font->getStringWidth(text) + 16;
+ h = 10;
+
+ cnv->create(w, h, 1);
+ cnv->fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
+
+ font->setColor(7);
+ font->drawString((byte*)cnv->pixels + 1, cnv->w, text);
+ font->drawString((byte*)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
+ font->drawString((byte*)cnv->pixels + cnv->w, cnv->w, text);
+ font->drawString((byte*)cnv->pixels + 2 + cnv->w, cnv->w, text);
+ font->setColor(1);
+ font->drawString((byte*)cnv->pixels + 1 + cnv->w, cnv->w, text);
+ } else {
+ w = font->getStringWidth(text);
+ h = font->height();
+
+ cnv->create(w, h, 1);
+ cnv->fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
+
+ font->drawString((byte*)cnv->pixels, cnv->w, text);
+ }
+
+ return label;
+}
+
+
void Gfx::setLabel(Label *label) {
_label = label;
@@ -544,7 +581,7 @@ void Gfx::drawLabel() {
r.moveTo(_label->_pos);
Graphics::Surface* surf = g_system->lockScreen();
- flatBlit(r, (byte*)_label->_cnv.getBasePtr(0, 0), surf, 0);
+ flatBlit(r, (byte*)_label->_cnv.getBasePtr(0, 0), surf, LABEL_TRANSPARENT_COLOR);
g_system->unlockScreen();
}