Simple module to maintain aspect ratio at any resolution. You need to specify your reference resolution and the screen resolution. Your reference resolution will be scaled to the screen resolution while maintaining it's aspect ratio. It's important for your code to be resolution independent by pointing to the reference resolution at all times. Try typing in some different screen resolutions! Letterboxing is automatic by scissoring.
EDIT: Fullscreen not so friendly with weird resolutions. Don't go fullscreen and set a non supported resolution or else it won't scale correctly!
EDIT2: Clamped mouse position
EDIT3: Added other modes of scaling
EDIT4: Added nearest mode for integer based zooming
EDIT5: Fixed screenPosition
[Snippet] Screen Scaler Helper
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: [Snippet] Aspect Ratio Scaler
Neat, maybe restrict the returned mouse position to being on screen?
- Daniel Eakins
- Citizen
- Posts: 99
- Joined: Thu Jul 18, 2013 9:14 pm
- Location: France
Re: [Snippet] Screen Scaler Helper
This script is awesome. I second xXxMoNkEyMaNxXx's question but otherwise this works perfectly!
Re: [Snippet] Screen Scaler Helper
I wrote a longer Blogpost about scaling pixelperfect to fullscreen. You might want to read this.
http://crankgaming.blogspot.de/2013/01/ ... aling.html
humansarepuppies implemented this idea and code is on github.
https://github.com/humansarepuppies/eng ... en-scaling
http://crankgaming.blogspot.de/2013/01/ ... aling.html
humansarepuppies implemented this idea and code is on github.
https://github.com/humansarepuppies/eng ... en-scaling
- Daniel Eakins
- Citizen
- Posts: 99
- Joined: Thu Jul 18, 2013 9:14 pm
- Location: France
Re: [Snippet] Screen Scaler Helper
This is definitely interesting stuff. Thanks!
---
EDIT: There seems to be an error in r.screenPosition
---
EDIT: There seems to be an error in r.screenPosition
Re: [Snippet] Screen Scaler Helper
Hi, Daniel. I should really test my stuff. See the first post for the update.
- Daniel Eakins
- Citizen
- Posts: 99
- Joined: Thu Jul 18, 2013 9:14 pm
- Location: France
Re: [Snippet] Screen Scaler Helper
I needed something like this so badly, time to tear it apart and devour its soul implement it!
Thanks for this great snippet!
Thanks for this great snippet!
"Bump." -CMFIend420
Re: [Snippet] Screen Scaler Helper
Sorry for bumping this thread , but i have been using this snippet for scaling to different resolutions in 0.8.0 and it has been working wonderfully there.After I updated to 0.9.1 I have been getting very weird results with this snippet(look at screenshots below) and now I can't use my game on resolutions other than the one it was designed for(which is 1366x768).
So, I'm wondering if anyone has fixed this for 0.9 or has a better way to support different resolutions?
How it's supposed to be:
How it is in 0.9.1:
So, I'm wondering if anyone has fixed this for 0.9 or has a better way to support different resolutions?
How it's supposed to be:
How it is in 0.9.1:
Re: [Snippet] Screen Scaler Helper
Sorry for bumping again,but... Ideas anyone?xCode195 wrote:-snip-
I think the calculations for setScissor() function are wrong but I can't fix them
Who is online
Users browsing this forum: No registered users and 3 guests