ScummVM API documentation
GuiGfxElement.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_GUI_GFX_ELEMENT_H
29#define HPL_GUI_GFX_ELEMENT_H
30
31#include "hpl1/engine/gui/GuiTypes.h"
32
33namespace hpl {
34
35class iGuiMaterial;
36class iTexture;
37class cResourceImage;
38
39class cGui;
40
41#define kMaxGuiTextures (4)
42
43//------------------------------------------
44
45enum eGuiGfxAnimationType {
46 eGuiGfxAnimationType_Loop,
47 eGuiGfxAnimationType_StopAtEnd,
48 eGuiGfxAnimationType_Oscillate,
49 eGuiGfxAnimationType_Random,
50 eGuiGfxAnimationType_LastEnum
51};
52
54 friend class cGuiGfxElement;
55
56public:
57 cGuiGfxAnimation() : mfFrameLength(1), mType(eGuiGfxAnimationType_Loop) {}
58
59 void AddFrame(int alNum);
60 void SetType(eGuiGfxAnimationType aType);
61 void SetFrameLength(float afLength);
62
63private:
64 tString msName;
65 Common::Array<int> mvFrames;
66 float mfFrameLength;
67 eGuiGfxAnimationType mType;
68};
69
70//------------------------------------------
71
73 friend class cGuiSet;
74 friend class cGuiRenderObjectCompare;
75
76public:
77 cGuiGfxElement(cGui *apGui);
79
80 void Update(float afTimeStep);
81
82 void AddImage(cResourceImage *apImage);
83 void AddTexture(iTexture *apTexture);
84
85 void AddImageToBuffer(cResourceImage *apImage);
86
87 void SetOffset(const cVector3f &avOffset) { mvOffset = avOffset; }
88 const cVector3f &GetOffset() const { return mvOffset; }
89
90 void SetActiveSize(const cVector2f &avSize) { mvActiveSize = avSize; }
91 const cVector2f &GetActiveSize() { return mvActiveSize; }
92
93 cGuiGfxAnimation *CreateAnimtion(const tString &asName);
94 void PlayAnimation(int alNum);
95 cGuiGfxAnimation *GetAnimation(int alIdx) { return mvAnimations[alIdx]; }
96 void SetAnimationTime(float afTime);
97
98 void SetAnimationPaused(bool abX) { mbAnimationPaused = abX; }
99 bool GSetAnimationPaused() { return mbAnimationPaused; }
100
101 void SetMaterial(iGuiMaterial *apMat);
102
103 void SetColor(const cColor &aColor);
104
105 cVector2f GetImageSize();
106
107 void Flush();
108
109private:
110 void SetImage(cResourceImage *apImage, int alNum);
111
112 cVector2f mvImageSize;
113 cGui *mpGui;
114 tVertexVec mvVtx;
115
116 cVector3f mvOffset;
117 cVector2f mvActiveSize;
118
119 iGuiMaterial *mpMaterial;
120 iTexture *mvTextures[kMaxGuiTextures];
121 cResourceImage *mvImages[kMaxGuiTextures];
122
123 Common::Array<cResourceImage *> mvImageBufferVec;
124
126 int mlCurrentAnimation;
127 float mfCurrentFrame;
128 int mlActiveImage;
129 bool mbForwardAnim;
130 bool mbAnimationPaused;
131
132 int mlTextureNum;
133
134 bool mbFlushed;
135};
136
137} // namespace hpl
138
139#endif // HPL_GUI_GFX_ELEMENT_H
Definition: str.h:59
Definition: Color.h:37
Definition: GuiGfxElement.h:53
Definition: GuiGfxElement.h:72
Definition: Gui.h:73
Definition: GuiSet.h:83
Definition: GuiSet.h:112
Definition: ResourceImage.h:43
Definition: GuiMaterial.h:36
Definition: Texture.h:88