B
bluesky5
Guest
Hi,
My HTML5 game does not adjust when I resize web browser window. There is something strange going on from beginning of all this story with scaling of HTML5 game.
In my code and now in your code, NazGhuL, when I start game by pressing of little green arrow (button) in upper left corner of GMS GUI to see game as it is already online...and game appears and starts in Google Chrome everything goes smoothly. Game (with your code and with my code) is scaling perfectly with changing size of web browser....but when I create application (as HTML5, of course), and then I get link over Google disc and then I insert this link in small piece of HTML code (look below, please) and embed it on my Weebly page ... scaling with changing of size of web browser window is gone (sometimes all game appears on web page in small window, maybe 3 inch width and 2 inch of height) ....all what stays is just that objects in game fits better on the edges of window/game but only within 288 (width) x 480 (height) room/window.
This is code for embedding on web page:
<iframe src="https://b624ec0fac9882c4b0ab52d2a8ba7ab223edab33.googledrive.com/host/0BwyOcOy36CmeLTRYZ0tUakZFa2M/" scrolling="no" title="Tropical pond 0i1 edu"></iframe>
Is it here maybe, in HTML code something wrong what cause losing of scaling with resizing of web browser window ?
I try to make HTML5 game which will adjust to as many as possible (web browsers on displays on) mobile phones, tablets etc. I am working in GMS 1.4.1474, HTML5 module. My game have few rooms. All rooms are 288 (width) x 480 (height). Already tried several changes in code, also tried with views, but nothing works. I wish to set scaling properly, so, please, help.
This was game before adding code for scaling: http://alanbgames.weebly.com/neskalir.html
This is how it looks now: http://alanbgames.weebly.com/ after I add next code in first room in obj_controller :
in Create event:
base_width = room_width;
base_height = room_height;
width = base_width;
height = base_height;
in Step event (of same obj_controller):
if (browser_width != width || browser_height != height)
{
width = browser_width
height = browser_height
scr_HTML5_Scale_Canvas(base_width, base_height, width, height, true);
}
and in above mentioned script, scr_HTML5_Scale_Canvas :
aspect = argument0 / argument1;
if argument2 / aspect > argument3
{
window_set_size(argument3 * aspect, argument3);
}
else
{
window_set_size(argument2, argument2 / aspect);
}
if argument4
{
window_center();
}
With upper code, I achieved that game scales properly but only inside 288 x 480 room (I tried to enlarge room but game is not scaling right and visible is just smaller part of game) and I wish to get scaling of game accordingly to size of web browser (acctualy approximately accordingly to size of display on smartphone, tablet, laptop or computer - game is mainly for mobile phones).
Sorry, for long post and....please, help.
My HTML5 game does not adjust when I resize web browser window. There is something strange going on from beginning of all this story with scaling of HTML5 game.
In my code and now in your code, NazGhuL, when I start game by pressing of little green arrow (button) in upper left corner of GMS GUI to see game as it is already online...and game appears and starts in Google Chrome everything goes smoothly. Game (with your code and with my code) is scaling perfectly with changing size of web browser....but when I create application (as HTML5, of course), and then I get link over Google disc and then I insert this link in small piece of HTML code (look below, please) and embed it on my Weebly page ... scaling with changing of size of web browser window is gone (sometimes all game appears on web page in small window, maybe 3 inch width and 2 inch of height) ....all what stays is just that objects in game fits better on the edges of window/game but only within 288 (width) x 480 (height) room/window.
This is code for embedding on web page:
<iframe src="https://b624ec0fac9882c4b0ab52d2a8ba7ab223edab33.googledrive.com/host/0BwyOcOy36CmeLTRYZ0tUakZFa2M/" scrolling="no" title="Tropical pond 0i1 edu"></iframe>
Is it here maybe, in HTML code something wrong what cause losing of scaling with resizing of web browser window ?
I try to make HTML5 game which will adjust to as many as possible (web browsers on displays on) mobile phones, tablets etc. I am working in GMS 1.4.1474, HTML5 module. My game have few rooms. All rooms are 288 (width) x 480 (height). Already tried several changes in code, also tried with views, but nothing works. I wish to set scaling properly, so, please, help.
This was game before adding code for scaling: http://alanbgames.weebly.com/neskalir.html
This is how it looks now: http://alanbgames.weebly.com/ after I add next code in first room in obj_controller :
in Create event:
base_width = room_width;
base_height = room_height;
width = base_width;
height = base_height;
in Step event (of same obj_controller):
if (browser_width != width || browser_height != height)
{
width = browser_width
height = browser_height
scr_HTML5_Scale_Canvas(base_width, base_height, width, height, true);
}
and in above mentioned script, scr_HTML5_Scale_Canvas :
aspect = argument0 / argument1;
if argument2 / aspect > argument3
{
window_set_size(argument3 * aspect, argument3);
}
else
{
window_set_size(argument2, argument2 / aspect);
}
if argument4
{
window_center();
}
With upper code, I achieved that game scales properly but only inside 288 x 480 room (I tried to enlarge room but game is not scaling right and visible is just smaller part of game) and I wish to get scaling of game accordingly to size of web browser (acctualy approximately accordingly to size of display on smartphone, tablet, laptop or computer - game is mainly for mobile phones).
Sorry, for long post and....please, help.
Last edited by a moderator: