frame rendering

This commit is contained in:
dave 2022-11-23 10:51:48 -08:00
parent b9e1625425
commit f016ccf558
2 changed files with 8 additions and 6 deletions

View File

@ -48,6 +48,7 @@ class Video(object):
class Source(object):
def __init__(self, file_path):
self.file_path = file_path
self.load()
def load(self):
"""
@ -77,7 +78,7 @@ class Sprite(object):
def next_frame(self):
for animation in self.get_pending_animations():
animation.apply()
animation.apply(self)
def draw(self, canvas):
"""
@ -86,16 +87,17 @@ class Sprite(object):
raise NotImplementedError()
def ImageSprite(Sprite):
class ImageSprite(Sprite):
def __init__(self, source, position=(0, 0)):
raise Exception("huh")
# super().__init__(source, position)
super().__init__(source, position)
def draw(self, canvas):
"""
Draw the sprite on top of the given canvas
"""
raise NotImplementedError()
# raise NotImplementedError("xd")
# pass
canvas.paste(self.source.img, (0, 0))
class Animation(object):

View File

@ -24,7 +24,7 @@ video = Video(framerate=30, width=640, height=480)
# a Source is a piece of media that we can include in the animation
# there should not be any reason to create two Source()s of the same input media.
logo_img = ImageSource("dvd_logo.png")
logo_img = ImageSource("dvd.png")
# a Sprite is an instance of a piece of media. They contain contextual information such as the position of the sprite
# on the canvas.