![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
Scrolling and stamping whole framebuffer rows at word speed. More...
Functions | |
| void | gfx_scroll (int y, int h, int dx, int dy, int fill=-1) |
| Moves a band of rows by (dx, dy) pixels inside the band. | |
| void | gfx_copyRow (int y, const uint8_t *src, int x0, int x1) |
| Copies pixels [x0, x1) of a full-width row buffer into framebuffer row y, clipped. | |
Scrolling and stamping whole framebuffer rows at word speed.
Word copies in SRAM. newlib-nano's memmove/memcpy are byte loops in flash here: a screen shake built on memmove cost ~10 ms a frame.
| void gfx_scroll | ( | int | y, |
| int | h, | ||
| int | dx, | ||
| int | dy, | ||
| int | fill = -1 |
||
| ) |
Moves a band of rows by (dx, dy) pixels inside the band.
Moves the band of rows y..y+h-1 by dx pixels right and dy rows down (negative = left/up). Odd dx is fine (nibble shifts). It works on whole rows and ignores the clip rectangle - it is a post-process: shake, scrolling backgrounds.
| y | First row of the band. |
| h | Rows in the band (clipped to the screen). |
| dx | Pixels to move right; negative moves left. |
| dy | Rows to move down; negative moves up. |
| fill | Palette index for the pixels uncovered by the move, or -1 (the default) to leave them as they were. |
| void gfx_copyRow | ( | int | y, |
| const uint8_t * | src, | ||
| int | x0, | ||
| int | x1 | ||
| ) |
Copies pixels [x0, x1) of a full-width row buffer into framebuffer row y, clipped.
Build a pattern row once, stamp it into many rows at word speed: tiled floors, checkerboards, gradients.
| y | Framebuffer row. |
| src | A row of GFX_FB_STRIDE bytes, packed like the framebuffer. |
| x0 | First pixel copied. |
| x1 | One past the last pixel copied. |