-
Notifications
You must be signed in to change notification settings - Fork 77
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
How to properly do resizing #602
Comments
Let me know if ResizeStrategy doesn't solve this issue, in which case we can re-open it. |
Thanks, I'll try to play with it a little. I suspect I might be missing a variant of the enum that does what I want (I just want to use the whole window without resizing the content and without any care of aspect ration ‒ something like if I resize a browser window, the page gets smaller or larger area to render in but the font stays the same), but I'll first check if one of the existing can be actually used for that. |
Oh, I misinterpreted the issue text. You can listen for the resize event, and use the following code (or something like it): gfx.set_projection(Transform:orthographic(Rectangle::new_sized(ev.size()))); |
As I said, I eventually figured something out (I also have scrolling, so I also set the top-left corner of the rectangle, resp the middlepoint). My point about the issue was, figuring this out wasn't really easy and it took me some time (and getting a different-sized screen) to figure out I actually should. So I wonder if such use case should be also part of the ResizeStrategy enum, or if there should be some example with the view with this kind of resizing + scrolling or something (I'm fine writing it). |
I'm trying to create a kind of view of the game world. And I want to let the user use however large window they like, simply showing as much of the world/map as it fits and implement some kind of follow-the player or scrolling. However, it seems quicksilver somehow prefers games that have finite bounded world and makes it smaller and larger with the window ‒ and therefore somehow rescaling what one pixel means in the coordinates. I've eventually made it work with
set_projection
, but it took some amount of digging through the docs, as it is not entirely intuitive that this needs to be done (well, maybe for people who do gamedev longer than 4 weekends it is).To demonstrate, this „world“ is just 40 000 blue dots in a regular square grid. I'd expect that when I resize the window, I see fewer or more of them. Instead, they get compressed or stretched and I get ellipses instead.
So my question is, does it make sense to have an example with resizing? Maybe if I add the
set_projection
here?(This one is probably not good in other ways, it seems the rendering in a tight loop is hogging my system and maybe I should be doing something else than just naïvely place the circles one by one).
(Trying with linux, quicksilver version 0.4.0-alpha0.3)
The text was updated successfully, but these errors were encountered: