Android Scaling Troubleshooting [GMS:1.4]

gdkid

Member
Hi guys

I have a problem with scaling, in some specific Android phones, it shows the screen like this. The big one is the scaled version, while the smaller one is the original size.

I can't figure out the reason for that. You can see the attached image of error.
Thank you in advance.
Code:
/* Script to set the size of the game screen
 *
 * returns nothing
 *
 */
globalvar screen_width,window_width,window_height,touch;
screen_width = 768;
switch (os_type) {
  // desktop
  case os_windows:
  case os_linux:
  case os_macosx:
    window_width =  768;  // change this to the desired window width
    window_height = 1024;  // change this to the desired window height
    touch = false;
  break;

  // mobile
  case os_android:
  case os_ios:
  case os_winphone:
  case os_tizen:
    window_width = round(display_get_width());
    window_height = round(display_get_height());
    touch = true;
  break;
}

var max_w = window_width;
var max_h = window_height;
var aspect = window_width / window_height;
if (max_w < max_h) { //portrait
  var VIEW_WIDTH = min(base_w, max_w);
  var VIEW_HEIGHT = VIEW_WIDTH / aspect;
  //VIEW_HEIGHT = VIEW_HEIGHT - 50*(VIEW_HEIGHT/window_height)
} else {
  var VIEW_HEIGHT =min(base_h, max_h);
  var VIEW_WIDTH = VIEW_HEIGHT * aspect;
}
view_wview[0] = floor(VIEW_WIDTH);
view_hview[0] = floor(VIEW_HEIGHT);
view_wport[0] = max_w;
view_hport[0] = max_h;

surface_resize(application_surface, view_wview[0], view_hview[0]);
window_width = view_wview[0];
window_height = view_hview[0];

// resize window on desktop
if (!touch) {
  window_set_size(view_wview[0], view_hview[0]);
}

error_1.jpg error_2.jpg
 
Top