mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +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)
|
||||
ScrollingList::ScrollingList(Configuration &c,
|
||||
Page &p,
|
||||
bool layoutMode,
|
||||
float scaleX,
|
||||
float scaleY,
|
||||
Font *font,
|
||||
@ -48,6 +49,7 @@ ScrollingList::ScrollingList(Configuration &c,
|
||||
std::string imageType)
|
||||
: Component(p)
|
||||
, horizontalScroll(false)
|
||||
, layoutMode_(layoutMode)
|
||||
, spriteList_(NULL)
|
||||
, scrollPoints_(NULL)
|
||||
, tweenPoints_(NULL)
|
||||
@ -585,50 +587,109 @@ bool ScrollingList::allocateTexture(unsigned int index, Item *item)
|
||||
|
||||
ImageBuilder imageBuild;
|
||||
|
||||
std::string layoutName;
|
||||
config_.getProperty("layout", layoutName);
|
||||
|
||||
// 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_);
|
||||
|
||||
// check sub-collection path for art based on gamename
|
||||
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_);
|
||||
}
|
||||
|
||||
// check collection path for art based on game name (full title)
|
||||
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_);
|
||||
}
|
||||
|
||||
// check sub-collection path for art based on game name (full title)
|
||||
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_);
|
||||
}
|
||||
|
||||
// check collection path for art based on parent game name
|
||||
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_);
|
||||
}
|
||||
|
||||
// check sub-collection path for art based on parent game name
|
||||
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_);
|
||||
}
|
||||
|
||||
// check collection path for art based on system name
|
||||
if(!t)
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(item->name, imageType_, true, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, page, imageType_, scaleX_, scaleY_);
|
||||
if (layoutMode_)
|
||||
{
|
||||
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)
|
||||
|
||||
@ -44,6 +44,7 @@ public:
|
||||
|
||||
ScrollingList(Configuration &c,
|
||||
Page &p,
|
||||
bool layoutMode,
|
||||
float scaleX,
|
||||
float scaleY,
|
||||
Font *font,
|
||||
@ -65,7 +66,7 @@ public:
|
||||
void destroyItems();
|
||||
void setPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<AnimationEvents *> *tweenPoints);
|
||||
void setScrollDirection(ScrollDirection direction);
|
||||
unsigned int getSelectedIndex();
|
||||
unsigned int getSelectedIndex();
|
||||
unsigned int getSize();
|
||||
void pageUp();
|
||||
void pageDown();
|
||||
@ -104,6 +105,7 @@ private:
|
||||
ScrollStateIdle
|
||||
};
|
||||
|
||||
bool layoutMode_;
|
||||
std::vector<Component *> *spriteList_;
|
||||
std::vector<ViewInfo *> *scrollPoints_;
|
||||
std::vector<AnimationEvents *> *tweenPoints_;
|
||||
|
||||
@ -733,12 +733,13 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
|
||||
std::string menuType = "vertical";
|
||||
std::string imageType = "null";
|
||||
std::map<int, xml_node<> *> overrideItems;
|
||||
xml_node<> *itemDefaults = menuXml->first_node("itemDefaults");
|
||||
xml_attribute<> *imageTypeXml = menuXml->first_attribute("imageType");
|
||||
xml_attribute<> *menuTypeXml = menuXml->first_attribute("type");
|
||||
xml_attribute<> *scrollTimeXml = menuXml->first_attribute("scrollTime");
|
||||
xml_node<> *itemDefaults = menuXml->first_node("itemDefaults");
|
||||
xml_attribute<> *modeXml = menuXml->first_attribute("mode");
|
||||
xml_attribute<> *imageTypeXml = menuXml->first_attribute("imageType");
|
||||
xml_attribute<> *menuTypeXml = menuXml->first_attribute("type");
|
||||
xml_attribute<> *scrollTimeXml = menuXml->first_attribute("scrollTime");
|
||||
xml_attribute<> *scrollAccelerationXml = menuXml->first_attribute("scrollAcceleration");
|
||||
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("orientation");
|
||||
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("orientation");
|
||||
|
||||
if(menuTypeXml)
|
||||
{
|
||||
@ -756,10 +757,20 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
|
||||
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.
|
||||
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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user