feat: Added basic introduction tutorial

This commit is contained in:
WerWolv
2023-12-13 23:03:39 +01:00
parent 346f1362c6
commit f000b6bc0a
16 changed files with 246 additions and 28 deletions

View File

@@ -32,7 +32,10 @@
/* Forward declarations */
struct GLFWwindow;
namespace hex { class Achievement; }
namespace hex {
class Achievement;
class View;
}
namespace hex {
@@ -248,6 +251,7 @@ namespace hex {
EVENT_DEF(EventImHexClosing);
EVENT_DEF(EventAchievementUnlocked, const Achievement&);
EVENT_DEF(EventSearchBoxClicked);
EVENT_DEF(EventViewOpened, View*);
EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*);
EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64);
@@ -269,6 +273,7 @@ namespace hex {
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*);
EVENT_DEF(RequestRemoveBookmark, u64);
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
EVENT_DEF(RequestRunPatternCode);
EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path);
EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path);
EVENT_DEF(RequestUpdateWindowTitle);

View File

@@ -61,6 +61,9 @@ namespace hex {
*/
Step& allowSkip();
Step& onAppear(std::function<void()> callback);
Step& onComplete(std::function<void()> callback);
/**
* @brief Checks if this step is the current step
@@ -76,7 +79,7 @@ namespace hex {
private:
struct Highlight {
std::string unlocalizedText;
ImGuiID highlightId;
std::vector<std::variant<Lang, std::string, int>> highlightIds;
};
struct Message {
@@ -97,6 +100,7 @@ namespace hex {
Tutorial *m_parent;
std::vector<Highlight> m_highlights;
std::optional<Message> m_message;
std::function<void()> m_onAppear, m_onComplete;
};
Step& addStep();

View File

@@ -92,6 +92,8 @@ namespace hex {
[[nodiscard]] bool didWindowJustOpen();
void setWindowJustOpened(bool state);
void trackViewOpenState();
static void discardNavigationRequests();
[[nodiscard]] static std::string toWindowName(const std::string &unlocalizedName);
@@ -104,7 +106,7 @@ namespace hex {
private:
std::string m_unlocalizedViewName;
bool m_windowOpen = false;
bool m_windowOpen = false, m_prevWindowOpen = false;
std::map<Shortcut, ShortcutManager::ShortcutEntry> m_shortcuts;
bool m_windowJustOpened = false;