1
0
mirror of synced 2024-11-12 10:10:53 +01:00
ImHex/plugins/builtin/include/content/views/view_achievements.hpp
Nik e77f138514
feat: Added Achievements (#1230)
This PR adds Achievements to ImHex that serve as both a guide and a fun
way to learn more about ImHex and reverse engineering
2023-08-06 21:33:15 +02:00

43 lines
1.2 KiB
C++

#pragma once
#include <hex.hpp>
#include <hex/ui/view.hpp>
#include <hex/api/achievement_manager.hpp>
namespace hex::plugin::builtin {
class ViewAchievements : public View {
public:
ViewAchievements();
~ViewAchievements() override;
void drawContent() override;
void drawAlwaysVisible() override;
[[nodiscard]] bool isAvailable() const override { return true; }
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
[[nodiscard]] ImVec2 getMinSize() const override {
return scaled({ 800, 600 });
}
[[nodiscard]] ImVec2 getMaxSize() const override {
return scaled({ 1600, 1200 });
}
private:
ImVec2 drawAchievementTree(ImDrawList *drawList, const AchievementManager::AchievementNode * prevNode, const std::vector<AchievementManager::AchievementNode*> &nodes, ImVec2 position);
private:
bool m_viewOpen = false;
std::list<const Achievement*> m_achievementUnlockQueue;
const Achievement *m_currAchievement = nullptr;
const Achievement *m_achievementToGoto = nullptr;
float m_achievementUnlockQueueTimer = -1;
bool m_showPopup = true;
ImVec2 m_offset;
};
}