Skip to content

Commit 54a691a

Browse files
committed
Enhance README usage instructions, and add links
1 parent 1d3ae5a commit 54a691a

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,40 @@
22
This repository serves as a quickstart template for GDExtension development with Godot 4.0+.
33

44
## Contents
5-
* An empty Godot project (`demo/`)
5+
* Preconfigured source files for C++ development of the GDExtension ([src/](./src/))
6+
* An empty Godot project in [demo/](./demo), to test the GDExtension
67
* godot-cpp as a submodule (`godot-cpp/`)
7-
* GitHub Issues template (`.github/ISSUE_TEMPLATE.yml`)
8-
* GitHub CI/CD workflows to publish your library packages when creating a release (`.github/workflows/builds.yml`)
9-
* preconfigured source files for C++ development of the GDExtension (`src/`)
10-
* 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)
8+
* GitHub Issues template ([.github/ISSUE_TEMPLATE.yml](./.github/ISSUE_TEMPLATE.yml))
9+
* GitHub CI/CD workflows to publish your library packages when creating a release ([.github/workflows/builds.yml](./.github/workflows/builds.yml))
10+
* An SConstruct file with various functions, such as boilerplate for [Adding documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/cpp/gdextension_docs_system.html)
1111

1212
## Usage - Template
1313

14-
To use this template, log in to GitHub and click the green "Use this template" button at the top of the repository page.
15-
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.
14+
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.
1615

17-
For getting started after cloning your own copy to your local machine, you should:
16+
To get started with your new GDExtension, do the following:
17+
18+
* clone your repository to your local computer
1819
* initialize the godot-cpp git submodule via `git submodule update --init`
19-
* change the name of your library
20-
* change the name of the compiled library file inside the `SConstruct` file by modifying the `libname` string.
21-
* change the pathnames of the to be loaded library name inside the `demo/bin/example.gdextension` file. By replacing `EXTENSION-NAME` only to the name specified in your `SConstruct` file.
22-
* change the name of the `demo/bin/example.gdextension` file
23-
* 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.
24-
* 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);`.
25-
26-
### Configuring an IDE
20+
* change the name of the compiled library file inside the [SConstruct](./SConstruct) file by modifying the `libname` string.
21+
* change the paths of the to be loaded library name inside the [demo/bin/example.gdextension](./demo/bin/example.gdextension) file, by replacing `EXTENSION-NAME` with the name you chose for `libname`.
22+
* change the `entry_symbol` string inside [demo/bin/example.gdextension](./demo/bin/example.gdextension) file.
23+
* rename the `example_library_init` function in [src/register_types.cpp](./src/register_types.cpp) to the same name you chose for `entry_symbol`.
24+
* change the name of the `demo/bin/example.gdextension` file
25+
26+
Now, you can build the project with the following command:
27+
28+
```shell
29+
scons
30+
```
31+
32+
If the build command worked, you can test it with the [demo](./demo) project. Import it into Godot, open it, and launch the main scene. You should see it print the following line in the console:
33+
34+
```
35+
Type: 24
36+
```
37+
38+
### Configuring an IDE
2739
You can develop your own extension with any text editor and by invoking scons on the command line, but if you want to work with an IDE (Integrated Development Environment), you can use a compilation database file called `compile_commands.json`. Most IDEs should automatically identify this file, and self-configure appropriately.
2840
To generate the database file, you can run one of the following commands in the project root directory:
2941
```shell

0 commit comments

Comments
 (0)