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/spacebar/baglib/object.h"
27 #include "bagel/spacebar/boflib/gfx/sprite.h"
28 
29 namespace Bagel {
30 namespace SpaceBar {
31 
35 class CBagSpriteObject : public CBagObject {
36 private:
37  CBofSprite *_xSprite;
38  int _nCels;
39  int _nWieldCursor; // Ref Id for the objects over cursor
40  bool _bAnimated : 1;
41  int _nMaxFrameRate;
42 
43 public:
45  virtual ~CBagSpriteObject();
46 
47  ErrorCode attach() override;
48  ErrorCode detach() override;
49  bool isAttached() override {
50  return _xSprite != nullptr;
51  }
52  ParseCodes setInfo(CBagIfstream &istr) override;
53 
54  bool isInside(const CBofPoint &xPoint) override;
55 
56  int getWieldCursor() const {
57  return _nWieldCursor;
58  }
59  void setWieldCursor(int n) {
60  _nWieldCursor = n;
61  }
62 
63  CBofSprite *getSprite() const {
64  return _xSprite;
65  }
66  CBofRect getRect() override;
67  int getCels() const {
68  return _nCels;
69  }
70 
71  bool isAnimated() const {
72  return _bAnimated;
73  }
74 
75  void setAnimated(bool b = true);
76  void setCels(int nCels);
77  void setPosition(const CBofPoint &pos) override;
78 
79  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *pSrcRect = nullptr, int /*nMaskColor*/ = -1) override;
80 
81  void setProperty(const CBofString &sProp, int nVal) override;
82  int getProperty(const CBofString &sProp) override;
83 
84  int getFrameRate() const {
85  return _nMaxFrameRate;
86  }
87  void setFrameRate(int nFR) {
88  _nMaxFrameRate = nFR;
89  }
90 
91  uint32 _nLastUpdate;
92 };
93 
94 } // namespace SpaceBar
95 } // namespace Bagel
96 
97 #endif
Definition: ifstream.h:32
ParseCodes setInfo(CBagIfstream &istr) override
Definition: object.h:86
Definition: rect.h:35
Definition: sprite.h:39
Definition: string.h:38
Definition: afxwin.h:27
Definition: point.h:32
Definition: sprite_object.h:35
Definition: bitmap.h:57