放大 Slick2D

发布于 2024-12-21 18:53:10 字数 115 浏览 3 评论 0原文

我正在开发一款非常低分辨率的游戏,我需要放大才能使其可见。我知道我可以使用 Graphics.scale(float x, float y) 但我想放大到中心。如何缩放中心的图形?有没有更简单的方法来玩低分辨率游戏?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ˉ厌 2024-12-28 18:53:10

我认为你可以 translate(float x , float y) 您的绘图表面(因此原点 (0, 0) 位于中心),然后放大。然后您可以使用 resetTransform() 删除效果。

如果这不起作用,只需在通过实验放大时移动上/左渲染偏移,直到找到正确的结果。一旦你弄清楚了,将该逻辑放入一个名为 zoomOverPoint(float x, float y) 的方法中,然后你就可以设置了。

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.

爱的那么颓废 2024-12-28 18:53:10

这是一个相当粗糙的解决方案,但是如果您将所有内容放大并移动它会怎么样?

例如,假设你有一个正方形和一个圆形,
您想要放大坐标为 200, 100 的正方形
圆位于坐标 500, 400

因此,要放大正方形,请将其向屏幕中心移动,并在放大时逐渐增加其尺寸,同时,圆也会移出屏幕并且变得相对更大。我不知道这是否有意义,但你可能必须为此找出一些复杂的 VecMath。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文