12#include <pocketpy/pocketpy.h>
16namespace py = pybind11;
53 py::class_<T> pyClass = py::class_<T>(catosPyMod, name).def(py::init<>());
54 auto hash =
typeid(T).hash_code();
56 _pythonClasses.
put(hash, pyClass);
59 template<
typename T,
typename U>
61 auto hash =
typeid(T).hash_code();
63 auto obj = _pythonClasses.
get(hash);
65 auto pyClass = std::any_cast<py::class_<T>>(obj);
68 pyClass.def_readwrite(name, ptr);
71 template<
class T,
typename U>
73 auto hash =
typeid(T).hash_code();
75 auto obj = _pythonClasses.
get(hash);
77 auto pyClass = std::any_cast<py::class_<T>>(obj);
79 pyClass.def(name, ptr);
84 py::scoped_interpreter* interpreter =
nullptr;
85 py::module catosPyMod;
Definition application.h:13
The registry is the core system and provides reflection to the rest of the engine.
Definition registry.h:351
Object that holds info about a Script.
Definition ScriptingEngine.h:23
catos::string src
Definition ScriptingEngine.h:24
catos::string className
Definition ScriptingEngine.h:25
Definition ScriptingEngine.h:31
void registerMethod(const char *name, U T::*ptr)
Definition ScriptingEngine.h:72
void registerClass(const char *name)
Definition ScriptingEngine.h:51
void endScripts()
Definition ScriptingEngine.cpp:119
void startScripts()
Definition ScriptingEngine.cpp:90
~ScriptingEngine()
Definition ScriptingEngine.cpp:31
void registerNewScript(const catos::string &pathToPythonFile)
Definition ScriptingEngine.cpp:35
ScriptingEngine()
Definition ScriptingEngine.cpp:16
static ScriptingEngine & getInstance()
singleton :D
Definition ScriptingEngine.cpp:11
void updateScripts()
Definition ScriptingEngine.cpp:107
void registerProperty(const char *name, U T::*ptr)
Definition ScriptingEngine.h:60
V get(const K &key)
Gets the value based on the key given.
Definition hashmap.h:89
void put(const K &key, const V &value)
puts an item in the table.
Definition hashmap.h:107
Custom string class that functions as dynamic C_str.
Definition string.h:11