Some pause screen errors

M

Magic-4e

Guest
Hi there I am making a pause screen for my game and I stumbled across a problem.
When I pause the game only a quarter of the screen is visible.
I mean that objects are only visible on a quarter of the screen.
I am using a disabled command to stop all objects from moving so they don't desync or lose velocity.
And I am using a surface comand to make the objects appear again while everything is standing still.

Here is my code:


PAUSE ACTIVATION CODE:

global.pauseSurf = surface_create(view_wview[0], view_hview[0]);
surface_set_target(global.pauseSurf);
with(all)
{
if (visible == true)
{
x = x-view_xview[0];
y = y-view_yview[0];
event_perform(ev_draw, 0);
x = x+view_xview[0];
y = y+view_yview[0];
}
}
surface_reset_target();

instance_deactivate_all(true);
instance_activate_object(Pauze_obj);



PAUSE DEACTIVATION CODE:

instance_activate_all();
if (surface_exists(global.pauseSurf))
{
surface_free(global.pauseSurf);
}


DRAW EVENT CODE:

if (global.Gamepauzed == 1)
{
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_rectangle(0,0,room_width,room_height,0);
draw_set_alpha(1);
if (surface_exists(global.pauseSurf))
{
draw_surface(global.pauseSurf, view_xview[0], view_yview[0]);
}
}




*If you guys need more info on my game just let me know.*



.
 
W

Wild_West

Guest
Hi there I am making a pause screen for my game and I stumbled across a problem.
When I pause the game only a quarter of the screen is visible.
I mean that objects are only visible on a quarter of the screen.
I am using a disabled command to stop all objects from moving so they don't desync or lose velocity.
And I am using a surface comand to make the objects appear again while everything is standing still.

Here is my code:


PAUSE ACTIVATION CODE:

global.pauseSurf = surface_create(view_wview[0], view_hview[0]);
surface_set_target(global.pauseSurf);
with(all)
{
if (visible == true)
{
x = x-view_xview[0];
y = y-view_yview[0];
event_perform(ev_draw, 0);
x = x+view_xview[0];
y = y+view_yview[0];
}
}
surface_reset_target();

instance_deactivate_all(true);
instance_activate_object(Pauze_obj);



PAUSE DEACTIVATION CODE:

instance_activate_all();
if (surface_exists(global.pauseSurf))
{
surface_free(global.pauseSurf);
}


DRAW EVENT CODE:

if (global.Gamepauzed == 1)
{
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_rectangle(0,0,room_width,room_height,0);
draw_set_alpha(1);
if (surface_exists(global.pauseSurf))
{
draw_surface(global.pauseSurf, view_xview[0], view_yview[0]);
}
}




*If you guys need more info on my game just let me know.*

I just use a background draw over the screen and deactivate everything for my pausing but I guess that's not the effect you want.


.
 
M

Magic-4e

Guest
Yeah I like this effect a little more.
I don't know about draw background, but I have used a sprite screenshot before this, however I got the exact same problem.
I am wondering if you or anyone else know's why this is happening?
 
M

Magic-4e

Guest
Is your view size the same as your port size? (inside view tab in room editor)
Ah thanks it was indeed different.
* Yes it workt thanks. :)
But question, what is port on screen?
 
Last edited by a moderator:

Simon Gust

Member
The port is the actual window size, at fullscreen it would be your monitor resolution.
If your port size is bigger than your view size, your game get's scaled by the division of the two (scale = view port / view view).
So if your view size is 960 x 540 and your port at 1920 x 1080 (or fullscreen) every pixel is actually 2x2 pixels on screen.
 
M

Magic-4e

Guest
The port is the actual window size, at fullscreen it would be your monitor resolution.
If your port size is bigger than your view size, your game get's scaled by the division of the two (scale = view port / view view).
So if your view size is 960 x 540 and your port at 1920 x 1080 (or fullscreen) every pixel is actually 2x2 pixels on screen.
Ah yes I get it. Thanks.
I still have some other questions but I will ask them later. I got to run.
 
M

Magic-4e

Guest
Hi everybody I have fixed the problem of my first question but there's still something that is bothering me.
All objects are transparent while I am pausing my game does anybody know why?
 
M

Magic-4e

Guest
Hi everybody I have fixed the problem of my first question but there's still something that is bothering me.
All objects are transparent while I am pausing my game does anybody know why?
Also each time I pause the game there appear more and more ghost versions of the previous times I paused the game only more transparent depending on how many times ago I have paused the game before.
 

RangerX

Member
Are those objects already have some transparency?
Because it might be because you did not turn off the alpha blending of the application surface before taking the "screenshot".

EDIT:
Also, you're supposed to edit your posts and not repost.
 
M

Magic-4e

Guest
Are those objects already have some transparency?
Because it might be because you did not turn off the alpha blending of the application surface before taking the "screenshot".

EDIT:
Also, you're supposed to edit your posts and not repost.
Ow sorry.
But I don't know if the surface has alpha blending on, however I do have a black box covering the entire screen to make it appear darkened with an alpha value run in the same draw event. (See my draw event above in the original post)
 
M

Magic-4e

Guest
This guy here had a similar problem apparently. 2 surfaces on top of each other with blending problems.
https://forum.yoyogames.com/index.p...-two-surfaces-problem-help-appreciated.11716/

And look at this function. I would use it once when you open the game and see if that fixes your prob:
http://docs.yoyogames.com/source/dadiospice/002_reference/drawing/color and blending/draw_enable_alphablend.html
Sorry but I don't think your first link has something to do with what I have and your second link will not help me either I am afraid.
Thanks for the help tho. :)
 
M

Magic-4e

Guest
Hi um can someone please explain why my objects display transparent when I pause?
And why there appear ghost versions of the previous times I pause each time I pause?
Please I cant find out why, it must be somthing simple I just can't see.
 
Are you sure those links won't help you? Have you tried all the suggestions in the linked posts, as well as the articles linked in those posts?

Have you tried this yet:

After you create the surface in the Pause Activation code, try clearing the surface.
draw_clear_alpha(c_black, 0);

Code:
global.pauseSurf = surface_create(view_wview[0], view_hview[0]);
surface_set_target(global.pauseSurf);
draw_clear_alpha(c_black, 0);
// ...rest of the code
 
Top