此变量保存运行游戏的浏览器的宽度(以像素为单位)。如果不存在浏览器,则返回窗口大小。
参见: 游戏窗口
browser_width
if (browser_height > window_get_height()) || (browser_width > window_get_width())
{
var xx, yy;
if (browser_width > window_get_width())
{
xx = (browser_width - window_get_width()) / 2;
}
else
{
xx = 0;
}
if (browser_height > window_get_height())
{
yy = (browser_height - window_get_height()) / 2;
}
else
{
yy = 0;
}
window_set_position(xx, yy);
}
上面的代码检查浏览器的宽度和高度,看看是否有一个大于当前窗口的宽度和高度。 如果它们中的任何一个是,它就会计算游戏窗口在浏览器中的新位置。