mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-26 17:54:46 +01:00
Check main layout directory if art cannot be found in the collection's layout directory.
This commit is contained in:
parent
f1fe21843d
commit
edf866f0c7
@ -19,10 +19,11 @@
|
||||
#include "../../Utility/Log.h"
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
Image::Image(std::string file, Page &p, float scaleX, float scaleY)
|
||||
Image::Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY)
|
||||
: Component(p)
|
||||
, texture_(NULL)
|
||||
, file_(file)
|
||||
, altFile_(altFile)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
{
|
||||
@ -58,6 +59,10 @@ void Image::allocateGraphicsMemory()
|
||||
{
|
||||
SDL_LockMutex(SDL::getMutex());
|
||||
texture_ = IMG_LoadTexture(SDL::getRenderer(), file_.c_str());
|
||||
if (!texture_ && altFile_ != "")
|
||||
{
|
||||
texture_ = IMG_LoadTexture(SDL::getRenderer(), altFile_.c_str());
|
||||
}
|
||||
|
||||
if (texture_ != NULL)
|
||||
{
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
class Image : public Component
|
||||
{
|
||||
public:
|
||||
Image(std::string file, Page &p, float scaleX, float scaleY);
|
||||
Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY);
|
||||
virtual ~Image();
|
||||
void freeGraphicsMemory();
|
||||
void allocateGraphicsMemory();
|
||||
@ -31,6 +31,7 @@ public:
|
||||
protected:
|
||||
SDL_Texture *texture_;
|
||||
std::string file_;
|
||||
std::string altFile_;
|
||||
float scaleX_;
|
||||
float scaleY_;
|
||||
};
|
||||
|
||||
@ -35,7 +35,7 @@ Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, f
|
||||
|
||||
if(Utils::findMatchingFile(prefix, extensions, file))
|
||||
{
|
||||
image = new Image(file, p, scaleX, scaleY);
|
||||
image = new Image(file, "", p, scaleX, scaleY);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
@ -353,8 +353,12 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
{
|
||||
std::string imagePath;
|
||||
imagePath = Utils::combinePath(Configuration::convertToAbsolutePath(layoutPath, imagePath), std::string(src->value()));
|
||||
std::string layoutName;
|
||||
config_.getProperty("layout", layoutName);
|
||||
std::string altImagePath;
|
||||
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
||||
|
||||
Image *c = new Image(imagePath, *page, scaleX_, scaleY_);
|
||||
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
||||
buildViewInfo(componentXml, c->baseViewInfo);
|
||||
loadTweens(c, componentXml);
|
||||
page->addComponent(c);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user