diff --git a/pgfw/Display.py b/pgfw/Display.py index d92300c..53a2fa5 100644 --- a/pgfw/Display.py +++ b/pgfw/Display.py @@ -1,6 +1,7 @@ from os import environ from sys import maxsize, platform +import pygame from pygame import display, image, mouse from pygame.locals import * @@ -33,16 +34,16 @@ class Display(GameChild): environ["SDL_VIDEO_CENTERED"] = "1" def init_screen(self): - # flags = 0 full = False if self.fullscreen_requested(): - # flags = -abs(FULLSCREEN) full = True - self.set_screen(0x0, fs=full) + + # Added pygame.SCALED to avoid fullscreen bug + # + self.set_screen(pygame.SCALED, fs=full) def fullscreen_requested(self): - return not self.check_command_line(self.windowed_flag) and \ - self.fullscreen_enabled + return not self.check_command_line(self.windowed_flag) and self.fullscreen_enabled def set_screen(self, flags=0x0, dimensions=None, fs=False): self.dimensions_changed = dimensions is not None @@ -80,16 +81,4 @@ class Display(GameChild): def toggle_fullscreen(self, event): if self.delegate.compare(event, "toggle-fullscreen"): - screen = self.screen - cpy = screen.convert() - flags = self.screen.get_flags() - if flags & 0x80000000: - full = False - if not platform == "win32" and maxsize >> 33: - flags ^= 0x80000000 - else: - flags ^= -0x80000000 - else: - full = True - self.set_screen(flags, fs=full) - screen.blit(cpy, (0, 0)) + pygame.display.toggle_fullscreen()