NastyMonk
Member
Hi, lovely people in the community,
I came across this tutorial today about how to create a pause screen. COFFEE-BREAK TUTORIALS: PAUSING YOUR GAME (GML). This tutorial really provoked lots of new thoughts for me.
This tutorial creates a game screen capture background by deactivating all except the calling instance, drawing the application surface to another custom surface and drawing this custom surface to the screen, all of which happens in the draw event. This really has me wonder that how can you be sure that after deactivating the instances, the application surface will have all instances drawn to it?
This seems to have something to do with the event order. Let's say we have five instances. Instance 1-4 and a control instance that is in charge of pausing and drawing the pause screen. If the draw event of the control instance is called after Instance 1,2,3 but before Instance 4. Does it mean that the pause screen will not have Instance 4 on it? If so, is it a good idea to put the deactivate function in the draw event since you have no idea the order of when all these draw events will be called?
I have tried implementing it myself but with a small tweak. I put the deactivation function in the keyboard I/O event for the designated pause key. It turns out that nothing shows up except the background layer. It seems that If you deactivate the instances in the I/O event, the application surface will have nothing in it when you try to draw it to a custom surface in the draw event.
This goes against my expectations because I thought the application surface would have stuff in it from the previous event loop. But somehow the application surface is cleared after each event loop. If so, when does it get freed? After post draw event?
I came across this tutorial today about how to create a pause screen. COFFEE-BREAK TUTORIALS: PAUSING YOUR GAME (GML). This tutorial really provoked lots of new thoughts for me.
This tutorial creates a game screen capture background by deactivating all except the calling instance, drawing the application surface to another custom surface and drawing this custom surface to the screen, all of which happens in the draw event. This really has me wonder that how can you be sure that after deactivating the instances, the application surface will have all instances drawn to it?
This seems to have something to do with the event order. Let's say we have five instances. Instance 1-4 and a control instance that is in charge of pausing and drawing the pause screen. If the draw event of the control instance is called after Instance 1,2,3 but before Instance 4. Does it mean that the pause screen will not have Instance 4 on it? If so, is it a good idea to put the deactivate function in the draw event since you have no idea the order of when all these draw events will be called?
I have tried implementing it myself but with a small tweak. I put the deactivation function in the keyboard I/O event for the designated pause key. It turns out that nothing shows up except the background layer. It seems that If you deactivate the instances in the I/O event, the application surface will have nothing in it when you try to draw it to a custom surface in the draw event.
This goes against my expectations because I thought the application surface would have stuff in it from the previous event loop. But somehow the application surface is cleared after each event loop. If so, when does it get freed? After post draw event?