|
2516 | 2516 | </code></pre></div>
|
2517 | 2517 |
|
2518 | 2518 |
|
2519 |
| -<pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint((x, y)) <span class="hljs-comment"># Tests if a point is inside the rectangle.</span> |
2520 |
| -<bool> = <Rect>.colliderect(<Rect>) <span class="hljs-comment"># Tests if two rectangles overlap.</span> |
| 2519 | +<pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint((x, y)) <span class="hljs-comment"># Tests if point is inside the rectangle.</span> |
| 2520 | +<bool> = <Rect>.colliderect(<Rect>) <span class="hljs-comment"># Tests if the two rectangles overlap.</span> |
2521 | 2521 | <int> = <Rect>.collidelist(<list_of_Rect>) <span class="hljs-comment"># Returns index of first colliding Rect or -1.</span>
|
2522 | 2522 | <list> = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-comment"># Returns indexes of all colliding Rects.</span>
|
2523 | 2523 | </code></pre>
|
2524 |
| -<div><h3 id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><code class="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <span class="hljs-comment"># Returns the display surface.</span> |
2525 |
| -<Surf> = pg.Surface((width, height) [, ...]) <span class="hljs-comment"># New RGB surface. Add `pg.SRCALPHA` for RGBA.</span> |
| 2524 | +<div><h3 id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><code class="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <span class="hljs-comment"># Returns display surface.</span> |
| 2525 | +<Surf> = pg.Surface((width, height), …) <span class="hljs-comment"># New RGB surface. Add `pg.SRCALPHA` for RGBA.</span> |
2526 | 2526 | <Surf> = pg.image.load(<span class="hljs-string">'<path>'</span>) <span class="hljs-comment"># Loads the image. Format depends on source.</span>
|
2527 | 2527 | <Surf> = <Surf>.subsurface(<Rect>) <span class="hljs-comment"># Returns a subsurface.</span>
|
2528 | 2528 | </code></pre></div>
|
2529 | 2529 |
|
2530 | 2530 |
|
2531 |
| -<pre><code class="python language-python hljs"><Surf>.fill(color) <span class="hljs-comment"># Fills the whole surface.</span> |
| 2531 | +<pre><code class="python language-python hljs"><Surf>.fill(color) <span class="hljs-comment"># Tuple, Color('#rrggbb[aa]') or Color(<name>).</span> |
2532 | 2532 | <Surf>.set_at((x, y), color) <span class="hljs-comment"># Updates pixel.</span>
|
2533 | 2533 | <Surf>.blit(<Surf>, (x, y)) <span class="hljs-comment"># Draws passed surface to the surface.</span>
|
2534 | 2534 | </code></pre>
|
2535 | 2535 | <pre><code class="python language-python hljs"><Surf> = pg.transform.scale(<Surf>, (width, height))
|
2536 | 2536 | <Surf> = pg.transform.rotate(<Surf>, degrees)
|
2537 |
| -<Surf> = pg.transform.flip(<Surf>, xbool, ybool) |
| 2537 | +<Surf> = pg.transform.flip(<Surf>, x_bool, y_bool) |
2538 | 2538 | </code></pre>
|
2539 | 2539 | <pre><code class="python language-python hljs">pg.draw.line(<Surf>, color, (x1, y1), (x2, y2), width)
|
2540 | 2540 | pg.draw.arc(<Surf>, color, <Rect>, from_radians, to_radians)
|
|
0 commit comments