如何在 pygame 中放大和缩小屏幕? [英] How do I make my screen zoom in and out in pygame?
本文介绍了如何在 pygame 中放大和缩小屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码:如果有人对如何放大我的游戏有任何想法,请帮助我
解决方案
使用 pygame.transform.smoothscale()
显示的缩放副本 pygame.Surface
在屏幕上绘制后:
zoomed_screen = pygame.transform.smoothscale(screen, (new_width, new_height))
Blit放大的表面在屏幕上
screen.blit(zoomed_screen, ....)
The code: https://pastebin.pl/view/6f60a32d I have tried using opengl and tried putting all of the stuff into a surface, and none of them worked
if anyone have any ideas on how to zoom in my game pls help me
解决方案
Use pygame.transform.smoothscale()
a scaled copy of the display pygame.Surface
after the screen is drawn on the screen:
zoomed_screen = pygame.transform.smoothscale(screen, (new_width, new_height))
Blit the zoomed Surface on the screen
screen.blit(zoomed_screen, ....)
这篇关于如何在 pygame 中放大和缩小屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文