Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MiniMapTexture.h
Show All 20 Lines | |||||
#include "graphics/Color.h" | #include "graphics/Color.h" | ||||
#include "graphics/Texture.h" | #include "graphics/Texture.h" | ||||
#include "maths/Vector2D.h" | #include "maths/Vector2D.h" | ||||
#include "renderer/backend/IDeviceCommandContext.h" | #include "renderer/backend/IDeviceCommandContext.h" | ||||
#include "renderer/backend/ITexture.h" | #include "renderer/backend/ITexture.h" | ||||
#include "renderer/VertexArray.h" | #include "renderer/VertexArray.h" | ||||
#include <memory> | #include <memory> | ||||
#include <string> | |||||
#include <unordered_map> | |||||
#include <vector> | #include <vector> | ||||
class CSimulation2; | class CSimulation2; | ||||
class CTerrain; | class CTerrain; | ||||
class CMiniMapTexture | class CMiniMapTexture | ||||
{ | { | ||||
NONCOPYABLE(CMiniMapTexture); | NONCOPYABLE(CMiniMapTexture); | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | private: | ||||
size_t m_EntitiesDrawn = 0; | size_t m_EntitiesDrawn = 0; | ||||
double m_PingDuration = 25.0; | double m_PingDuration = 25.0; | ||||
double m_HalfBlinkDuration = 0.0; | double m_HalfBlinkDuration = 0.0; | ||||
double m_NextBlinkTime = 0.0; | double m_NextBlinkTime = 0.0; | ||||
bool m_BlinkState = false; | bool m_BlinkState = false; | ||||
std::vector<Icon> m_Icons; | std::vector<Icon> m_Icons; | ||||
// We store the map as a member to avoid redundant reallocations on each | |||||
// update. We use a grid approach to combine icons by distance. | |||||
struct CellIconKey | |||||
{ | |||||
std::string path; | |||||
Stan: #include<string> | |||||
u8 r, g, b; | |||||
}; | |||||
struct CellIconKeyHash | |||||
{ | |||||
size_t operator()(const CellIconKey& key) const; | |||||
}; | |||||
struct CellIconKeyEqual | |||||
{ | |||||
bool operator()(const CellIconKey& lhs, const CellIconKey& rhs) const; | |||||
}; | |||||
struct CellIcon | |||||
{ | |||||
// TODO: use CVector2DI. | |||||
Done Inline ActionsWon't I be i32? Stan: Won't I be i32? | |||||
Done Inline ActionsMaybe, at least it should be a vector of integer values. vladislavbelov: Maybe, at least it should be a vector of integer values. | |||||
u16 gridX, gridY; | |||||
float halfSize; | |||||
CVector2D worldPosition; | |||||
}; | |||||
std::unordered_map<CellIconKey, std::vector<CellIcon>, CellIconKeyHash, CellIconKeyEqual> m_IconsCache; | |||||
}; | }; | ||||
#endif // INCLUDED_MINIMAPTEXTURE | #endif // INCLUDED_MINIMAPTEXTURE |
Wildfire Games · Phabricator
#include<string>