1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Some pause screen errors

Discussion in 'Programming' started by Magic-4e, Jul 4, 2017.

  1. Magic-4e

    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.*



    .
     
  2. Wild_West

    Wild_West Member

    Joined:
    Jun 25, 2016
    Posts:
    911
     
  3. Magic-4e

    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?
     
  4. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,258
    Sounds to me like you're scaling the view.
     
  5. Magic-4e

    Magic-4e Guest

    If I did I did't know I had done that.
    I only know I have a custom room size.
     
  6. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,258
    Is your view size the same as your port size? (inside view tab in room editor)
     
  7. RangerX

    RangerX Member

    Joined:
    Jun 20, 2016
    Posts:
    2,605
    what's your view size and the resolution of the monitor you're trying to display the game in?
     
  8. Magic-4e

    Magic-4e Guest

    Ah thanks it was indeed different.
    * Yes it workt thanks. :)
    But question, what is port on screen?
     
    Last edited by a moderator: Jul 4, 2017
  9. Magic-4e

    Magic-4e Guest

    1920x1080
    But I don't want it to be full screen sorry.
    But thanks anyway.
     
  10. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,258
    Yous just said it in your last post.
     
  11. Magic-4e

    Magic-4e Guest

    What?
     
  12. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,258
    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.
     
  13. Magic-4e

    Magic-4e Guest

    Ah yes I get it. Thanks.
    I still have some other questions but I will ask them later. I got to run.
     
  14. Magic-4e

    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?
     
  15. Magic-4e

    Magic-4e Guest

    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.
     
  16. RangerX

    RangerX Member

    Joined:
    Jun 20, 2016
    Posts:
    2,605
    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.
     
  17. Magic-4e

    Magic-4e Guest

    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)
     
  18. RangerX

    RangerX Member

    Joined:
    Jun 20, 2016
    Posts:
    2,605
  19. Magic-4e

    Magic-4e Guest

    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. :)
     
  20. Magic-4e

    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.
     
  21. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,389
    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
    
     

Share This Page