Files
QtGameMaker/help/files/409_03_backgrounds.html
T

116 lines
5.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Backgrounds</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>Backgrounds</h3>
The following routines can be used to create new backgrounds and to remove them.
<p>
<blockquote>
<tt><b>background_duplicate(ind)</b></tt>
Creates a duplicate of the background with the
given index. It returns the index of the new background. When an error occurs -1 is
returned.<br>
<tt><b>background_assign(ind,back)</b></tt>
Assigns the indicated background to background
ind. So this makes a copy of the background.<br>
<tt><b>background_add(fname,removeback,smooth)</b></tt>
Adds the image stored in the file fname to the set of background resources.
Many different types of images can be dealt with. When the image has an
alpha channel, this is used for transparency. <tt>removeback</tt> indicates whether
to make all pixels with the background color (left-bottom pixel) transparent.
<tt>smooth</tt> indicates whether to smooth the boundaries. The function returns the index of
the new background that you can then use to draw it or to assign it to the variable
background_index[0] to make it visible in the current room. When an error occurs -1 is
returned.<br>
<tt><b>background_replace(ind,fname,removeback,smooth)</b></tt>
Same as above but in this case the background with index ind is replaced. The function returns
whether it is successful. When the background is currently visible in the room it wil be
replaced also.<br>
<tt><b>background_add_background(fname)</b></tt>
Adds the background stored the file fname to the set of background resources. The file must be
a .gmbck file that is saved in the background property form in <i>Game Maker</i>. As this
file contains all background settings, no further arguments are required.
The function returns the index of
the new background that you can then use to draw it or to assign it to the variable
background_index[0] to make it visible in the current room. When an error occurs -1 is
returned.<br>
<tt><b>background_replace_background(ind,fname)</b></tt>
Same as above but in this case the background with index ind is replaced. The function returns whether
it is successful. When the background is currently visible in the room it wil be
replaced also.<br>
<tt><b>background_create_color(w,h,col)</b></tt>
Creates a background of the given size and with the given color.
It returns the index of the new background. When an error occurs -1 is returned.<br>
<tt><b>background_create_gradient(w,h,col1,col2,kind)</b></tt>
Creates a gradient filled background of the given size.
col1 and col2 indicate the two colors. kind is a number between 0 and 5
indicating the kind of gradient: 0=horizontal 1=vertical, 2= rectangle, 3=ellipse,
4=double horizontal, 5=double vertical. It returns the index of the new background. When an
error occurs -1 is returned.<br>
<tt><b>background_create_from_screen(x,y,w,h,removeback,smooth)</b></tt>
Creates a background by copying the given area from the screen. <tt>removeback</tt> indicates whether
to make all pixels with the background color (left-bottom pixel) transparent.
<tt>smooth</tt> indicates whether to smooth the boundaries. This function
makes it possible to create any background you want. Draw the image on
the screen using the drawing functions and next create a background from
it. (If you don't do this in the drawing event you can even do it in
such a way that it is not visible on the screen by not refreshing the
screen.) The function returns the
index of the new background. A work of caution is required here. Even
though we speak about the screen, it is actually the drawing region that matters. The fact
that there is a window on the screen and that the image might be scaled in this window does
not matter.<br>
<tt><b>background_create_from_surface(id,x,y,w,h,removeback,smooth)</b></tt>
Creates a background by copying the given area from the surface with the given id.
<tt>removeback</tt> indicates whether
to make all pixels with the background color (left-bottom pixel) transparent.
<tt>smooth</tt> indicates whether to smooth the boundaries. This function
makes it possible to create any background you want. Draw the image on
the surface using the drawing functions and next create a background from
it. Note that alpha values are maintained in the background.<br>
<tt><b>background_delete(ind)</b></tt>
Deletes the background from memory, freeing the memory used.<br>
</blockquote>
<p>
The following routine exists to change the appearance of a background.
<p>
<blockquote>
<tt><b>background_set_alpha_from_background(ind,back)</b></tt>
Changes the alpha (transparancy) values in the background with index
<tt>ind</tt> using the intensity values in the background <tt>back</tt>. This cannot
be undone.<br>
</blockquote>
<p>
<!--END-->
</body>
</html>
<!-- KEYWORDS
background_duplicate()
background_assign()
background_add()
background_replace()
background_add_background()
background_replace_background()
background_create_color()
background_create_gradient()
background_create_from_screen()
background_create_from_surface()
background_delete()
background_set_alpha_from_background()
-->