Hi Claudio,
Thanks, that worked perfectly. I'm curious as to why it seems, at least to me, a little bit complicated to pause a scene. I'd imagine something int he API where we could call director.pause() and it'd just do all this for me. (Thanks for the tip about replacing scenes).
Here is my finished working code, for anyone int he future looking for an answer.
This code is from the currently executing Layer:
def endGame(self):
#make game over screen
endGameLayer = Layer()
posx = int(self.windowWidth / 2 - 140)
posy = int(self.windowHeight/2)
txtWarning = cocos.text.Label('GAME OVER MAN, \n GAME OVER!!',
font_size=12,
font_name="Disco",
x=posx,
y=posy
)
endGameLayer.add(txtWarning, 20)
#add pause scene
endScene = self.getPauseScene()
endScene.add(endGameLayer)
director.push(endScene)
def getPauseScene(self):
w, h = director.window.width, director.window.height
texture = pyglet.image.Texture.create_for_size(GL_TEXTURE_2D, w, h, GL_RGBA)
texture.blit_into(pyglet.image.get_buffer_manager().get_color_buffer(), 0,0,0)
return PauseScene(texture.get_region(0, 0, w, h))