Code example for creating GUI in a C++ module

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

I’m new to Godot and currently a little bit overwhelmed by all the features, structures and concepts of Godot.
I’m trying to figure out if I’m able to port an existing game with a custom engine over to Godot.
The game is written entirely in C/C++, so I would like to use C++ modules for this (not GDScript nor GDNative).

I followed the tutorial about C++ modules (Custom modules in C++ — Godot Engine (3.1) documentation in English) and this is working fine so far.

Unfortunately, this example code is very self-contained and doesn’t use one of the more interesting APIs of Godot like creating GUI elements.

I’m not sure yet if I can bypass completely GDScript and the Editor. So what I have done so far is creating a C++ module, creating an empty Node in the Editor which is linked to a GDScript which only calls the entry function of my C++ module. As a result I’m getting correct console outputs from my C++ module. So far so good.

I have tried by myself to display some GUI elements, however, I’m neither getting any kind of error or warning nor do I see anything at all. My guess is that I haven’t yet understood the Scene/Node/Views/…Elements concepts so I can’t really come up with correct code.

Does anyone has some basic example code for a C++ module which is displaying same basic UI element like a button and text?

I basically have the same question and haven’t been able to find an answer yet. Let me know if you found some good reference. I have a custom game engine that is currently bolted to Unreal 4 as a simulation but also runs without Unreal as a server. Considering switching to Godot for a lighter weight renderer and editor. Don’t need most of Unreal 4 features.

keleios | 2019-09-10 12:18