Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectTypes/CMiniMap.h
Show All 13 Lines | |||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#ifndef INCLUDED_MINIMAP | #ifndef INCLUDED_MINIMAP | ||||
#define INCLUDED_MINIMAP | #define INCLUDED_MINIMAP | ||||
#include "graphics/ShaderProgramPtr.h" | #include "graphics/ShaderProgramPtr.h" | ||||
#include "graphics/Texture.h" | |||||
#include "gui/ObjectBases/IGUIObject.h" | #include "gui/ObjectBases/IGUIObject.h" | ||||
#include "renderer/VertexArray.h" | #include "renderer/VertexArray.h" | ||||
Stan: Forward decl? | |||||
Done Inline ActionsDidn't work because of the usage in the struct. Imarok: Didn't work because of the usage in the struct. | |||||
class CCamera; | class CCamera; | ||||
class CMatrix3D; | class CMatrix3D; | ||||
Done Inline ActionsCColor is struct, also if you use CColor as type in the header then you need to use include instead of forward declaration. The same for CVector2D. vladislavbelov: `CColor` is `struct`, also if you use `CColor` as type in the header then you need to use… | |||||
Done Inline ActionsHmm, yeah. Shouldn't change things in the mid of the night xD Imarok: Hmm, yeah. Shouldn't change things in the mid of the night xD | |||||
class CTerrain; | class CTerrain; | ||||
class CVector2D; | |||||
class CMiniMap : public IGUIObject | class CMiniMap : public IGUIObject | ||||
Done Inline ActionsThe Obj suffix is useless. vladislavbelov: The `Obj` suffix is useless. | |||||
Done Inline ActionsIf it's used only for the CMiniMap class then it might moved to its protected/private section. vladislavbelov: If it's used only for the `CMiniMap` class then it might moved to its protected/private section. | |||||
{ | { | ||||
GUI_OBJECT(CMiniMap) | GUI_OBJECT(CMiniMap) | ||||
public: | public: | ||||
CMiniMap(CGUI& pGUI); | CMiniMap(CGUI& pGUI); | ||||
virtual ~CMiniMap(); | virtual ~CMiniMap(); | ||||
/** | /** | ||||
* @return The maximum height for unit passage in water. | * @return The maximum height for unit passage in water. | ||||
*/ | */ | ||||
static float GetShallowPassageHeight(); | static float GetShallowPassageHeight(); | ||||
Done Inline ActionsYou might add an empty line before. vladislavbelov: You might add an empty line before. | |||||
bool Flare(const CVector2D& pos, const CColor& color); | |||||
protected: | protected: | ||||
struct MapFlare | |||||
StanUnsubmitted Done Inline Actionsprotected or private? Stan: protected or private? | |||||
ImarokAuthorUnsubmitted Done Inline Actionssame as the rest Imarok: same as the rest | |||||
{ | |||||
CPos pos; | |||||
CColor color; | |||||
Done Inline ActionsNeed an include Stan: Need an include | |||||
double time; | |||||
}; | |||||
virtual void Draw(); | virtual void Draw(); | ||||
virtual void CreateJSObject(); | |||||
/** | /** | ||||
* @see IGUIObject#HandleMessage() | * @see IGUIObject#HandleMessage() | ||||
*/ | */ | ||||
virtual void HandleMessage(SGUIMessage& Message); | virtual void HandleMessage(SGUIMessage& Message); | ||||
/** | /** | ||||
* @see IGUIObject#IsMouseOver() | * @see IGUIObject#IsMouseOver() | ||||
*/ | */ | ||||
virtual bool IsMouseOver() const; | virtual bool IsMouseOver() const; | ||||
Done Inline ActionsUn-needed wraitii: Un-needed | |||||
// create the minimap textures | // create the minimap textures | ||||
void CreateTextures(); | void CreateTextures(); | ||||
// rebuild the terrain texture map | // rebuild the terrain texture map | ||||
void RebuildTerrainTexture(); | void RebuildTerrainTexture(); | ||||
// destroy and free any memory and textures | // destroy and free any memory and textures | ||||
void Destroy(); | void Destroy(); | ||||
void SetCameraPos(); | void SetCameraPos(); | ||||
bool FireWorldClickEvent(int button, int clicks); | bool FireWorldClickEvent(int button, int clicks); | ||||
static const CStr EventNameWorldClick; | static const CStr EventNameWorldClick; | ||||
// the terrain we are mini-mapping | // the terrain we are mini-mapping | ||||
const CTerrain* m_Terrain; | const CTerrain* m_Terrain; | ||||
const CCamera* m_Camera; | const CCamera* m_Camera; | ||||
//Whether or not the mouse is currently down | //Whether or not the mouse is currently down | ||||
bool m_Clicking; | bool m_Clicking; | ||||
std::deque<MapFlare> m_MapFlares; | |||||
Done Inline Actions#include <deque> Stan: #include <deque> | |||||
// minimap texture handles | // minimap texture handles | ||||
GLuint m_TerrainTexture; | GLuint m_TerrainTexture; | ||||
static const int FLARE_TEXTURE_SIZE = 16; | |||||
Done Inline ActionsUse constant instead of the magic number. vladislavbelov: Use constant instead of the magic number. | |||||
Done Inline ActionsUsually we use upper case with underscores for such constants. vladislavbelov: Usually we use upper case with underscores for such constants. | |||||
CTexturePtr m_FlareTextures[FLARE_TEXTURE_SIZE]; | |||||
StanUnsubmitted Done Inline ActionsCould use std::array maybe. Stan: Could use std::array maybe. | |||||
Done Inline ActionsMight need another include for CTexturePtr Stan: Might need another include for CTexturePtr | |||||
Done Inline ActionsNah, that's from Texture.h Imarok: Nah, that's from `Texture.h` | |||||
// texture data | // texture data | ||||
u32* m_TerrainData; | u32* m_TerrainData; | ||||
// whether we need to regenerate the terrain texture | // whether we need to regenerate the terrain texture | ||||
bool m_TerrainDirty; | bool m_TerrainDirty; | ||||
// Whether to draw a black square around and under the minimap. | // Whether to draw a black square around and under the minimap. | ||||
bool m_Mask; | bool m_Mask; | ||||
Show All 11 Lines | protected: | ||||
// maximal water height to allow the passage of a unit (for underwater shallows). | // maximal water height to allow the passage of a unit (for underwater shallows). | ||||
float m_ShallowPassageHeight; | float m_ShallowPassageHeight; | ||||
float m_WaterHeight; | float m_WaterHeight; | ||||
void DrawTexture(CShaderProgramPtr shader, float coordMax, float angle, float x, float y, float x2, float y2, float z) const; | void DrawTexture(CShaderProgramPtr shader, float coordMax, float angle, float x, float y, float x2, float y2, float z) const; | ||||
void DrawViewRect(CMatrix3D transform) const; | void DrawViewRect(const CMatrix3D& transform) const; | ||||
void DrawFlare(CShaderProgramPtr shader, const MapFlare& flare, double cur_time) const; | |||||
void GetMouseWorldCoordinates(float& x, float& z) const; | void GetMouseWorldCoordinates(float& x, float& z) const; | ||||
CPos GetMapCoordinates(float x, float z) const; | |||||
float GetAngle() const; | float GetAngle() const; | ||||
VertexIndexArray m_IndexArray; | VertexIndexArray m_IndexArray; | ||||
VertexArray m_VertexArray; | VertexArray m_VertexArray; | ||||
VertexArray::Attribute m_AttributePos; | VertexArray::Attribute m_AttributePos; | ||||
VertexArray::Attribute m_AttributeColor; | VertexArray::Attribute m_AttributeColor; | ||||
size_t m_EntitiesDrawn; | size_t m_EntitiesDrawn; | ||||
double m_PingDuration; | double m_PingDuration; | ||||
double m_HalfBlinkDuration; | double m_HalfBlinkDuration; | ||||
double m_NextBlinkTime; | double m_NextBlinkTime; | ||||
bool m_BlinkState; | bool m_BlinkState; | ||||
}; | }; | ||||
#endif // INCLUDED_MINIMAP | #endif // INCLUDED_MINIMAP |
Wildfire Games · Phabricator
Forward decl?