window_set_size

Sets the size of the window in pixels.

Syntax:

GML Code Example

window_set_size( w, h );


Argument Description
w The new width of the window.
h The new height of the window.


Returns:N/A


Description

With this function you can change the size of the game window. If you use this function to change the size of the game window, the contents of the window will be scaled to fit with a 1:1 ratio to the background canvas which will keep the image crisp and clear (although scaled if the window is other than the room or view size). For example, if you have a 200 x 150 pixel window, and the player stretches the window by dragging the borders, the final window size may be 400 x 300 pixels, but the drawing canvas is STILL 200 x 150, which gives a blurred image as the pixel ratio is now 1:2. However, if you use this function to set the window size, the 1:1 ratio is maintained, even though the image is scaled to fit the new window size.


Example:

GML Code Example

if mouse_check_button_pressed(mb_left)
    {
    global.scale += 1;
    window_set_size(200 * global.scale, 150 * global.scale);
    }
 

The above code will change the size of the window based on the value of the variable "global.scale" when the mouse button is pressed.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here