|
|
@ -2496,12 +2496,10 @@ rect = pg.Rect(<span class="hljs-number">235</span>, <span class="hljs-number">2 |
|
|
|
<div><h3 id="rect">Rect</h3><p><strong>Object for storing rectangular coordinates.</strong></p><pre><code class="python language-python hljs"><Rect> = pg.Rect(topleft_x, topleft_y, width, height) |
|
|
|
<tuple> = <Rect>.topleft/topright/bottomright/bottomleft/center |
|
|
|
<int> = <Rect>.x/y/centerx/centery |
|
|
|
<Rect> = <Rect>.move(<tuple>) <span class="hljs-comment"># Or: <Rect>.move(<int>, <int>)</span> |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
|
|
|
|
<pre><code class="python language-python hljs"><Rect> = <Rect>.move(<tuple>) <span class="hljs-comment"># Or: <Rect>.move(<int>, <int>)</span> |
|
|
|
<Rect>.move_ip(<tuple>) <span class="hljs-comment"># Or: <Rect>.move_ip(<int>, <int>)</span> |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint(<tuple>) <span class="hljs-comment"># Or: <Rect>.collidepoint(<int>, <int>)</span> |
|
|
|
<bool> = <Rect>.colliderect(<Rect>) |
|
|
|
index = <Rect>.collidelist(<list_of_Rect>) <span class="hljs-comment"># Returns index of first coliding Rect or -1.</span> |
|
|
@ -2522,13 +2520,11 @@ indices = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-c |
|
|
|
<Surface> = pg.transform.rotate(<Surface>, angle) |
|
|
|
<Surface> = pg.transform.scale(<Surface>, (width, height)) |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs">pg.draw.rect(<Surface>, color, <Rect>) |
|
|
|
<pre><code class="python language-python hljs">pg.draw.line(<Surface>, color, start_pos, end_pos, width) |
|
|
|
pg.draw.arc(<Surface>, color, <Rect>, start_angle, stop_angle) |
|
|
|
pg.draw.rect(<Surface>, color, <Rect>) |
|
|
|
pg.draw.polygon(<Surface>, color, points) |
|
|
|
pg.draw.circle(<Surface>, color, center, radius) |
|
|
|
pg.draw.ellipse(<Surface>, color, <Rect>) |
|
|
|
pg.draw.arc(<Surface>, color, <Rect>, start_angle, stop_angle) |
|
|
|
pg.draw.line(<Surface>, color, start_pos, end_pos, width) |
|
|
|
pg.draw.lines(<Surface>, color, points) |
|
|
|
</code></pre> |
|
|
|
<div><h3 id="font">Font</h3><pre><code class="python language-python hljs"><Font> = pg.font.SysFont(name, size, bold=<span class="hljs-keyword">False</span>, italic=<span class="hljs-keyword">False</span>) |
|
|
|
<Font> = pg.font.Font(<span class="hljs-string">'<path>'</span>, size) |
|
|
|