ZVISION: Let the cursor manager do pixel format conversion for cursors

This commit is contained in:
Filippos Karapetis 2014-12-24 22:29:52 +02:00
parent 1bc9b13357
commit 84341a889c
4 changed files with 5 additions and 8 deletions

View File

@ -57,12 +57,9 @@ ZorkCursor::ZorkCursor(ZVision *engine, const Common::String &fileName)
_height = file.readUint16LE();
uint dataSize = _width * _height * sizeof(uint16);
_surface.create(_width, _height, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
_surface.create(_width, _height, engine->_resourcePixelFormat);
uint32 bytesRead = file.read(_surface.getPixels(), dataSize);
assert(bytesRead == dataSize);
// Convert to RGB 565
_surface.convertToInPlace(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
}
ZorkCursor::ZorkCursor(const ZorkCursor &other) {

View File

@ -45,7 +45,7 @@ const char *CursorManager::_zNemCursorFileNames[NUM_CURSORS] = { "00act", "arrow
"hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up"
};
CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat)
CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat pixelFormat)
: _engine(engine),
_pixelFormat(pixelFormat),
_cursorIsPushed(false),

View File

@ -58,7 +58,7 @@ enum CursorIndex {
*/
class CursorManager {
public:
CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat);
CursorManager(ZVision *engine, const Graphics::PixelFormat pixelFormat);
private:
static const int NUM_CURSORS = 18;
@ -67,7 +67,7 @@ private:
ZorkCursor _cursors[NUM_CURSORS + 2][2];
ZVision *_engine;
const Graphics::PixelFormat *_pixelFormat;
const Graphics::PixelFormat _pixelFormat;
bool _cursorIsPushed;
int _item;
int _lastitem;

View File

@ -194,7 +194,7 @@ void ZVision::initialize() {
_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _screenPixelFormat);
_saveManager = new SaveManager(this);
_stringManager = new StringManager(this);
_cursorManager = new CursorManager(this, &_screenPixelFormat);
_cursorManager = new CursorManager(this, _resourcePixelFormat);
_textRenderer = new TextRenderer(this);
_midiManager = new MidiManager();