emil das klappt so ned
This commit is contained in:
parent
d84aa6c0d1
commit
27af4863df
1 changed files with 27 additions and 12 deletions
39
main.py
39
main.py
|
@ -19,14 +19,14 @@ speeds = 1
|
|||
|
||||
class DVD():
|
||||
def __init__(self,scale,speed):
|
||||
self.newcolor()
|
||||
self.dvd = pygame.image.load("dvd-logo.png")
|
||||
self.size = self.dvd.get_size()
|
||||
self.scale = scale
|
||||
self.speed = speed
|
||||
self.get_sdvd()
|
||||
self.pos = ri(0,screensize[0]-self.size[0]),ri(0,screensize[1]-self.size[1])
|
||||
self.get_dvd()
|
||||
self.richtung = ["r","u"]
|
||||
self.newcolor()
|
||||
self.render()
|
||||
|
||||
|
||||
|
@ -59,19 +59,26 @@ class DVD():
|
|||
def newcolor(self):
|
||||
self.color = (ri(0,255),ri(0,255),ri(0,255))
|
||||
|
||||
def get_sdvd(self):
|
||||
def get_dvd(self):
|
||||
scaledx = self.size[0]*self.scale
|
||||
scaledy = self.size[1]*self.scale
|
||||
self.scalesize = (scaledx,scaledy)
|
||||
self.sdvd = pygame.transform.scale(self.dvd,self.scalesize)
|
||||
self.rendered_dvd = pygame.surface.Surface(self.scalesize, flags=pygame.SRCALPHA)
|
||||
|
||||
self.rendered_dvd.fill(self.color)
|
||||
self.rendered_dvd = pygame.transform.scale(self.dvd,self.scalesize)#(self.scalesize[0],self.scalesize[1]+10))
|
||||
|
||||
#pygame.transform.threshold(self.advd, self.advd, (0, 0, 0), (0, 0, 0,128), self.color, inverse_set=False)
|
||||
screen.blit(self.rendered_dvd,self.pos)
|
||||
|
||||
def render(self):
|
||||
self.get_sdvd()
|
||||
self.get_dvd()
|
||||
|
||||
pygame.draw.rect(screen,self.color,(self.pos[0],self.pos[1],self.scalesize[0],self.scalesize[1]))
|
||||
screen.blit(self.sdvd,self.pos)
|
||||
screen.blit(self.rendered_dvd,self.pos)
|
||||
|
||||
dvds = []
|
||||
dvds.append(DVD(1,1))
|
||||
dvds.append(DVD(1,1))#ri(1,10)))
|
||||
|
||||
def toggle_fullscreen(is_fullscreen):
|
||||
if is_fullscreen:
|
||||
|
@ -82,10 +89,18 @@ def toggle_fullscreen(is_fullscreen):
|
|||
return is_fullscreen,pygame.display.get_window_size()
|
||||
|
||||
def get_debug_text():
|
||||
debug_text = ""
|
||||
for index,a in enumerate(globals()):
|
||||
debug_text = default_font.render(f"{str(a)} = {globals()[a]}", True, (240, 240, 240))
|
||||
screen.blit(debug_text,(0,index*default_font.get_height()))
|
||||
def text(text,line_counter):
|
||||
debug_text = default_font.render(str(text), True, (240, 240, 240))
|
||||
screen.blit(debug_text,(0,line_counter*default_font.get_height()))
|
||||
|
||||
line_counter = 1
|
||||
globalvars =globals()
|
||||
for a in globalvars:
|
||||
text(f"{str(a)} = {str(globalvars[a])}",line_counter)
|
||||
line_counter += 1
|
||||
for a in dvds:
|
||||
text(vars(a),line_counter)
|
||||
line_counter += 1
|
||||
|
||||
running = True
|
||||
if __name__ == "__main__":
|
||||
|
@ -111,7 +126,7 @@ if __name__ == "__main__":
|
|||
if pressed_keys[pygame.K_LEFT] and scales>=0.2:
|
||||
scales -= 0.1
|
||||
if pressed_keys[pygame.K_PLUS] and not preview_pressed_keys[pygame.K_PLUS]:
|
||||
dvds.append(DVD(1,1))
|
||||
dvds.append(DVD(1,1)) #ri(1,30)))
|
||||
if pressed_keys[pygame.K_MINUS] and not preview_pressed_keys[pygame.K_MINUS] and not len(dvds) == 0:
|
||||
dvds.pop(0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue