PinmikPanik/gamedata/objects/fullscreenbutton.py

19 lines
640 B
Python
Raw Normal View History

2021-09-19 20:24:49 +02:00
from gamedata.objects.button import Button
class FullScreen(Button):
def __init__(self,x,y,game,w,h):
super().__init__(x,y,game,w,h)
self.text = "Toggle Fullscreen"
def toggle(self,game):
game.globals["fullscreen"] = not game.globals["fullscreen"]
if game.globals["fullscreen"]:
game.screen = game.pygame.display.set_mode((game.screen.get_width(),game.screen.get_height()),game.pygame.FULLSCREEN)
else:
game.screen = game.pygame.display.set_mode((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT),game.pygame.RESIZABLE)
self.click = toggle