简体   繁体   English

放大Slick2D

[英]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. 我知道我可以使用Graphics.scale(float x,float y),但我想放大到中心。 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. 我认为您可以平移(浮动x,浮动y)绘图表面(因此原点(0, 0)在中心),然后放大。然后可以使用resetTransform()删除效果。

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. 一旦弄清楚了,就将该逻辑放入一个名为zoomOverPoint(float x, float y) ,然后即可进行设置。

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 例如,假设您有一个正方形和一个圆形,您想放大在坐标200、100处的正方形。

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. 我不知道这是否有意义,但是您可能必须为此解决一些复杂的VecMath。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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