mehrere bilder support vom emil kopiert ;)
This commit is contained in:
parent
595c2dc386
commit
2c8eba52e0
2 changed files with 12 additions and 4 deletions
BIN
dvd-logo.png
BIN
dvd-logo.png
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB |
16
main.py
16
main.py
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import pygame
|
import pygame
|
||||||
|
from random import choice
|
||||||
from random import randint as ri
|
from random import randint as ri
|
||||||
|
import os
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
default_font = pygame.font.SysFont("sans", 14)
|
default_font = pygame.font.SysFont("sans", 14)
|
||||||
|
@ -24,18 +26,24 @@ screensize = pygame.display.get_window_size()
|
||||||
|
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
|
working_directory = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
images = []
|
||||||
|
for image in os.listdir(f"{working_directory}/dvds"):
|
||||||
|
images.append(pygame.image.load(f"{working_directory}/dvds/{image}"))
|
||||||
|
|
||||||
scales = 1
|
scales = 1
|
||||||
speeds = 1
|
speeds = 1
|
||||||
|
|
||||||
class DVD():
|
class DVD():
|
||||||
def __init__(self,scale,speed):
|
def __init__(self,scale,speed):
|
||||||
self.newcolor()
|
self.newcolor()
|
||||||
self.dvd = pygame.image.load("dvd-logo.png")
|
|
||||||
|
self.dvd = choice(images)
|
||||||
self.size = self.dvd.get_size()
|
self.size = self.dvd.get_size()
|
||||||
self.scale = scale
|
self.scale = scale
|
||||||
self.speed = speed
|
self.speed = speed
|
||||||
self.pos = ri(0,screensize[0]-self.size[0]),ri(0,screensize[1]-self.size[1])
|
self.pos = ri(0,screensize[0]-self.size[0]),ri(0,screensize[1]-self.size[1])
|
||||||
self.get_dvd(False)
|
self.get_dvd(inverse)
|
||||||
self.richtung = ["r","u"]
|
self.richtung = ["r","u"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +97,7 @@ class DVD():
|
||||||
|
|
||||||
|
|
||||||
dvds = []
|
dvds = []
|
||||||
dvds.append(DVD(1,1))#ri(1,10)))
|
dvds.append(DVD(1,1,"dvds/dvd-logo.png"))#ri(1,10)))
|
||||||
|
|
||||||
|
|
||||||
def get_debug_text():
|
def get_debug_text():
|
||||||
|
@ -132,7 +140,7 @@ if __name__ == "__main__":
|
||||||
if pressed_keys[pygame.K_LEFT] and scales>=0.2:
|
if pressed_keys[pygame.K_LEFT] and scales>=0.2:
|
||||||
scales -= 0.1
|
scales -= 0.1
|
||||||
if pressed_keys[pygame.K_PLUS] and not preview_pressed_keys[pygame.K_PLUS]:
|
if pressed_keys[pygame.K_PLUS] and not preview_pressed_keys[pygame.K_PLUS]:
|
||||||
dvds.append(DVD(1,1)) #ri(1,30)))
|
dvds.append(DVD(1,1,"dvds/dvd-logo.png")) #ri(1,30)))
|
||||||
if pressed_keys[pygame.K_MINUS] and not preview_pressed_keys[pygame.K_MINUS] and not len(dvds) == 0:
|
if pressed_keys[pygame.K_MINUS] and not preview_pressed_keys[pygame.K_MINUS] and not len(dvds) == 0:
|
||||||
dvds.pop(0)
|
dvds.pop(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue