• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Pause menu screenshot not working

D

Drago Supremo

Guest
Hi guys,
i'm trying to make a pause menu with the game paused in the background.

Actually what i'm trying to do is to take a screenshot making a sprite of the surface and then drawing it on the screen.
Code:
if (pause)
{
    if !(sprite_exists(screenshot))
    {
        screenshot = sprite_create_from_surface(application_surface, 0, 0, view_wport, view_hport, false, false, 0, 0);
    }
    draw_sprite_ext(screenshot, 0, 0, 0, 0.5, 0.5, 0, c_white, 1);
    instance_deactivate_all(true);

}
This is in the Draw Event of the Player object.

The problem is that when i try to draw the screenshot it's not haligned with the view as shown below:
screenshot.PNG
The area evidenced in red is the screenshot.

I've already tried changing the coordinate in which the sprite is drawn(view_xview, view_xport...) but nothing seems to work:bash:
 
D

Drago Supremo

Guest
That's because the remaining instances have not executed their Draw event yet, and thus won't show up in application_surface.

Given the Draw event cycle, you should consider using the Draw GUI End event for this.
I tried to put the code in the Draw GUI End event and it works! This also explains why many instances were not shown up, but why was the screenshot not centered on the screen?
Many thanks anyway.
 
Top