SFML / imgui-sfml

Dear ImGui backend for use with SFML
MIT License
1.15k stars 172 forks source link

Use conversion constructor #267

Closed ChrisThrasher closed 11 months ago

ChrisThrasher commented 11 months ago

We can simplify imgui-SFML.cpp a decent amount by using the ImVec constructor we define in imconfig-SFML.h.

eliasdaler commented 11 months ago

Here's a problem with this - it makes imconfig-SFML.h required and it defines IM_VEC2_CLASS_EXTRA which not all users might want.

This might be especially problematic if they want to have their own IM_VEC2_CLASS_EXTRA which defines conversion from their vector types to ImVec2/4 and imgui-sfml always defining it might lead to some problems, especially if using imgui-sfml as a shared library.

ChrisThrasher commented 11 months ago

If I'm understanding correct, this code results in a hard compilation failure if someone changes the value of IMGUI_SFML_USE_DEFAULT_CONFIG to point to a different header? If that's true then we have no choice but to revert this.

ChrisThrasher commented 11 months ago

See #268

A better solution would be to add a toImVec function in the same anonymous namespace as toImColor.