123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|539|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Basic Basement -> Screen scaling

Mon, 13 Jul 2015, 13:16
Dither
Hi all. It's been a while!

You know how emulators like MAME, ZSNES and the like can run in full screen mode with bilinear filtering and scanlines?

Does anyone know how a similar effect could be achieved in PureBasic? I mean, is there a way to do all your rendering on a buffer at the "true" resolution (say, 320 x 240) and then display that scaled up to full-screen with some filtering and effects applied?

A (sort of) related question: Do you guys think 640 x 480 will be widely supported for much longer? I hope so.
Mon, 13 Jul 2015, 14:26
steve_ancell
If you mean how to make stuff appear in the same place no matter what the device's screen size then use this simple formula: scale = (deviceSize / gameSize)

Multiply these variables with where you would want it on a set area. Also Multiply these with any scaling and colision detection.

scaleX = (deviceWidth / gameWidth)
scaleY = (deviceHeight / gameHeight)
Mon, 13 Jul 2015, 15:03
steve_ancell
For instance: this will make the sprite appear half way across the screen regardless of the actual screen size. I know it's in BlitzBasic but the principle should work in any dev kit. I hope this helps.



Mon, 13 Jul 2015, 17:51
Dither
Steve,

Thanks for the answer, and the very clear example! I'm going to convert it to PB and see what it looks like.

The approach I was trying and failing to implement was to do all rendering for a given frame, at the original size, to a buffer, then scaling the whole thing at once before showing it to the user -- preferably with some kind of filtering to soften the edges between pixels (I imagine they'll look uneven if the scaling is not by a round number). Does this sound possible/like a good idea?
Mon, 13 Jul 2015, 18:15
steve_ancell
No probs, glad I can be of assistance.
Tue, 14 Jul 2015, 01:21
Jayenkai
Steve's approach is the one that I use. I combine it with three sets of art, loading larger crisper assets for larger resolutions, or tiny art for tiny screens.

This is a nice and fast approach to getting the job done.
Trying to screen grab the entire screen and manually rescale it will take far too much time away from your game.
Unless you're willing to drop to a slower framerate, this isn't a recommended method.

-=-=-
''Load, Next List!''
Tue, 14 Jul 2015, 11:56
Dither
Thanks, Jay.