https://github.com/godotengine/godot-cpp-template
Quickstart template for GDExtension development with Godot
https://github.com/godotengine/godot-cpp-template
gdextension godot godot-engine
Last synced: 5 months ago
JSON representation
Quickstart template for GDExtension development with Godot
- Host: GitHub
- URL: https://github.com/godotengine/godot-cpp-template
- Owner: godotengine
- License: unlicense
- Created: 2023-08-05T22:43:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-15T20:03:49.000Z (5 months ago)
- Last Synced: 2025-05-15T21:23:44.842Z (5 months ago)
- Topics: gdextension, godot, godot-engine
- Language: Python
- Homepage: https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/what_is_gdextension.html
- Size: 103 KB
- Stars: 224
- Watchers: 33
- Forks: 65
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# godot-cpp template
This repository serves as a quickstart template for GDExtension development with Godot 4.0+.## Contents
* An empty Godot project (`demo/`)
* godot-cpp as a submodule (`godot-cpp/`)
* GitHub Issues template (`.github/ISSUE_TEMPLATE.yml`)
* GitHub CI/CD workflows to publish your library packages when creating a release (`.github/workflows/builds.yml`)
* preconfigured source files for C++ development of the GDExtension (`src/`)
* setup to automatically generate `.xml` files in a `doc_classes/` directory to be parsed by Godot as [GDExtension built-in documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/gdextension_docs_system.html)## Usage - Template
To use this template, log in to GitHub and click the green "Use this template" button at the top of the repository page.
This will let you create a copy of this repository with a clean git history. Make sure you clone the correct branch as these are configured for development of their respective Godot development branches and differ from each other. Refer to the docs to see what changed between the versions.For getting started after cloning your own copy to your local machine, you should:
* initialize the godot-cpp git submodule via `git submodule update --init`
* change the name of your library
* change the name of the compiled library file inside the `SConstruct` file by modifying the `libname` string.
* change the pathnames of the to be loaded library name inside the `demo/bin/example.gdextension` file. By replacing `libgdexample` to the name specified in your `SConstruct` file.
* change the name of the `demo/bin/example.gdextension` file
* change the `entry_symbol` string inside your `demo/bin/your-extension.gdextension` file to be configured for your GDExtension name. This should be the same as the `GDExtensionBool GDE_EXPORT` external C function. As the name suggests, this sets the entry function for your GDExtension to be loaded by the Godot editors C API.
* register the classes you want Godot to interact with inside the `register_types.cpp` file in the initialization method (here `initialize_gdextension_types`) in the syntax `GDREGISTER_CLASS(CLASS-NAME);`.## Usage - Actions
This repository comes with a GitHub action that builds the GDExtension for cross-platform use. It triggers automatically for each pushed change. You can find and edit it in [builds.yml](.github/workflows/builds.yml).
After a workflow run is complete, you can find the file `godot-cpp-template.zip` on the `Actions` tab on GitHub.