8#include <nlohmann/json.hpp>
10#include "galaxy/core/ServiceLocator.hpp"
31 this->
m_self = std::move(s.m_self);
32 this->
m_update = std::move(s.m_update);
33 this->
m_file = std::move(s.m_file);
40 this->
m_self = std::move(s.m_self);
41 this->
m_update = std::move(s.m_update);
42 this->
m_file = std::move(s.m_file);
58 auto& fs = core::ServiceLocator<fs::VirtualFileSystem>::ref();
60 auto script = fs.read(
file);
70 auto& state = core::ServiceLocator<sol::state>::ref();
71 auto& nui = core::ServiceLocator<ui::NuklearUI>::ref();
75 auto result = state.load(script);
119 nlohmann::json json =
"{}"_json;
127 load(json.at(
"file"));
#define GALAXY_LOG(level, msg,...)
Script for running an active UI.
const std::string & file() const
Get script file.
GUI & operator=(GUI &&)
Move assignment operator.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
void load(const std::string &file)
Load script and set context.
virtual ~GUI()
Destructor.
sol::table m_self
The script object (table) returned by a lua script.
nlohmann::json serialize() override
Serializes object.
std::string m_file
Script file.
sol::function m_update
The update function belonging to the lua table.