Added infoBackgroundImage

This commit is contained in:
Aloshi 2013-11-21 14:06:01 -06:00
parent a7359a2d08
commit 87137df51e
6 changed files with 33 additions and 5 deletions

View file

@ -97,6 +97,7 @@ Pretty much any image format is supported.
`<backgroundImage>` - No default. `<backgroundImage>` - No default.
`<headerImage>` - No default. `<headerImage>` - No default.
`<infoBackgroundImage>` - No default.
Sounds Sounds
====== ======

View file

@ -22,7 +22,8 @@ std::map<std::string, unsigned int> ThemeData::sDefaultColors = boost::assign::m
std::map<std::string, ImageDef> ThemeData::sDefaultImages = boost::assign::map_list_of std::map<std::string, ImageDef> ThemeData::sDefaultImages = boost::assign::map_list_of
("backgroundImage", ImageDef("", true)) ("backgroundImage", ImageDef("", true))
("headerImage", ImageDef("", false)); ("headerImage", ImageDef("", false))
("infoBackgroundImage", ImageDef("", false));
std::map<std::string, SoundDef> ThemeData::sDefaultSounds = boost::assign::map_list_of std::map<std::string, SoundDef> ThemeData::sDefaultSounds = boost::assign::map_list_of
("scrollSound", SoundDef("")) ("scrollSound", SoundDef(""))

View file

@ -13,7 +13,7 @@ BasicGameListView::BasicGameListView(Window* window, FileData* root)
mHeaderText.setPosition(0, 0); mHeaderText.setPosition(0, 0);
mHeaderText.setCentered(true); mHeaderText.setCentered(true);
mHeaderImage.setResize(0, mSize.y() * 0.2f, false); mHeaderImage.setResize(0, mSize.y() * 0.185f, false);
mHeaderImage.setOrigin(0.5f, 0.0f); mHeaderImage.setOrigin(0.5f, 0.0f);
mHeaderImage.setPosition(mSize.x() / 2, 0); mHeaderImage.setPosition(mSize.x() / 2, 0);

View file

@ -3,9 +3,17 @@
DetailedGameListView::DetailedGameListView(Window* window, FileData* root) : DetailedGameListView::DetailedGameListView(Window* window, FileData* root) :
BasicGameListView(window, root), BasicGameListView(window, root),
mDescContainer(window), mDescription(window), mDescContainer(window), mDescription(window),
mImage(window) mImage(window), mInfoBackground(window)
{ {
const float padding = 0.02f; mHeaderImage.setPosition(mSize.x() * 0.25f, 0);
mHeaderImage.setResize(mSize.x() * 0.5f, 0, true);
mInfoBackground.setPosition(0, mSize.y() * 0.5f, 0);
mInfoBackground.setOrigin(0, 0.5f);
mInfoBackground.setResize(mSize.x() * 0.5f, mSize.y(), true);
addChild(&mInfoBackground);
const float padding = 0.01f;
mList.setPosition(mSize.x() * (0.50f + padding), mList.getPosition().y()); mList.setPosition(mSize.x() * (0.50f + padding), mList.getPosition().y());
mList.setSize(mSize.x() * (0.50f - 2*padding), mList.getSize().y()); mList.setSize(mSize.x() * (0.50f - 2*padding), mList.getSize().y());
@ -34,6 +42,7 @@ void DetailedGameListView::setTheme(const std::shared_ptr<ThemeData>& theme)
mDescription.setFont(theme->getFont("descriptionFont")); mDescription.setFont(theme->getFont("descriptionFont"));
mDescription.setColor(theme->getColor("descriptionColor")); mDescription.setColor(theme->getColor("descriptionColor"));
mInfoBackground.setImage(theme->getImage("infoBackgroundImage").getTexture());
} }
void DetailedGameListView::updateInfoPanel() void DetailedGameListView::updateInfoPanel()

View file

@ -18,6 +18,7 @@ private:
void updateInfoPanel(); void updateInfoPanel();
ImageComponent mImage; ImageComponent mImage;
ImageComponent mInfoBackground;
ScrollableContainer mDescContainer; ScrollableContainer mDescContainer;
TextComponent mDescription; TextComponent mDescription;

View file

@ -101,7 +101,23 @@ std::shared_ptr<GameListView> ViewController::getSystemView(SystemData* system)
if(system != NULL) if(system != NULL)
{ {
//decide type
bool detailed = false;
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
for(auto it = files.begin(); it != files.end(); it++)
{
if(!(*it)->getThumbnailPath().empty())
{
detailed = true;
break;
}
}
if(detailed)
view = std::shared_ptr<GameListView>(new DetailedGameListView(mWindow, system->getRootFolder())); view = std::shared_ptr<GameListView>(new DetailedGameListView(mWindow, system->getRootFolder()));
else
view = std::shared_ptr<GameListView>(new BasicGameListView(mWindow, system->getRootFolder()));
view->setTheme(system->getTheme()); view->setTheme(system->getTheme());
}else{ }else{
LOG(LogError) << "null system"; // should eventually return an "all games" gamelist view LOG(LogError) << "null system"; // should eventually return an "all games" gamelist view