platypirates
platypirates

Reputation: 331

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?

Upvotes: 0

Views: 1406

Answers (2)

Michael Curry
Michael Curry

Reputation: 989

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.

Upvotes: 0

jefflunt
jefflunt

Reputation: 33954

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.

Upvotes: 1

Related Questions