1
0
mirror of synced 2025-01-18 17:14:13 +01:00

impr: Add interactive tutorials button to the welcome screen

This commit is contained in:
WerWolv 2024-02-24 16:10:05 +01:00
parent 0d4d8efe4e
commit 132b211796
3 changed files with 17 additions and 1 deletions

View File

@ -998,8 +998,10 @@
"hex.builtin.welcome.help.gethelp.link": "https://github.com/WerWolv/ImHex/discussions/categories/get-help",
"hex.builtin.welcome.help.repo": "GitHub Repository",
"hex.builtin.welcome.help.repo.link": "https://imhex.werwolv.net/git",
"hex.builtin.welcome.learn.achievements.title": "Achievement Progress",
"hex.builtin.welcome.learn.achievements.title": "Achievements",
"hex.builtin.welcome.learn.achievements.desc": "Learn how to use ImHex by completing all achievements",
"hex.builtin.welcome.learn.interactive_tutorial.title": "Interactive Tutorials",
"hex.builtin.welcome.learn.interactive_tutorial.desc": "Get started quickly by playing through the tutorials",
"hex.builtin.welcome.learn.latest.desc": "Read ImHex's current changelog",
"hex.builtin.welcome.learn.latest.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.learn.latest.title": "Latest Release",

View File

@ -2,6 +2,7 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/tutorial_manager.hpp>
#include <hex/api/task_manager.hpp>
#include <fonts/codicons_font.h>
@ -13,6 +14,14 @@ namespace hex::plugin::builtin {
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.tutorials.name" }, ICON_VS_COMPASS, 4000, Shortcut::None, [&, this] {
this->getWindowOpenState() = true;
});
RequestOpenWindow::subscribe(this, [this](const std::string &name) {
if (name == "Tutorials") {
TaskManager::doLater([this] {
this->getWindowOpenState() = true;
});
}
});
}

View File

@ -279,6 +279,11 @@ namespace hex::plugin::builtin {
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, size))
hex::openWebpage("hex.builtin.welcome.learn.plugins.link"_lang);
ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal, 3_scaled);
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.interactive_tutorial.title"_lang, "hex.builtin.welcome.learn.interactive_tutorial.desc"_lang, size)) {
RequestOpenWindow::post("Tutorials");
}
if (auto [unlocked, total] = AchievementManager::getProgress(); unlocked != total) {
if (ImGuiExt::DescriptionButtonProgress("hex.builtin.welcome.learn.achievements.title"_lang, "hex.builtin.welcome.learn.achievements.desc"_lang, float(unlocked) / float(total), size)) {
RequestOpenWindow::post("Achievements");