Gnimuc / CImGui.jl

Julia wrapper for cimgui
https://github.com/cimgui/cimgui
MIT License
253 stars 25 forks source link

Window dimensions are always reported as 400x400 #130

Closed Octogonapus closed 2 months ago

Octogonapus commented 2 months ago

GetWindowSize(), GetWindowWidth(), and GetWindowHeight() always report 400 regardless of the provided window_size to render and regardless of the true window size when resizing it at runtime. I could reproduce this by adding @show CImGui.GetWindowWidth() here on the latest master.

JamesWrigley commented 2 months ago

The problem is the location of the calls to GetWindowSize(), they (along with all other CImGui calls) have to be within a Begin()/End() block to work properly. If you put it outside of that then it looks like you get the window size of the default debug window: image

See for example: https://github.com/ocornut/imgui/issues/4404#issuecomment-894266498

If you put those calls within a window block then you should get the right sizes. Alternatively, if you're really looking for the GLFW window size you probably want unsafe_load(GetIO().DisplaySize).

Octogonapus commented 2 months ago

Thank you!