blackhole.c: make animation resolution aware

This commit is contained in:
Christian Kroll 2014-05-17 19:47:41 +02:00
parent d4dbc53e5a
commit 8a3ecd882e
1 changed files with 4 additions and 3 deletions

View File

@ -54,7 +54,8 @@ static signed char cos_i(unsigned char const angle) {
#define NUM_CIRCLE 7
#define W (NUM_COLS * 4)
#define H (NUM_ROWS * 4)
/**
* Draws a black hole like pattern (viewed from different perspectives).
@ -71,8 +72,8 @@ void blackhole(void) {
for (signed char j = 0; j < 64; j += 8) {
signed char a = (j & 0x08) ? 0 : 4;
pixel p;
p.x = (64 + cos_i(angle + j + a) * helpRadius / 64) >> 3;
p.y = (64 + sin_i(angle + add + j + a) * helpRadius / 64) >> 3;
p.x = (W + cos_i(angle + j + a) * helpRadius / W) / 8u;
p.y = (H + sin_i(angle + add + j + a) * helpRadius / H) / 8u;
if ((p.x < NUM_COLS) && (p.y < NUM_ROWS)) {
setpixel(p, 3);
}