Meester Dennis
Member
Hi there,
I have an question. Sorry for my bad English, but I will try to explain my problem. I'm scaling my game with this code:
Now the game window is scaling the way I want, but when i'm scaling my game down, sometimes my buttons didn't work. Is it possible to fix this problem? I you want, you can test it here: https://meesterdennis.nl/temp/serieren2.html
I hope someone can help me.
Greets,
Dennis van Duin
Ps: As you can see, I want to scale my game bij de width ore the height of the browser. You always have to so everyting, but it is okay to see some empty space near te game on the left and right, ore above en below the game.
I have an question. Sorry for my bad English, but I will try to explain my problem. I'm scaling my game with this code:
if ((prev_browser_width != browser_width) || (prev_browser_height != browser_height))
{
var bw, bh, rw, rh, nw, nh, nx, ny, ra;
bw = browser_width;
bh = browser_height;
rw = view_wport[0];
rh = view_hport[0];
nx = 0 // new x
ny = 0 // new y
// nw en nh zijn 'new width' en 'new height'
if ((bw / rw) > (bh / rh))
{
nh = bh
nw = rw * (bh / rh)
nx = (bw / 2) - (nw / 2)
}else{
nw = bw
nh = rh * (bw / rw)
ny = (bh / 2) - (nh / 2)
}
surface_resize(application_surface, nw, nh);
view_set_wport(0,nw)
view_set_hport(0,nh)
view_set_xport(0,nx)
view_set_yport(0,ny)
window_set_size(nw, nh)
window_set_position(nx, ny)
prev_browser_width = browser_width
prev_browser_height = browser_height
}
{
var bw, bh, rw, rh, nw, nh, nx, ny, ra;
bw = browser_width;
bh = browser_height;
rw = view_wport[0];
rh = view_hport[0];
nx = 0 // new x
ny = 0 // new y
// nw en nh zijn 'new width' en 'new height'
if ((bw / rw) > (bh / rh))
{
nh = bh
nw = rw * (bh / rh)
nx = (bw / 2) - (nw / 2)
}else{
nw = bw
nh = rh * (bw / rw)
ny = (bh / 2) - (nh / 2)
}
surface_resize(application_surface, nw, nh);
view_set_wport(0,nw)
view_set_hport(0,nh)
view_set_xport(0,nx)
view_set_yport(0,ny)
window_set_size(nw, nh)
window_set_position(nx, ny)
prev_browser_width = browser_width
prev_browser_height = browser_height
}
Now the game window is scaling the way I want, but when i'm scaling my game down, sometimes my buttons didn't work. Is it possible to fix this problem? I you want, you can test it here: https://meesterdennis.nl/temp/serieren2.html
I hope someone can help me.
Greets,
Dennis van Duin
Ps: As you can see, I want to scale my game bij de width ore the height of the browser. You always have to so everyting, but it is okay to see some empty space near te game on the left and right, ore above en below the game.