Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
scripting.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2023 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <spdlog/sinks/ringbuffer_sink.h>
20#include <spdlog/spdlog.h>
21
22#include <memory>
23#include <string>
24#include <string_view>
25#include <vector>
26
27#include <sol/sol.hpp>
28
29namespace cqsp {
30namespace scripting {
31class ScriptInterface : public sol::state {
32 public:
33 using sol::state::state;
35 void RunScript(std::string_view str);
36 void ParseResult(const sol::protected_function_result&);
37 void RegisterDataGroup(std::string_view name);
38 void Init();
39 int GetLength(std::string_view);
40
41 std::vector<std::string> values;
42
43 std::vector<std::string> GetLogs();
44
45 private:
46 std::shared_ptr<spdlog::logger> logger;
47 std::shared_ptr<spdlog::sinks::ringbuffer_sink_mt> ringbuffer_sink;
48};
49} // namespace scripting
50} // namespace cqsp
Definition: scripting.h:31
void RegisterDataGroup(std::string_view name)
Definition: scripting.cpp:55
ScriptInterface()
Definition: scripting.cpp:29
int GetLength(std::string_view)
Definition: scripting.cpp:75
std::vector< std::string > values
Definition: scripting.h:41
void ParseResult(const sol::protected_function_result &)
Definition: scripting.cpp:44
void Init()
Definition: scripting.cpp:68
std::vector< std::string > GetLogs()
Definition: scripting.cpp:77
std::shared_ptr< spdlog::logger > logger
Definition: scripting.h:46
std::shared_ptr< spdlog::sinks::ringbuffer_sink_mt > ringbuffer_sink
Definition: scripting.h:47
void RunScript(std::string_view str)
Definition: scripting.cpp:53
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21