MeltingCat
Member
I have gotten this error 'Invalid surface dimensions' after using surface_resize in a room start event.
The error occurs only sometimes - I can't quite figure out a pattern behind it and would like to know more what invalid surface dimensions might be.
A google search brings nothing but one thread on reddit, where nobody provides a helpful response, apart from rounding the pixels to integers, which I am doing.
The error occurs sometimes when the game might not know what room to enter after trying to load a save file which doesn't exist - but I tried to get around this and it still comes up every so often. Here is my code of my camera object in the room start event - I'm using this to change the camera dimensions according to the screen size.
Thank you for any help provided. Any information regarding surface dimensions is helpful.
The error occurs only sometimes - I can't quite figure out a pattern behind it and would like to know more what invalid surface dimensions might be.
A google search brings nothing but one thread on reddit, where nobody provides a helpful response, apart from rounding the pixels to integers, which I am doing.
The error occurs sometimes when the game might not know what room to enter after trying to load a save file which doesn't exist - but I tried to get around this and it still comes up every so often. Here is my code of my camera object in the room start event - I'm using this to change the camera dimensions according to the screen size.
Code:
Width = camera_get_view_width(view_camera[0]);
Height = camera_get_view_height(view_camera[0]);
var _CamAspect = Width/Height;
DispW = display_get_width();
DispH = display_get_height();
var _DispAspect = DispW / DispH;
if _CamAspect != _DispAspect {
Height = Width / _DispAspect;
var _Wport = view_get_wport(view_camera[0]);
var _Hport = _Wport / _DispAspect;
view_set_hport(0, round(_Hport));
view_hport[0] = _Hport;
}
camera_set_view_size(view_camera[0], round(Width), round(Height));
SurfW = round(Width);
SurfH = round(Height);
surface_resize(application_surface, SurfW, SurfH);