The actual game happens in a window. This window has a number of properties, like whether it has a border, whether it is full screen, etc. Normally these are set in the Game Settings. But you can change then during the game. The following functions exist for this:window_set_visible(visible) Sets whether the game window is visible. Clearly you normally want the window to remain visible during the whole game. The program will not receive keyboard events when the window is invisible. window_get_visible() Returns whether the game window is visible. window_set_fullscreen(full) Sets whether the window is shown in full screen mode. window_get_fullscreen() Returns whether the window is shown in full screen mode. window_set_showborder(show) Sets whether the border around the window is shown. (In full screen mode it is never shown.) window_get_showborder() Returns whether the border around the window is shown in windowed mode. window_set_showicons(show) Sets whether the border icons (iconize, maximize, close) are shown. (In full screen mode these are never shown.) window_get_showicons() Returns whether the border icons are shown in windowed mode. window_set_stayontop(stay) Sets whether the window must always stay on top of other windows. window_get_stayontop() Returns whether the window always stays on top of other windows. window_set_sizeable(sizeable) Sets whether the window is sizeable by the player. (The player can only size it when the border is shown and the window is not in full screen mode.) window_get_sizeable() Returns whether the window is sizeable by the player. window_set_caption(caption) Sets the caption string for the window. Normally you specify this when defining the room and it can be changed using the variable room_caption. So this function is normally not useful, unless you draw the room yourself rather than letting Game Maker do it. The caption is only visible when the window has a border and when it is not in full screen mode. window_get_caption() Returns the window caption. window_set_cursor(curs) Sets the mouse cursor used in the window.
You can use the following constant:
In particular, to hide the mouse cursor, use cr_none as value.window_get_cursor() Returns the cursor used in the window. window_set_color(color) Sets the color of the part of the window that is not used for displaying the room. window_get_color() Returns the window color. window_set_region_scale(scale,adaptwindow) If the window is larger than the actual room normally the room is displayed in a region centered in the window. It is though possible to indicate that it must be scaled to fill the whole or part of the window. A value of 1 is no scaling. If you use a value of 0 the region will be scaled to fill the whole window. If you set it to a negative value it will be scaled to the maximal size inside the window while maintaining the aspect ratio (this is often what you want). adaptwindow indicates whether the window size must be adapted if the scaled room does not fit in. Adapting the window is only effective when the scale factor is positive. window_get_region_scale() Returns the scale factor for the drawing region.
The window has a position on the screen and a size. (When we talk about position and size we always mean the client part of the window without the borders.) You can change these although you hardly ever do from within your game. Normally they are determined automatically or by the player. The following functions can be used to change the window position and size. Note that these functions deal with the windowed mode. If the window is in full screen mode they can still be used but will only have effect when switching full screen mode off.window_set_position(x,y) Sets the position of the (client part of the) window to the indicated position. window_set_size(w,h) Sets the size of the (client part of the) window to the indicated size. Note that is the indicated size is too small to fit the drawing region it is kept large enough for the region to fit it. window_set_rectangle(x,y,w,h) Sets the position and size of the window rectangle. (Does both previous routines in one step.) window_center() Centers the window on the screen. window_default() Gives the window the default size and position (centered) on the screen. window_get_x() Returns the current x-coordinate of the window. window_get_y() Returns the current y-coordinate of the window. window_get_width() Returns the current width of the window. window_get_height() Returns the current height of the window.
Again, you probably never want to use any of the window positioning functions as Game Maker takes care of these automatically.
In rare cases you might want to know the position of the mouse with respect to the window. (Normally you always use the mouse position with respect to the room or with respect to a view.) The following functions exist for this.window_mouse_get_x() Returns the x-coordinate of the mouse in the window. window_mouse_get_y() Returns the y-coordinate of the mouse in the window. window_mouse_set(x,y) Sets the position of the mouse in the window to the indicated values.
Contributor: Mark Overmars