buggins / dlangui

Cross Platform GUI for D programming language
Boost Software License 1.0
816 stars 121 forks source link

Embed into existing SDL app #533

Open whitebyte opened 6 years ago

whitebyte commented 6 years ago

Hi, is there any way to embed DlangUI into existing SDL2 app and create widgets inside preexisting SDL window (not made by DlangUI)? I already have a window and a main loop in my app, and I want to try to plug-in DlangUI into it, but after the quick skim through examples I have an impression that DlangUI only works with it's own created window and context. I remember some old threads on forum.dlang.org regarding similar question, but don't know if it was answered or not.

buggins commented 6 years ago

It's possible, if you implement Window and Platform for working as SDL2 embedded.

whitebyte commented 6 years ago

Could you please elaborate? Or maybe give some minimal example?

buggins commented 6 years ago

DSFML backend is example of embedded implementation. It has window and platform classes implementation to work with external event loop and externally created windows/surfaces. It looks like new SDL_EMBEDDED configuration needs to be created based on SDL platform implementation reworked similar to DSFML.