ich grigs ne hinnnnnnn

This commit is contained in:
Michael S. 2024-01-20 22:39:12 +01:00
parent 1fff6840fb
commit 3a70231b9a

31
main.py
View file

@ -5,10 +5,19 @@ from random import randint as ri
pygame.init() pygame.init()
default_font = pygame.font.SysFont("sans", 14) 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 is_fullscreen = False
fill_screen = True fill_screen = True
show_debug = False 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") pygame.display.set_caption("Screensaver")
screensize = pygame.display.get_window_size() screensize = pygame.display.get_window_size()
@ -66,30 +75,22 @@ class DVD():
self.rendered_dvd = pygame.surface.Surface(self.scalesize, flags=pygame.SRCALPHA) 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_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_dvd.fill(self.color)
self.rendered_dvd2.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)
pygame.transform.threshold(self.rendered_dvd, self.rendered_dvd2, (0, 0, 0), (255, 0, 0, 128), self.color, inverse_set=False) #print(_test_)
#screen.blit(self.rendered_dvd2,self.pos) #screen.blit(self.rendered_dvd2,self.pos)
screen.blit(self.rendered_dvd,self.pos) screen.blit(self.rendered_dvd,self.pos)
def render(self): def render(self):
self.get_dvd() self.get_dvd()
#pygame.draw.rect(screen,self.color,(self.pos[0],self.pos[1],self.scalesize[0],self.scalesize[1])) 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) screen.blit(self.rendered_dvd,self.pos)
dvds = [] dvds = []
dvds.append(DVD(1,1))#ri(1,10))) 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 get_debug_text():
def text(text,line_counter): def text(text,line_counter):