ScummVM API documentation
ImageEntity.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/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_IMAGE_ENTITY_H
29#define HPL_IMAGE_ENTITY_H
30
31#include "common/array.h"
32#include "hpl1/engine/graphics/GraphicsTypes.h"
33#include "hpl1/engine/scene/Entity2D.h"
34
35class TiXmlElement;
36
37namespace hpl {
38
39class cResources;
40class cGraphics;
41class cImageEntityData;
42class cImageAnimation;
43
44class cImageEntity : public iEntity2D {
45public:
46 cImageEntity(tString asName, cResources *apResources, cGraphics *apGraphics, bool abAutoDeleteData = true);
48
49 const cRect2f &GetBoundingBox();
50 bool UpdateBoundingBox();
51 tString GetEntityType() { return "ImageEntity"; }
52
53 void Render();
54
55 void UpdateLogic(float afTimeStep);
56
57 bool LoadData(TiXmlElement *apRootElem);
58
59 bool LoadEntityData(tString asDataName, int alAnimNum = 0);
60 bool LoadEntityData(cImageEntityData *apData, int alAnimNum = 0);
61
62 cImageEntityData *GetEntityData() { return mpEntityData; }
63
65
66 bool SetAnimation(const tString &asName, bool abLoop = true);
67 const tString &GetCurrentAnimation() const;
68 bool AnimationIsLooped() { return mbLoopAnimation; }
69 bool AnimationIsPlaying();
70 void StopAnimation();
71
72 void SetAnimationSpeed(float afSpeed) { mfAnimSpeed = afSpeed; }
73 float GetAnimationSpeed() { return mfAnimSpeed; }
74
75 void SetFrameNum(float afFrame) { mfFrameNum = afFrame; }
76 float GetFrameNum() { return mfFrameNum; }
77 int GetMaxFrameNum();
78
79 void SetAnimationPaused(bool abX) { mbAnimationPaused = abX; }
80 bool GetAnimationPaused() { return mbAnimationPaused; }
81
82 void SetFlipH(bool abX);
83 bool GetFlipH() { return mbFlipH; }
84 void SetFlipV(bool abX);
85 bool GetFlipV() { return mbFlipV; }
86
87 cVector2f GetSize() { return mvSize; }
88 void SetSize(const cVector2f &avSize);
89
90 void SetAlpha(float afX);
91 float GetAlpha() { return mfAlpha; }
92
93 void Flash(float afAdd);
94
95 bool IsCollidable() { return mbCollidable; }
96
97private:
98 cResources *mpResources;
99 cGraphics *mpGraphics;
100 cImageEntityData *mpEntityData;
101
102 float mfAlpha;
103 float mfFlashAdd;
104 bool mbFlashing;
105
106 bool mbCollidable;
107
108 bool mbAutoDeleteData;
109
110 cVector2f mvSize;
111 bool mbFlipH;
112 bool mbFlipV;
113
114 bool mbRotationHasChanged;
115 bool mbSizeHasChanged;
116 float mfCurrentAngle;
117
118 cImageAnimation *mpAnimation;
119 float mfFrameNum;
120 float mfAnimSpeed;
121 int mlFrame;
122 int mlLastFrame;
123 bool mbAnimationPaused;
124 bool mbLoopAnimation;
125
126 tVertexVec mvBaseVtx;
127 tVertexVec mvVtx;
128 tUIntVec mvIdxVec;
129
130 cVector3f mvTransform;
131
132 tString msTempString;
133};
134
136typedef tImageEntityVec::iterator tImageEntityVecIt;
137
138} // namespace hpl
139
140#endif // HPL_IMAGE_ENTITY_H
cImageEntity * * iterator
Definition: array.h:54
Definition: str.h:59
Definition: tinyxml.h:864
Definition: Graphics.h:46
Definition: ImageEntityData.h:57
Definition: ImageEntityData.h:70
Definition: ImageEntity.h:44
Definition: Resources.h:160
Definition: Entity2D.h:39