diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-08 08:01:02 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-08 08:01:02 +0100 |
commit | f90846d5a7a82573f85a58306c7b866baef95703 (patch) | |
tree | 59e5f2c56f7d6afcac7fb69e5998da97c635817b /src/main.c | |
parent | 1cd96edcd529599b2d1a0de584bee50252cc23be (diff) | |
download | gold-mine-run-f90846d5a7a82573f85a58306c7b866baef95703.tar.gz gold-mine-run-f90846d5a7a82573f85a58306c7b866baef95703.zip |
Use a rectangle struct
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -33,26 +33,26 @@ int main(int argc, char *argv[]) blit_update(); uint8_t bg[24 * 24] = { 0 }; - uint16_t x = 10, y = 10; + Rect dst = { 10, 10, 24, 24 }; int8_t ix = 1, iy = 1; uint8_t c = 0; while (!keys[KEY_ESC]) { // erase - blit(bg, x, y, 24, 24); + blit(bg, &dst); - x += ix; - y += iy; + dst.x += ix; + dst.y += iy; - if (x >= 320 - 24 || x == 0) + if (dst.x >= 320 - 24 || dst.x == 0) { ix *= -1; c = (c + 1) % 15; blit_erase(c); memset(bg, c, 24 * 24); } - if (y >= 200 - 24 || y == 0) + if (dst.y >= 200 - 24 || dst.y == 0) { iy *= -1; c = (c + 1) % 15; @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) } // draw - blit(binary_sprites_start, x, y, 24, 24); + blit(binary_sprites_start, &dst); wait_vsync(); blit_update(); |