Pygame缩放屏幕
我现在正在用32x32纹理写游戏,因为我的屏幕窗口太小,我有问题吗?我可以“缩放”整个游戏吗? wo14t.png“ alt =”在此处输入图像描述”>
现在看起来像这样,而我想要的是使整个屏幕更大和变焦只能看到地图的5%。
当然,如果我使屏幕更大,那将不会解决我的问题。 也许我应该添加另一台相机之类的东西?
我认为我很清楚自己。 谢谢!
im writing a game right now with 32x32 textures, i have a problem because my screen window is too small, is there any solution? Can i "zoom" my whole game?
Now it looks like this and exactly what i want is to make whole screen bigger and zoom to see only like 5% of map.
Of course, if i make my screen bigger it not gonna fix my problem.
Maybe i should add another camera or something?
I think I made myself quite clear.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您肯定可以像您所说的那样放大。
您可以调整屏幕大小:
并将显示器显示为要绘制的实际尺寸到:
但是,缩放表面确实很糟糕,因为像素艺术在缩放范围方面不佳。另一种选择是摄像头或关闭pygame,这将使您试图做的一切变得不那么复杂。我建议 rubato 开始。它将为您完成所有这些工作,您可以决定使用一个变量的实际网格(显示)。
祝你好运!如果您需要额外的帮助,请随时发表评论。
First, you can definitely zoom as you are saying.
You can resize the screen:
And have the display the actual size you want to draw to:
However, scaling surfaces is really bad as pixel art isn't great at scaling. An alternative would be a camera or switching off of pygame which would make everything you are trying to do way less complicated. I would recommend rubato for a start. It will do all this work for you, and you can decide how big you want your actual grid (display) to be with one variable.
Good luck! Feel free to comment if you want any extra help.
您可以解决此问题的一种方法是缩小屏幕本身的大小:
如果需要,可以将窗口设置为全屏:
One way you can fix this is by shrinking the size of the screen itself:
And if you want, you can set the window to Fullscreen: