aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/graphics.cpp
diff options
context:
space:
mode:
authorStrangerke2013-09-28 15:08:41 +0200
committerStrangerke2013-09-28 15:08:41 +0200
commit6a7326ec26b4882061a17cf399fa2f685c3d776e (patch)
tree69922d50b87272f69dd9af533e55e7453e8baa11 /engines/avalanche/graphics.cpp
parent0edb0e0434359d5ced78fa4f0a32ed1dafc51103 (diff)
downloadscummvm-rg350-6a7326ec26b4882061a17cf399fa2f685c3d776e.tar.gz
scummvm-rg350-6a7326ec26b4882061a17cf399fa2f685c3d776e.tar.bz2
scummvm-rg350-6a7326ec26b4882061a17cf399fa2f685c3d776e.zip
AVALANCHE: More rework on Graphic code
Diffstat (limited to 'engines/avalanche/graphics.cpp')
-rw-r--r--engines/avalanche/graphics.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 12e43671ee..007c5101f3 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -268,12 +268,12 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y,
return endPoint;
}
-void Graphics::drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) {
+void Graphics::drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) {
while (radius > 0)
- drawArc(surface, x, y, stAngle, endAngle, radius--, color);
+ drawArc(_scrolls, x, y, stAngle, endAngle, radius--, color);
}
-void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, Color color) {
+void Graphics::drawTriangle(Common::Point *p, Color color) {
// Draw the borders with a marking color.
_scrolls.drawLine(p[0].x, p[0].y, p[1].x, p[1].y, 255);
_scrolls.drawLine(p[1].x, p[1].y, p[2].x, p[2].y, 255);
@@ -310,7 +310,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, Colo
_scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color);
}
-void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
+void Graphics::drawText(::Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
for (uint i = 0; i < text.size(); i++) {
for (int j = 0; j < fontHeight; j++) {
byte pixel = font[(byte)text[i]][j];
@@ -323,6 +323,14 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text
}
}
+void Graphics::drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
+ _vm->_graphics->drawText(_surface, text, font, fontHeight, x, y, color);
+}
+
+void Graphics::drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color) {
+ _vm->_graphics->drawText(_scrolls, text, font, fontHeight, x, y, color);
+}
+
void Graphics::drawDigit(int index, int x, int y) {
drawPicture(_surface, _digits[index], x, y);
}
@@ -331,6 +339,30 @@ void Graphics::drawDirection(int index, int x, int y) {
drawPicture(_surface, _directions[index], x, y);
}
+void Graphics::drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2) {
+ for (byte i = 0; i < 2; i ++) {
+ _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite);
+ _scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite);
+
+ _scrolls.fillRect(Common::Rect(x2 - i, y1 + i, x2 - i + 1, y2 - i + 1), kColorDarkgray);
+ _scrolls.fillRect(Common::Rect(x1 + i, y2 - i, x2 - i, y2 - i + 1), kColorDarkgray);
+ }
+}
+
+void Graphics::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) {
+ CursorMan.showMouse(false);
+
+ drawScrollShadow(x1, y1, x2, y2);
+
+ bool offset = text.size() % 2;
+ x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3;
+ y1 = (y2 - y1) / 2 + y1 - 4;
+ drawScrollText(text, _vm->_font, 8, x1, y1, kColorBlue);
+ drawScrollText(Common::String('_'), _vm->_font, 8, x1, y1, kColorBlue);
+
+ CursorMan.showMouse(true);
+}
+
::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) {
// This function mimics Pascal's getimage().
// The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1.
@@ -379,12 +411,16 @@ void Graphics::drawDirection(int index, int x, int y) {
return picture;
}
-void Graphics::prepareAlsoDisplay() {
+void Graphics::clearAlso() {
_magics.fillRect(Common::Rect(0, 0, 640, 200), 0);
_magics.frameRect(Common::Rect(0, 45, 640, 161), 15);
}
-void Graphics::drawAlsoLines(int x1, int y1, int x2, int y2, Color color) {
+void Graphics::clearTextBar() {
+ _surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text.
+}
+
+void Graphics::setAlsoLine(int x1, int y1, int x2, int y2, Color color) {
_magics.drawLine(x1, y1, x2, y2, color);
}