mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Fixed an issue in CarouselComponent and GridComponent where the default image was rendered when it shouldn't.
Also moved a property position in GridComponent.
This commit is contained in:
parent
c5b42379c0
commit
abcd3e5bac
|
@ -190,10 +190,10 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"backgroundGradientType", STRING},
|
||||
{"selectorImage", PATH},
|
||||
{"selectorRelativeScale", FLOAT},
|
||||
{"selectorLayer", STRING},
|
||||
{"selectorColor", COLOR},
|
||||
{"selectorColorEnd", COLOR},
|
||||
{"selectorGradientType", STRING},
|
||||
{"selectorLayer", STRING},
|
||||
{"text", STRING},
|
||||
{"textRelativeScale", FLOAT},
|
||||
{"textColor", COLOR},
|
||||
|
|
|
@ -278,7 +278,9 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
|||
if (!mImageColorGradientHorizontal)
|
||||
defaultImage->setColorGradientHorizontal(false);
|
||||
defaultImage->setRotateByTargetSize(true);
|
||||
entry.data.item = defaultImage;
|
||||
// For the gamelist view the default image is applied in onDemandTextureLoad().
|
||||
if (!mGamelistView)
|
||||
entry.data.item = defaultImage;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,6 +457,9 @@ template <typename T> void CarouselComponent<T>::onDemandTextureLoad()
|
|||
else if (mImageType == "none") // Display the game name as text.
|
||||
return;
|
||||
|
||||
if (entry.data.imagePath == "")
|
||||
entry.data.imagePath = entry.data.defaultImagePath;
|
||||
|
||||
auto theme = game->getSystem()->getTheme();
|
||||
updateEntry(entry, theme);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
const std::string& getImageType() { return mImageType; }
|
||||
void setImageType(std::string imageType) { mImageType = imageType; }
|
||||
const std::string& getDefaultImage() { return mDefaultImage; }
|
||||
void setDefaultImage(std::string defaultItem) { mDefaultImage = defaultItem; }
|
||||
void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; }
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
void update(int deltaTime) override;
|
||||
void render(const glm::mat4& parentTrans) override;
|
||||
|
@ -104,18 +104,18 @@ private:
|
|||
bool remove(const T& obj) override { return List::remove(obj); }
|
||||
int size() const override { return List::size(); }
|
||||
|
||||
enum class SelectorLayer {
|
||||
TOP,
|
||||
MIDDLE,
|
||||
BOTTOM
|
||||
};
|
||||
|
||||
enum class ImageFit {
|
||||
CONTAIN,
|
||||
FILL,
|
||||
COVER
|
||||
};
|
||||
|
||||
enum class SelectorLayer {
|
||||
TOP,
|
||||
MIDDLE,
|
||||
BOTTOM
|
||||
};
|
||||
|
||||
Renderer* mRenderer;
|
||||
std::function<void()> mCancelTransitionsCallback;
|
||||
std::function<void(CursorState state)> mCursorChangedCallback;
|
||||
|
@ -155,11 +155,11 @@ private:
|
|||
bool mHasBackgroundColor;
|
||||
std::unique_ptr<ImageComponent> mSelectorImage;
|
||||
float mSelectorRelativeScale;
|
||||
SelectorLayer mSelectorLayer;
|
||||
unsigned int mSelectorColor;
|
||||
unsigned int mSelectorColorEnd;
|
||||
bool mSelectorColorGradientHorizontal;
|
||||
bool mHasSelectorColor;
|
||||
SelectorLayer mSelectorLayer;
|
||||
float mTextRelativeScale;
|
||||
unsigned int mTextColor;
|
||||
unsigned int mTextBackgroundColor;
|
||||
|
@ -207,11 +207,11 @@ GridComponent<T>::GridComponent()
|
|||
, mBackgroundColorGradientHorizontal {true}
|
||||
, mHasBackgroundColor {false}
|
||||
, mSelectorRelativeScale {1.0f}
|
||||
, mSelectorLayer {SelectorLayer::TOP}
|
||||
, mSelectorColor {0xFFFFFFFF}
|
||||
, mSelectorColorEnd {0xFFFFFFFF}
|
||||
, mSelectorColorGradientHorizontal {true}
|
||||
, mHasSelectorColor {false}
|
||||
, mSelectorLayer {SelectorLayer::TOP}
|
||||
, mTextRelativeScale {1.0f}
|
||||
, mTextColor {0x000000FF}
|
||||
, mTextBackgroundColor {0xFFFFFF00}
|
||||
|
@ -254,27 +254,29 @@ void GridComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeData>&
|
|||
}
|
||||
else if (entry.data.defaultImagePath != "" &&
|
||||
ResourceManager::getInstance().fileExists(entry.data.defaultImagePath)) {
|
||||
auto defaultItem = std::make_shared<ImageComponent>(false, dynamic);
|
||||
defaultItem->setLinearInterpolation(true);
|
||||
defaultItem->setMipmapping(true);
|
||||
auto defaultImage = std::make_shared<ImageComponent>(false, dynamic);
|
||||
defaultImage->setLinearInterpolation(true);
|
||||
defaultImage->setMipmapping(true);
|
||||
if (mImagefit == ImageFit::CONTAIN)
|
||||
defaultItem->setMaxSize(mItemSize * mImageRelativeScale);
|
||||
defaultImage->setMaxSize(mItemSize * mImageRelativeScale);
|
||||
else if (mImagefit == ImageFit::FILL)
|
||||
defaultItem->setResize(mItemSize * mImageRelativeScale);
|
||||
defaultImage->setResize(mItemSize * mImageRelativeScale);
|
||||
else if (mImagefit == ImageFit::COVER)
|
||||
defaultItem->setCroppedSize(mItemSize * mImageRelativeScale);
|
||||
defaultItem->setImage(entry.data.defaultImagePath);
|
||||
defaultItem->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||
defaultImage->setCroppedSize(mItemSize * mImageRelativeScale);
|
||||
defaultImage->setImage(entry.data.defaultImagePath);
|
||||
defaultImage->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||
if (mImageColor != 0xFFFFFFFF)
|
||||
defaultItem->setColorShift(mImageColor);
|
||||
defaultImage->setColorShift(mImageColor);
|
||||
if (mImageColorEnd != mImageColor) {
|
||||
defaultItem->setColorShiftEnd(mImageColorEnd);
|
||||
defaultImage->setColorShiftEnd(mImageColorEnd);
|
||||
if (!mImageColorGradientHorizontal)
|
||||
defaultItem->setColorGradientHorizontal(false);
|
||||
defaultImage->setColorGradientHorizontal(false);
|
||||
}
|
||||
defaultItem->setOrigin(0.5f, 0.5f);
|
||||
defaultItem->setRotateByTargetSize(true);
|
||||
entry.data.item = defaultItem;
|
||||
defaultImage->setOrigin(0.5f, 0.5f);
|
||||
defaultImage->setRotateByTargetSize(true);
|
||||
// For the gamelist view the default image is applied in onDemandTextureLoad().
|
||||
if (!mGamelistView)
|
||||
entry.data.item = defaultImage;
|
||||
}
|
||||
|
||||
if (!entry.data.item) {
|
||||
|
@ -392,6 +394,9 @@ template <typename T> void GridComponent<T>::onDemandTextureLoad()
|
|||
else if (mImageType == "none") // Display the game name as text.
|
||||
return;
|
||||
|
||||
if (entry.data.imagePath == "")
|
||||
entry.data.imagePath = entry.data.defaultImagePath;
|
||||
|
||||
auto theme = game->getSystem()->getTheme();
|
||||
updateEntry(entry, theme);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue