diff options
Diffstat (limited to 'src/colorpicker.cpp')
-rw-r--r-- | src/colorpicker.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/colorpicker.cpp b/src/colorpicker.cpp index f0eb2ea..0a2ac77 100644 --- a/src/colorpicker.cpp +++ b/src/colorpicker.cpp @@ -4,6 +4,9 @@ colorpicker::colorpicker() { setSize(32,17); + + currentFG = _COL_WHITE; + currentBG = _COL_BLACK; update(); } colorpicker::~colorpicker() @@ -13,7 +16,14 @@ colorpicker::~colorpicker() void colorpicker::onClick(sPos _pos, unsigned int _button) { + uint8_t color = (16*_pos.y + _pos.x/2); + if ((_button & 0x03) == 0) + currentFG = color; + else if ((_button & 0x03) == 2) + currentBG = color; + + update(); } uint16_t colorpicker::getColor() @@ -30,7 +40,10 @@ void colorpicker::update() } } - char text[17]; - snprintf(text, 16,"asdf"); + char text[33]; + snprintf(text, 32, "FG/BG"); drawText(text, {0,16}, _COL_WHITE_BG | _COL_BLACK); + + drawText(" ", {7,16}, _COL_WHITE | currentFG << 8 ); + drawText(" ", {10,16}, _COL_WHITE | currentBG << 8 ); } |