# Create a simple rendering system for particles. This is somewhat
-# similar to the TextureSprinteRender
er from sdl2.ext. Since we operate on
+# similar to the TextureSprinteRender from sdl2.ext. Since we operate on
# particles rather than sprites, we need to provide our own rendering logic.
def __init__(self, renderer, images):
# Create a new particle renderer. The surface argument will be
# the targets surface to do the rendering on. images is a set of
# images to be used for rendering the particles.
+ super(ParticleRender, self).__init__()
# Define, what component instances are processed by the
self.componenttypes = (CParticle,)
# Create a hardware-accelerated sprite factory. The sprite factory requires
# a rendering context, which enables it to create the underlying textures
# that serve as the visual parts for the sprites.
- renderer = sdl2.ext.Render
+ renderer = sdl2.ext.Render(window)
factory = sdl2.ext.SpriteFactory(sdl2.ext.TEXTURE, renderer=renderer)
# Create a set of images to be used as particles on rendering. The
# similar to the SoftSpriteRenderer, but since we only operate with
# hundreds of particles (and not sprites with all their overhead),
# we need an own rendering system.
- particlerenderer = ParticleRender
+ particlerenderer = ParticleRender(renderer, images)
# The almighty event loop. You already know several parts of it.