Please update this if you figure this out – I’m just playing around with GDExtension and C++ right now, but I’m getting an immediate crash when trying to use std::thread and haven’t been able to find much about C++ threading in GDExtensions.
I give up, and currently porting my game to Unity. Find out to many bugs, even using GDscript, C# or C++. I will still using godot, but for now, Unity feels like I can finish my project.
With the C++ version, I noticed that you cant build the entire game in C++: trying to use autoloads/singletons, threads, ahh~~~ I don’t remember the other points but there was a lot, the C++ version is more like to develop for godot not for your project.
Note: Also I am working in a SDL2 project with C++ and I am using ranges and views, threads/async, coroutines, for(const auto& v : somecontainer) that in godot-cpp can’t use it.
Thanks! I’m trying to convert from the GDScript tutorial to GDExtension, but I’m getting tripped up on how to convert the calls. So for example I don’t know how to convert:
thread = Thread.new()
thread.start(_thread_function.bind(“Wafflecopter”))
The object has to be registered. I believe I’ve mentioned in another thread that callable_mp is a recent addition that may not be available for earlier versions. However, it should work with the other callable if the one I’m using isn’t available.
You are amazing!! I super appreciate the help – makes a lot of sense now that I see it but I was struggling I will share my repo here soon for anyone looking in the future. Thanks again!!
This should work. You can ignore everything but the ready and on_animation_finished functions. After ready is called, a Callable is made that will be called when the animation has finished. It’s important that it one shots, otherwise the callable will stay connected, which will add to the number of times on_animation_finished is called when ready is called. After the signal signals and on_animation_finished is called, the code effectively resumes. The Callable is disconnected automatically because it is one shot.
Thanks so much! I’m working on a clean github project to share and potentially update the official documentation with all this great C++ GDExtension info.
It’s probably a mess, but here’s the GitHub repo I set up for this. I’m planning on doing a little more with it, but I want to keep it as a simple demo project.