espleaf/include/corner.h

38 lines
878 B
C++

#pragma once
class Corner;
#include "my_fastled.h"
#include <vector>
#include <list>
#include "node.h"
class Corner {
public:
Node* node;
uint8_t number;
Corner(Node* node, uint8_t number);
std::list<uint16_t> _leds;
std::vector<Corner*> _long_neighbours {};
std::vector<Corner*> _short_neighbours {};
CRGB color = CRGB(0x000000);
CRGB source_color;
CRGB target_color;
bool effect_running = false;
uint16_t color_blend_state = 1023;
uint16_t effect_id;
uint16_t effect_speed;
//bool loop();
void draw();
void blend_to(CRGB color, uint16_t effect_id=0, uint8_t effect_speed=0);
void add_led(uint16_t led_id);
void merge_leds(Corner* c);
void step();
void infect(uint16_t short_level, uint16_t long_level);
bool is_finished();
void set_color(CRGB color);
bool reached_level(uint16_t level);
private:
void _infect(std::vector<Corner*>* neighbours);
};