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 
35 namespace Gob {
36 
37 class ANIFile;
38 class CMPFile;
39 class Surface;
40 
42 class ANIObject : public BackBuffer {
43 public:
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 
113 private:
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
virtual void setPosition()
Definition: aniobject.h:42
uint16 getFrame() const
void setVisible(bool visible)
bool isVisible() const
void getFrameSize(int16 &width, int16 &height, uint16 n=0) const
virtual bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom)
Definition: backbuffer.h:37
void getFramePosition(int16 &x, int16 &y, uint16 n=0) const
ANIObject(const ANIFile &ani)
void setPause(bool pause)
bool isIn(int16 x, int16 y) const
Definition: anifile.h:40
Definition: cmpfile.h:49
virtual bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom)
virtual void advance()
void setMode(Mode mode)
uint16 getAnimation() const
Definition: surface.h:100
Play the animation continuously.
Definition: aniobject.h:45
void getPosition(int16 &x, int16 &y) const
Definition: anifile.h:53
Play the animation only once.
Definition: aniobject.h:46
bool isPaused() const
bool lastFrame() const
Mode
Definition: aniobject.h:44
void setFrame(uint16 frame)
void setAnimation(uint16 animation)