1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Question - Code So how to change aspect ratio or display size generally

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Owly, Dec 1, 2019.

  1. Owly

    Owly Member

    Joined:
    Nov 9, 2019
    Posts:
    10
    Hey all,

    This one's bugging me. I want to have an option for the player to change between 16/9 aspect ratio and 4/3... I've seen a guide suggesting using the command display_set_gui_size(w, h) but that didn't work at all...

    Here is the code I have that appears for a persistent object at the event "room start":

    var base_h = 768;
    var max_w = display_get_width();
    var max_h = display_get_height();
    var aspect = display_get_width() / display_get_height();

    global.VIEW_HEIGHT = min(base_h, max_h);
    global.VIEW_WIDTH = global.VIEW_HEIGHT * aspect;

    camera_set_view_size(view_camera[0], floor(global.VIEW_WIDTH), floor(global.VIEW_HEIGHT))
    view_wport[0] = max_w;
    view_hport[0] = max_h;
    surface_resize(application_surface, view_wport[0], view_hport[0]);

    ------------------------------------------------------------------------------------------

    Edit: added pictures in a reply to show what I mean.

    Thanks to any who can help!
     
    Last edited: Dec 1, 2019
  2. Owly

    Owly Member

    Joined:
    Nov 9, 2019
    Posts:
    10
    Ok, now with images, how do I make the left picture look like the right one with code? (from 16:9 to 4:3):
     

    Attached Files:

    • 16 9.jpg
      16 9.jpg
      File size:
      127.4 KB
      Views:
      8
    • 4 3.jpg
      4 3.jpg
      File size:
      125.8 KB
      Views:
      8
  3. Owly

    Owly Member

    Joined:
    Nov 9, 2019
    Posts:
    10
    Surely someone can shed light on how to go from 16:9 to 4:3? :)
     

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