Ensure key highlighting color is bright enough to not blend too much with black keys
This commit is contained in:
parent
73c7b0502d
commit
d3e01264b9
11
src/Cfg.h
11
src/Cfg.h
|
@ -29,6 +29,8 @@
|
|||
#ifndef __CFG_H__
|
||||
#define __CFG_H__
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define OPTION_BENCHMARK_TEST 0
|
||||
#if OPTION_BENCHMARK_TEST
|
||||
#define BENCHMARK_INIT() benchMarkInit()
|
||||
|
@ -71,6 +73,15 @@ public:
|
|||
return red == color.red && green == color.green && blue == color.blue;
|
||||
}
|
||||
|
||||
constexpr void ensureBrightness(float v)
|
||||
{
|
||||
if (red < v && green < v && blue < v) {
|
||||
red = std::max(red, v);
|
||||
green = std::max(green, v);
|
||||
blue = std::max(blue, v);
|
||||
}
|
||||
}
|
||||
|
||||
float red, green, blue;
|
||||
};
|
||||
|
||||
|
|
|
@ -168,9 +168,12 @@ void CScore::drawPianoKeyboard(){
|
|||
glScalef(1.0f, 1.4f, 1.0f);
|
||||
glTranslatef(Cfg::staveStartX() + xPlaceSize * static_cast<float>(i++), yStart, 0.0f);
|
||||
|
||||
CDraw::drColor (CColor(1.0, 1.0, 1.0));
|
||||
if(state[k]==1) CDraw::drColor(stopped ? Cfg::colorTheme().playedStoppedColor : Cfg::colorTheme().noteColor);
|
||||
if(state[k]==2) CDraw::drColor(Cfg::colorTheme().playedBadColor);
|
||||
const auto &theme = Cfg::colorTheme();
|
||||
auto color = CColor(1.0, 1.0, 1.0);
|
||||
if(state[k]==1) color = stopped ? theme.playedStoppedColor : theme.noteColor;
|
||||
else if(state[k]==2) color = theme.playedBadColor;
|
||||
color.ensureBrightness(0.4f); // ensure the color is bright enough to not blend too much with black keys
|
||||
CDraw::drColor(color);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(0, ySize);
|
||||
glVertex2f(xKeySize, ySize);
|
||||
|
|
Loading…
Reference in New Issue