2019-12-12 02:13:28 -08:00
|
|
|
//
|
|
|
|
// Created by aurailus on 2019-12-12.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-13 00:55:18 -07:00
|
|
|
#include "lua/LuaParser.h"
|
2019-12-12 02:13:28 -08:00
|
|
|
|
2020-08-13 00:55:18 -07:00
|
|
|
#include "lua/LuaMod.h"
|
|
|
|
#include "client/gui/GuiBuilder.h"
|
2020-07-06 18:34:59 -07:00
|
|
|
|
2020-11-03 23:29:30 -08:00
|
|
|
class Client;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-06 18:34:59 -07:00
|
|
|
class Subgame;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-06 18:34:59 -07:00
|
|
|
class AtlasRef;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-25 20:19:18 -07:00
|
|
|
class SubgameDef;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2020-07-06 18:34:59 -07:00
|
|
|
class GuiContainer;
|
2019-12-12 02:13:28 -08:00
|
|
|
|
|
|
|
class MenuSandbox : LuaParser {
|
2020-11-08 22:57:34 -08:00
|
|
|
public:
|
|
|
|
MenuSandbox(glm::ivec2& window, Client& client, std::shared_ptr<GuiContainer> container);
|
|
|
|
|
|
|
|
void load(const SubgameDef& subgame);
|
|
|
|
|
|
|
|
void update(double delta) override;
|
|
|
|
|
|
|
|
void windowResized();
|
|
|
|
|
|
|
|
using LuaParser::update;
|
|
|
|
private:
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
void loadApi();
|
|
|
|
|
|
|
|
void loadAndRunMod(const std::string& modPath);
|
|
|
|
|
|
|
|
void showError(const std::string& what, const std::string& subgame);
|
|
|
|
|
|
|
|
sol::protected_function_result runFileSandboxed(const std::string& file);
|
|
|
|
|
|
|
|
virtual sol::protected_function_result errorCallback(sol::protected_function_result r) const override;
|
|
|
|
|
2021-06-22 18:13:39 -07:00
|
|
|
LuaMod mod {};
|
2020-11-08 22:57:34 -08:00
|
|
|
std::vector<std::shared_ptr<AtlasRef>> modAssets{};
|
|
|
|
|
|
|
|
std::shared_ptr<GuiContainer> container = nullptr;
|
|
|
|
std::shared_ptr<GuiContainer> luaContainer = nullptr;
|
|
|
|
GuiBuilder builder;
|
|
|
|
|
|
|
|
Client& client;
|
|
|
|
glm::ivec2& win;
|
2019-12-12 02:13:28 -08:00
|
|
|
};
|