add dest surface in GlobalScale

This commit is contained in:
cuu 2020-01-13 14:49:02 +08:00
parent 6e9d146e80
commit 712ce14fc5
3 changed files with 4 additions and 2 deletions

View File

@ -112,8 +112,8 @@ def DrawText(canvas,text, x,y,width,height,canWidth,canHeight,fontObj):# text fo
def SwapAndShow(): def SwapAndShow():
screen = pygame.display.get_surface() screen = pygame.display.get_surface()
if config.GlobalScale > 1: if config.GlobalScale > 1:
tmp = pygame.transform.scale(config.GlobalCanvas,(Width*config.GlobalScale,Height*config.GlobalScale)) pygame.transform.scale(config.GlobalCanvas,(Width*config.GlobalScale,Height*config.GlobalScale),config.GlobalCanvas2)
screen.blit(tmp,(0,0,Width*config.GlobalScale,Height*config.GlobalScale)) screen.blit(config.GlobalCanvas2,(0,0,Width*config.GlobalScale,Height*config.GlobalScale))
elif config.GlobalScale == 1: elif config.GlobalScale == 1:
screen.blit(config.GlobalCanvas,(0,0,Width,Height)) screen.blit(config.GlobalCanvas,(0,0,Width,Height))

View File

@ -34,6 +34,7 @@ PowerLevels["balance_saving"] = [40,0,0]
PowerLevel = "balance_saving" PowerLevel = "balance_saving"
GlobalCanvas=None GlobalCanvas=None
GlobalCanvas2=None
GlobalScale = 1 GlobalScale = 1
def PreparationInAdv(): def PreparationInAdv():

View File

@ -663,6 +663,7 @@ if __name__ == '__main__':
exit() exit()
config.GlobalCanvas = pygame.Surface((Width,Height),0,32) config.GlobalCanvas = pygame.Surface((Width,Height),0,32)
config.GlobalCanvas2 = pygame.Surface(SCREEN_SIZE ,0,32)
crt_screen = CreateByScreen() crt_screen = CreateByScreen()
crt_screen.Init() crt_screen.Init()