Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/ObjectTypes/CMiniMap.h
Show All 12 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/Color.h" | |||||
#include "graphics/Texture.h" | |||||
#include "gui/ObjectBases/IGUIObject.h" | #include "gui/ObjectBases/IGUIObject.h" | ||||
#include "maths/Vector2D.h" | |||||
#include "renderer/VertexArray.h" | #include "renderer/VertexArray.h" | ||||
#include <deque> | |||||
#include <vector> | |||||
class CCamera; | class CCamera; | ||||
class CMatrix3D; | class CMatrix3D; | ||||
class CTerrain; | class CTerrain; | ||||
class CMiniMap : public IGUIObject | class CMiniMap : public IGUIObject | ||||
{ | { | ||||
GUI_OBJECT(CMiniMap) | GUI_OBJECT(CMiniMap) | ||||
public: | public: | ||||
CMiniMap(CGUI& pGUI); | CMiniMap(CGUI& pGUI); | ||||
virtual ~CMiniMap(); | virtual ~CMiniMap(); | ||||
bool Flare(const CVector2D& pos, const CStr& colorStr); | |||||
protected: | protected: | ||||
struct MapFlare | |||||
{ | |||||
CVector2D pos; | |||||
CColor color; | |||||
double time; | |||||
}; | |||||
virtual void Draw(CCanvas2D& canvas); | virtual void Draw(CCanvas2D& canvas); | ||||
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; | ||||
private: | private: | ||||
void SetCameraPositionFromMousePosition(); | void SetCameraPositionFromMousePosition(); | ||||
bool FireWorldClickEvent(int button, int clicks); | bool FireWorldClickEvent(int button, int clicks); | ||||
static const CStr EventNameWorldClick; | static const CStr EventNameWorldClick; | ||||
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; | |||||
std::vector<CTexturePtr> m_FlareTextures; | |||||
CGUISimpleSetting<u32> m_FlareTextureCount; | |||||
CGUISimpleSetting<u32> m_FlareRenderSize; | |||||
CGUISimpleSetting<u32> m_FlareAnimationSpeed; | |||||
CGUISimpleSetting<bool> m_FlareInterleave; | |||||
CGUISimpleSetting<u32> m_FlareLifetimeSeconds; | |||||
// Whether to draw a black square around and under the minimap. | // Whether to draw a black square around and under the minimap. | ||||
CGUISimpleSetting<bool> m_Mask; | CGUISimpleSetting<bool> m_Mask; | ||||
// map size | // map size | ||||
ssize_t m_MapSize; | ssize_t m_MapSize; | ||||
// 1.f if map is circular or 1.414f if square (to shrink it inside the circle) | // 1.f if map is circular or 1.414f if square (to shrink it inside the circle) | ||||
float m_MapScale; | float m_MapScale; | ||||
void RecreateFlareTextures(); | |||||
void DrawViewRect(const CMatrix3D& transform) const; | void DrawViewRect(const CMatrix3D& transform) const; | ||||
void DrawFlare(CCanvas2D& canvas, const MapFlare& flare, double curentTime) const; | |||||
void GetMouseWorldCoordinates(float& x, float& z) const; | void GetMouseWorldCoordinates(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; | ||||
Show All 10 Lines |
Wildfire Games · Phabricator