diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-06-12 22:54:25 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-06-12 22:54:25 +0200 |
commit | 613191e9e603fe8d1472016c34802156bf308f9f (patch) | |
tree | be4ff368db3146c260a2ac1a20358428bc576b91 /src/colorpicker.cpp | |
parent | f672aaab75181d327e34d778fcc14701b37c78a7 (diff) | |
download | ascedit-613191e9e603fe8d1472016c34802156bf308f9f.tar.gz |
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 ); } |