ScummVM API documentation
sprite_object.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BAGLIB_SPRITE_OBJECT_H
24 #define BAGEL_BAGLIB_SPRITE_OBJECT_H
25 
26 #include "bagel/baglib/object.h"
27 #include "bagel/boflib/gfx/sprite.h"
28 
29 namespace Bagel {
30 
34 class CBagSpriteObject : public CBagObject {
35 private:
36  CBofSprite *_xSprite;
37  int _nCels;
38  int _nWieldCursor; // Ref Id for the objects over cursor
39  bool _bAnimated : 1;
40  int _nMaxFrameRate;
41 
42 public:
44  virtual ~CBagSpriteObject();
45 
46  ErrorCode attach() override;
47  ErrorCode detach() override;
48  bool isAttached() override {
49  return _xSprite != nullptr;
50  }
51  ParseCodes setInfo(CBagIfstream &istr) override;
52 
53  bool isInside(const CBofPoint &xPoint) override;
54 
55  int getWieldCursor() const {
56  return _nWieldCursor;
57  }
58  void setWieldCursor(int n) {
59  _nWieldCursor = n;
60  }
61 
62  CBofSprite *getSprite() const {
63  return _xSprite;
64  }
65  CBofRect getRect() override;
66  int getCels() const {
67  return _nCels;
68  }
69 
70  bool isAnimated() const {
71  return _bAnimated;
72  }
73 
74  void setAnimated(bool b = true);
75  void setCels(int nCels);
76  void setPosition(const CBofPoint &pos) override;
77 
78  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect = nullptr, int /*nMaskColor*/ = -1) override;
79 
80  void setProperty(const CBofString &sProp, int nVal) override;
81  int getProperty(const CBofString &sProp) override;
82 
83  int getFrameRate() const {
84  return _nMaxFrameRate;
85  }
86  void setFrameRate(int nFR) {
87  _nMaxFrameRate = nFR;
88  }
89 
90  uint32 _nLastUpdate;
91 };
92 
93 } // namespace Bagel
94 
95 #endif
ParseCodes setInfo(CBagIfstream &istr) override
Definition: bitmap.h:55
Definition: sprite.h:38
Definition: rect.h:36
Definition: object.h:85
Definition: ifstream.h:31
Definition: sprite_object.h:34
Definition: string.h:38
Definition: bagel.h:31
Definition: point.h:34