diff --git a/demo/example.gd b/demo/example.gd
new file mode 100644
index 0000000..02cfc52
--- /dev/null
+++ b/demo/example.gd
@@ -0,0 +1,6 @@
+extends Node
+
+
+func _ready() -> void:
+ var example := ExampleClass.new()
+ example.print_type(example)
diff --git a/demo/example.tscn b/demo/example.tscn
new file mode 100644
index 0000000..8fea2ee
--- /dev/null
+++ b/demo/example.tscn
@@ -0,0 +1,6 @@
+[gd_scene load_steps=2 format=3 uid="uid://dh0oj81pufivs"]
+
+[ext_resource type="Script" path="res://example.gd" id="1_jdh55"]
+
+[node name="Node" type="Node"]
+script = ExtResource("1_jdh55")
diff --git a/doc_classes/ExampleClass.xml b/doc_classes/ExampleClass.xml
new file mode 100644
index 0000000..92f54e3
--- /dev/null
+++ b/doc_classes/ExampleClass.xml
@@ -0,0 +1,20 @@
+
+
+
+ Example class.
+
+
+ An example class.
+
+
+
+
+
+
+
+
+ Print the type of the variant.
+
+
+
+
diff --git a/src/example_class.cpp b/src/example_class.cpp
new file mode 100644
index 0000000..177f9b5
--- /dev/null
+++ b/src/example_class.cpp
@@ -0,0 +1,9 @@
+#include "example_class.h"
+
+void ExampleClass::_bind_methods() {
+ godot::ClassDB::bind_method(D_METHOD("print_type", "variant"), &ExampleClass::print_type);
+}
+
+void ExampleClass::print_type(const Variant &p_variant) const {
+ print_line(vformat("Type: %d", p_variant.get_type()));
+}
diff --git a/src/example_class.h b/src/example_class.h
new file mode 100644
index 0000000..76c6d55
--- /dev/null
+++ b/src/example_class.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "godot_cpp/classes/ref_counted.hpp"
+#include "godot_cpp/classes/wrapped.hpp"
+#include "godot_cpp/variant/variant.hpp"
+
+using namespace godot;
+
+class ExampleClass : public RefCounted {
+ GDCLASS(ExampleClass, RefCounted)
+
+protected:
+ static void _bind_methods();
+
+public:
+ ExampleClass() = default;
+ ~ExampleClass() override = default;
+
+ void print_type(const Variant &p_variant) const;
+};
diff --git a/src/register_types.cpp b/src/register_types.cpp
index 9f43623..2760920 100644
--- a/src/register_types.cpp
+++ b/src/register_types.cpp
@@ -1,9 +1,12 @@
#include "register_types.h"
+
#include
#include
#include
#include
+#include "example_class.h"
+
using namespace godot;
void initialize_gdextension_types(ModuleInitializationLevel p_level)
@@ -11,7 +14,7 @@ void initialize_gdextension_types(ModuleInitializationLevel p_level)
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
- //GDREGISTER_CLASS(YourClass);
+ GDREGISTER_CLASS(ExampleClass);
}
void uninitialize_gdextension_types(ModuleInitializationLevel p_level) {