From 626ba2211d0c8c7a6c034856ed49d39b20e101a1 Mon Sep 17 00:00:00 2001 From: "Patrick Exner (FlameLizard)" Date: Thu, 4 Jul 2024 22:38:54 +0200 Subject: [PATCH] Add documentation capabilities to template (#66) --- .gitignore | 1 + SConstruct | 12 ++++++-- doc_classes/Summator.xml | 34 +++++++++++++++++++++++ game/bin/summator.gdextension | 1 + game/project.godot | 2 +- godot-cpp | 2 +- {extension/src => src}/register_types.cpp | 0 {extension/src => src}/register_types.h | 0 {extension/src => src}/summator.cpp | 0 {extension/src => src}/summator.h | 0 10 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 doc_classes/Summator.xml rename {extension/src => src}/register_types.cpp (100%) rename {extension/src => src}/register_types.h (100%) rename {extension/src => src}/summator.cpp (100%) rename {extension/src => src}/summator.h (100%) diff --git a/.gitignore b/.gitignore index 03e0b25..696732a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Godot 4+ specific ignores .godot/ game/bin/summator/* +src/gen/* .sconsign*.dblite # Binaries diff --git a/SConstruct b/SConstruct index e7a82e0..fa51128 100644 --- a/SConstruct +++ b/SConstruct @@ -13,8 +13,16 @@ env = SConscript("godot-cpp/SConstruct") # - LINKFLAGS are for linking flags # tweak this if you want to use different folders, or more folders, to store your source code in. -env.Append(CPPPATH=["extension/src/"]) -sources = Glob("extension/src/*.cpp") +env.Append(CPPPATH=["src/"]) +sources = Glob("src/*.cpp") + +if env["target"] in ["editor", "template_debug"]: + try: + doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml")) + sources.append(doc_data) + print("Class reference added.") + except AttributeError: + print("Not including class reference as we're targeting a pre-4.3 baseline.") if env["platform"] == "macos": library = env.SharedLibrary( diff --git a/doc_classes/Summator.xml b/doc_classes/Summator.xml new file mode 100644 index 0000000..fdadf9e --- /dev/null +++ b/doc_classes/Summator.xml @@ -0,0 +1,34 @@ + + + + Very short and brief description. + + + This is a very long description. You can use [b]bold[/b], [i]italic[/i], [u]underlined[/u], [code]code[/code] and other cool things supported by BBCode tags. + + + https://docs.godotengine.org/en/stable/contributing/development/core_and_modules/custom_modules_in_cpp.html + https://github.com/paddy-exe/GDExtensionSummator + + + + + + + Add value to the Summator instance. + + + + + + Returns the total amount saved in the Summator instance. + + + + + + Resets the amount of the Summator instance to zero. + + + + diff --git a/game/bin/summator.gdextension b/game/bin/summator.gdextension index a590ffd..082da38 100644 --- a/game/bin/summator.gdextension +++ b/game/bin/summator.gdextension @@ -2,6 +2,7 @@ entry_symbol = "summator_library_init" compatibility_minimum = 4.1 +reloadable = true [libraries] diff --git a/game/project.godot b/game/project.godot index 16106b7..7d8eb37 100644 --- a/game/project.godot +++ b/game/project.godot @@ -13,5 +13,5 @@ config_version=5 config/name="GDExtensionSummator" config/tags=PackedStringArray("gdextension", "template") run/main_scene="res://main.tscn" -config/features=PackedStringArray("4.2") +config/features=PackedStringArray("4.3") config/icon="res://icon.png" diff --git a/godot-cpp b/godot-cpp index 7cd79e4..c414c2b 160000 --- a/godot-cpp +++ b/godot-cpp @@ -1 +1 @@ -Subproject commit 7cd79e4cc64ce484ba04d1919da7d4cd39aab5ff +Subproject commit c414c2b37d0563456a2fe194b16f8c4aa442e865 diff --git a/extension/src/register_types.cpp b/src/register_types.cpp similarity index 100% rename from extension/src/register_types.cpp rename to src/register_types.cpp diff --git a/extension/src/register_types.h b/src/register_types.h similarity index 100% rename from extension/src/register_types.h rename to src/register_types.h diff --git a/extension/src/summator.cpp b/src/summator.cpp similarity index 100% rename from extension/src/summator.cpp rename to src/summator.cpp diff --git a/extension/src/summator.h b/src/summator.h similarity index 100% rename from extension/src/summator.h rename to src/summator.h