Zepha/src/client/menu/MenuSandbox.h

52 lines
1.1 KiB
C
Raw Normal View History

2019-12-12 02:13:28 -08:00
#pragma once
2020-08-13 00:55:18 -07:00
#include "lua/LuaParser.h"
2019-12-12 02:13:28 -08:00
2021-09-06 18:33:01 -07:00
#include "lua/Mod.h"
2021-08-20 22:48:38 -07:00
#include "client/gui/Root.h"
#include "client/gui/Element.h"
#include "game/atlas/asset/AtlasTexture.h"
class Client;
class Subgame;
class SubgameDef;
class GuiContainer;
2019-12-12 02:13:28 -08:00
class MenuSandbox : LuaParser {
2021-08-20 22:48:38 -07:00
public:
MenuSandbox(Client& client, Gui::Root& root, sptr<Gui::Element> sandboxRoot);
2020-11-08 22:57:34 -08:00
void load(const SubgameDef& subgame);
void update(double delta) override;
using LuaParser::update;
2021-08-20 22:48:38 -07:00
private:
2020-11-08 22:57:34 -08:00
void reset();
void loadApi();
2021-09-06 18:33:01 -07:00
void loadMod(const std::filesystem::path& path);
2020-11-08 22:57:34 -08:00
2021-08-20 22:48:38 -07:00
void showError(const string& err);
2020-11-08 22:57:34 -08:00
2021-09-06 18:33:01 -07:00
/** Exposed to Lua, can provide a relative path, uses environment variables to resolve. */
sol::protected_function_result require(sol::this_environment thisEnv, const string& path);
2020-11-08 22:57:34 -08:00
2021-09-06 18:33:01 -07:00
/** Loads a file with the right enviroment, needs a canonical path. */
sol::protected_function_result loadFile(const string& path);
Mod mod {};
2021-08-20 22:48:38 -07:00
string subgameName;
2020-11-08 22:57:34 -08:00
2021-08-20 22:48:38 -07:00
Client& client;
2021-08-19 13:33:08 -07:00
2021-08-20 22:48:38 -07:00
Gui::Root& root;
sptr<Gui::Element> sandboxRoot;
vec<AtlasTexture> menuAssets {};
2020-11-08 22:57:34 -08:00
2021-08-22 11:58:52 -07:00
double accumulatedDelta = 0;
2019-12-12 02:13:28 -08:00
};