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

Add GetWindowSize() function #3206

Closed
wants to merge 1 commit into from
Closed

Add GetWindowSize() function #3206

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 27, 2023

Adds a GetWindowSize() function that returns the current window size to a Vector2.

This is helpful in case the window size was changed by the user (or the OS, WM, etc). And will be necessary for fixing the SetWindowMonitor().

@ghost
Copy link
Author

ghost commented Jul 27, 2023

I'm sorry, I completely missed GetScreenWidth() and GetScreenHeight(). I kept looking for Window and missed that. My apologies.

@ghost ghost closed this Jul 27, 2023
@raysan5
Copy link
Owner

raysan5 commented Jul 27, 2023

@ubkp Actually, it has been proposed several times, many users look for GetWindow*() and ask me why GetScreen*(). Despite it could be less intuitive, I tried to avoid GetWindow{Width/Height}() because some platforms supported by raylib do not use the concept of window, screen framebuffer is "directly" output to display, usually a screen fit on a window (when available) but even on then it could not be the case.

About why GetScreen{Width/Height}() instead of size, two reasons:

  1. Usually the pixel size returned is an integer value, Vector2 only support floats and I preferred to avoid adding a Point structure using ints (despite it could be needed on some circunstances).
  2. Usage reason, I noticed most of the time it's more useful to have the width and height in separate functions to be queried and used separately. Same happens with some other functions so I tried to be consistent.

@ghost
Copy link
Author

ghost commented Jul 27, 2023

@raysan5 Those are very good reasons. Thank you very much for the detailed explanation.

This pull request was closed.
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

Successfully merging this pull request may close these issues.

1 participant