FastLED 3.9.15
Loading...
Searching...
No Matches

◆ 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 442 of file Painter.cpp.

445 {
446 led_rope->RawBeginDraw();
447
448 Color3i black = Color3i::Black();
449
450 for (int i = 0; i < led_column_table_length; ++i) {
451 const Key& key = keyboard.keys_[i];
452
453 const int pixel_count = led_column_table[i];
454 const int draw_pixel_count = ceil(pixel_count * sqrt(key.curr_color_.v_));
455
456 const int black_pixel_count = pixel_count - draw_pixel_count;
457
458 // If i is even
459 if (i % 2 == 0) {
460 for (int j = 0; j < black_pixel_count; ++j) {
461 led_rope->RawDrawPixel(*led_rope->GetIterator(i));
462 }
463 for (int j = 0; j < draw_pixel_count; ++j) {
464 led_rope->RawDrawPixel(black);
465 }
466 } else {
467
468 for (int j = 0; j < draw_pixel_count; ++j) {
469 led_rope->RawDrawPixel(black);
470 }
471
472 for (int j = 0; j < black_pixel_count; ++j) {
473 led_rope->RawDrawPixel(*led_rope->GetIterator(i));
474 }
475 }
476 }
477 led_rope->RawCommitDraw();
478}
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
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: