diff --git a/THEMES.md b/THEMES.md
index fc4ff063b..c10b2e57d 100644
--- a/THEMES.md
+++ b/THEMES.md
@@ -576,6 +576,8 @@ Can be created as an extra.
- If true, the image will be tiled instead of stretched to fit its size. Useful for backgrounds.
* `color` - type: COLOR.
- Multiply each pixel's color by this color. For example, an all-white image with `FF0000` would become completely red. You can also control the transparency of an image with `FFFFFFAA` - keeping all the pixels their normal color and only affecting the alpha channel.
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
@@ -632,6 +634,8 @@ Can be created as an extra.
- If true, image will be shown when selected game does not have a video and no `default` video is configured.
* `showSnapshotDelay` - type: BOOLEAN
- If true, playing of video will be delayed for `delayed` seconds, when game is selected.
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
@@ -662,6 +666,8 @@ Can be created as an extra.
- Valid values are "left", "center", or "right". Controls alignment on the X axis. "center" will also align vertically.
* `forceUppercase` - type: BOOLEAN. Draw text in uppercase.
* `lineSpacing` - type: FLOAT. Controls the space between lines (as a multiple of font height). Default is 1.5.
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
@@ -705,11 +711,13 @@ Can be created as an extra.
* `pos` - type: NORMALIZED_PAIR.
* `size` - type: NORMALIZED_PAIR.
* `path` - type: PATH.
-
-EmulationStation borrows the concept of "nine patches" from Android (or "9-Slices"). Currently the implementation is very simple and hard-coded to only use 48x48px images (16x16px for each "patch"). Check the `data/resources` directory for some examples (button.png, frame.png).
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
+EmulationStation borrows the concept of "nine patches" from Android (or "9-Slices"). Currently the implementation is very simple and hard-coded to only use 48x48px images (16x16px for each "patch"). Check the `data/resources` directory for some examples (button.png, frame.png).
+
#### rating
* `pos` - type: NORMALIZED_PAIR.
@@ -727,6 +735,8 @@ EmulationStation borrows the concept of "nine patches" from Android (or "9-Slice
- Path to the "unfilled star" image. Image must be square (width equals height).
* `color` - type: COLOR.
- Multiply each pixel's color by this color. For example, an all-white image with `FF0000` would become completely red. You can also control the transparency of an image with `FFFFFFAA` - keeping all the pixels their normal color and only affecting the alpha channel.
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
@@ -753,6 +763,8 @@ EmulationStation borrows the concept of "nine patches" from Android (or "9-Slice
- Valid values are "left", "center", or "right". Controls alignment on the X axis. "center" will also align vertically.
* `forceUppercase` - type: BOOLEAN. Draw text in uppercase.
* `lineSpacing` - type: FLOAT. Controls the space between lines (as a multiple of font height). Default is 1.5.
+* `visible` - type: BOOLEAN.
+ - If true, component will be rendered, otherwise rendering will be skipped. Can be used to hide elements from a particular view.
* `zIndex` - type: FLOAT.
- z-index value for component. Components will be rendered in order of z-index value from low to high.
* `displayRelative` - type: BOOLEAN. Renders the datetime as a a relative string (ex: 'x days ago')
diff --git a/es-app/src/components/RatingComponent.cpp b/es-app/src/components/RatingComponent.cpp
index 924a0cbcc..bd47d91af 100644
--- a/es-app/src/components/RatingComponent.cpp
+++ b/es-app/src/components/RatingComponent.cpp
@@ -112,6 +112,9 @@ void RatingComponent::updateColors()
void RatingComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
trans.round();
Renderer::setMatrix(trans);
diff --git a/es-app/src/views/gamelist/DetailedGameListView.cpp b/es-app/src/views/gamelist/DetailedGameListView.cpp
index 87d2893f5..8eec3506e 100644
--- a/es-app/src/views/gamelist/DetailedGameListView.cpp
+++ b/es-app/src/views/gamelist/DetailedGameListView.cpp
@@ -86,7 +86,7 @@ void DetailedGameListView::onThemeChanged(const std::shared_ptr& them
BasicGameListView::onThemeChanged(theme);
using namespace ThemeFlags;
- mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION);
+ mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mName.applyTheme(theme, getName(), "md_name", ALL);
initMDLabels();
@@ -116,7 +116,7 @@ void DetailedGameListView::onThemeChanged(const std::shared_ptr& them
values[i]->applyTheme(theme, getName(), valElements[i], ALL ^ ThemeFlags::TEXT);
}
- mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX);
+ mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX | VISIBLE);
mDescription.setSize(mDescContainer.getSize().x(), 0);
mDescription.applyTheme(theme, getName(), "md_description", ALL ^ (POSITION | ThemeFlags::SIZE | ThemeFlags::ORIGIN | TEXT | ROTATION));
diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp
index 91f9c08b0..8a0fbe7c8 100644
--- a/es-app/src/views/gamelist/GridGameListView.cpp
+++ b/es-app/src/views/gamelist/GridGameListView.cpp
@@ -163,7 +163,7 @@ void GridGameListView::onThemeChanged(const std::shared_ptr& theme)
values[i]->applyTheme(theme, getName(), valElements[i], ALL ^ ThemeFlags::TEXT);
}
- mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX);
+ mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX | VISIBLE);
mDescription.setSize(mDescContainer.getSize().x(), 0);
mDescription.applyTheme(theme, getName(), "md_description", ALL ^ (POSITION | ThemeFlags::SIZE | ThemeFlags::ORIGIN | TEXT | ROTATION));
diff --git a/es-app/src/views/gamelist/VideoGameListView.cpp b/es-app/src/views/gamelist/VideoGameListView.cpp
index b57d66944..1daa91b1a 100644
--- a/es-app/src/views/gamelist/VideoGameListView.cpp
+++ b/es-app/src/views/gamelist/VideoGameListView.cpp
@@ -123,9 +123,9 @@ void VideoGameListView::onThemeChanged(const std::shared_ptr& theme)
BasicGameListView::onThemeChanged(theme);
using namespace ThemeFlags;
- mMarquee.applyTheme(theme, getName(), "md_marquee", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION);
- mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION);
- mVideo->applyTheme(theme, getName(), "md_video", POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION);
+ mMarquee.applyTheme(theme, getName(), "md_marquee", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
+ mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
+ mVideo->applyTheme(theme, getName(), "md_video", POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION | VISIBLE);
mName.applyTheme(theme, getName(), "md_name", ALL);
initMDLabels();
@@ -155,7 +155,7 @@ void VideoGameListView::onThemeChanged(const std::shared_ptr& theme)
values[i]->applyTheme(theme, getName(), valElements[i], ALL ^ ThemeFlags::TEXT);
}
- mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX);
+ mDescContainer.applyTheme(theme, getName(), "md_description", POSITION | ThemeFlags::SIZE | Z_INDEX | VISIBLE);
mDescription.setSize(mDescContainer.getSize().x(), 0);
mDescription.applyTheme(theme, getName(), "md_description", ALL ^ (POSITION | ThemeFlags::SIZE | ThemeFlags::ORIGIN | TEXT | ROTATION));
diff --git a/es-core/src/GuiComponent.cpp b/es-core/src/GuiComponent.cpp
index 9b7d22aa2..32be193bc 100644
--- a/es-core/src/GuiComponent.cpp
+++ b/es-core/src/GuiComponent.cpp
@@ -10,7 +10,7 @@
GuiComponent::GuiComponent(Window* window) : mWindow(window), mParent(NULL), mOpacity(255),
mPosition(Vector3f::Zero()), mOrigin(Vector2f::Zero()), mRotationOrigin(0.5, 0.5),
- mSize(Vector2f::Zero()), mTransform(Transform4x4f::Identity()), mIsProcessing(false)
+ mSize(Vector2f::Zero()), mTransform(Transform4x4f::Identity()), mIsProcessing(false), mVisible(true)
{
for(unsigned char i = 0; i < MAX_ANIMATIONS; i++)
mAnimationMap[i] = NULL;
@@ -62,6 +62,9 @@ void GuiComponent::update(int deltaTime)
void GuiComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
renderChildren(trans);
}
@@ -157,6 +160,15 @@ void GuiComponent::setDefaultZIndex(float z)
mDefaultZIndex = z;
}
+bool GuiComponent::isVisible() const
+{
+ return mVisible;
+}
+void GuiComponent::setVisible(bool visible)
+{
+ mVisible = visible;
+}
+
Vector2f GuiComponent::getCenter() const
{
return Vector2f(mPosition.x() - (getSize().x() * mOrigin.x()) + getSize().x() / 2,
@@ -424,6 +436,11 @@ void GuiComponent::applyTheme(const std::shared_ptr& theme, const std
setZIndex(elem->get("zIndex"));
else
setZIndex(getDefaultZIndex());
+
+ if(properties & ThemeFlags::VISIBLE && elem->has("visible"))
+ setVisible(elem->get("visible"));
+ else
+ setVisible(true);
}
void GuiComponent::updateHelpPrompts()
diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h
index 4c15ba578..082077389 100644
--- a/es-core/src/GuiComponent.h
+++ b/es-core/src/GuiComponent.h
@@ -76,6 +76,9 @@ public:
float getDefaultZIndex() const;
void setDefaultZIndex(float zIndex);
+ bool isVisible() const;
+ void setVisible(bool visible);
+
// Returns the center point of the image (takes origin into account).
Vector2f getCenter() const;
@@ -157,6 +160,7 @@ protected:
float mZIndex = 0;
bool mIsProcessing;
+ bool mVisible;
public:
const static unsigned char MAX_ANIMATIONS = 4;
diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp
index cf2548089..470d21001 100644
--- a/es-core/src/ThemeData.cpp
+++ b/es-core/src/ThemeData.cpp
@@ -10,7 +10,7 @@
#include
std::vector ThemeData::sSupportedViews { { "system" }, { "basic" }, { "detailed" }, { "grid" }, { "video" } };
-std::vector ThemeData::sSupportedFeatures { { "video" }, { "carousel" }, { "z-index" } };
+std::vector ThemeData::sSupportedFeatures { { "video" }, { "carousel" }, { "z-index" }, { "visible" } };
std::map> ThemeData::sElementMap {
{ "image", {
@@ -24,6 +24,7 @@ std::map> The
{ "default", PATH },
{ "tile", BOOLEAN },
{ "color", COLOR },
+ { "visible", BOOLEAN },
{ "zIndex", FLOAT } } },
{ "imagegrid", {
{ "pos", NORMALIZED_PAIR },
@@ -56,6 +57,7 @@ std::map> The
{ "forceUppercase", BOOLEAN },
{ "lineSpacing", FLOAT },
{ "value", STRING },
+ { "visible", BOOLEAN },
{ "zIndex", FLOAT } } },
{ "textlist", {
{ "pos", NORMALIZED_PAIR },
@@ -81,11 +83,13 @@ std::map> The
{ "pos", NORMALIZED_PAIR },
{ "size", NORMALIZED_PAIR },
{ "origin", NORMALIZED_PAIR },
- { "zIndex", FLOAT } } },
+ { "visible", BOOLEAN },
+ { "zIndex", FLOAT } } },
{ "ninepatch", {
{ "pos", NORMALIZED_PAIR },
{ "size", NORMALIZED_PAIR },
{ "path", PATH },
+ { "visible", BOOLEAN },
{ "zIndex", FLOAT } } },
{ "datetime", {
{ "pos", NORMALIZED_PAIR },
@@ -103,7 +107,8 @@ std::map> The
{ "value", STRING },
{ "format", STRING },
{ "displayRelative", BOOLEAN },
- { "zIndex", FLOAT } } },
+ { "visible", BOOLEAN },
+ { "zIndex", FLOAT } } },
{ "rating", {
{ "pos", NORMALIZED_PAIR },
{ "size", NORMALIZED_PAIR },
@@ -113,6 +118,7 @@ std::map> The
{ "color", COLOR },
{ "filledPath", PATH },
{ "unfilledPath", PATH },
+ { "visible", BOOLEAN },
{ "zIndex", FLOAT } } },
{ "sound", {
{ "path", PATH } } },
@@ -132,7 +138,8 @@ std::map> The
{ "rotationOrigin", NORMALIZED_PAIR },
{ "default", PATH },
{ "delay", FLOAT },
- { "zIndex", FLOAT },
+ { "visible", BOOLEAN },
+ { "zIndex", FLOAT },
{ "showSnapshotNoVideo", BOOLEAN },
{ "showSnapshotDelay", BOOLEAN } } },
{ "carousel", {
diff --git a/es-core/src/ThemeData.h b/es-core/src/ThemeData.h
index 4fc9faa74..a2e9db392 100644
--- a/es-core/src/ThemeData.h
+++ b/es-core/src/ThemeData.h
@@ -41,6 +41,7 @@ namespace ThemeFlags
DELAY = 4096,
Z_INDEX = 8192,
ROTATION = 16384,
+ VISIBLE = 32768,
ALL = 0xFFFFFFFF
};
}
diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp
index 14f5fac13..67b03782a 100644
--- a/es-core/src/components/ImageComponent.cpp
+++ b/es-core/src/components/ImageComponent.cpp
@@ -317,6 +317,9 @@ void ImageComponent::updateColors()
void ImageComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
Renderer::setMatrix(trans);
@@ -466,6 +469,11 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, const s
setZIndex(elem->get("zIndex"));
else
setZIndex(getDefaultZIndex());
+
+ if(properties & ThemeFlags::VISIBLE && elem->has("visible"))
+ setVisible(elem->get("visible"));
+ else
+ setVisible(true);
}
std::vector ImageComponent::getHelpPrompts()
diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp
index fedf95115..4088e69f3 100644
--- a/es-core/src/components/NinePatchComponent.cpp
+++ b/es-core/src/components/NinePatchComponent.cpp
@@ -103,6 +103,9 @@ void NinePatchComponent::buildVertices()
void NinePatchComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
trans.round();
diff --git a/es-core/src/components/ScrollableContainer.cpp b/es-core/src/components/ScrollableContainer.cpp
index cedc547ce..ba9116b16 100644
--- a/es-core/src/components/ScrollableContainer.cpp
+++ b/es-core/src/components/ScrollableContainer.cpp
@@ -13,6 +13,9 @@ ScrollableContainer::ScrollableContainer(Window* window) : GuiComponent(window),
void ScrollableContainer::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
Vector2i clipPos((int)trans.translation().x(), (int)trans.translation().y());
diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp
index d1fc995f4..8c4083b2c 100644
--- a/es-core/src/components/TextComponent.cpp
+++ b/es-core/src/components/TextComponent.cpp
@@ -95,6 +95,9 @@ void TextComponent::setUppercase(bool uppercase)
void TextComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
if (mRenderBackground)
diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp
index 6cd5f082a..b76ed273b 100644
--- a/es-core/src/components/VideoComponent.cpp
+++ b/es-core/src/components/VideoComponent.cpp
@@ -145,6 +145,9 @@ void VideoComponent::setOpacity(unsigned char opacity)
void VideoComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
Transform4x4f trans = parentTrans * getTransform();
GuiComponent::renderChildren(trans);
@@ -223,6 +226,11 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, const s
setZIndex(elem->get("zIndex"));
else
setZIndex(getDefaultZIndex());
+
+ if(properties & ThemeFlags::VISIBLE && elem->has("visible"))
+ setVisible(elem->get("visible"));
+ else
+ setVisible(true);
}
std::vector VideoComponent::getHelpPrompts()
diff --git a/es-core/src/components/VideoPlayerComponent.cpp b/es-core/src/components/VideoPlayerComponent.cpp
index 0b0948e42..b7666e73d 100644
--- a/es-core/src/components/VideoPlayerComponent.cpp
+++ b/es-core/src/components/VideoPlayerComponent.cpp
@@ -30,6 +30,9 @@ VideoPlayerComponent::~VideoPlayerComponent()
void VideoPlayerComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
VideoComponent::render(parentTrans);
if (!mIsPlaying || mPlayerPid == -1)
diff --git a/es-core/src/components/VideoVlcComponent.cpp b/es-core/src/components/VideoVlcComponent.cpp
index 91f7532e4..5a381b793 100644
--- a/es-core/src/components/VideoVlcComponent.cpp
+++ b/es-core/src/components/VideoVlcComponent.cpp
@@ -131,6 +131,9 @@ void VideoVlcComponent::resize()
void VideoVlcComponent::render(const Transform4x4f& parentTrans)
{
+ if (!isVisible())
+ return;
+
VideoComponent::render(parentTrans);
float x, y;