Pygame script in Ren'Py
Posted: Tue Aug 05, 2014 1:49 pm
My brother is trying to get something he made in Pygame to work in Ren'Py and he wanted to ask some questions.
--- So I would like to take advantage of some of Ren'Py's features for a project however I'm running into a couple basic issues that I'll need to understand before I even know how viable it is to take this approach.
I have been able to figure out how to get pygame to take over the display (that's no trick really) but I'm having a much harder time figuring out how to hand the display back to the original settings afterward. I could redo much of the code I already have to use Ren'Py type scripting but that would nullify some of the purpose of this. I have tried to experiment with having the pygame script not take over the screen but just draw on it but I run into the second problem. (as a note: what I've tried was using a pygame.surface.fill( ) which didn't work because the Ren'Py display is OpenGl by default and pygame.surface.blit( ) which is where the second problem came in.
The second problem involves renderables. For some reason I'm having a hard time getting the pygame script to load images through Ren'Py. I can define the image in the Ren'Py script and it knows how to work with it but whether I try to pass it to the normal Python script or try to load the image in the Pygame script with pygame.image.load( ) it can't seem to handle it. I've seen some examples of things which use some of the guts of the rendering system and I could probably work my way through that but I'd rather not if there's a simpler way to do things.
I rather get the idea that Ren'Py was not meant to be used the way I'm trying to use it but I'm wondering if more knowledgeable people could either confirm that or point me in a direction that would make it seem more viable. ---
--- So I would like to take advantage of some of Ren'Py's features for a project however I'm running into a couple basic issues that I'll need to understand before I even know how viable it is to take this approach.
I have been able to figure out how to get pygame to take over the display (that's no trick really) but I'm having a much harder time figuring out how to hand the display back to the original settings afterward. I could redo much of the code I already have to use Ren'Py type scripting but that would nullify some of the purpose of this. I have tried to experiment with having the pygame script not take over the screen but just draw on it but I run into the second problem. (as a note: what I've tried was using a pygame.surface.fill( ) which didn't work because the Ren'Py display is OpenGl by default and pygame.surface.blit( ) which is where the second problem came in.
The second problem involves renderables. For some reason I'm having a hard time getting the pygame script to load images through Ren'Py. I can define the image in the Ren'Py script and it knows how to work with it but whether I try to pass it to the normal Python script or try to load the image in the Pygame script with pygame.image.load( ) it can't seem to handle it. I've seen some examples of things which use some of the guts of the rendering system and I could probably work my way through that but I'd rather not if there's a simpler way to do things.
I rather get the idea that Ren'Py was not meant to be used the way I'm trying to use it but I'm wondering if more knowledgeable people could either confirm that or point me in a direction that would make it seem more viable. ---