241 lines
8.3 KiB
HTML
241 lines
8.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>The Window</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>The window</h3>
|
|
|
|
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 <b>Game Settings</b>. But you can change then during
|
|
the game. The following functions exist for this:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>window_set_visible(visible)</b></tt>
|
|
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.<br>
|
|
<tt><b>window_get_visible()</b></tt>
|
|
Returns whether the game window is visible.<br>
|
|
<tt><b>window_set_fullscreen(full)</b></tt>
|
|
Sets whether the window is shown in full screen mode.<br>
|
|
<tt><b>window_get_fullscreen()</b></tt>
|
|
Returns whether the window is shown in full screen mode.<br>
|
|
<tt><b>window_set_showborder(show)</b></tt>
|
|
Sets whether the border around the window is shown.
|
|
(In full screen mode it is never shown.)<br>
|
|
<tt><b>window_get_showborder()</b></tt>
|
|
Returns whether the border around the window is shown in windowed mode.<br>
|
|
<tt><b>window_set_showicons(show)</b></tt>
|
|
Sets whether the border icons (iconize, maximize, close) are shown.
|
|
(In full screen mode these are never shown.)<br>
|
|
<tt><b>window_get_showicons()</b></tt>
|
|
Returns whether the border icons are shown in windowed mode.<br>
|
|
<tt><b>window_set_stayontop(stay)</b></tt>
|
|
Sets whether the window must always stay on top of other windows.<br>
|
|
<tt><b>window_get_stayontop()</b></tt>
|
|
Returns whether the window always stays on top of other windows.<br>
|
|
<tt><b>window_set_sizeable(sizeable)</b></tt>
|
|
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.)<br>
|
|
<tt><b>window_get_sizeable()</b></tt>
|
|
Returns whether the window is sizeable by the player.<br>
|
|
<tt><b>window_set_caption(caption)</b></tt>
|
|
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 <i>Game Maker</i> do it.
|
|
The caption is only visible when the window has a border and
|
|
when it is not in full screen mode.<br>
|
|
<tt><b>window_get_caption()</b></tt>
|
|
Returns the window caption.<br>
|
|
<tt><b>window_set_cursor(curs)</b></tt>
|
|
Sets the mouse cursor used in the window. You can use the following constant:
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>cr_default</b></tt><br>
|
|
<tt><b>cr_none</b></tt><br>
|
|
<tt><b>cr_arrow</b></tt><br>
|
|
<tt><b>cr_cross</b></tt><br>
|
|
<tt><b>cr_beam</b></tt><br>
|
|
<tt><b>cr_size_nesw</b></tt><br>
|
|
<tt><b>cr_size_ns</b></tt><br>
|
|
<tt><b>cr_size_nwse</b></tt><br>
|
|
<tt><b>cr_size_we</b></tt><br>
|
|
<tt><b>cr_uparrow</b></tt><br>
|
|
<tt><b>cr_hourglass</b></tt><br>
|
|
<tt><b>cr_drag</b></tt><br>
|
|
<tt><b>cr_nodrop</b></tt><br>
|
|
<tt><b>cr_hsplit</b></tt><br>
|
|
<tt><b>cr_vsplit</b></tt><br>
|
|
<tt><b>cr_multidrag</b></tt><br>
|
|
<tt><b>cr_sqlwait</b></tt><br>
|
|
<tt><b>cr_no</b></tt><br>
|
|
<tt><b>cr_appstart</b></tt><br>
|
|
<tt><b>cr_help</b></tt><br>
|
|
<tt><b>cr_handpoint</b></tt><br>
|
|
<tt><b>cr_size_all</b></tt><br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
In particular, to hide the mouse cursor, use <tt>cr_none</tt> as value.<br>
|
|
<tt><b>window_get_cursor()</b></tt>
|
|
Returns the cursor used in the window.<br>
|
|
<tt><b>window_set_color(color)</b></tt>
|
|
Sets the color of the part of the window that is not
|
|
used for displaying the room.<br>
|
|
<tt><b>window_get_color()</b></tt>
|
|
Returns the window color.<br>
|
|
<tt><b>window_set_region_scale(scale,adaptwindow)</b></tt>
|
|
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). <tt>adaptwindow</tt>
|
|
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.<br>
|
|
<tt><b>window_get_region_scale()</b></tt>
|
|
Returns the scale factor for the drawing region.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
|
|
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.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>window_set_position(x,y)</b></tt>
|
|
Sets the position of the (client part of the) window to the indicated position.<br>
|
|
<tt><b>window_set_size(w,h)</b></tt>
|
|
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.<br>
|
|
<tt><b>window_set_rectangle(x,y,w,h)</b></tt>
|
|
Sets the position and size of the window rectangle.
|
|
(Does both previous routines in one step.)<br>
|
|
<tt><b>window_center()</b></tt>
|
|
Centers the window on the screen.<br>
|
|
<tt><b>window_default()</b></tt>
|
|
Gives the window the default size and position (centered) on the screen.<br>
|
|
<tt><b>window_get_x()</b></tt>
|
|
Returns the current x-coordinate of the window.<br>
|
|
<tt><b>window_get_y()</b></tt>
|
|
Returns the current y-coordinate of the window.<br>
|
|
<tt><b>window_get_width()</b></tt>
|
|
Returns the current width of the window.<br>
|
|
<tt><b>window_get_height()</b></tt>
|
|
Returns the current height of the window.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
|
|
Again, you probably never want to use any of the window positioning functions as
|
|
<i>Game Maker</i> takes care of these automatically.
|
|
|
|
<P>
|
|
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.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>window_mouse_get_x()</b></tt>
|
|
Returns the x-coordinate of the mouse in the window.<br>
|
|
<tt><b>window_mouse_get_y()</b></tt>
|
|
Returns the y-coordinate of the mouse in the window.<br>
|
|
<tt><b>window_mouse_set(x,y)</b></tt>
|
|
Sets the position of the mouse in the window to the indicated values.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
window
|
|
window properties
|
|
fullscreen
|
|
cursor
|
|
cursor shape
|
|
caption
|
|
drawing region
|
|
region for drawing
|
|
window position
|
|
window size
|
|
|
|
window_set_visible()
|
|
window_get_visible()
|
|
window_set_fullscreen()
|
|
window_get_fullscreen()
|
|
window_set_showborder()
|
|
window_get_showborder()
|
|
window_set_showicons()
|
|
window_get_showicons()
|
|
window_set_stayontop()
|
|
window_get_stayontop()
|
|
window_set_sizeable()
|
|
window_get_sizeable()
|
|
window_set_caption()
|
|
window_get_caption()
|
|
window_set_cursor()
|
|
cr_default
|
|
cr_none
|
|
cr_arrow
|
|
cr_cross
|
|
cr_beam
|
|
cr_size_nesw
|
|
cr_size_ns
|
|
cr_size_nwse
|
|
cr_size_we
|
|
cr_uparrow
|
|
cr_hourglass
|
|
cr_drag
|
|
cr_nodrop
|
|
cr_hsplit
|
|
cr_vsplit
|
|
cr_multidrag
|
|
cr_sqlwait
|
|
cr_no
|
|
cr_appstart
|
|
cr_help
|
|
cr_handpoint
|
|
cr_size_all
|
|
window_get_cursor()
|
|
window_set_color()
|
|
window_get_color()
|
|
window_set_region_scale()
|
|
window_get_region_scale()
|
|
window_set_position()
|
|
window_set_size()
|
|
window_set_rectangle()
|
|
window_center()
|
|
window_default()
|
|
window_get_x()
|
|
window_get_y()
|
|
window_get_width()
|
|
window_get_height()
|
|
window_mouse_get_x()
|
|
window_mouse_get_y()
|
|
window_mouse_set()
|
|
|
|
--> |