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

GM:S 1.4 [SOLVED] Surface resize

Discussion in 'Programming' started by marasovec, Nov 9, 2019.

  1. marasovec

    marasovec Member

    Joined:
    Sep 15, 2016
    Posts:
    333
    I'm trying to resize application_surface so it looks more and more pixelated but it doesn't seem to do anything
    I guess I'm just missing something obvious

    CREATE EVENT:
    Code:
    surf = -1;
    w = 800;
    h = 600;
    
    DRAW EVENT:
    Code:
    if !surface_exists(surf)
        {
        surf = surface_create(surface_get_width(application_surface), surface_get_height(application_surface));
        surface_copy(surf, 0, 0, application_surface);
        }
    else
        {
        if w > 8 w--;
        if h > 6 h--;
        surface_resize(surf, w, h);
     
        draw_surface_stretched(surf, view_xview[0], view_yview[0], 800, 600);
        }
    
    (application_surface is enabled)
     
  2. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,199
    My suggestion
    CREATE
    Code:
    surf = -1;
    w = view_wview;
    h = view_hview;
    
    DRAW
    Code:
    if !surface_exists(surf)
    {
        surf = surface_create(surface_get_width(application_surface), surface_get_height(application_surface));
    }
    else
    {
        if w > 8 w--;
        if h > 6 h--;
       
        surface_resize(surf, w, h);
        surface_set_target(surf);
        draw_clear_alpha(0, 0.0);
        draw_surface_stretched(application_surface, 0, 0, w, h);
        surface_reset_target();
        draw_surface_stretched(surf, view_xview, view_yview, view_wview, view_hview);
    }
    
    Or alternitavely, just resize the application surface.
     
    marasovec likes this.
  3. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,977
    EDIT - Wait, I think I misunderstood what you're trying to accomplish. Are you trying to create a zoom effect or pixelate everything that is on the app surface?
     
  4. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,393
    Application surface is the one surface you never have to check exists. You can even resize it right at the start before drawing happens, as it remembers this size for the first time it's used.

    Also not sure why you're copying the app surface. Just issue a resize, and it'll resize next draw frame.
     
  5. marasovec

    marasovec Member

    Joined:
    Sep 15, 2016
    Posts:
    333
    Pixelate everything
     
  6. marasovec

    marasovec Member

    Joined:
    Sep 15, 2016
    Posts:
    333
    Thanks that worked
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice