简体   繁体   中英

Zooming in Slick2D

I'm working on a really low res game that I need to zoom in to make it visible. I know I can use Graphics.scale(float x, float y) but I'd like to zoom into the center. How can I scale the Graphics in the center? Is there an easier way to do low res games?

I think you could translate(float x, float y) your drawing surface (so the origin (0, 0) is in the center) and then zoom in. Then you can use resetTransform() to remove the effect.

If that doesn't work, just move your upper/left rendering offset while you're zooming in via experimentation until you get it right. Once you get it figured out, put that logic into a method called zoomOverPoint(float x, float y) and then you'll be set.

It's a fairly crude solution, but what if you just make everything bigger and move it?

For example, let's say you had a square and a circle, You want to zoom in on the square which is at coordinates 200, 100 The circle is at coordinates 500, 400

So to zoom in on the square you move it towards the center of the screen and increase the size of it gradually as you zoom in, at the same time, the circle will also be moving off the screen and getting relatively bigger. I don't know if that makes any sense, but you'd probably have to figure out some complicated VecMath for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM