feat: add map background color
This commit is contained in:
@@ -56,6 +56,13 @@ struct Color {
|
||||
std::uint8_t r, g, b;
|
||||
};
|
||||
|
||||
static constexpr Color BLACK{ 0, 0, 0 };
|
||||
static constexpr Color WHITE{ 255, 255, 255 };
|
||||
|
||||
static constexpr Color RED{ 255, 0, 0 };
|
||||
static constexpr Color GREEN{ 0, 255, 0 };
|
||||
static constexpr Color BLUE{ 0, 0, 255 };
|
||||
|
||||
struct Tile {
|
||||
virtual TileType getType() const = 0;
|
||||
};
|
||||
@@ -134,6 +141,7 @@ protected:
|
||||
TowerTileColorPalette m_TowerPlacePalette;
|
||||
Color m_WalkablePalette;
|
||||
std::vector<Color> m_DecorationPalette;
|
||||
Color m_Background;
|
||||
|
||||
std::unordered_map<ChunkCoord, ChunkPtr> m_Chunks;
|
||||
|
||||
@@ -172,6 +180,7 @@ public:
|
||||
const TowerTileColorPalette& getTowerTileColorPalette() const { return m_TowerPlacePalette; }
|
||||
const Color& getWalkableTileColor() const { return m_WalkablePalette; }
|
||||
const std::vector<Color>& getDecorationPalette() const { return m_DecorationPalette; }
|
||||
const Color& getBackgroundColor() const { return m_Background; }
|
||||
|
||||
const TilePalette& getTilePalette() const { return m_TilePalette; }
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
Client* getClient() const { return m_Client; }
|
||||
|
||||
render::Renderer* getRenderer() const { return m_Renderer; }
|
||||
WorldClient& getWorld() { return m_WorldClient; }
|
||||
WorldClient& getWorldClient() { return m_WorldClient; }
|
||||
|
||||
virtual void HandlePacket(const protocol::ConnexionInfoPacket* packet);
|
||||
virtual void HandlePacket(const protocol::PlayerJoinPacket* packet);
|
||||
|
||||
@@ -45,6 +45,7 @@ struct WorldHeader {
|
||||
game::TowerTileColorPalette m_TowerPlacePalette;
|
||||
game::Color m_WalkablePalette;
|
||||
std::vector<game::Color> m_DecorationPalette;
|
||||
game::Color m_Background;
|
||||
|
||||
game::SpawnColorPalette m_SpawnColorPalette;
|
||||
|
||||
@@ -128,6 +129,7 @@ public:
|
||||
const game::TowerTileColorPalette& getTowerTilePalette() const { return m_Header.m_TowerPlacePalette; }
|
||||
const game::Color& getWalkableTileColor() const { return m_Header.m_WalkablePalette; }
|
||||
const std::vector<game::Color>& getDecorationPalette() const { return m_Header.m_DecorationPalette; }
|
||||
const game::Color& getBackgroundColor() const { return m_Header.m_Background; }
|
||||
|
||||
const game::Spawn& getRedSpawn() const { return m_Header.m_RedSpawn; }
|
||||
const game::Spawn& getBlueSpawn() const { return m_Header.m_BlueSpawn; }
|
||||
|
||||
@@ -29,6 +29,8 @@ private:
|
||||
std::unique_ptr<WorldShader> m_WorldShader;
|
||||
std::unique_ptr<EntityShader> m_EntityShader;
|
||||
|
||||
glm::vec3 m_BackgroundColor;
|
||||
|
||||
bool m_IsometricView = true;
|
||||
float m_IsometricShade = m_IsometricView;
|
||||
glm::vec2 m_CamPos{};
|
||||
@@ -49,6 +51,8 @@ public:
|
||||
void setCamPos(const glm::vec2& newPos);
|
||||
void setIsometricView(bool isometric); // false = 2D true = Isometric
|
||||
|
||||
void setBackgroundColor(const glm::vec3& color) { m_BackgroundColor = color; }
|
||||
|
||||
glm::vec2 getCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight);
|
||||
private:
|
||||
void updateIsometricView();
|
||||
|
||||
Reference in New Issue
Block a user