Can i do everything in GDNative C++ ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Karim

Can i do everything in C++ or can everything that can be made with GDScript be made with GDNative C++ or i must code some things from scratch ?

:bust_in_silhouette: Reply From: Bengt Söderström

More than 99% can be done in C++(GDNative).
So far, its only in the editor’s inspector where I haven’t quite figured out how to do everything from GDNative, like:
-property_list_changed_notify() not updating values in inspector as it does in GDScript,
-exposing a variable as a specific type like Texture; I use Variant then cast it instead.

Also, you may need to use the STL for things like vector if not create your own since Godot’s Vector class is not exposed in GDNative.

What frustrates me is that in C# and GDScript when a node extends from KinematicBody 2D for example there is 2 properties called Position And Rotation ( Vector and float ) storing the body’s position and rotation and i can’t find this anywhere in GDNative. So how come that something so basic is not exposed ?

Karim | 2021-01-31 14:33

// In GDNative, accessor functions typically have get_ or set_
// prepended, so those should already be exposed as:
Vector2 pos = get_position();
float rot = get_rotation_degrees();

Bengt Söderström | 2021-01-31 15:49