Topic was automatically imported from the old Question2Answer platform.
How to integrate exsiting c++ project in godot 2D?
for some game already has some written code , rewrite it would be a huge task.
Since godot has plugin, how to use it with existing code.
This kind of project usually has a whole game logic ,and game loop like
we just want godot do the input , load texture and draw .
updateGame logic is in old code.
For the draw part, just need a node that display sprite each loop.
the sprite attribute like position is update in old c/c++ code
Godot’s SceneTree manages the game loop (input, update, draw).
You can have a single Node in the tree that manages the data or port it to the Godot way and make many nodes for different tasks (in gdscript and gdnative if needed).
For a more tight integration, look if you can modify the engine and make your own MainLoop.
in my opinion ,
make a node for the main game
run the old c logic code in an independent thread , make 2 pipe.
Pipe1 to get the input from godot.
Pipe2 to push the display sprite each frame to godot.
Godot just do rendering in this node.
For other menu, setting, ui etc, make other node, use the godot way.