From 8df7dd0b41e951b34426bc2a7743002b7c802eb1 Mon Sep 17 00:00:00 2001 From: nutbuster Date: Mon, 13 Sep 2021 23:01:40 +1000 Subject: [PATCH] Add program --- dvdlogo.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 dvdlogo.py diff --git a/dvdlogo.py b/dvdlogo.py new file mode 100644 index 0000000..fb824ef --- /dev/null +++ b/dvdlogo.py @@ -0,0 +1,50 @@ +""" +howto: obs -> window -> filters -> chromake +""" +import pygame as p +import pygame.font as ft +import pygame.sysfont as sft +import pygame.image + +textcolor=(0x00, 0x00, 0x00) +chromakey=(0x00, 0xFF, 0x00) +speed=8 + +d = p.display.set_mode() +c = p.time.Clock() + +p.display.init() +""" +print(ft.get_fonts()) +ft.init() +sft.initsysfonts() +ff = sft.SysFont('dejavusans', 28) +""" + +i = p.sprite.Sprite() +#i.image = ff.render("SWNBR", True, textcolor) +i.image = p.image.load('image.png').convert_alpha() +i.rect = i.image.get_rect() +i.rect.x = (d.get_width()/3) +i.rect.y = (d.get_height()/3) + +a=[(speed,speed), (speed,-speed), (-speed,-speed), (-speed,speed)] +b=0 +while True: + c.tick_busy_loop(60) + d.fill(chromakey) + + tmp = i.rect.move(*a[b]) + while (tmp.left < 0 or + tmp.top < 0 or + tmp.right > d.get_width() or + tmp.bottom > d.get_height()): + if (b == len(a)-1): + b = 0 + else: + b += 1 + tmp = tmp.move(*a[b]) + i.rect = tmp + d.blit(i.image, i.rect) + + p.display.flip()