Attaching SDL2 to an existing FMX window Delphi 10.2

Problem:
I want to use SDL_CreateWindowForm to initialize SDL2 video on an existed window using Firemonkey.

Tagged:

Comments

  • edited May 30

    Solution:
    Since FMX is cross-platform I need to find the native window handle for each platform. In my case Windows.
    Using FMX.Platform.Win unit I can call

    nativeHandle := WindowHandleToPlatform( myForm.Handle).Wnd;
    ...
    //then pass the handle to SDL2, the secret is to pass it casting to Pointer)
    fWindow := SDL_CreateWindowFrom(pointer(nativeHandle);
    

    That was the way to make it work! :)

Sign In or Register to comment.