问题
I've been using pygame to make a game recently, and have ran into a little problem...
Basically, I would like to be able to stretch the whole image that is on the screen (all the things that I have blitted to it) into the resolution which the user has resized the window to. I've searched a lot on the documentation for pygame and on stack overflow and I can't seem to find an answer... Is it even possible? The source code for my game is pretty big atm, if anyone needs it I'll be willing to post it. Sorry if I made my question a little unclear :)
回答1:
Blit everything to a separate surface (not directly to the screen), let's call it main_surface. Then blit the main_surface to the screen.
Call pygame.transform.scale(main_surface, (width, height)
with the new width and height that you get from the VIDEORESIZE
event to scale the main_surface and everything in it to the new window dimensions.
来源:https://stackoverflow.com/questions/18835940/is-there-a-way-to-stretch-the-whole-display-image-to-fit-a-given-resolution