diff --git a/main.py b/main.py index cca79ae..05fb252 100755 --- a/main.py +++ b/main.py @@ -5,10 +5,19 @@ from random import randint as ri pygame.init() default_font = pygame.font.SysFont("sans", 14) +def toggle_fullscreen(is_fullscreen): + if is_fullscreen: + pygame.display.set_mode((600,500),pygame.RESIZABLE) + else: + pygame.display.set_mode((0,0),pygame.FULLSCREEN) + is_fullscreen = not is_fullscreen + return is_fullscreen,pygame.display.get_window_size() + is_fullscreen = False fill_screen = True show_debug = False -screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN) +screen = pygame.display.set_mode((600,500))#(0,0),pygame.FULLSCREEN) +is_fullscreen,screensize = toggle_fullscreen(is_fullscreen) pygame.display.set_caption("Screensaver") screensize = pygame.display.get_window_size() @@ -65,31 +74,23 @@ class DVD(): self.scalesize = (scaledx,scaledy) self.rendered_dvd = pygame.surface.Surface(self.scalesize, flags=pygame.SRCALPHA) self.rendered_dvd = pygame.transform.scale(self.dvd,self.scalesize)#(self.scalesize[0],self.scalesize[1]+10)) - - self.rendered_dvd2 = pygame.surface.Surface(self.scalesize, flags=pygame.SRCALPHA) - self.rendered_dvd2.fill(self.color) - - pygame.transform.threshold(self.rendered_dvd, self.rendered_dvd2, (0, 0, 0), (255, 0, 0, 128), self.color, inverse_set=False) + #self.rendered_dvd.fill(self.color) + #self.rendered_dvd2 = pygame.surface.Surface(self.scalesize, flags=pygame.SRCALPHA) + #_test_ = pygame.transform.threshold(self.rendered_dvd, self.rendered_dvd, (0, 0, 0), (0, 0, 0, 0), self.color, inverse_set=False) + #print(_test_) #screen.blit(self.rendered_dvd2,self.pos) screen.blit(self.rendered_dvd,self.pos) def render(self): self.get_dvd() - #pygame.draw.rect(screen,self.color,(self.pos[0],self.pos[1],self.scalesize[0],self.scalesize[1])) - #screen.blit(self.rendered_dvd,self.pos) + pygame.draw.rect(screen,self.color,(self.pos[0],self.pos[1],self.scalesize[0],self.scalesize[1])) + screen.blit(self.rendered_dvd,self.pos) dvds = [] dvds.append(DVD(1,1))#ri(1,10))) -def toggle_fullscreen(is_fullscreen): - if is_fullscreen: - pygame.display.set_mode((600,500),pygame.RESIZABLE) - else: - pygame.display.set_mode((0,0),pygame.FULLSCREEN) - is_fullscreen = not is_fullscreen - return is_fullscreen,pygame.display.get_window_size() def get_debug_text(): def text(text,line_counter):