mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Add help component theme options textColorDimmed
and iconColorDimmed
.
This commit is contained in:
parent
dfffd1057d
commit
c2042e66e2
|
@ -16,8 +16,10 @@ HelpStyle::HelpStyle()
|
|||
position =
|
||||
glm::vec2{Renderer::getScreenWidth() * 0.012f, Renderer::getScreenHeight() * 0.9515f};
|
||||
origin = glm::vec2{};
|
||||
iconColor = 0x777777FF;
|
||||
textColor = 0x777777FF;
|
||||
textColorDimmed = 0x777777FF;
|
||||
iconColor = 0x777777FF;
|
||||
iconColorDimmed = 0x777777FF;
|
||||
entrySpacing = 16.0f;
|
||||
iconTextSpacing = 8.0f;
|
||||
textStyle = "uppercase";
|
||||
|
@ -45,9 +47,15 @@ void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::s
|
|||
if (elem->has("textColor"))
|
||||
textColor = elem->get<unsigned int>("textColor");
|
||||
|
||||
if (elem->has("textColorDimmed"))
|
||||
textColorDimmed = elem->get<unsigned int>("textColorDimmed");
|
||||
|
||||
if (elem->has("iconColor"))
|
||||
iconColor = elem->get<unsigned int>("iconColor");
|
||||
|
||||
if (elem->has("iconColorDimmed"))
|
||||
iconColorDimmed = elem->get<unsigned int>("iconColorDimmed");
|
||||
|
||||
if (elem->has("fontPath") || elem->has("fontSize"))
|
||||
font = Font::getFromTheme(elem, ThemeFlags::ALL, font);
|
||||
|
||||
|
|
|
@ -21,8 +21,10 @@ class ThemeData;
|
|||
struct HelpStyle {
|
||||
glm::vec2 position;
|
||||
glm::vec2 origin;
|
||||
unsigned int iconColor;
|
||||
unsigned int textColor;
|
||||
unsigned int textColorDimmed;
|
||||
unsigned int iconColor;
|
||||
unsigned int iconColorDimmed;
|
||||
std::shared_ptr<Font> font;
|
||||
float entrySpacing;
|
||||
float iconTextSpacing;
|
||||
|
|
|
@ -151,7 +151,9 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>> The
|
|||
{{"pos", NORMALIZED_PAIR},
|
||||
{"origin", NORMALIZED_PAIR},
|
||||
{"textColor", COLOR},
|
||||
{"textColorDimmed", COLOR},
|
||||
{"iconColor", COLOR},
|
||||
{"iconColorDimmed", COLOR},
|
||||
{"fontPath", PATH},
|
||||
{"fontSize", FLOAT},
|
||||
{"entrySpacing", FLOAT},
|
||||
|
|
|
@ -359,6 +359,11 @@ void Window::update(int deltaTime)
|
|||
mScreensaver->update(deltaTime);
|
||||
}
|
||||
|
||||
bool Window::isBackgroundDimmed()
|
||||
{
|
||||
return !mGuiStack.empty() && (mGuiStack.front() != mGuiStack.back() || mRenderLaunchScreen);
|
||||
}
|
||||
|
||||
void Window::render()
|
||||
{
|
||||
glm::mat4 trans{Renderer::getIdentity()};
|
||||
|
@ -366,7 +371,7 @@ void Window::render()
|
|||
mRenderedHelpPrompts = false;
|
||||
|
||||
// Draw only bottom and top of GuiStack (if they are different).
|
||||
if (mGuiStack.size()) {
|
||||
if (!mGuiStack.empty()) {
|
||||
auto& bottom = mGuiStack.front();
|
||||
auto& top = mGuiStack.back();
|
||||
|
||||
|
@ -408,7 +413,7 @@ void Window::render()
|
|||
unsigned char* processedTexture =
|
||||
new unsigned char[Renderer::getScreenWidth() * Renderer::getScreenHeight() * 4];
|
||||
|
||||
// Defocus the background using multiple passes of gaussian blur, with the number
|
||||
// De-focus the background using multiple passes of gaussian blur, with the number
|
||||
// of iterations relative to the screen resolution.
|
||||
Renderer::shaderParameters backgroundParameters;
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
void removeGui(GuiComponent* gui);
|
||||
GuiComponent* peekGui();
|
||||
int getGuiStackSize() { return static_cast<int>(mGuiStack.size()); }
|
||||
bool isBackgroundDimmed();
|
||||
|
||||
bool init();
|
||||
void deinit();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include "Window.h"
|
||||
#include "components/ComponentGrid.h"
|
||||
#include "components/ImageComponent.h"
|
||||
#include "components/TextComponent.h"
|
||||
|
@ -121,10 +122,16 @@ void HelpComponent::updateGrid()
|
|||
float width = 0;
|
||||
const float height = std::round(font->getLetterHeight() * 1.25f);
|
||||
|
||||
// State variable indicating whether gui is dimmed.
|
||||
bool isDimmed = mWindow->isBackgroundDimmed();
|
||||
LOG(LogError) << "updateGrid() called. dimmed = \"" << isDimmed << "\"";
|
||||
|
||||
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) {
|
||||
auto icon = std::make_shared<ImageComponent>(mWindow);
|
||||
icon->setImage(getIconTexture(it->first.c_str()));
|
||||
icon->setColorShift(mStyle.iconColor);
|
||||
icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor);
|
||||
LOG(LogError) << "setColorShift() called. dimmed = \""
|
||||
<< (isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor) << "\"";
|
||||
icon->setResize(0, height);
|
||||
icons.push_back(icon);
|
||||
|
||||
|
@ -140,7 +147,8 @@ void HelpComponent::updateGrid()
|
|||
lblInput = Utils::String::toUpper(lblInput);
|
||||
}
|
||||
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, lblInput, font, mStyle.textColor);
|
||||
auto lbl = std::make_shared<TextComponent>(
|
||||
mWindow, lblInput, font, isDimmed ? mStyle.textColorDimmed : mStyle.textColor);
|
||||
labels.push_back(lbl);
|
||||
|
||||
width +=
|
||||
|
|
Loading…
Reference in a new issue