~ubuntu-branches/ubuntu/warty/pygame/warty

« back to all changes in this revision

Viewing changes to docs/ref/Rect.html

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-17 17:09:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040917170953-caomeukd8awvvpwv
Tags: 1.6-0.2ubuntu1
Add missing build-depends: python

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
30
30
|| <a href=pygame_mouse.html>mouse</a> || 
31
31
<a href=pygame_movie.html>movie</a> || 
 
32
<a href=pygame_sndarray.html>sndarray</a> || 
32
33
<a href=pygame_surfarray.html>surfarray</a> || 
33
34
<a href=pygame_time.html>time</a> || 
34
35
<a href=pygame_transform.html>transform</a> ||<br>
41
42
|| <a href=Rect.html>Rect</a> || 
42
43
<a href=Sound.html>Sound</a> || 
43
44
<a href=Surface.html>Surface</a> ||<br>
44
 
&nbsp;<br>|| <a href=pygame_cursors.html>cursors</a> || 
45
 
<a href=pygame_sprite.html>sprite</a> || 
46
 
<a href=pygame_version.html>version</a> ||<br>
 
45
&nbsp;<br>|| <a href=pygame_color.html>color</a> || 
 
46
<a href=pygame_cursors.html>cursors</a> || 
 
47
<a href=pygame_sprite.html>sprite</a> ||<br>
47
48
 
48
49
 
49
50
</td></tr></table></td></tr></table>
57
58
<br>&nbsp;<br>
58
59
Rect contains helpful methods, as well as a list of
59
60
modifiable members:
60
 
top, bottom, left, right, topleft, topright,
61
 
bottomleft, bottomright, size, width, height,
62
 
center, centerx, centery, midleft, midright, midtop,
63
 
midbottom. When changing thesemembers, the rectangle
 
61
<table border="0" cellspacing=0 cellpadding=0 width=66%><tr valign=top><td align=left><ul><li>top<li>bottom<li>left<li>right</ul></td>
 
62
<td align=left><ul><li>topleft<li>topright<li>bottomleft<li>bottomright</ul></td>
 
63
<td align=left><ul><li>midleft<li>midright<li>midtop<li>midbottom</ul></td>
 
64
<td align=left><ul><li>center<li>centerx<li>centery</ul></td>
 
65
<td align=left><ul><li>size<li>width<li>height</ul></td>
 
66
</tr></table><br>
 
67
When changing these members, the rectangle
64
68
will be moved to the given assignment. (except when
65
69
changing the size, width, or height member, which will
66
70
resize the rectangle from the topleft corner)
67
71
<br>&nbsp;<br>
68
72
The rectstyle arguments used frequently with the
69
73
Rect object (and elsewhere in pygame) is one of
70
 
the following things. First, an actual Rect
71
 
object. Second, a sequence of [xpos, ypos, width,
72
 
height]. Lastly, a pair of sequences, representing
73
 
the position and size [[xpos, ypos], [width,
74
 
height]]. Also, if a method takes a rectstyle
75
 
argument as its only argument, you can simply pass
76
 
four arguments representing xpos, ypos, width,
77
 
height.
 
74
the following things.
 
75
<table border=0 cellspacing=0 cellpadding=0 width=80%>
 
76
<tr align=left valign=top><td align=left valign=middle width=20%><blockquote> </blockquote></td><td align=left valign=top><ul>
 
77
<li>an actual Rect object. 
 
78
<li>a sequence of [xpos, ypos, width, height]. 
 
79
<li>a pair of sequences, representing the position and size [[xpos, ypos], [width,height]]. 
 
80
<li>if a method takes a rectstyle argument <b>as its <i>only</i> argument</b>, you can simply pass four arguments representing xpos, ypos, width, height. 
 
81
</ul>and perhaps most importantly:
 
82
<ul><li>A rectstyle argument can also be <b><strong>_any_ python object</b> with an attribute named <b>'rect'.</b></strong>
 
83
</ul></td></tr></table>
78
84
 
79
85
<hr>
80
86
 
91
97
rectangle cropped inside another</td></tr>
92
98
 
93
99
 
 
100
<tr><td><a href=#collidedict>collidedict</a></td><td> -
 
101
find overlapping rectangle in a dictionary</td></tr>
 
102
 
 
103
 
 
104
<tr><td><a href=#collidedictall>collidedictall</a></td><td> -
 
105
find all overlapping rectangles</td></tr>
 
106
 
 
107
 
94
108
<tr><td><a href=#collidelist>collidelist</a></td><td> -
95
109
find overlapping rectangle</td></tr>
96
110
 
181
195
begin with, you will get a rectangle with 0 size.
182
196
</ul><br>&nbsp;<br>
183
197
 
 
198
<a name=collidedict><font size=+2><b>collidedict
 
199
</b></font><br><font size=+1><tt>
 
200
Rect.collidedict(dict if rectstyle keys) -> key/value pair
 
201
</tt></font><ul>
 
202
Returns the key/value pair of the first rectangle key
 
203
in the dict that overlaps the base rectangle. Once an
 
204
overlap is found, this will stop checking the
 
205
remaining list. If no overlap is found, it will
 
206
return None.
 
207
<br>&nbsp;<br>
 
208
Remember python dictionary keys must be immutable,
 
209
Rects are not immutable, so they cannot directly be,
 
210
dictionary keys. You can convert the Rect to a tuple
 
211
with the tuple() builtin command.
 
212
</ul><br>&nbsp;<br>
 
213
 
 
214
<a name=collidedictall><font size=+2><b>collidedictall
 
215
</b></font><br><font size=+1><tt>
 
216
Rect.collidedictall(rectstyle list) -> key/val list
 
217
</tt></font><ul>
 
218
Returns a list of the indexes that contain
 
219
rectangles overlapping the base rectangle. If no
 
220
overlap is found, it will return an empty
 
221
sequence.
 
222
<br>&nbsp;<br>
 
223
Remember python dictionary keys must be immutable,
 
224
Rects are not immutable, so they cannot directly be,
 
225
dictionary keys. You can convert the Rect to a tuple
 
226
with the tuple() builtin command.
 
227
</ul><br>&nbsp;<br>
 
228
 
184
229
<a name=collidelist><font size=+2><b>collidelist
185
230
</b></font><br><font size=+1><tt>
186
231
Rect.collidelist(rectstyle list) -> int index
194
239
 
195
240
<a name=collidelistall><font size=+2><b>collidelistall
196
241
</b></font><br><font size=+1><tt>
197
 
Rect.collidelistall(rectstyle list) -> int index
 
242
Rect.collidelistall(rectstyle list) -> index list
198
243
</tt></font><ul>
199
244
Returns a list of the indexes that contain
200
245
rectangles overlapping the base rectangle. If no
275
320
</b></font><br><font size=+1><tt>
276
321
Rect.union(rectstyle) -> Rect
277
322
</tt></font><ul>
278
 
Creates a new Rect to completely cover the
 
323
Returns a new Rect to completely cover the
279
324
given input. There may be area inside the new
280
325
Rect that is not covered by either input.
281
326
</ul><br>&nbsp;<br>
302
347
</b></font><br><font size=+1><tt>
303
348
Rect.unionall_ip(sequence_of_rectstyles) -> None
304
349
</tt></font><ul>
305
 
Returns a new rectangle that completely covers all the
 
350
Resizes the rectangle to completely cover all the
306
351
given inputs. There may be area inside the new
307
352
rectangle that is not covered by the inputs.
308
353
</ul><br>&nbsp;<br>