rootobj.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <api/script/objcontroller.h>
  2. #include "rootobj.h"
  3. #include <api/script/objects/rootobject.h>
  4. #include "api.h"
  5. #include <api/script/scriptguid.h>
  6. RootObjectInstance::RootObjectInstance()
  7. {
  8. ASSERT(WASABI_API_MAKI != 0);
  9. rootobject_init();
  10. }
  11. RootObjectInstance::~RootObjectInstance()
  12. {
  13. WASABI_API_MAKI->maki_deencapsulate(rootObjectGuid, my_root_object);
  14. }
  15. RootObject *RootObjectInstance::getRootObject() {
  16. return my_root_object;
  17. }
  18. ScriptObject *RootObjectInstance::getScriptObject() {
  19. return &my_script_object;
  20. }
  21. const wchar_t *RootObjectInstance::getClassName()
  22. {
  23. return my_root_object->rootobject_getClassName();
  24. }
  25. void RootObjectInstance::notify(const wchar_t *s, const wchar_t *t, int u, int v) {
  26. my_root_object->rootobject_notify(s, t, u, v);
  27. }
  28. void RootObjectInstance::rootobject_init()
  29. {
  30. my_root_object = static_cast<RootObject *>(WASABI_API_MAKI->maki_encapsulate(rootObjectGuid, &my_script_object)); // creates an encapsulated RootObject
  31. my_script_object.vcpu_setInterface(rootObjectInstanceGuid, static_cast<void *>(this));
  32. my_script_object.vcpu_setClassName(L"Object");
  33. my_script_object.vcpu_setController(WASABI_API_MAKI->maki_getController(rootObjectGuid));
  34. }