thegooglecodearchive / los-cocos

Automatically exported from code.google.com/p/los-cocos
0 stars 0 forks source link

Pause, on_exit() and on_draw() problem #48

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create layer that initializes some resources in on_enter() 
2. in on_draw() it will draw those resources
3. in on_exit() it will free those expensive resources
4. Pause that layer... it will crash.

It will crash since those resources were freed in on_exit(), and the pause
layer will call it's on_draw() method.

This happened to me with Bruce's python interpreter.

Solution: 
   on_pause and on_resume different from on_enter / on_exit() 
   or on_exit() shall not be called on_pause() 
   or wont fix for 0.3 ?
   or invalid, this is not a bug ?

Original issue reported on code.google.com by ricardoq...@gmail.com on 26 Apr 2008 at 2:28

GoogleCodeExporter commented 9 years ago
this is why the pause layer could not make the sublayers draw the boxes. so, i 
know
why now.

i dont know we should/could fix this. the pausescene method we are using is 
actually
too expensive. we could just grab a texture of the last frame and paste that. 
no need
to actually render everything every frame. this could be done with a "grab 
screen"
action, that gets the texture and automatically calls a function with the 
texture as
parameter.

but i dont know if there are other uses form calling visit/on_draw at something 
that
is not on stage. 

Original comment by lucio.to...@gmail.com on 26 Apr 2008 at 9:14

GoogleCodeExporter commented 9 years ago
grab screen is a nice solution.

Original comment by ricardoq...@gmail.com on 26 Apr 2008 at 9:24

GoogleCodeExporter commented 9 years ago
fixed using grab screen. internal change only! but not an action, just a call to
pyglet to read the color buffer. (that is, we dont render to texture first)

Original comment by lucio.to...@gmail.com on 30 Apr 2008 at 8:13