Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MiniMap.h
Go to the documentation of this file.
1 /* Copyright (C) 2013 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_MINIMAP
19 #define INCLUDED_MINIMAP
20 
21 #include "gui/GUI.h"
22 #include "renderer/VertexArray.h"
23 
24 
25 class CCamera;
26 class CTerrain;
27 
28 class CMiniMap : public IGUIObject
29 {
31 public:
32  CMiniMap();
33  virtual ~CMiniMap();
34 protected:
35  virtual void Draw();
36 
37  /**
38  * @see IGUIObject#HandleMessage()
39  */
40  virtual void HandleMessage(SGUIMessage &Message);
41 
42  // create the minimap textures
43  void CreateTextures();
44 
45  // rebuild the terrain texture map
46  void RebuildTerrainTexture();
47 
48  // destroy and free any memory and textures
49  void Destroy();
50 
51  void SetCameraPos();
52 
53  void FireWorldClickEvent(int button, int clicks);
54 
55  // the terrain we are mini-mapping
57 
58  const CCamera* m_Camera;
59 
60  //Whether or not the mouse is currently down
61  bool m_Clicking;
62 
63  // minimap texture handles
65 
66  // texture data
68 
69  // whether we need to regenerate the terrain texture
71 
73 
74  // map size
76 
77  // texture size
78  GLsizei m_TextureSize;
79 
80  // 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
81  float m_MapScale;
82 
83  // maximal water height to allow the passage of a unit (for underwater shallows).
85 
86  void DrawTexture(float coordMax, float angle, float x, float y, float x2, float y2, float z);
87 
88  void DrawViewRect();
89 
90  void GetMouseWorldCoordinates(float& x, float& z);
91 
92  float GetAngle();
93 
98 
100 
105 };
106 
107 #endif
GLuint m_TerrainTexture
Definition: MiniMap.h:64
virtual ~CMiniMap()
Definition: MiniMap.cpp:131
float GetAngle()
Definition: MiniMap.cpp:232
void Destroy()
Calls Destroy on all children, and deallocates all memory.
Definition: MiniMap.cpp:761
void RebuildTerrainTexture()
Definition: MiniMap.cpp:699
const CTerrain * m_Terrain
Definition: MiniMap.h:56
bool m_Clicking
Definition: MiniMap.h:61
VertexArray::Attribute m_AttributePos
Definition: MiniMap.h:96
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
Definition: IGUIObject.h:140
virtual void HandleMessage(SGUIMessage &Message)
Definition: MiniMap.cpp:136
ssize_t m_Height
Definition: MiniMap.h:72
A VertexArray that is specialised to handle 16-bit array indices.
Definition: VertexArray.h:212
u32 * m_TerrainData
Definition: MiniMap.h:67
CMiniMap()
Definition: MiniMap.cpp:60
float m_ShallowPassageHeight
Definition: MiniMap.h:84
VertexArray::Attribute m_AttributeColor
Definition: MiniMap.h:97
double m_PingDuration
Definition: MiniMap.h:101
bool m_TerrainDirty
Definition: MiniMap.h:70
void GetMouseWorldCoordinates(float &x, float &z)
Definition: MiniMap.cpp:206
GLsizei m_TextureSize
Definition: MiniMap.h:78
Definition: Camera.h:39
void DrawTexture(float coordMax, float angle, float x, float y, float x2, float y2, float z)
Definition: MiniMap.cpp:335
ssize_t m_MapSize
Definition: MiniMap.h:75
double m_NextBlinkTime
Definition: MiniMap.h:103
VertexIndexArray m_IndexArray
Definition: MiniMap.h:94
intptr_t ssize_t
Definition: wposix_types.h:82
float m_MapScale
Definition: MiniMap.h:81
void FireWorldClickEvent(int button, int clicks)
Definition: MiniMap.cpp:238
#define u32
Definition: types.h:41
void DrawViewRect()
Definition: MiniMap.cpp:263
void CreateTextures()
Definition: MiniMap.cpp:672
ssize_t m_Width
Definition: MiniMap.h:72
VertexArray m_VertexArray
Definition: MiniMap.h:95
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:106
bool m_BlinkState
Definition: MiniMap.h:104
void SetCameraPos()
Definition: MiniMap.cpp:222
size_t m_EntitiesDrawn
Definition: MiniMap.h:99
const CCamera * m_Camera
Definition: MiniMap.h:58
virtual void Draw()
Draws the object.
Definition: MiniMap.cpp:359
#define GUI_OBJECT(obj)
Definition: GUIbase.h:62
double m_HalfBlinkDuration
Definition: MiniMap.h:102