-
Notifications
You must be signed in to change notification settings - Fork 5
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
Scaling modes #114
Comments
I agree with these changes. This is how I propose they would be implemented:
With this I hope we could remove "camera" from tophat altogether and stop the coordinate conversion hell. |
I completely agree with removing camera, it worked but it appears that transforms are better now, plus, that could be a good performance boost since matrix multiplication is pretty cheap and really easy to SIMD as for setScalingFlags, i still think this is a pretty good "wrapper feature" that will just use the transforms under the hood. setViewport idea is something i actually wanted for a long time where the game's screen looks different over the editor ui and such |
but also there's an upside to having a viewport, although that can be patched by the user if they start using the image targets. right now the things are scaled in "vector mode" but sometimes scaling needs to be applied after rasterization, like in pixel art games |
I will start by removing camera and adding |
Removing camera will be pain. Lot of my projects frequently use |
same thing, but you can make it use setViewport on high level right? |
What exactly do you mean? |
I implement |
Make global camera use setviewport under the hood, although now i've realized that would require a setter. You can also do setviewport to match the global camera somewhere during the pipeline when you are actually changing the rect, but yeah, that's one of the places globals can get in the way. |
I'll take a look! |
You can do `setViewport(th.Vf2{global.cam.w, global.cam.h})` at the end of
every cycle.
"---------- Původní zpráva ----------
Od: ske ***@***.***>
Datum: 12.11.2022 11:13:15
Předmět: Re: [marekmaskarinec/tophat] Scaling modes (Issue #114)
"
What exactly do you mean?
"
Make global camera use setviewport under the hood, although now i've
realized that would require a setter. You can also do setviewport to match
the global camera somewhere during the pipeline when you are actually
changing the rect, but yeah, that's one of the places globals can get in the
way.
—
Reply to this email directly, view it on GitHub
(#114 (comment))
, or unsubscribe
(https://github.com/notifications/unsubscribe-auth/AKGM45J2G6EAIXRHGQAHVKLWH5UTNANCNFSM6AAAAAAR4ZEICY)
.
You are receiving this because you commented. Message ID: <marekmaskarinec/
***@***.***>
"
|
We should take this issue into consideration when working on the new renderer. |
This issue can be implemented manually using framebuffers now. However since this is extremely common I think it's worth adding it natively. Thoughts? |
Currently how window screen is scaled is it fits the game screen into the window while preserving aspect ratio. This works for most games and if you don't want black bars you can always set the screen size to window size and handle that manually, however for out of box experience it may also be nice to have integer-only scaling mode:
Here's an example of how this looks:
Here you can see pixels are scaled by integer and preserving the aspect ratio.
Making a window smaller on the width made the entire game resize to fit the screen too, while preserving aspect ratio and pixel integrity.
This is obviously very useful for pixel art games.
In my opinion there should be scaling flags like
KEEP_ASPECT_RATIO
andKEEP_PIXEL_INTEGRITY
or something similar which you can combine. Currently windows created right now haveKEEP_ASPECT_RATIO
set, removing that will just stretch the contents of the window, it's usually not a desirable effect, but nonetheless may be needed for some.The way this can be implemented is by calculating the bounding box out of these properties, or even simpler, without the properties allow the user to specify where the bounding box will go themselves, so they can have their own scaling/positioning modes. This can also be addressed with #99
Related: #63
The text was updated successfully, but these errors were encountered: