Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window dimensions are always reported as 400x400 #130

Closed
Octogonapus opened this issue Jul 1, 2024 · 2 comments
Closed

Window dimensions are always reported as 400x400 #130

Octogonapus opened this issue Jul 1, 2024 · 2 comments

Comments

@Octogonapus
Copy link

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
Copy link
Collaborator

JamesWrigley commented Jul 1, 2024

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: ocornut/imgui#4404 (comment)

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
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants