scummvm/engines/xeen/resources.h

108 lines
2.6 KiB
C
Raw Normal View History

2014-12-24 09:58:47 +11: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.
* 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.
* 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.
*
*/
#ifndef XEEN_RESOURCES_H
#define XEEN_RESOURCES_H
#include "common/scummsys.h"
#include "common/array.h"
2014-12-24 09:58:47 +11:00
#include "common/file.h"
#include "graphics/surface.h"
#include "xeen/xsurface.h"
2014-12-24 09:58:47 +11:00
namespace Xeen {
class XeenEngine;
class Resources {
public:
/**
* Instantiates the resource manager
*/
static void init(XeenEngine *vm);
};
/**
* Derived file class
*/
class File : public Common::File {
public:
File() : Common::File() {}
File(const Common::String &filename) { openFile(filename); }
virtual ~File() {}
2014-12-24 09:58:47 +11:00
void openFile(const Common::String &filename);
};
2014-12-30 10:22:05 -10:00
class GraphicResource {
protected:
int32 _filesize;
byte *_data;
void drawOffset(XSurface &dest, uint16 offset, const Common::Point &destPos) const;
public:
GraphicResource(const Common::String &filename);
virtual ~GraphicResource();
int size() const;
};
/**
* Defines a resource that Contains a list of singular sprite frames
*/
class FramesResource : public GraphicResource {
private:
Common::Array<uint32> _index;
public:
FramesResource(const Common::String &filename);
virtual ~FramesResource() {}
void draw(XSurface &dest, int frame, const Common::Point &destPos) const;
void draw(XSurface &dest, int frame) const;
};
/**
* Defines a resource that contains sets of two layered sprites per frame
*/
class SpriteResource : public GraphicResource {
private:
struct IndexEntry {
uint16 _offset1, _offset2;
};
Common::Array<IndexEntry> _index;
public:
SpriteResource(const Common::String &filename);
2014-12-30 10:22:05 -10:00
virtual ~SpriteResource() {}
void draw(XSurface &dest, int frame, const Common::Point &destPos) const;
void draw(XSurface &dest, int frame) const;
};
} // End of namespace Xeen
2014-12-24 09:58:47 +11:00
#endif /* MADS_RESOURCES_H */