0 votes

enter image description hereI'd like to use a 3rd party library written in C++ and include it in my gdscript in order to control the logic of the game. I've heard about gdnative. How can I use those C++ library files and interface them with the gdscript code without having to modify those file (too many of them) ? What I need is use these library as an API from gdscript.

Something like in the figure.
PS: I read the tutorial here but it talks only about one file with godot headers. But couldn't understand how I can talk with that 3rd party code.

asked Dec 24, 2017 in Engine by yaniss (14 points)

there are two ways to do it. GDNative or C++ modules

GDNative only exposes a subset of what you can do with c++ modules

you kinda have to be more specific and what classes you wish to touch

http://docs.godotengine.org/en/latest/development/cpp/custom_modules_in_cpp.html

1 Answer

+1 vote

The tutorial in the news is obsolete now. Up to date documentation is pending to be written anytime soon, but in the meantime this example exists: https://github.com/GodotNativeTools/GDNative-demos/tree/master/c/SimpleDemo (that one is in pure C though).

There is also this C++ demo: https://github.com/GodotNativeTools/GDNative-demos/tree/master/cpp/kinematic_character

answered Dec 27, 2017 by Zylann (26,055 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.