Some memory leaks fixed.

This commit is contained in:
2019-06-19 22:23:49 +02:00
parent 9eeb4b50fd
commit 0163bbef6c
6 changed files with 18 additions and 6 deletions

View File

@ -6,6 +6,10 @@ SnakeEffect::SnakeEffect() {
this->window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
}
SnakeEffect::~SnakeEffect() {
delete window;
}
void SnakeEffect::loop() {
if (run++ % EFFECT_SNAKE_SLOWDOWN == 0) { // Change the coordinates only on every n-th run.
if (random8(EFFECT_SNAKE_DIRECTION_CHANGE)==0 || is_turn_needed()) turn_random();