import pygame class Window: window:None width:int height:int title:str icon_path:str paused:bool pause_menu:None search: pygame.Surface def __init__(self, width:int=640, height:int=480, title="", icon_path=""): self.set_resolution(width,height) self.set_title(title) self.set_icon(icon_path) self.mount() self.paused=False self.pause_menu = pygame.Surface((width, height)) self.pause_menu.set_alpha(128) self.pause_menu.fill((0,0,0)) self.search = pygame.Surface((width, height), flags=pygame.SRCALPHA) def set_resolution(self, width:int, height:int): self.width = width self.height = height def set_title(self, title:str): self.title=title def set_icon(self, icon_path:str): self.icon_path= icon_path def mount(self): self.window = pygame.display.set_mode((self.width,self.height)) pygame.display.set_caption(self.title) if self.icon_path != "": icon = pygame.image.load(self.icon_path) pygame.display.set_icon(icon) def pause(self, paused:bool): self.paused=paused if self.paused: self.window.blit(self.pause_menu,(0,0)) pygame.display.update() #self.search.fill(pygame.Color(0,0,0,0)) def draw_search(self, pos1:list=[0,0], pos2:list=[0,0], tile_size:int=64): #self.search.fill(pygame.Color(0,0,0,0)) pos1 = [pos1[0]*tile_size, pos1[1]*tile_size] pos2 = [pos2[0]*tile_size, pos2[1]*tile_size] pygame.draw.line(self.search, pygame.Color(255,0,0), pos1, pos2, 5) pygame.display.flip() self.search.blit(self.window, (0,0)) pygame.display.update()