在pygame中转换图像
我正在尝试调整 pygame 中的图像大小。我希望我的背景图像填满整个屏幕。我想根据背景的新(拉伸)尺寸设置整个屏幕。以下内容不起作用,我正在尝试找出原因。
建议?
background = pygame.image.load("data/stars.bmp")
pygame.transform.scale(background, (1200,800)) #or some size x,y here.
bgRect = background.get_rect()
size = width, height = bgRect.width, bgRect.height
screen = pygame.display.set_mode(size)
screen.blit(background, bgRect)
pygame.display.flip()
I'm trying to resize an image in pygame. I want my background image to fill the entire screen. I'd like to setup the entire screen based on the new (stretched) dimensions of the background. The following isn't working and I'm trying to figure out why.
Suggestions?
background = pygame.image.load("data/stars.bmp")
pygame.transform.scale(background, (1200,800)) #or some size x,y here.
bgRect = background.get_rect()
size = width, height = bgRect.width, bgRect.height
screen = pygame.display.set_mode(size)
screen.blit(background, bgRect)
pygame.display.flip()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)