Jonathan Hunter
Member
I just bought the HTML5 license in the sale and wanted to get my minesweeper clone working in a browser. The only problem I'm having is that the camera does not seem to work properly and some GUI element don't draw at all. The view appears to be much larger than it should be, it is showing the background colour which should never be visible. The GUI is the proper size but the 9 slice border sprite has disappeared even though it is being drawn in the same event as the other GUI elements. When I check the camera and GUI size attributes when the game is running they show that they are the correct values.
Windows desktop version vs HTML5 version in Firefox
Camera object create event code:
Windows desktop version vs HTML5 version in Firefox
Camera object create event code:
GML:
view_enabled = true;
view_visible[view] = true;
var scale = game.scale;
//desktop view is dependant on the current minefield dimensions
if(os_browser == browser_not_a_browser){
viewWidth = (field.width*tileSize + borderSize*2);
viewHeight = (field.height*tileSize + borderSize + borderTopSize);
camera_set_view_size(view, viewWidth, viewHeight);
camera_set_view_pos(view, -borderSize, -borderTopSize);
}
//HTML view is dependant on the max minefield dimensions (30x16)
else{
viewWidth = (30*tileSize + borderSize*2);
viewHeight = (16*tileSize + borderSize + borderTopSize);
camera_set_view_size(view, viewWidth, viewHeight);
camera_set_view_pos(view, -borderSize-(15*tileSize), -borderTopSize);
}
window_set_size(viewWidth*scale, viewHeight*scale);
display_set_gui_maximize(scale, scale);
display_set_gui_size(viewWidth, viewHeight);
surface_resize(application_surface, viewWidth, viewHeight);