My phone is using a resolution of 360 x 640
with a 9:16
aspect ratio. I set my room in game maker to 360 x 640
and game maker thinks it's in landscape mode. I disabled landscape mode in the android settings and set to portrait only, like it should be. How do I get it to scale properly?
This is the code I have in my Scale Manager Object.
Create Event:
///Display Properties
ideal_width = 0;
ideal_height = 640;
aspect_ratio = display_get_width()/display_get_height();
ideal_width = round(ideal_height/aspect_ratio);
//check for odd numbers
if(ideal_width & 1) {
ideal_width++;
}
for (var i = 1; i <= room_last; i++) {
if(room_exists(i)) {
room_set_view(i,0,true,0,0,ideal_width,ideal_height,0,0,ideal_width,ideal_height,0,0,0,0,-1);
room_set_view_enabled(i,true);
}
}
surface_resize(application_surface,ideal_width , ideal_height);
window_set_size(ideal_width,ideal_height);
room_goto(room_next(room));
Answer
I switched the variables locations in this line
ideal_width = round(ideal_height/aspect_ratio);
Now it's
ideal_height = round(ideal_width/aspect_ratio);
No comments:
Post a Comment