ocornut / imgui

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

Rotate Entire Window ImGui SDL2 #6942

Open S-A-Martin opened 8 months ago

S-A-Martin commented 8 months ago

Hello,

I'm dealing with a product where the embedded display is mounted upside down (for better cable management). I'm testing ImGui out on the display to see if it's a viable fit and it's going great except that everything is obviously upside down. If I make SDL draw calls of my own I can use SDL_RenderCopyEx to rotate all of my SDL rendering, but the ImGui demo window does not get rotated too.

Is there a way to simply flip ImGui upside down entirely? (a search for rotate/flip/transform showed nothing). Or is there a way to flip the entire render of my own SDL code plus the ImGui draw calls all in one?

Thanks!

GamingMinds-DanielC commented 8 months ago

Best way would be to let whichever system you are using handle the rotation, basically rotate the entire output including a potential mouse cursor. If you are using tough input, rotate that as well. Next alternative would be to copy the ImGui backends you are using and patch the rotation into your copies.

ocornut commented 8 months ago

It depends which backend you are using but you could use GetBackgroundDrawList()->AddCallback() to register a draw callback and rotate the projection matrix here.