diff --git a/RetroFE/Source/Graphics/Component/ImageBuilder.cpp b/RetroFE/Source/Graphics/Component/ImageBuilder.cpp index d5743b7..67d4959 100644 --- a/RetroFE/Source/Graphics/Component/ImageBuilder.cpp +++ b/RetroFE/Source/Graphics/Component/ImageBuilder.cpp @@ -33,9 +33,10 @@ Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, f std::string prefix = Utils::combinePath(path, name); std::string file; - printf(" findMatchingFile, prefix = %s, file = %s\n", prefix.c_str(), file.c_str()); + //printf(" findMatchingFile, prefix = %s, extensions = %s\n", prefix.c_str(), extensions.c_str()); if(Utils::findMatchingFile(prefix, extensions, file)) { + //printf(" fFound Matching File, prefix = %s, file = %s\n", prefix.c_str(), file.c_str()); image = new Image(file, "", p, scaleX, scaleY, dithering); } diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp index d8ccc01..cfc880b 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp @@ -414,13 +414,9 @@ void ReloadableMedia::reloadTexture( bool previousItem ) } } - // if image and artwork was not specified, fall back to displaying text + // if image and artwork was not specified, image fall back if(!loadedComponent_ && imageFallback_) { - //loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_); - /*baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth; - baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;*/ - std::string imagePath; ImageBuilder imageBuild; imagePath = Utils::combinePath(Configuration::absolutePath, "collections", collectionName ); @@ -428,19 +424,13 @@ void ReloadableMedia::reloadTexture( bool previousItem ) loadedComponent_ = imageBuild.CreateImage( imagePath, page, std::string("fallback"), scaleX_, scaleY_, ditheringAuthorized_ ); } - // if image and artwork was not specified, fall back to displaying text + // if image and artwork was not specified, and no image fallback, fall back to displaying text if(!loadedComponent_ && textFallback_) { loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_); baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth; baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight; } - - /*if(imageAndText_){ - loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_); - baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth; - baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight; - }*/ } diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp index 7c4577d..e5941ea 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp @@ -105,12 +105,17 @@ void ReloadableScrollingText::update(float dt) } } - if (newItemSelected || - (newScrollItemSelected && getMenuScrollReload())) - { - reloadTexture( ); - newItemSelected = false; - } + // Reload media + if (newItemSelected) + { + reloadTexture(); + newItemSelected = false; + } + else if(newScrollItemSelected && getMenuScrollReload()) + { + reloadTexture(true); + newScrollItemSelected = false; + } Component::update(dt); } @@ -141,8 +146,12 @@ void ReloadableScrollingText::initializeFonts( ) fontInst_->initialize( ); } - void ReloadableScrollingText::reloadTexture( ) +{ + reloadTexture(false); +} + +void ReloadableScrollingText::reloadTexture( bool previousItem ) { needRender_ = true; @@ -159,11 +168,15 @@ void ReloadableScrollingText::reloadTexture( ) text_.clear( ); - Item *selectedItem = page.getSelectedItem( displayOffset_ ); - if (!selectedItem) - { - return; - } + /* Select item to reload */ + Item *selectedItem = NULL; + if(previousItem){ + selectedItem = page.getPreviousSelectedItem(displayOffset_); + } + else{ + selectedItem = page.getSelectedItem(displayOffset_); + } + if(!selectedItem) return; config_.getProperty( "currentCollection", currentCollection_ ); diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h index 1eb7d27..3376348 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h @@ -36,6 +36,7 @@ public: private: void reloadTexture( ); + void reloadTexture( bool previousItem ); void loadText( std::string collection, std::string type, std::string basename, std::string filepath, bool systemMode ); Configuration &config_; bool systemMode_; diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp index a96ce4e..5dbd1c0 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp @@ -58,12 +58,16 @@ ReloadableText::~ReloadableText() void ReloadableText::update(float dt) { if (newItemSelected || - (newScrollItemSelected && getMenuScrollReload()) || type_ == "time") { ReloadTexture(); newItemSelected = false; } + else if(newScrollItemSelected && getMenuScrollReload()) + { + ReloadTexture(true); + newScrollItemSelected = false; + } // needs to be ran at the end to prevent the NewItemSelected flag from being detected Component::update(dt); @@ -103,7 +107,11 @@ void ReloadableText::deInitializeFonts() } -void ReloadableText::ReloadTexture() +void ReloadableText::ReloadTexture(){ + ReloadTexture(false); +} + +void ReloadableText::ReloadTexture( bool previousItem ) { if (imageInst_ != NULL) { @@ -111,7 +119,14 @@ void ReloadableText::ReloadTexture() imageInst_ = NULL; } - Item *selectedItem = page.getSelectedItem( displayOffset_ ); + /* Select item to reload */ + Item *selectedItem = NULL; + if(previousItem){ + selectedItem = page.getPreviousSelectedItem(displayOffset_); + } + else{ + selectedItem = page.getSelectedItem(displayOffset_); + } if (selectedItem != NULL) { diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.h b/RetroFE/Source/Graphics/Component/ReloadableText.h index 3a2fcfd..991035e 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.h +++ b/RetroFE/Source/Graphics/Component/ReloadableText.h @@ -35,7 +35,8 @@ public: void initializeFonts(); private: - void ReloadTexture(); + void ReloadTexture( ); + void ReloadTexture( bool previousItem ); Configuration &config_; Text *imageInst_; diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 094b75e..9ae53d7 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -148,8 +148,6 @@ void Page::onNewItemSelected() if(!(activeMenu_.size() > 0 && activeMenu_[0])) return; selectedItem_ = activeMenu_[0]->getSelectedItem(); - //printf("onNewItemSelected\n"); - for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++) { for(std::vector::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++) @@ -172,7 +170,6 @@ void Page::onNewScrollItemSelected() if(!(activeMenu_.size() > 0 && activeMenu_[0])) return; selectedItem_ = activeMenu_[0]->getSelectedItem(); - //printf("onNewScrollItemSelected\n"); for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) {