vnen / gdextension-c-example

A very simple example of using GDExtension with C without any language bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GDExtension C example

This is a very basic example on how to create a GDExtension using C without any language bindings. It replicates the C++ example from the official documentation but without the C++ bindings.

The intention is to showcase how the GDExtension API works so other bindings can use this as a reference.

Note that while it's possible to develop your extensions in C like this, it is not the recommended workflow. The API was not designed to be used without some sort of code generation to create helper functions. Doing all this manually can become tedious quite fast.

The api.c (and its corresponding header) are a small set of such helper functions, made so the interaction with the GDExtension API and the extension logic in itself are separate. This makes it easier to understand each part of the example.

Compiling

The SConstruct file is a very simple one that compiles a debug build targeting the platform where you're running scons on. After compiling, the Godot project in the demo folder can be opened in the editor.

About

A very simple example of using GDExtension with C without any language bindings

License:MIT License


Languages

Language:C 99.5%Language:Python 0.5%