Can the engine be embedded into a C++ Windows desktop window?

Godot Version

godot 4.5 / 4.6

Question

Hey
I’m checking the possibilities to embed a C/C++ 2D engine into a Windows window and run the game from this window and, of course, capture the input events from the engine so it can be playable and use its own event loop. I mean, the Windows also has its own event loop. How do they work together if they work together? This is my simple Windows code:

HWND hwnd = CreateWindowExW(

      exStyle, kClassName, L"systemtray", style, CW_USEDEFAULT, CW_USEDEFAULT,

      desiredClient.right - desiredClient.left, desiredClient.bottom - desiredClient.top,

      nullptr, nullptr, instance, nullptr);




  if (!hwnd) return 1;




  ShowWindow(hwnd, SW_HIDE);




  MSG message{};

  while (GetMessageW(&message, nullptr, 0, 0) > 0) {

    TranslateMessage(&message);

    DispatchMessageW(&message);

  }

Define “embed”.
What would be the purpose of doing this?

running game inside native windows window

The game already runs inside a native windows window… on windows :smiley:

Is there any particular reason why you can’t go the other way around and create the window using Godot and then embed your own stuff into the Godot window? Might be easier to do it this way around.

This is what i need to bigger project

Now with Godot 4.6 there is libgodot, did you take a look at that?

yes i did , there is tiny example that dont do much and i dont know how to continue from there