Increase room size on phone

Discussion in 'Programming' started by Blakecubed, Sep 10, 2018.

  1. Blakecubed

    Blakecubed Member

    Joined:
    Sep 9, 2018
    Posts:
    11
    Hello!

    I've been developing a game for the iOS export in GameMaker Studio 1.4 and I need to stretch the screen to fit any phone's aspect ratio. All the rooms are currently 640 x 960, so whenever I try to scale it on a phone that does not have a proportional ratio, black bars show up on the edges. I do not want to use the Full Scale feature (in Global Game Settings) because it stretches all the objects in the room. To solve the issue, I would like to be able to change the height of the room to the height of the phone's screen. However, when I use the room_set_height(<room>, display_get_height) function, the black bars still show up and objects spawn in the black bars. When I attempt to use surface_resize(application_surface, display_get_width, display_get_height); to resolve this, it just stretches all the objects and does the same thing as the Full Scale feature. How would you go about changing the room height so that the room can fit on any phone without black bars showing up?

    Thanks in advance!

    NOTE: All objects are randomly spawned inside the room when the room starts, so I use the entire room at once.
     
  2. Phil Strahl

    Phil Strahl Member

    Joined:
    Jul 3, 2016
    Posts:
    381
    I would have in initialization room first where you read the device's aspect ratio, then set the room dimensions of the first proper game room and, most importantly, also change the view size and view port to reflect that aspect ratio. My hunch is that this might be the culprit in your case.
     
  3. Blakecubed

    Blakecubed Member

    Joined:
    Sep 9, 2018
    Posts:
    11
    Thanks for the response!

    I already have everything you mentioned except for changing the view size and port. If I don't have views in the game, would this cause a problem?
     
  4. Phil Strahl

    Phil Strahl Member

    Joined:
    Jul 3, 2016
    Posts:
    381
    My guess is that having a view that adjusts itself to the precise aspect ratio of the device would fix your problem, so I would try that. If you haven't worked with views, it's not that hard, really. In the room editor, just make sure that you also make the view active, otherwise you won't see a thing.
     

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