mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Added support for mode="layout" for menu items.
This commit is contained in:
parent
68e3d94c9e
commit
d7e6b7bf11
@ -41,6 +41,7 @@
|
|||||||
//todo: remove coupling from configuration data (if possible)
|
//todo: remove coupling from configuration data (if possible)
|
||||||
ScrollingList::ScrollingList(Configuration &c,
|
ScrollingList::ScrollingList(Configuration &c,
|
||||||
Page &p,
|
Page &p,
|
||||||
|
bool layoutMode,
|
||||||
float scaleX,
|
float scaleX,
|
||||||
float scaleY,
|
float scaleY,
|
||||||
Font *font,
|
Font *font,
|
||||||
@ -48,6 +49,7 @@ ScrollingList::ScrollingList(Configuration &c,
|
|||||||
std::string imageType)
|
std::string imageType)
|
||||||
: Component(p)
|
: Component(p)
|
||||||
, horizontalScroll(false)
|
, horizontalScroll(false)
|
||||||
|
, layoutMode_(layoutMode)
|
||||||
, spriteList_(NULL)
|
, spriteList_(NULL)
|
||||||
, scrollPoints_(NULL)
|
, scrollPoints_(NULL)
|
||||||
, tweenPoints_(NULL)
|
, tweenPoints_(NULL)
|
||||||
@ -585,50 +587,109 @@ bool ScrollingList::allocateTexture(unsigned int index, Item *item)
|
|||||||
|
|
||||||
ImageBuilder imageBuild;
|
ImageBuilder imageBuild;
|
||||||
|
|
||||||
|
std::string layoutName;
|
||||||
|
config_.getProperty("layout", layoutName);
|
||||||
|
|
||||||
// check collection path for art based on gamename
|
// check collection path for art based on gamename
|
||||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collectionName);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
||||||
|
|
||||||
// check sub-collection path for art based on gamename
|
// check sub-collection path for art based on gamename
|
||||||
if(!t)
|
if(!t)
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", item->collectionInfo->name);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check collection path for art based on game name (full title)
|
// check collection path for art based on game name (full title)
|
||||||
if(!t && item->title != item->fullTitle)
|
if(!t && item->title != item->fullTitle)
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collectionName);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check sub-collection path for art based on game name (full title)
|
// check sub-collection path for art based on game name (full title)
|
||||||
if(!t && item->title != item->fullTitle)
|
if(!t && item->title != item->fullTitle)
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", item->collectionInfo->name);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check collection path for art based on parent game name
|
// check collection path for art based on parent game name
|
||||||
if(!t && item->cloneof != "")
|
if(!t && item->cloneof != "")
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collectionName);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check sub-collection path for art based on parent game name
|
// check sub-collection path for art based on parent game name
|
||||||
if(!t && item->cloneof != "")
|
if(!t && item->cloneof != "")
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
if (layoutMode_)
|
||||||
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", item->collectionInfo->name);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "medium_artwork", imageType_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||||
|
}
|
||||||
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check collection path for art based on system name
|
// check collection path for art based on system name
|
||||||
if(!t)
|
if(!t)
|
||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath(item->name, imageType_, true, imagePath);
|
if (layoutMode_)
|
||||||
t = imageBuild.CreateImage(imagePath, page, imageType_, scaleX_, scaleY_);
|
{
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", item->name);
|
||||||
|
imagePath = Utils::combinePath(imagePath, "system_artwork");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_.getMediaPropertyAbsolutePath(item->name, imageType_, true, imagePath);
|
||||||
|
}
|
||||||
|
t = imageBuild.CreateImage(imagePath, page, imageType_, scaleX_, scaleY_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t)
|
if (!t)
|
||||||
|
|||||||
@ -44,6 +44,7 @@ public:
|
|||||||
|
|
||||||
ScrollingList(Configuration &c,
|
ScrollingList(Configuration &c,
|
||||||
Page &p,
|
Page &p,
|
||||||
|
bool layoutMode,
|
||||||
float scaleX,
|
float scaleX,
|
||||||
float scaleY,
|
float scaleY,
|
||||||
Font *font,
|
Font *font,
|
||||||
@ -104,6 +105,7 @@ private:
|
|||||||
ScrollStateIdle
|
ScrollStateIdle
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool layoutMode_;
|
||||||
std::vector<Component *> *spriteList_;
|
std::vector<Component *> *spriteList_;
|
||||||
std::vector<ViewInfo *> *scrollPoints_;
|
std::vector<ViewInfo *> *scrollPoints_;
|
||||||
std::vector<AnimationEvents *> *tweenPoints_;
|
std::vector<AnimationEvents *> *tweenPoints_;
|
||||||
|
|||||||
@ -733,12 +733,13 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
|
|||||||
std::string menuType = "vertical";
|
std::string menuType = "vertical";
|
||||||
std::string imageType = "null";
|
std::string imageType = "null";
|
||||||
std::map<int, xml_node<> *> overrideItems;
|
std::map<int, xml_node<> *> overrideItems;
|
||||||
xml_node<> *itemDefaults = menuXml->first_node("itemDefaults");
|
xml_node<> *itemDefaults = menuXml->first_node("itemDefaults");
|
||||||
xml_attribute<> *imageTypeXml = menuXml->first_attribute("imageType");
|
xml_attribute<> *modeXml = menuXml->first_attribute("mode");
|
||||||
xml_attribute<> *menuTypeXml = menuXml->first_attribute("type");
|
xml_attribute<> *imageTypeXml = menuXml->first_attribute("imageType");
|
||||||
xml_attribute<> *scrollTimeXml = menuXml->first_attribute("scrollTime");
|
xml_attribute<> *menuTypeXml = menuXml->first_attribute("type");
|
||||||
|
xml_attribute<> *scrollTimeXml = menuXml->first_attribute("scrollTime");
|
||||||
xml_attribute<> *scrollAccelerationXml = menuXml->first_attribute("scrollAcceleration");
|
xml_attribute<> *scrollAccelerationXml = menuXml->first_attribute("scrollAcceleration");
|
||||||
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("orientation");
|
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("orientation");
|
||||||
|
|
||||||
if(menuTypeXml)
|
if(menuTypeXml)
|
||||||
{
|
{
|
||||||
@ -756,10 +757,20 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
|
|||||||
imageType = imageTypeXml->value();
|
imageType = imageTypeXml->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool layoutMode = false;
|
||||||
|
if(modeXml)
|
||||||
|
{
|
||||||
|
std::string sysMode = modeXml->value();
|
||||||
|
if(sysMode == "layout")
|
||||||
|
{
|
||||||
|
layoutMode = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// on default, text will be rendered to the menu. Preload it into cache.
|
// on default, text will be rendered to the menu. Preload it into cache.
|
||||||
Font *font = addFont(itemDefaults, NULL);
|
Font *font = addFont(itemDefaults, NULL);
|
||||||
|
|
||||||
menu = new ScrollingList(config_, page, scaleX_, scaleY_, font, layoutKey, imageType);
|
menu = new ScrollingList(config_, page, layoutMode, scaleX_, scaleY_, font, layoutKey, imageType);
|
||||||
|
|
||||||
if(scrollTimeXml)
|
if(scrollTimeXml)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user