ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
59.74k stars 10.17k forks source link

SDL2 backend does not build on UWP #8008

Closed rokups closed 3 days ago

rokups commented 5 days ago

Version/Branch of Dear ImGui:

Version 1.91, Branch: docking

Back-ends:

imgui_impl_sdl2.cpp

Compiler, OS:

MSVC

Full config/build information:

No response

Details:

SDL2 backend uses GetWindowLong/SetWindowLong/ShowWindow windows API, which are not allowed with UWP and the build fails. It would make sense to disable code using these APIs on UWP. You can check presence of UWP build like so:

#if defined(WINAPI_FAMILY_PARTITION)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Is UWP
#endif
#endif

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

ocornut commented 5 days ago

Could you provide a PR for it? (if adequate, over docking branch with 1 commit for master 1 commit for docking if needed) We do test for UWP here and there already so can use same syntax as whatever is already in.

ocornut commented 3 days ago

Pushed a fix d7cedd6

rokups commented 3 days ago

Sorry, i did not manage to get to this in time. Thanks for the fix :)

ocornut commented 3 days ago

Note that I used the same logic as main lib was using: (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_GAMES) which differs from your proposed version. I am not entirely sure what the FAMILY vs FAMILY_PARTITION means at this point.