Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ur_ui_tutorials_browser.hpp
Go to the documentation of this file.
1
11
12#ifndef ZOAPPUITUTORIALSBROWSER_H
13#define ZOAPPUITUTORIALSBROWSER_H
14
15#define GLM_ENABLE_EXPERIMENTAL
16#include <glm/gtx/string_cast.hpp>
17
18#include "toymaker/sim_system.hpp"
19
20#include "ur_records.hpp"
21
22
29 std::string mHeading {};
30 std::string mText {};
31 std::string mImageFilepath {};
32};
33
39class UrUITutorialsBrowser: public ToyMaker::SimObjectAspect<UrUITutorialsBrowser> {
40public:
41
42 UrUITutorialsBrowser(): ToyMaker::SimObjectAspect<UrUITutorialsBrowser>{0} {}
43 inline static std::string getSimObjectAspectTypeName() { return "UrUITutorialsBrowser"; }
44 static std::shared_ptr<BaseSimObjectAspect> create(const nlohmann::json& jsonAspectProperties);
45 std::shared_ptr<BaseSimObjectAspect> clone() const override;
46
47 void loadScene(const std::string& sceneResourceName);
48
49private:
50 uint32_t mPage {0};
51 std::string mTutorialsFilepath {};
52 std::string mTutorialTextAspect {};
53 std::string mTutorialHeadingAspect {};
54 std::string mTutorialImageAspect {};
55 std::vector<TutorialContent> mTutorials {};
56
57 void onActivated() override;
58
59 void onButtonClicked(const std::string& button);
60
61 bool hasPage(uint32_t page) const;
62 void openPage(uint32_t page);
63
64 void loadTutorials();
65
66public:
68 *this, "ButtonClickedObserved",
69 [this](const std::string& button) { this->onButtonClicked(button); }
70 };
71};
72
74void from_json(const nlohmann::json& json, TutorialContent& tutorialContent);
76void to_json(nlohmann::json& json, const TutorialContent& tutorialContent);
77
78#endif
A SignalObserver object, which can subscribe to Signals matching its data signature and receive signa...
Definition signals.hpp:412
An object containing closely related methods and data, and exposing object lifecycle and application ...
Definition sim_system.hpp:956
std::shared_ptr< BaseSimObjectAspect > clone() const override
A method which must be overridden to specify how a new aspect should be constructed as a copy of this...
Definition ur_ui_tutorials_browser.cpp:23
void onActivated() override
Callback for when the aspect is activated (after it is attached to an active SimObject,...
Definition ur_ui_tutorials_browser.cpp:53
The data associated with a single tutorial page.
Definition ur_ui_tutorials_browser.hpp:28
Contains aspect class definition for the records save system.