mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Added menuScrollReload attribute for reloadable items to allow reloading of
the art/text while scrolling through the menu. Beta release, since this functionality is mostly untested at this time.
This commit is contained in:
parent
eca598ec8d
commit
430480cdb4
@ -25,8 +25,8 @@ Component::Component(Page &p)
|
|||||||
{
|
{
|
||||||
tweens_ = NULL;
|
tweens_ = NULL;
|
||||||
backgroundTexture_ = NULL;
|
backgroundTexture_ = NULL;
|
||||||
|
menuScrollReload_ = false;
|
||||||
freeGraphicsMemory();
|
freeGraphicsMemory();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component::Component(const Component ©)
|
Component::Component(const Component ©)
|
||||||
@ -56,6 +56,7 @@ void Component::freeGraphicsMemory()
|
|||||||
animationType_ = "";
|
animationType_ = "";
|
||||||
animationRequested_ = false;
|
animationRequested_ = false;
|
||||||
newItemSelected = false;
|
newItemSelected = false;
|
||||||
|
newScrollItemSelected = false;
|
||||||
menuIndex_ = -1;
|
menuIndex_ = -1;
|
||||||
|
|
||||||
currentTweens_ = NULL;
|
currentTweens_ = NULL;
|
||||||
@ -118,6 +119,11 @@ void Component::setNewItemSelected()
|
|||||||
newItemSelected = true;
|
newItemSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Component::setNewScrollItemSelected()
|
||||||
|
{
|
||||||
|
newScrollItemSelected = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Component::isIdle()
|
bool Component::isIdle()
|
||||||
{
|
{
|
||||||
return (currentTweenComplete_ || animationType_ == "idle" || animationType_ == "menuIdle");
|
return (currentTweenComplete_ || animationType_ == "idle" || animationType_ == "menuIdle");
|
||||||
@ -399,3 +405,15 @@ bool Component::isPlaying()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Component::setMenuScrollReload(bool menuScrollReload)
|
||||||
|
{
|
||||||
|
menuScrollReload_ = menuScrollReload;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Component::getMenuScrollReload()
|
||||||
|
{
|
||||||
|
return menuScrollReload_;
|
||||||
|
}
|
||||||
|
|||||||
@ -36,9 +36,11 @@ public:
|
|||||||
void triggerEvent(std::string event, int menuIndex = -1);
|
void triggerEvent(std::string event, int menuIndex = -1);
|
||||||
void setPlaylist(std::string name );
|
void setPlaylist(std::string name );
|
||||||
void setNewItemSelected();
|
void setNewItemSelected();
|
||||||
|
void setNewScrollItemSelected();
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
bool isMenuScrolling();
|
bool isMenuScrolling();
|
||||||
bool newItemSelected;
|
bool newItemSelected;
|
||||||
|
bool newScrollItemSelected;
|
||||||
|
|
||||||
virtual void update(float dt);
|
virtual void update(float dt);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
@ -46,6 +48,8 @@ public:
|
|||||||
virtual bool isPlaying();
|
virtual bool isPlaying();
|
||||||
ViewInfo baseViewInfo;
|
ViewInfo baseViewInfo;
|
||||||
std::string collectionName;
|
std::string collectionName;
|
||||||
|
void setMenuScrollReload(bool menuScrollReload);
|
||||||
|
bool getMenuScrollReload();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Page &page;
|
Page &page;
|
||||||
@ -67,5 +71,6 @@ private:
|
|||||||
std::string animationRequestedType_;
|
std::string animationRequestedType_;
|
||||||
std::string animationType_;
|
std::string animationType_;
|
||||||
bool animationRequested_;
|
bool animationRequested_;
|
||||||
|
bool menuScrollReload_;
|
||||||
int menuIndex_;
|
int menuIndex_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -63,11 +63,13 @@ void ReloadableMedia::enableTextFallback_(bool value)
|
|||||||
|
|
||||||
void ReloadableMedia::update(float dt)
|
void ReloadableMedia::update(float dt)
|
||||||
{
|
{
|
||||||
if (newItemSelected)
|
if (newItemSelected ||
|
||||||
|
(newScrollItemSelected && getMenuScrollReload()))
|
||||||
{
|
{
|
||||||
|
|
||||||
reloadTexture();
|
reloadTexture();
|
||||||
newItemSelected = false;
|
newItemSelected = false;
|
||||||
|
newScrollItemSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loadedComponent_)
|
if(loadedComponent_)
|
||||||
|
|||||||
@ -88,7 +88,8 @@ void ReloadableScrollingText::update(float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newItemSelected)
|
if (newItemSelected ||
|
||||||
|
(newScrollItemSelected && getMenuScrollReload()))
|
||||||
{
|
{
|
||||||
reloadTexture( );
|
reloadTexture( );
|
||||||
newItemSelected = false;
|
newItemSelected = false;
|
||||||
|
|||||||
@ -56,7 +56,9 @@ ReloadableText::~ReloadableText()
|
|||||||
|
|
||||||
void ReloadableText::update(float dt)
|
void ReloadableText::update(float dt)
|
||||||
{
|
{
|
||||||
if (newItemSelected || type_ == "time")
|
if (newItemSelected ||
|
||||||
|
(newScrollItemSelected && getMenuScrollReload()) ||
|
||||||
|
type_ == "time")
|
||||||
{
|
{
|
||||||
ReloadTexture();
|
ReloadTexture();
|
||||||
newItemSelected = false;
|
newItemSelected = false;
|
||||||
|
|||||||
@ -164,6 +164,19 @@ void Page::onNewItemSelected()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::onNewScrollItemSelected()
|
||||||
|
{
|
||||||
|
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return;
|
||||||
|
selectedItem_ = activeMenu_[0]->getSelectedItem();
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->setNewScrollItemSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::highlightLoadArt()
|
void Page::highlightLoadArt()
|
||||||
{
|
{
|
||||||
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return;
|
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return;
|
||||||
@ -1171,6 +1184,7 @@ void Page::scroll(bool forward)
|
|||||||
menu->scroll(forward);
|
menu->scroll(forward);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onNewScrollItemSelected();
|
||||||
if(highlightSoundChunk_)
|
if(highlightSoundChunk_)
|
||||||
{
|
{
|
||||||
highlightSoundChunk_->play();
|
highlightSoundChunk_->play();
|
||||||
|
|||||||
@ -44,6 +44,7 @@ public:
|
|||||||
virtual ~Page();
|
virtual ~Page();
|
||||||
void deInitialize();
|
void deInitialize();
|
||||||
virtual void onNewItemSelected();
|
virtual void onNewItemSelected();
|
||||||
|
virtual void onNewScrollItemSelected();
|
||||||
void highlightLoadArt();
|
void highlightLoadArt();
|
||||||
bool pushCollection(CollectionInfo *collection);
|
bool pushCollection(CollectionInfo *collection);
|
||||||
bool popCollection();
|
bool popCollection();
|
||||||
|
|||||||
@ -342,6 +342,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
for(xml_node<> *componentXml = layout->first_node("container"); componentXml; componentXml = componentXml->next_sibling("container"))
|
for(xml_node<> *componentXml = layout->first_node("container"); componentXml; componentXml = componentXml->next_sibling("container"))
|
||||||
{
|
{
|
||||||
Container *c = new Container(*page);
|
Container *c = new Container(*page);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
buildViewInfo(componentXml, c->baseViewInfo);
|
buildViewInfo(componentXml, c->baseViewInfo);
|
||||||
loadTweens(c, componentXml);
|
loadTweens(c, componentXml);
|
||||||
page->addComponent(c);
|
page->addComponent(c);
|
||||||
@ -366,6 +373,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
||||||
|
|
||||||
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
buildViewInfo(componentXml, c->baseViewInfo);
|
buildViewInfo(componentXml, c->baseViewInfo);
|
||||||
loadTweens(c, componentXml);
|
loadTweens(c, componentXml);
|
||||||
page->addComponent(c);
|
page->addComponent(c);
|
||||||
@ -393,6 +407,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
||||||
|
|
||||||
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
|
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
buildViewInfo(componentXml, c->baseViewInfo);
|
buildViewInfo(componentXml, c->baseViewInfo);
|
||||||
loadTweens(c, componentXml);
|
loadTweens(c, componentXml);
|
||||||
page->addComponent(c);
|
page->addComponent(c);
|
||||||
@ -412,9 +433,14 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
Font *font = addFont(componentXml, NULL);
|
||||||
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
buildViewInfo(componentXml, c->baseViewInfo);
|
buildViewInfo(componentXml, c->baseViewInfo);
|
||||||
|
|
||||||
loadTweens(c, componentXml);
|
loadTweens(c, componentXml);
|
||||||
page->addComponent(c);
|
page->addComponent(c);
|
||||||
}
|
}
|
||||||
@ -424,9 +450,14 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
Font *font = addFont(componentXml, NULL);
|
||||||
Text *c = new Text("", *page, font, scaleX_, scaleY_);
|
Text *c = new Text("", *page, font, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
buildViewInfo(componentXml, c->baseViewInfo);
|
buildViewInfo(componentXml, c->baseViewInfo);
|
||||||
|
|
||||||
loadTweens(c, componentXml);
|
loadTweens(c, componentXml);
|
||||||
page->addComponent(c);
|
page->addComponent(c);
|
||||||
page->setStatusTextComponent(c);
|
page->setStatusTextComponent(c);
|
||||||
@ -560,6 +591,13 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
pluralPostfix = pluralPostfixXml->value();
|
pluralPostfix = pluralPostfixXml->value();
|
||||||
}
|
}
|
||||||
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
|
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(tagName == "reloadableScrollingText")
|
else if(tagName == "reloadableScrollingText")
|
||||||
@ -623,14 +661,27 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
pluralPostfix = pluralPostfixXml->value();
|
pluralPostfix = pluralPostfixXml->value();
|
||||||
}
|
}
|
||||||
c = new ReloadableScrollingText(config_, systemMode, layoutMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime);
|
c = new ReloadableScrollingText(config_, systemMode, layoutMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
Font *font = addFont(componentXml, NULL);
|
||||||
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
||||||
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
|
if (menuScrollReload &&
|
||||||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
|
Utils::toLower(menuScrollReload->value()) == "yes"))
|
||||||
|
{
|
||||||
|
c->setMenuScrollReload(true);
|
||||||
|
}
|
||||||
xml_attribute<> *textFallback = componentXml->first_attribute("textFallback");
|
xml_attribute<> *textFallback = componentXml->first_attribute("textFallback");
|
||||||
|
|
||||||
if(textFallback && Utils::toLower(textFallback->value()) == "true")
|
if(textFallback && Utils::toLower(textFallback->value()) == "true")
|
||||||
{
|
{
|
||||||
static_cast<ReloadableMedia *>(c)->enableTextFallback_(true);
|
static_cast<ReloadableMedia *>(c)->enableTextFallback_(true);
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "8";
|
std::string retrofe_version_minor = "8";
|
||||||
std::string retrofe_version_build = "14";
|
std::string retrofe_version_build = "14b1";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user