galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
GUI.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_COMPONENTS_GUI_HPP_
9#define GALAXY_COMPONENTS_GUI_HPP_
10
11#include <sol/sol.hpp>
12
14
15namespace galaxy
16{
17 namespace components
18 {
22 class GUI final : public fs::Serializable
23 {
24 public:
28 GUI();
29
35 GUI(const nlohmann::json& json);
36
40 GUI(GUI&&);
41
45 GUI& operator=(GUI&&);
46
50 virtual ~GUI();
51
57 void load(const std::string& file);
58
64 [[nodiscard]] const std::string& file() const;
65
71 [[nodiscard]] nlohmann::json serialize() override;
72
78 void deserialize(const nlohmann::json& json) override;
79
80 private:
84 GUI& operator=(const GUI&) = delete;
85
89 GUI(const GUI&) = delete;
90
91 public:
95 sol::table m_self;
96
100 sol::function m_update;
101
102 private:
106 std::string m_file;
107 };
108 } // namespace components
109} // namespace galaxy
110
111#endif
Script for running an active UI.
Definition GUI.hpp:23
GUI()
Constructor.
Definition GUI.cpp:20
const std::string & file() const
Get script file.
Definition GUI.cpp:112
GUI & operator=(GUI &&)
Move assignment operator.
Definition GUI.cpp:36
void deserialize(const nlohmann::json &json) override
Deserializes from object.
Definition GUI.cpp:125
void load(const std::string &file)
Load script and set context.
Definition GUI.cpp:56
virtual ~GUI()
Destructor.
Definition GUI.cpp:48
sol::table m_self
The script object (table) returned by a lua script.
Definition GUI.hpp:95
GUI & operator=(const GUI &)=delete
Copy assignment operator.
nlohmann::json serialize() override
Serializes object.
Definition GUI.cpp:117
std::string m_file
Script file.
Definition GUI.hpp:106
GUI(const GUI &)=delete
Copy constructor.
sol::function m_update
The update function belonging to the lua table.
Definition GUI.hpp:100
Allows a class to be serialized.
Timer.hpp galaxy.
Definition Async.hpp:17