mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-07 16:17:38 +03:00
Use consistent invertText variable for all text rendering
Co-authored-by: lukestein <44452336+lukestein@users.noreply.github.com>
This commit is contained in:
parent
62877ca87d
commit
a72fbdda62
@ -325,6 +325,9 @@ void HomeActivity::render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasContinueReading) {
|
if (hasContinueReading) {
|
||||||
|
// When cover is shown, invert text colors on selection; without cover, invert normally
|
||||||
|
const bool invertText = coverRendered ? bookSelected : !bookSelected;
|
||||||
|
|
||||||
// Split into words (avoid stringstream to keep this light on the MCU)
|
// Split into words (avoid stringstream to keep this light on the MCU)
|
||||||
std::vector<std::string> words;
|
std::vector<std::string> words;
|
||||||
words.reserve(8);
|
words.reserve(8);
|
||||||
@ -444,9 +447,6 @@ void HomeActivity::render() {
|
|||||||
renderer.drawRect(boxX, boxY, boxWidth, boxHeight, !bookSelected);
|
renderer.drawRect(boxX, boxY, boxWidth, boxHeight, !bookSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When cover is shown, invert text colors on selection; without cover, invert normally
|
|
||||||
const bool invertText = coverRendered ? bookSelected : !bookSelected;
|
|
||||||
|
|
||||||
for (const auto& line : lines) {
|
for (const auto& line : lines) {
|
||||||
renderer.drawCenteredText(UI_12_FONT_ID, titleYStart, line.c_str(), invertText);
|
renderer.drawCenteredText(UI_12_FONT_ID, titleYStart, line.c_str(), invertText);
|
||||||
titleYStart += renderer.getLineHeight(UI_12_FONT_ID);
|
titleYStart += renderer.getLineHeight(UI_12_FONT_ID);
|
||||||
@ -485,9 +485,9 @@ void HomeActivity::render() {
|
|||||||
const int continueBoxY = continueY - continuePadding / 2;
|
const int continueBoxY = continueY - continuePadding / 2;
|
||||||
renderer.fillRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, bookSelected);
|
renderer.fillRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, bookSelected);
|
||||||
renderer.drawRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, !bookSelected);
|
renderer.drawRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, !bookSelected);
|
||||||
renderer.drawCenteredText(UI_10_FONT_ID, continueY, continueText, bookSelected);
|
renderer.drawCenteredText(UI_10_FONT_ID, continueY, continueText, invertText);
|
||||||
} else {
|
} else {
|
||||||
renderer.drawCenteredText(UI_10_FONT_ID, continueY, "Continue Reading", !bookSelected);
|
renderer.drawCenteredText(UI_10_FONT_ID, continueY, "Continue Reading", invertText);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No book to continue reading
|
// No book to continue reading
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user