2#include "../Component/CustomComponent.h"
3#include "../Util/Matrix.h"
4#include "Base/SContainerList.h"
5#include "Base/CoreBase.h"
18 static void RegisterScript(
const std::string& script);
21 void DefineClasses(HSQUIRRELVM vm = Sqrat::DefaultVM::Get());
23 void ReleaseSqratObject();
25 static void ReadScriptList() ;
28 Sqrat::Class<T>& SQRClassDef(std::string className, HSQUIRRELVM vm = Sqrat::DefaultVM::Get());
31 Sqrat::Class<T>& SQRComponentDef(std::string className, HSQUIRRELVM vm = Sqrat::DefaultVM::Get());
34 int m_gameobjectIndex = -1;
39 Sqrat::Class<T>& ScriptMgr::SQRClassDef(std::string className, HSQUIRRELVM vm) {
41 Sqrat::Class<T>* sqClass =
new Sqrat::Class<T>(Sqrat::DefaultVM::Get(), className);
42 Sqrat::RootTable(vm).Bind(className.c_str(), *sqClass);
46 if (className == _SC(
"GameObject")) {
47 m_gameobjectIndex = m_objects.size();
55 Sqrat::Class<T>& ScriptMgr::SQRComponentDef(std::string className, HSQUIRRELVM vm) {
56 if (m_gameobjectIndex >= 0) {
57 auto sqClass = *
static_cast<Sqrat::Class<SGameObject>*
>(Get(m_gameobjectIndex));
58 sqClass.Func((std::string() +
"GetComponent_" + className +
"_").c_str(),
59 &SGameObject::GetComponent<T>);
63 return SQRClassDef<T>(className, vm);