2015-03-15 20:52:55 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2015-05-09 16:04:13 +00:00
|
|
|
*
|
2015-03-15 20:52:55 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2015-05-09 16:04:13 +00:00
|
|
|
*
|
2015-03-15 20:52:55 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-11 02:51:47 +00:00
|
|
|
#ifndef SHERLOCK_SURFACE_H
|
|
|
|
#define SHERLOCK_SURFACE_H
|
2015-03-15 20:52:55 +00:00
|
|
|
|
|
|
|
#include "common/rect.h"
|
2015-06-07 15:05:26 +00:00
|
|
|
#include "common/platform.h"
|
2016-05-27 01:48:40 +00:00
|
|
|
#include "graphics/screen.h"
|
2015-06-10 23:46:14 +00:00
|
|
|
#include "sherlock/fonts.h"
|
2016-03-11 02:51:47 +00:00
|
|
|
#include "sherlock/image_file.h"
|
2015-03-15 20:52:55 +00:00
|
|
|
|
|
|
|
namespace Sherlock {
|
|
|
|
|
2015-06-06 19:36:23 +00:00
|
|
|
#define SCALE_THRESHOLD 0x100
|
2015-06-11 12:32:31 +00:00
|
|
|
#define TRANSPARENCY 255
|
2015-06-06 19:36:23 +00:00
|
|
|
|
2016-03-11 02:51:47 +00:00
|
|
|
/**
|
2016-05-27 01:48:40 +00:00
|
|
|
* Implements a base surface that combines both a managed surface and the font
|
2016-03-11 02:51:47 +00:00
|
|
|
* drawing code. It also introduces a series of drawing method stubs that the 3DO
|
|
|
|
* Serrated Scalpel screen overrides to implement sprite doubling
|
|
|
|
*/
|
2016-05-27 01:48:40 +00:00
|
|
|
class BaseSurface: public Graphics::Screen, public Fonts {
|
2016-03-11 02:51:47 +00:00
|
|
|
public:
|
2015-06-06 18:25:09 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Constructor
|
2015-06-06 18:25:09 +00:00
|
|
|
*/
|
2016-05-27 01:48:40 +00:00
|
|
|
BaseSurface();
|
2016-05-28 15:20:50 +00:00
|
|
|
|
2015-05-19 11:37:55 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Constructor
|
2015-05-19 11:37:55 +00:00
|
|
|
*/
|
2016-05-27 01:48:40 +00:00
|
|
|
BaseSurface(int width, int height);
|
2015-06-12 09:59:33 +00:00
|
|
|
|
2015-05-19 11:50:50 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Draws a surface on this surface
|
2015-05-19 11:50:50 +00:00
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual void SHblitFrom(const Graphics::Surface &src) {
|
|
|
|
Graphics::ManagedSurface::blitFrom(src);
|
|
|
|
}
|
2015-05-19 11:50:50 +00:00
|
|
|
|
2015-05-19 11:37:55 +00:00
|
|
|
/**
|
|
|
|
* Draws a surface at a given position within this surface
|
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos) {
|
|
|
|
Graphics::ManagedSurface::blitFrom(src, destPos);
|
|
|
|
}
|
2015-05-19 11:50:50 +00:00
|
|
|
|
2015-05-19 11:37:55 +00:00
|
|
|
/**
|
|
|
|
* Draws a sub-section of a surface at a given position within this surface
|
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos, const Common::Rect &srcBounds) {
|
|
|
|
Graphics::ManagedSurface::blitFrom(src, srcBounds, destPos);
|
|
|
|
}
|
2015-08-02 23:04:48 +00:00
|
|
|
|
2015-05-19 11:37:55 +00:00
|
|
|
/**
|
|
|
|
* Draws an image frame at a given position within this surface with transparency
|
|
|
|
*/
|
2016-10-22 00:01:14 +00:00
|
|
|
virtual void SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
|
2016-03-11 02:51:47 +00:00
|
|
|
bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
|
2015-03-17 03:38:58 +00:00
|
|
|
|
2015-05-19 23:08:48 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Draws an image frame at a given position within this surface with transparency
|
2015-05-19 23:08:48 +00:00
|
|
|
*/
|
2016-10-22 00:01:14 +00:00
|
|
|
virtual void SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
|
2016-03-11 02:51:47 +00:00
|
|
|
bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
|
2015-05-19 23:08:48 +00:00
|
|
|
|
2015-05-19 11:37:55 +00:00
|
|
|
/**
|
|
|
|
* Fill a given area of the surface with a given color
|
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual void SHfillRect(const Common::Rect &r, uint color) {
|
|
|
|
Graphics::ManagedSurface::fillRect(r, color);
|
|
|
|
}
|
2015-05-19 13:10:35 +00:00
|
|
|
|
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Return the width of the surface
|
2015-05-19 13:10:35 +00:00
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual uint16 width() const { return this->w; }
|
2016-05-28 15:20:50 +00:00
|
|
|
|
2015-06-15 23:53:50 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Return the height of the surface
|
2015-06-15 23:53:50 +00:00
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
virtual uint16 height() const { return this->h; }
|
2015-06-15 23:53:50 +00:00
|
|
|
|
2015-05-19 13:10:35 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Draws the given string into the back buffer using the images stored in _font
|
2015-05-19 13:10:35 +00:00
|
|
|
*/
|
2016-03-11 02:51:47 +00:00
|
|
|
void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor);
|
2016-05-28 15:20:50 +00:00
|
|
|
|
2015-06-11 00:54:05 +00:00
|
|
|
/**
|
2016-03-11 02:51:47 +00:00
|
|
|
* Draws a fancy version of the given string at the given position
|
2015-06-11 00:54:05 +00:00
|
|
|
*/
|
2015-09-09 12:15:59 +00:00
|
|
|
void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2);
|
2015-03-15 21:25:21 +00:00
|
|
|
};
|
|
|
|
|
2016-05-27 01:48:40 +00:00
|
|
|
class Surface : public BaseSurface {
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Override the addDirtyRect from Graphics::Screen, since for standard
|
|
|
|
* surfaces we don't need dirty rects to be tracked
|
|
|
|
*/
|
|
|
|
virtual void addDirtyRect(const Common::Rect &r) {}
|
|
|
|
public:
|
|
|
|
Surface() : BaseSurface() {}
|
2016-08-01 08:46:18 +00:00
|
|
|
Surface(int width_, int height_) : BaseSurface(width_, height_) {}
|
2016-05-27 01:48:40 +00:00
|
|
|
};
|
|
|
|
|
2015-03-15 20:52:55 +00:00
|
|
|
} // End of namespace Sherlock
|
|
|
|
|
|
|
|
#endif
|