Skip to content
Snippets Groups Projects
Commit 551326da authored by Malte Schmitz's avatar Malte Schmitz
Browse files

Use fill

parent ab69cf8a
No related branches found
No related tags found
No related merge requests found
......@@ -101,18 +101,12 @@ int state = STATE_PAUSE;
void show() {
pixels.clear();
if (state == STATE_PAUSE) {
for (int i = 0; i < greenLength; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
pixels.fill(0x00FF00, 0, greenLength);
if (singlePlayer) {
for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x0000FF);
}
pixels.fill(0x0000FF, NEOPIXEL_LEN / 2);
} else {
for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1);
int points = pointsInternal;
if (lastPointInternal && hideLastPoint) {
points = max(0, points - 1);
......@@ -131,17 +125,11 @@ void show() {
}
} else if (state == STATE_FORWARD || state == STATE_BACKWARD) {
for (int i = 0; i < greenLength; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
pixels.fill(0x00FF00, 0, greenLength);
if (singlePlayer) {
for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x0000FF);
}
pixels.fill(0x0000FF, NEOPIXEL_LEN / 2);
} else {
for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1);
}
pixels.setPixelColor(position, 0xFFFFFF);
}
......@@ -231,18 +219,14 @@ void handleButton() {
void handleExternalMissedAnimation() {
int step = (100 - taskExternalMissedAnimation.getIterations()) % 25;
pixels.clear();
for (int i = NEOPIXEL_LEN - 1 - 25; i < NEOPIXEL_LEN - 25 + step; i++) {
pixels.setPixelColor(i, 0xFF0000);
}
pixels.fill(0xFF0000, NEOPIXEL_LEN - 1 - 25, step + 1);
pixels.show();
}
void handleInternalMissedAnimation() {
int step = (100 - taskInternalMissedAnimation.getIterations()) % 25;
pixels.clear();
for (int i = 25 - step; i < 25; i++) {
pixels.setPixelColor(i, 0xFF0000);
}
pixels.fill(0xFF0000, 25 - step, step + 1);
pixels.show();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment