ScummVM API documentation
aniobject.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_ANIOBJECT_H
29#define GOB_ANIOBJECT_H
30
31#include "common/system.h"
32
33#include "gob/backbuffer.h"
34
35namespace Gob {
36
37class ANIFile;
38class CMPFile;
39class Surface;
40
42class ANIObject : public BackBuffer {
43public:
44 enum Mode {
47 };
48
50 ANIObject(const ANIFile &ani);
52 ANIObject(const CMPFile &cmp);
53 virtual ~ANIObject();
54
56 void setVisible(bool visible);
57
59 bool isVisible() const;
60
62 void setPause(bool pause);
63
65 bool isPaused() const;
66
68 void setMode(Mode mode);
69
71 virtual void setPosition();
73 virtual void setPosition(int16 x, int16 y);
74
76 void getPosition(int16 &x, int16 &y) const;
77
79 void getFramePosition(int16 &x, int16 &y, uint16 n = 0) const;
81 void getFrameSize(int16 &width, int16 &height, uint16 n = 0) const;
82
84 bool isIn(int16 x, int16 y) const;
86 bool isIn(const ANIObject &obj) const;
87
89 void setAnimation(uint16 animation);
90
92 void rewind();
93
95 void setFrame(uint16 frame);
96
98 uint16 getAnimation() const;
100 uint16 getFrame() const;
101
103 bool lastFrame() const;
104
106 virtual bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
108 virtual bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
109
111 virtual void advance();
112
113private:
114 const ANIFile *_ani;
115 const CMPFile *_cmp;
116
117 uint16 _animation;
118 uint16 _frame;
119
120 bool _visible;
121 bool _paused;
122
123 Mode _mode;
124
125 int16 _x;
126 int16 _y;
127
128
129 bool drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
130 bool drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
131};
132
133} // End of namespace Gob
134
135#endif // GOB_ANIOBJECT_H
Definition: anifile.h:53
Definition: aniobject.h:42
virtual bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom)
bool lastFrame() const
void setAnimation(uint16 animation)
void getFrameSize(int16 &width, int16 &height, uint16 n=0) const
bool isIn(int16 x, int16 y) const
void setPause(bool pause)
bool isPaused() const
void setVisible(bool visible)
ANIObject(const CMPFile &cmp)
void setFrame(uint16 frame)
uint16 getFrame() const
virtual void setPosition(int16 x, int16 y)
bool isIn(const ANIObject &obj) const
void getFramePosition(int16 &x, int16 &y, uint16 n=0) const
void getPosition(int16 &x, int16 &y) const
virtual void advance()
virtual bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom)
Mode
Definition: aniobject.h:44
@ kModeOnce
Play the animation only once.
Definition: aniobject.h:46
@ kModeContinuous
Play the animation continuously.
Definition: aniobject.h:45
virtual void setPosition()
uint16 getAnimation() const
bool isVisible() const
void setMode(Mode mode)
ANIObject(const ANIFile &ani)
Definition: backbuffer.h:37
Definition: cmpfile.h:49
Definition: surface.h:106