Change example code to properly represent test cases with refcounted objects

This commit is contained in:
Bastiaan Olij
2022-12-05 22:04:08 +11:00
parent 32859ea25c
commit f24ee56c5d
4 changed files with 46 additions and 8 deletions

View File

@@ -25,12 +25,20 @@ using namespace godot;
class ExampleRef : public RefCounted {
GDCLASS(ExampleRef, RefCounted);
private:
static int instance_count;
static int last_id;
int id;
protected:
static void _bind_methods() {}
static void _bind_methods();
public:
ExampleRef();
~ExampleRef();
int get_id();
};
class ExampleMin : public Control {
@@ -79,6 +87,7 @@ public:
void simple_const_func() const;
String return_something(const String &base);
Viewport *return_something_const() const;
Ref<ExampleRef> return_empty_ref() const;
ExampleRef *return_extended_ref() const;
Ref<ExampleRef> extended_ref_checks(Ref<ExampleRef> p_ref) const;
Variant varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);