summaryrefslogtreecommitdiffstats
path: root/test/src/example.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-09-09 20:40:40 -0300
committerBastiaan Olij <mux213@gmail.com>2021-09-27 23:08:11 +1000
commit38ee8bfcf724de3294146d04c6c83f2c06bc198b (patch)
tree99fd10f0c1d964a900f019135247205c06cdc71e /test/src/example.cpp
parente839199848cba6f3470a6f836b2b2992e4593104 (diff)
downloadredot-cpp-38ee8bfcf724de3294146d04c6c83f2c06bc198b.tar.gz
Change constructor/destructor management of extension classes
This makes sure custom constructors are always called on extension classes. However, note that constructors should not take any parameters, since Godot doesn't support that. Parameters are ignore in memnew macro. Use memnew(MyClass()) instead of memnew(MyClass) since it now needs a value instead of a class name. This macro calls MyClass::_new() (define in GDCLASS macro) which ultimately calls Godot to create the object, ensuring that both the Godot and the extension instances are created. Non Godot classes (that don't derive godot::Object) are constructed as usual an can have parameters. memdelete is also changed for the same reason, as it needs to destroy the Godot object as well, and that automatically frees the bound extension instance.
Diffstat (limited to 'test/src/example.cpp')
0 files changed, 0 insertions, 0 deletions