diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index 054556e..de70612 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -27,6 +27,7 @@ Component::Component(Page &p) backgroundTexture_ = NULL; menuScrollReload_ = false; freeGraphicsMemory(); + id_ = -1; } Component::Component(const Component ©) @@ -116,12 +117,17 @@ void Component::setPlaylist(std::string name) void Component::setNewItemSelected() { - newItemSelected = true; + newItemSelected = true; } void Component::setNewScrollItemSelected() { - newScrollItemSelected = true; + newScrollItemSelected = true; +} + +void Component::setId( int id ) +{ + id_ = id; } bool Component::isIdle() @@ -417,3 +423,8 @@ bool Component::getMenuScrollReload() { return menuScrollReload_; } + +int Component::getId( ) +{ + return id_; +} diff --git a/RetroFE/Source/Graphics/Component/Component.h b/RetroFE/Source/Graphics/Component/Component.h index 2b0aa2a..2abd384 100644 --- a/RetroFE/Source/Graphics/Component/Component.h +++ b/RetroFE/Source/Graphics/Component/Component.h @@ -41,6 +41,7 @@ public: bool isMenuScrolling(); bool newItemSelected; bool newScrollItemSelected; + void setId( int id ); virtual void update(float dt); virtual void draw(); @@ -50,12 +51,15 @@ public: std::string collectionName; void setMenuScrollReload(bool menuScrollReload); bool getMenuScrollReload(); - virtual void setInput(std::string text) {}; + virtual void setText(std::string text, int id = -1) {}; + virtual void setImage(std::string filePath, int id = -1) {}; + int getId( ); protected: Page &page; std::string playlistName; + private: bool animate(); @@ -74,4 +78,5 @@ private: bool animationRequested_; bool menuScrollReload_; int menuIndex_; + int id_; }; diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index 5aa156c..fb8d9a0 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -22,13 +22,12 @@ #include -Text::Text( std::string text, Page &p, Font *font, float scaleX, float scaleY, bool input ) +Text::Text( std::string text, Page &p, Font *font, float scaleX, float scaleY ) : Component(p) , textData_(text) , fontInst_(font) , scaleX_(scaleX) , scaleY_(scaleY) - , input_(input) { allocateGraphicsMemory( ); } @@ -58,14 +57,9 @@ void Text::initializeFonts( ) fontInst_->initialize( ); } -void Text::setText( std::string text ) +void Text::setText( std::string text, int id ) { - textData_ = text; -} - -void Text::setInput( std::string text ) -{ - if ( input_ ) + if ( getId( ) == id ) textData_ = text; } diff --git a/RetroFE/Source/Graphics/Component/Text.h b/RetroFE/Source/Graphics/Component/Text.h index 411a5cf..69162aa 100644 --- a/RetroFE/Source/Graphics/Component/Text.h +++ b/RetroFE/Source/Graphics/Component/Text.h @@ -29,10 +29,9 @@ class Text : public Component { public: - Text( std::string text, Page &p, Font *font, float scaleX, float scaleY, bool input = false ); + Text( std::string text, Page &p, Font *font, float scaleX, float scaleY ); virtual ~Text( ); - void setText( std::string text ); - void setInput( std::string text ); + void setText( std::string text, int id = -1 ); void allocateGraphicsMemory( ); void freeGraphicsMemory( ); void deInitializeFonts( ); @@ -44,5 +43,4 @@ private: Font *fontInst_; float scaleX_; float scaleY_; - bool input_; }; diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 25f5084..26e2957 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -483,7 +483,7 @@ void Page::highlightExit() } -void Page::menuAction( std::string action ) +void Page::triggerEvent( std::string action ) { for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { @@ -492,11 +492,11 @@ void Page::menuAction( std::string action ) } -void Page::menuInput( std::string text ) +void Page::setText( std::string text, int id ) { for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it) { - (*it)->setInput( text ); + (*it)->setText( text, id ); } } diff --git a/RetroFE/Source/Graphics/Page.h b/RetroFE/Source/Graphics/Page.h index d25e072..2269c87 100644 --- a/RetroFE/Source/Graphics/Page.h +++ b/RetroFE/Source/Graphics/Page.h @@ -98,8 +98,8 @@ public: void menuScroll(); void highlightEnter(); void highlightExit(); - void menuAction( std::string action ); - void menuInput( std::string text ); + void triggerEvent( std::string action ); + void setText( std::string text, int id ); void addPlaylist(); void removePlaylist(); void reallocateMenuSpritePoints(); diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index 26da4b5..322eb69 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -388,7 +388,14 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) for(xml_node<> *componentXml = layout->first_node("image"); componentXml; componentXml = componentXml->next_sibling("image")) { - xml_attribute<> *src = componentXml->first_attribute("src"); + xml_attribute<> *src = componentXml->first_attribute("src"); + xml_attribute<> *idXml = componentXml->first_attribute("id"); + + int id = -1; + if (idXml) + { + id = Utils::convertInt(idXml->value()); + } if (!src) { @@ -404,6 +411,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value())); Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || @@ -422,6 +430,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) { xml_attribute<> *srcXml = componentXml->first_attribute("src"); xml_attribute<> *numLoopsXml = componentXml->first_attribute("numLoops"); + xml_attribute<> *idXml = componentXml->first_attribute("id"); + + int id = -1; + if (idXml) + { + id = Utils::convertInt(idXml->value()); + } if (!srcXml) { @@ -438,6 +453,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1; Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || @@ -455,6 +471,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) for(xml_node<> *componentXml = layout->first_node("text"); componentXml; componentXml = componentXml->next_sibling("text")) { xml_attribute<> *value = componentXml->first_attribute("value"); + xml_attribute<> *idXml = componentXml->first_attribute("id"); + + int id = -1; + if (idXml) + { + id = Utils::convertInt(idXml->value()); + } if (!value) { @@ -464,6 +487,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page) { Font *font = addFont(componentXml, NULL); Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || @@ -525,11 +549,19 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, xml_attribute<> *startTimeXml = componentXml->first_attribute("startTime"); xml_attribute<> *endTimeXml = componentXml->first_attribute("endTime"); xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment"); + xml_attribute<> *idXml = componentXml->first_attribute("id"); bool systemMode = false; bool layoutMode = false; bool commonMode = false; bool menuMode = false; int selectedOffset = 0; + + int id = -1; + if (idXml) + { + id = Utils::convertInt(idXml->value()); + } + if(tagName == "reloadableVideo") { type = componentXml->first_attribute("imageType"); @@ -627,6 +659,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, pluralPostfix = pluralPostfixXml->value(); } c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || @@ -676,6 +709,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { alignment = alignmentXml->value(); } + std::string singlePrefix = ""; if (singlePrefixXml) { @@ -697,6 +731,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, pluralPostfix = pluralPostfixXml->value(); } c = new ReloadableScrollingText(config_, systemMode, layoutMode, menuMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || @@ -710,6 +745,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, { Font *font = addFont(componentXml, NULL); c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, menuMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_); + c->setId( id ); xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload"); if (menuScrollReload && (Utils::toLower(menuScrollReload->value()) == "true" || diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp index e8739ac..6dceb05 100644 --- a/RetroFE/Source/SDL.cpp +++ b/RetroFE/Source/SDL.cpp @@ -205,12 +205,10 @@ bool SDL::initialize( Configuration &config ) } } - //todo: specify in configuration file if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 ) { std::string error = Mix_GetError( ); - Logger::write( Logger::ZONE_ERROR, "SDL", "Audio initialize failed: " + error ); - retVal = false; + Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error ); } return retVal; diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index bbaef48..4f3fd9a 100644 --- a/RetroFE/Source/Version.cpp +++ b/RetroFE/Source/Version.cpp @@ -21,7 +21,7 @@ std::string retrofe_version_major = "0"; std::string retrofe_version_minor = "8"; -std::string retrofe_version_build = "15b3"; +std::string retrofe_version_build = "15b4"; std::string Version::getString( )