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 returned as float (f32) #995

Open
chris-t-jansen opened this issue Feb 22, 2025 · 0 comments
Open

Window dimensions returned as float (f32) #995

chris-t-jansen opened this issue Feb 22, 2025 · 0 comments

Comments

@chris-t-jansen
Copy link

I went to write some code that would iterate over all the pixels on the screen (inefficient I know, but it was to test something), and I found that I couldn't because nannou returns window dimensions as floating-point numbers (f32).

for pt_x in 0..app.main_window().rect().w() {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `f32`

Why does nannou do this? I can't find anything in the docs about it, and I don't see another issue about this as far as I can tell.

The .size() method when building a window only takes integer values (u32 specifically), and I printed the window dimensions at runtime while resizing the window, but they always came back as whole numbers with an empty decimal component, so I'm unsure when the window size could ever be fractional. Do certain operating systems allow for sub-pixel window sizes?

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

1 participant