# HG changeset patch # User František Kučera # Date 1514069257 -3600 # Node ID e24883b00180ff556473993dcc7dfe9e934c0fd6 # Parent e85d2bfaff73b9effe3f150e323b1c12a91fb275 COLOR in class diff -r e85d2bfaff73 -r e24883b00180 c++/rgb-assembler/commands/Color.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c++/rgb-assembler/commands/Color.h Sat Dec 23 23:47:37 2017 +0100 @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include "../Command.h" + +namespace commands { + +class Color : public Command { +public: + + void process(octet_t* memory, address_t& index) override { + led_t led = read(memory, index); + color_t r = read(memory, index); + color_t g = read(memory, index); + color_t b = read(memory, index); + wprintf(L"COLOR %02X %02X %02X → %d\n", r, g, b, led); + } +private: + +}; + +} diff -r e85d2bfaff73 -r e24883b00180 c++/rgb-assembler/nbproject/configurations.xml --- a/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:45:27 2017 +0100 +++ b/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:47:37 2017 +0100 @@ -4,6 +4,7 @@ + commands/Color.h Command.h commands/End.h commands/Goto.h @@ -48,6 +49,8 @@ + + @@ -84,6 +87,8 @@ + + diff -r e85d2bfaff73 -r e24883b00180 c++/rgb-assembler/rgb-assembler.cpp --- a/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:45:27 2017 +0100 +++ b/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:47:37 2017 +0100 @@ -11,6 +11,7 @@ #include "commands/Goto.h" #include "commands/Sleep.h" #include "commands/End.h" +#include "commands/Color.h" using namespace std; @@ -116,6 +117,7 @@ {CMD_GOTO, make_shared()}, {CMD_SLEEP, make_shared()}, {CMD_END, make_shared()}, + {CMD_COLOR, make_shared()}, }; for (address_t i = 0; i < MEMORY_SIZE;) { @@ -133,15 +135,6 @@ } switch (command) { - case CMD_COLOR: - { - led_t led = read(memory, i); - color_t r = read(memory, i); - color_t g = read(memory, i); - color_t b = read(memory, i); - wprintf(L"COLOR %02X %02X %02X → %d\n", r, g, b, led); - break; - } case CMD_INCREMENT: case CMD_DECREMENT: {