Skip to content

Commit

Permalink
Add documentation capabilities to template (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddy-exe authored Jul 4, 2024
1 parent 46a6b99 commit 626ba22
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Godot 4+ specific ignores
.godot/
game/bin/summator/*
src/gen/*
.sconsign*.dblite

# Binaries
Expand Down
12 changes: 10 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
34 changes: 34 additions & 0 deletions doc_classes/Summator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Summator" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
<brief_description>
Very short and brief description.
</brief_description>
<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.
</description>
<tutorials>
<link title="Summator Module Docs">https://docs.godotengine.org/en/stable/contributing/development/core_and_modules/custom_modules_in_cpp.html</link>
<link title="GDExtensionSummator GitHub">https://github.com/paddy-exe/GDExtensionSummator</link>
</tutorials>
<methods>
<method name="add">
<return type="void" />
<param index="0" name="value" type="int" default="1" />
<description>
Add value to the Summator instance.
</description>
</method>
<method name="get_total" qualifiers="const">
<return type="int" />
<description>
Returns the total amount saved in the Summator instance.
</description>
</method>
<method name="reset">
<return type="void" />
<description>
Resets the amount of the Summator instance to zero.
</description>
</method>
</methods>
</class>
1 change: 1 addition & 0 deletions game/bin/summator.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

entry_symbol = "summator_library_init"
compatibility_minimum = 4.1
reloadable = true

[libraries]

Expand Down
2 changes: 1 addition & 1 deletion game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 106 files
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 626ba22

Please sign in to comment.