It doesn't matter if you're building for mobile... your game is still displayed in a window, and that window still needs to be the correct size. I suggest you read this tech blog series before going any further as it'll help you understand what's going on and what you need to do:
This article is part one of a series in which we will explore the different ways to scale your game to fit screens of different resolutions. Scaling your gam...
www.yoyogames.com
This blog post is a continuation from The Basics Of Scaling - The GUI Layer where we looked at different methods to scale the GUI layer so that it can b...
www.yoyogames.com
Does not really help me.
As pointed out by the 2nd article:
The 1st article is about filling the GUI into display of any resolution and look correct whereas;
The 2nd article is about filling the game into display of any resolution and look correct.
Currently I just want to display a window of 360x640 with a room size of 800x800. That's all. I do not even have a game to run yet.
The output is correct when I fill in the viewport setting via room editor.
Now I am struggling with how to do the equivalent via code. I think this is a very BASIC thing but somehow cannot get it done.
Below is my attempt via code:
view_enabled = true;
global.camera_base_view = camera_create_view(0, 0, 360, 640);
view_set_visible(0,true);
view_set_camera(0, global.camera_base_view);
view_set_wport(0, 360);
view_set_hport(0, 640);
view_set_xport(0, 0);
view_set_yport(0, 0);
Anyone be so kind to show me exactly how it is done?
Referring above video from a fantastic GMS2 user. She did not really code the viewport. She just config it using the room editor. So not really helping my case either.
UPDATE
I amended my code as per below comment, I can get the window to the size I want but I notice there is distortion in the text displayed compared to above screenshot.
Amended code.
Looks slight vertically distorted, it is as if the test been squeezed vertically a bit. And it is not drawing at (0,0).
Further testing, yes, the view is squeezed top and bottom. I do not understand why.
Left, using code, right using room editor
I step debug the game, I notice when using code, the output is actually what I wanted and after looping a few times, it turns to what we see on the left hand side. Weird.
Not solved.