pitrix/include/effect_snake.h
Fabian Schlenz 382631d7d7 Effect#loop now gets the time since the last run of the loop in ms. This enables
the effects to show animations that stay fluid independent of the current frame rate.
2019-10-01 06:29:32 +02:00

26 lines
550 B
C++

#pragma once
#include "Effect.h"
#include "prototypes.h"
class SnakeEffect : public Effect {
private:
Coords coords;
uint8_t direction = 1;
uint8_t hue = 0;
uint8_t run = 0;
bool is_turn_needed();
void turn_random();
bool turn_right();
bool turn_left();
bool is_direction_okay(uint8_t direction);
public:
SnakeEffect();
~SnakeEffect();
void loop(uint16_t ms);
boolean valid_position(Coords c);
Coords update_position(Coords c, uint8_t direction);
boolean can_be_shown_with_clock();
String get_name() override { return "snake"; }
};