f8/cpp/scriptengine.h
2018-11-26 21:09:20 +08:00

35 lines
889 B
C++

#pragma once
namespace a8
{
class PyEngine;
};
namespace f8
{
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;
};
}