FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

◆ PaintVuSpaceInvaders()

void Painter::PaintVuSpaceInvaders ( uint32_t now_ms,
const KeyboardState & keyboard,
const int * led_column_table,
int led_column_table_length,
LedRopeInterface * led_rope )
staticprivate

Definition at line 449 of file Painter.cpp.

452 {
453 led_rope->RawBeginDraw();
454
455 Color3i black = Color3i::Black();
456
457 for (int i = 0; i < led_column_table_length; ++i) {
458 const Key& key = keyboard.keys_[i];
459
460 const int pixel_count = led_column_table[i];
461 const int draw_pixel_count = ceil(pixel_count * sqrt(key.curr_color_.v_));
462
463 const int black_pixel_count = pixel_count - draw_pixel_count;
464
465 // If i is even
466 if (i % 2 == 0) {
467 for (int j = 0; j < black_pixel_count; ++j) {
468 led_rope->RawDrawPixel(*led_rope->GetIterator(i));
469 }
470 for (int j = 0; j < draw_pixel_count; ++j) {
471 led_rope->RawDrawPixel(black);
472 }
473 } else {
474
475 for (int j = 0; j < draw_pixel_count; ++j) {
476 led_rope->RawDrawPixel(black);
477 }
478
479 for (int j = 0; j < black_pixel_count; ++j) {
480 led_rope->RawDrawPixel(*led_rope->GetIterator(i));
481 }
482 }
483 }
484 led_rope->RawCommitDraw();
485}
Key keys_[kNumKeys]
Definition Keyboard.h:103
virtual void RawDrawPixel(const Color3i &c)=0
virtual void RawCommitDraw()=0
virtual void RawBeginDraw()=0
virtual Color3i * GetIterator(int i)=0
T ceil(T value)
Definition math.h:18
static Color3i Black()
Definition color.h:9
float v_
Definition color.h:98
ColorHSV curr_color_
Definition Keyboard.h:48

References Color3i::Black(), Key::curr_color_, LedRopeInterface::GetIterator(), KeyboardState::keys_, LedRopeInterface::RawBeginDraw(), LedRopeInterface::RawCommitDraw(), LedRopeInterface::RawDrawPixel(), and ColorHSV::v_.

Referenced by Paint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: