Closed Remusforte closed 6 years ago
There isn't any documentation yet, though I would like to write some next time I have a bunch of free time.
Luckily it isn't a particularly large module yet so I can go over the basics here. After doing all the usual pgame/pygame_sdl2 setup, create your renderer like so:
renderer = Renderer(None, vsync=False)
Then you need to create Renderer module Sprites which are pretty much like regular pygame sprites except they take a Texture instead of a surface as an image to draw with. Luckily you can make a texture from a surface:
sprite = Sprite(renderer.load_texture(surface))
sprite.pos = [100.0,100.0]
Then in your game loop, render your sprite like so:
sprite.render()
You could also put them all into a Container class from the Renderer module if you have lots, these work much the same as Sprite groups in regular pygame.
finally you need to call:
renderer.render_present()
to put all the sprites onto the screen, much the same as pygame.display.flip()
is used in regular pygame.
Let me know if that helps!
Yes, this helped a lot!!! :) I'll come back with more specifics when I stumble again, but your synopsis has me headed in the right direction! Thank you!
I am interested in playing around with the (admittedly experimental) module pygame_sdl2.render, but I have yet to find any documentation. So I decided to first try running the file test_render.py, found in \old-tests. Unfortunately, this file tries to load files: "paper.jpg" and "rlplayer.json", neither of which have I spotted in the pygame_sdl2 package.
Do those files exist somewhere, or is there a valid test for render than I should look to instead? Or - even better - is there any documentation on this module?