|
2496 | 2496 | <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) |
2497 | 2497 | <int> = <Rect>.x/y/centerx/centery |
2498 | 2498 | <tup.> = <Rect>.topleft/topright/bottomright/bottomleft/center |
2499 | | -<Rect> = <Rect>.move(<tuple>) |
| 2499 | +<Rect> = <Rect>.move((x, y)) |
2500 | 2500 | </code></pre></div> |
2501 | 2501 |
|
2502 | 2502 |
|
2503 | | -<pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint(<tuple>) <span class="hljs-comment"># Tests if a point is inside a rectangle.</span> |
| 2503 | +<pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint((x, y)) <span class="hljs-comment"># Tests if a point is inside a rectangle.</span> |
2504 | 2504 | <bool> = <Rect>.colliderect(<Rect>) <span class="hljs-comment"># Tests if two rectangles overlap.</span> |
2505 | 2505 | <int> = <Rect>.collidelist(<list_of_Rect>) <span class="hljs-comment"># Returns index of first colliding Rect or -1.</span> |
2506 | 2506 | <list> = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-comment"># Returns indices of all colliding Rects.</span> |
|
2512 | 2512 | </code></pre></div> |
2513 | 2513 |
|
2514 | 2514 |
|
2515 | | -<pre><code class="python language-python hljs"><Surf>.set_at((x, y), color) <span class="hljs-comment"># Updates pixel.</span> |
2516 | | -<Surf>.fill(color) <span class="hljs-comment"># Fills the whole surface.</span> |
| 2515 | +<pre><code class="python language-python hljs"><Surf>.fill(color) <span class="hljs-comment"># Fills the whole surface.</span> |
| 2516 | +<Surf>.set_at((x, y), color) <span class="hljs-comment"># Updates pixel.</span> |
2517 | 2517 | <Surf>.blit(<Surface>, (x, y)) <span class="hljs-comment"># Draws passed surface to the surface.</span> |
2518 | 2518 | </code></pre> |
2519 | 2519 | <pre><code class="python language-python hljs"><Surf> = pg.transform.flip(<Surf>, xbool, ybool) |
2520 | 2520 | <Surf> = pg.transform.rotate(<Surf>, degrees) |
2521 | 2521 | <Surf> = pg.transform.scale(<Surf>, (width, height)) |
2522 | 2522 | </code></pre> |
2523 | | -<pre><code class="python language-python hljs">pg.draw.line(<Surf>, color, start_pos, end_pos, width) |
| 2523 | +<pre><code class="python language-python hljs">pg.draw.line(<Surf>, color, (x1, y1), (x2, y2), width) |
2524 | 2524 | pg.draw.arc(<Surf>, color, <Rect>, start_radians, stop_radians) |
2525 | 2525 | pg.draw.rect(<Surf>, color, <Rect>) |
2526 | 2526 | pg.draw.polygon(<Surf>, color, points) |
2527 | 2527 | pg.draw.ellipse(<Surf>, color, <Rect>) |
2528 | 2528 | </code></pre> |
2529 | | -<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>) |
| 2529 | +<div><h3 id="font">Font</h3><pre><code class="python language-python hljs"><Font> = pg.font.SysFont(<span class="hljs-string">'<name>'</span>, size, bold=<span class="hljs-keyword">False</span>, italic=<span class="hljs-keyword">False</span>) |
2530 | 2530 | <Font> = pg.font.Font(<span class="hljs-string">'<path>'</span>, size) |
2531 | 2531 | <Surf> = <Font>.render(text, antialias, color, background=<span class="hljs-keyword">None</span>) |
2532 | 2532 | </code></pre></div> |
|
0 commit comments