espleaf/include/corner.h

35 lines
846 B
C
Raw Normal View History

2021-01-03 16:12:47 +00:00
#pragma once
#include "my_fastled.h"
#include <vector>
#include <list>
#include "edge.h"
2021-01-03 16:12:47 +00:00
class Corner {
public:
Edge* e1;
Edge* e2;
Corner(Edge* e1, Edge* e2);
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);
};