feat: add upgrade popup prototype

This commit is contained in:
2021-11-06 14:12:22 +01:00
parent 6825a6327f
commit ae802b4253
4 changed files with 84 additions and 45 deletions

View File

@@ -38,7 +38,8 @@ enum class TowerSize : std::uint8_t {
};
enum class TowerPath : std::uint8_t {
Top = 0, // Base path
Top = 0,
Base, // Base Path
Bottom
};
@@ -62,9 +63,9 @@ private:
// 1, 2, 3, 4
std::uint8_t m_Level : 3;
// 0 : base path 1 : top path (if there is bottom path) 2 : bottom path (if there is top path)
TowerPath m_Path : 1;
TowerPath m_Path : 2;
public:
TowerLevel() : m_Level(1), m_Path(TowerPath::Top) {}
TowerLevel() : m_Level(1), m_Path(TowerPath::Base) {}
TowerLevel(std::uint8_t level, TowerPath path) : m_Level(level), m_Path(path) {}
std::uint8_t getLevel() const { return m_Level; }
@@ -75,8 +76,8 @@ public:
// operator to sort maps
friend bool operator<(const TowerLevel& level, const TowerLevel& other) {
return level.getLevel() * static_cast<std::uint8_t>(level.getPath()) <
other.getLevel() * static_cast<std::uint8_t>(other.getPath());
return level.getLevel() + static_cast<std::uint8_t>(level.getPath()) * 4 <
other.getLevel() + static_cast<std::uint8_t>(other.getPath()) * 4;
}
};

View File

@@ -26,6 +26,7 @@ private:
glm::vec2 m_CamPos;
glm::vec2 m_CursorPos;
glm::vec2 m_HoldCursorPos;
glm::vec2 m_LastClicked;
float m_Zoom;
float m_CamSensibility = 1;
bool m_PopupOpened = false;
@@ -52,9 +53,9 @@ private:
void renderTowers() const;
void renderMobs() const;
void renderTileSelect() const;
void renderPopups() const;
void renderTowerPlacePopup() const;
void renderTowerUpgradePopup() const;
void renderPopups();
void renderTowerPlacePopup();
void renderTowerUpgradePopup();
void renderMobTooltip() const;
void detectClick();
glm::vec2 getCursorWorldPos() const;