From 0a3fb023d54858427f57260eeb69ec6931e69ca7 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Mon, 30 Jul 2018 21:44:24 +1000 Subject: [PATCH] Fixed GODOT_SUBCLASS macro --- include/core/Godot.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index 9beaf24..1a140a3 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -46,10 +46,12 @@ T *get_wrapper(godot_object *obj) #define GODOT_SUBCLASS(Name, Base) \ public: inline static const char *___get_type_name() { return static_cast(#Name); } \ - inline static const char *___get_base_type_name() { return static_cast(#Base); } \ + enum { ___CLASS_IS_SCRIPT = 1, }; \ + inline static Name *_new() { godot::NativeScript *script = godot::NativeScript::_new(); script->set_library(godot::get_wrapper((godot_object *) godot::gdnlib)); script->set_class_name(#Name); Name *instance = godot::as(script->new_()); return instance; } \ + inline static const char *___get_base_type_name() { return #Base; } \ + inline static Object *___get_from_variant(godot::Variant a) { return (godot::Object *) godot::as(godot::Object::___get_from_variant(a)); } \ private: - template struct _ArgCast { static T _arg_cast(Variant a)