You will have to make adjustments to make those elements draw correctly again. Personally, I like to have interface elements set only a handful of pixels off the edge of the screen, so when the resolution is changed lower, they're not too intrusive. But if you have, say, a text box popping in 300 pixels off the right of the screen and suddenly your screen goes from 1920 wide to 640 wide, you're going to have a gap spanning half the screen and that text box will probably be cut off by quite a lot.
This method holds a few flaws, as stated on the OP, you must re-execute the code everytime the room changes, and if you dont do that everything gets reseted.
It is possible to change the views propierties at runtime, without need to use room_set_view(), wich is a bit of a clumsy function, since it changes the propierties of the room at startup and the only part we really need to change there is the views propierties.
The way I do it is pretty much the same calculation, but made on a Step event, so whenever you rotate the screen you get the view adjusted automatically with no need to reset the room or whatever; I use view_wport and view_wview constants, they give better and simpler results and you only have to specify them on the room you are on:if os_type == os_android || os_type == os_ios { display_w = display_get_width(); display_h = display_get_height(); aspect_ratio = display_h/display_w; if (display_w > display_h) { aspect_ratio = display_w/display_h; } view_wview[0] = 768*aspect_ratio; view_wport[0] = view_wview[0]; } // On this example, the view width will be scaled to match the // screen's aspect ratio, while the height will remain the same (768px) // Notice how the view ports change too to match the screen resolution!
The calculations and manners may change depending on the needs, but the method of applying the view sizes remains. I use this method on all of my alredy published games and prototypes/>
0.o Ooh, that's an interesting alternate.. I'll have to play with that later. Thanks for sharing!
This seems pretty useful! (Was looking for something to do this) my question is what if you have something draw on the screen at a specific location like using view_wport and hport then add numbers like if I don't want it at wport (0,0) instead i'd do something like view_wport + 300 (for example) now when this changes the resolution if mines set to be at 1920x1080 and they got down to 640x480 (for example) would that put the draw in the wrong spot?
Using things like view_hview/2 (centered vertically) or view_wview*0.75 (3/4 of the way to the right) will always draw that element in the same relative spot no matter what your resolution is. When you add and subtract, that's where things can get a little messed up. In some cases, you may want to either scale up/down elements or even make multiple versions of them for specific screen size ranges. view_wport and view_hport should work about the same, I think.



Find content
Male
