blackhole.c: make animation resolution aware
This commit is contained in:
parent
d4dbc53e5a
commit
8a3ecd882e
|
@ -54,7 +54,8 @@ static signed char cos_i(unsigned char const angle) {
|
||||||
|
|
||||||
|
|
||||||
#define NUM_CIRCLE 7
|
#define NUM_CIRCLE 7
|
||||||
|
#define W (NUM_COLS * 4)
|
||||||
|
#define H (NUM_ROWS * 4)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a black hole like pattern (viewed from different perspectives).
|
* 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) {
|
for (signed char j = 0; j < 64; j += 8) {
|
||||||
signed char a = (j & 0x08) ? 0 : 4;
|
signed char a = (j & 0x08) ? 0 : 4;
|
||||||
pixel p;
|
pixel p;
|
||||||
p.x = (64 + cos_i(angle + j + a) * helpRadius / 64) >> 3;
|
p.x = (W + cos_i(angle + j + a) * helpRadius / W) / 8u;
|
||||||
p.y = (64 + sin_i(angle + add + j + a) * helpRadius / 64) >> 3;
|
p.y = (H + sin_i(angle + add + j + a) * helpRadius / H) / 8u;
|
||||||
if ((p.x < NUM_COLS) && (p.y < NUM_ROWS)) {
|
if ((p.x < NUM_COLS) && (p.y < NUM_ROWS)) {
|
||||||
setpixel(p, 3);
|
setpixel(p, 3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue