f8/cpp/scriptengine.h
2018-08-18 17:05:49 +08:00

31 lines
798 B
C++

#pragma once
namespace a8
{
class PyEngine;
};
class ScriptEngine : public a8::Singleton<ScriptEngine>
{
private:
ScriptEngine() {};
friend class a8::Singleton<ScriptEngine>;
public:
void Init();
void UnInit();
void Update();
bool LoadModule(const std::string& module_name);
bool LoadString(const std::string& str);
std::tuple<bool, a8::XValue> CallGlobalFunc(const char* func_name,
std::initializer_list<a8::XValue> args);
std::tuple<bool, a8::XValue> CallModuleFunc(const char* module_name,
const char* func_name,
std::initializer_list<a8::XValue> args);
public:
a8::PyEngine *engine_ = nullptr;
};