ScummVM API documentation
GraphicsDrawer.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_GRAPHICSDRAWER_H
29 #define HPL_GRAPHICSDRAWER_H
30 
31 #include "common/array.h"
32 #include "common/list.h"
33 #include "hpl1/engine/graphics/BackgroundImage.h"
34 #include "hpl1/engine/graphics/GraphicsTypes.h"
35 #include "hpl1/std/multiset.h"
36 
37 namespace hpl {
38 
39 class iLowLevelGraphics;
40 class cResourceImage;
41 class cGfxObject;
42 class cMaterialHandler;
43 class iMaterial;
44 
46 public:
47  cGfxObject *mpObject;
48  cVector3f mvTransform;
49 
50  bool mbIsColorAndSize;
51  cColor mColor;
52  cVector2f mvSize;
53  bool mbFlipH = false;
54  bool mbFlipV = false;
55  float mfAngle = 0;
56 
57  iMaterial *GetMaterial() const;
58  float GetZ() const { return mvTransform.z; }
59 };
60 
62 typedef tGfxObjectVec::iterator tGfxObjectVecIt;
63 
65 public:
66  bool operator()(const cGfxBufferObject &aObjectA, const cGfxBufferObject &aObjectB) const;
67 };
68 
70 typedef tGfxBufferSet::iterator tGfxBufferSetIt;
71 
72 class cResources;
73 
76 
78 public:
79  cGraphicsDrawer(iLowLevelGraphics *apLowLevelGraphics, cMaterialHandler *apMaterialHandler,
80  cResources *apResources);
81  ~cGraphicsDrawer();
82 
88  void DrawGfxObject(cGfxObject *apObject, const cVector3f &avPos);
89 
99  void DrawGfxObject(cGfxObject *apObject, const cVector3f &avPos,
100  const cVector2f &avSize, const cColor &aColor,
101  bool abFlipH = false, bool abFlipV = false, float afAngle = 0);
102 
106  void DrawAll();
107 
115  cGfxObject *CreateGfxObject(const tString &asFileName, const tString &asMaterialName,
116  bool abAddToList = true);
124  cGfxObject *CreateGfxObject(Bitmap2D *apBmp, const tString &asMaterialName,
125  bool abAddToList = true);
126 
127  cGfxObject *CreateGfxObjectFromTexture(const tString &asFileName, const tString &asMaterialName,
128  bool abAddToList = true);
132  void DestroyGfxObject(cGfxObject *apObject);
133 
134  cBackgroundImage *AddBackgroundImage(const tString &asFileName, const tString &asMaterialName,
135  const cVector3f &avPos, bool abTile,
136  const cVector2f &avSize, const cVector2f &avPosPercent, const cVector2f &avVel);
137 
138  void UpdateBackgrounds();
139  void DrawBackgrounds(const cRect2f &aCollideRect);
140  void ClearBackgrounds();
141 
142 private:
143  iLowLevelGraphics *mpLowLevelGraphics;
144  cMaterialHandler *mpMaterialHandler;
145  cResources *mpResources;
146 
147  tGfxBufferSet m_setGfxBuffer;
148 
149  tGfxObjectList mlstGfxObjects;
150 
151  tBackgroundImageMap m_mapBackgroundImages;
152 };
153 
154 } // namespace hpl
155 
156 #endif // HPL_GRAPHICSDRAWER_H
Definition: AI.h:36
Definition: str.h:59
Definition: array.h:52
Definition: bitmap2D.h:42
T * iterator
Definition: array.h:54
Definition: stablemap.h:43
Definition: GraphicsDrawer.h:45
Definition: GraphicsDrawer.h:64
Definition: GraphicsDrawer.h:77
Definition: GfxObject.h:38
Definition: Resources.h:160
Definition: Color.h:37
Definition: list_intern.h:51
Definition: MaterialHandler.h:38
Definition: Material.h:203
Definition: BackgroundImage.h:38
Definition: LowLevelGraphics.h:200