ScummVM API documentation
sprites.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef MM_SHARED_XEEN_SPRITES_H
23#define MM_SHARED_XEEN_SPRITES_H
24
25#include "common/scummsys.h"
26#include "common/array.h"
27#include "common/file.h"
28#include "graphics/surface.h"
29#include "mm/shared/xeen/file.h"
30#include "mm/shared/xeen/xsurface.h"
31
32namespace MM {
33namespace Xeen {
34class XeenEngine;
35class Window;
36} // namespace Xeen
37
38namespace Shared {
39namespace Xeen {
40
41enum {
42 SCALE_MASK = 0x7FFF, SCALE_ENLARGE = 0x8000
43};
44
45enum SpriteFlags {
46 SPRFLAG_MODE_MASK = 0xF00, SPRFLAG_DRAWER1 = 0x100, SPRFLAG_DRAWER2 = 0x200,
47 SPRFLAG_DRAWER3 = 0x300, SPRFLAG_DRAWER4 = 0x400, SPRFLAG_DRAWER5 = 0x500, SPRFLAG_DRAWER6 = 0x600,
48 SPRFLAG_DRAWER7 = 0x700, SPRFLAG_800 = 0x800, SPRFLAG_SCENE_CLIPPED = 0x2000,
49 SPRFLAG_BOTTOM_CLIPPED = 0x4000, SPRFLAG_HORIZ_FLIPPED = 0x8000, SPRFLAG_RESIZE = 0x10000
50};
51
53protected:
54 struct IndexEntry {
55 uint16 _offset1, _offset2;
57 };
59 size_t _filesize;
60 byte *_data;
61 Common::Path _filename;
62 static int _clippedBottom;
63
68
72 void draw(XSurface &dest, int frame, const Common::Point &destPos,
73 const Common::Rect &bounds, uint flags = 0, int scale = 0) const;
74
78 void copy(const SpriteResource &src);
79public:
81 SpriteResource(const Common::Path &filename);
83
84 virtual ~SpriteResource();
85
90
94 void load(const Common::Path &filename);
95
99 void clear();
100
110 void draw(XSurface &dest, int frame, const Common::Point &destPos,
111 uint flags = 0, int scale = 0) const;
112
118 void draw(XSurface &dest, int frame) const;
119
123 void draw(Graphics::ManagedSurface *dest, int frame, const Common::Point &destPos) const;
124
128 Common::Point getFrameSize(int frame) const;
129
133 size_t size() const {
134 return _index.size();
135 }
136
140 bool empty() const {
141 return _index.size() == 0;
142 }
143
148 static void setClippedBottom(int y) {
149 _clippedBottom = y;
150 }
151};
152
153} // End of namespace Xeen
154} // End of namespace Shared
155} // End of namespace MM
156
157#endif
Definition: array.h:52
size_type size() const
Definition: array.h:316
Definition: path.h:52
Definition: stream.h:745
Definition: managed_surface.h:51
Definition: sprites.h:52
Common::Point getFrameSize(int frame) const
void draw(XSurface &dest, int frame, const Common::Point &destPos, uint flags=0, int scale=0) const
void load(const Common::Path &filename)
bool empty() const
Definition: sprites.h:140
static void setClippedBottom(int y)
Definition: sprites.h:148
void draw(XSurface &dest, int frame) const
void load(Common::SeekableReadStream &f)
SpriteResource & operator=(const SpriteResource &src)
void copy(const SpriteResource &src)
void draw(XSurface &dest, int frame, const Common::Point &destPos, const Common::Rect &bounds, uint flags=0, int scale=0) const
void draw(Graphics::ManagedSurface *dest, int frame, const Common::Point &destPos) const
size_t size() const
Definition: sprites.h:133
Definition: xsurface.h:45
Definition: detection.h:27
Definition: rect.h:144
Definition: rect.h:536
Definition: sprites.h:54