Merge pull request #634 from supersquared/master

Add support for md_thumbnail & md_marquee
This commit is contained in:
John Rassa 2020-03-19 20:58:17 -04:00 committed by GitHub
commit 4eafb8771a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 0 deletions

View file

@ -6,6 +6,8 @@
DetailedGameListView::DetailedGameListView(Window* window, FileData* root) :
BasicGameListView(window, root),
mDescContainer(window), mDescription(window),
mThumbnail(window),
mMarquee(window),
mImage(window),
mLblRating(window), mLblReleaseDate(window), mLblDeveloper(window), mLblPublisher(window),
@ -24,6 +26,23 @@ DetailedGameListView::DetailedGameListView(Window* window, FileData* root) :
mList.setAlignment(TextListComponent<FileData*>::ALIGN_LEFT);
mList.setCursorChangedCallback([&](const CursorState& /*state*/) { updateInfoPanel(); });
// Thumbnail
mThumbnail.setOrigin(0.5f, 0.5f);
mThumbnail.setPosition(2.0f, 2.0f);
mThumbnail.setVisible(false);
mThumbnail.setMaxSize(mSize.x() * (0.25f - 2*padding), mSize.y() * 0.10f);
mThumbnail.setDefaultZIndex(25);
addChild(&mThumbnail);
// Marquee
mMarquee.setOrigin(0.5f, 0.5f);
// Default to off the screen
mMarquee.setPosition(2.0f, 2.0f);
mMarquee.setVisible(false);
mMarquee.setMaxSize(mSize.x() * (0.5f - 2*padding), mSize.y() * 0.18f);
mMarquee.setDefaultZIndex(35);
addChild(&mMarquee);
// image
mImage.setOrigin(0.5f, 0.5f);
mImage.setPosition(mSize.x() * 0.25f, mList.getPosition().y() + mSize.y() * 0.2125f);
@ -86,6 +105,8 @@ void DetailedGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& them
BasicGameListView::onThemeChanged(theme);
using namespace ThemeFlags;
mThumbnail.applyTheme(theme, getName(), "md_thumbnail", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mMarquee.applyTheme(theme, getName(), "md_marquee", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mName.applyTheme(theme, getName(), "md_name", ALL);
@ -199,6 +220,8 @@ void DetailedGameListView::updateInfoPanel()
//mDescription.setText("");
fadingOut = true;
}else{
mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mImage.setImage(file->getImagePath());
mDescription.setText(file->metadata.get("desc"));
mDescContainer.reset();
@ -221,6 +244,8 @@ void DetailedGameListView::updateInfoPanel()
}
std::vector<GuiComponent*> comps = getMDValues();
comps.push_back(&mThumbnail);
comps.push_back(&mMarquee);
comps.push_back(&mImage);
comps.push_back(&mDescription);
comps.push_back(&mName);

View file

@ -24,6 +24,8 @@ private:
void initMDLabels();
void initMDValues();
ImageComponent mThumbnail;
ImageComponent mMarquee;
ImageComponent mImage;
TextComponent mLblRating, mLblReleaseDate, mLblDeveloper, mLblPublisher, mLblGenre, mLblPlayers, mLblLastPlayed, mLblPlayCount;

View file

@ -14,6 +14,7 @@
VideoGameListView::VideoGameListView(Window* window, FileData* root) :
BasicGameListView(window, root),
mDescContainer(window), mDescription(window),
mThumbnail(window),
mMarquee(window),
mImage(window),
mVideo(nullptr),
@ -43,6 +44,14 @@ VideoGameListView::VideoGameListView(Window* window, FileData* root) :
mList.setAlignment(TextListComponent<FileData*>::ALIGN_LEFT);
mList.setCursorChangedCallback([&](const CursorState& /*state*/) { updateInfoPanel(); });
// Thumbnail
mThumbnail.setOrigin(0.5f, 0.5f);
mThumbnail.setPosition(2.0f, 2.0f);
mThumbnail.setVisible(false);
mThumbnail.setMaxSize(mSize.x() * (0.25f - 2*padding), mSize.y() * 0.10f);
mThumbnail.setDefaultZIndex(35);
addChild(&mThumbnail);
// Marquee
mMarquee.setOrigin(0.5f, 0.5f);
mMarquee.setPosition(mSize.x() * 0.25f, mSize.y() * 0.10f);
@ -54,6 +63,7 @@ VideoGameListView::VideoGameListView(Window* window, FileData* root) :
mImage.setOrigin(0.5f, 0.5f);
// Default to off the screen
mImage.setPosition(2.0f, 2.0f);
mImage.setVisible(false);
mImage.setMaxSize(1.0f, 1.0f);
mImage.setDefaultZIndex(30);
addChild(&mImage);
@ -123,6 +133,7 @@ void VideoGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
BasicGameListView::onThemeChanged(theme);
using namespace ThemeFlags;
mThumbnail.applyTheme(theme, getName(), "md_thumbnail", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mMarquee.applyTheme(theme, getName(), "md_marquee", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mImage.applyTheme(theme, getName(), "md_image", POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mVideo->applyTheme(theme, getName(), "md_video", POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION | VISIBLE);
@ -253,6 +264,7 @@ void VideoGameListView::updateInfoPanel()
mVideoPlaying = true;
mVideo->setImage(file->getThumbnailPath());
mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mImage.setImage(file->getImagePath());
@ -277,6 +289,7 @@ void VideoGameListView::updateInfoPanel()
}
std::vector<GuiComponent*> comps = getMDValues();
comps.push_back(&mThumbnail);
comps.push_back(&mMarquee);
comps.push_back(mVideo);
comps.push_back(&mDescription);
@ -317,6 +330,12 @@ void VideoGameListView::launch(FileData* game)
{
target = Vector3f(mMarquee.getCenter().x(), mMarquee.getCenter().y(), 0);
}
else if(mThumbnail.hasImage() &&
(mThumbnail.getPosition().x() < screenWidth && mThumbnail.getPosition().x() > 2.0f &&
mThumbnail.getPosition().y() < screenHeight && mThumbnail.getPosition().y() > 2.0f))
{
target = Vector3f(mThumbnail.getCenter().x(), mThumbnail.getCenter().y(), 0);
}
else if(mImage.hasImage() &&
(mImage.getPosition().x() < screenWidth && mImage.getPosition().x() > 2.0f &&
mImage.getPosition().y() < screenHeight && mImage.getPosition().y() > 2.0f))

View file

@ -31,6 +31,7 @@ private:
void initMDLabels();
void initMDValues();
ImageComponent mThumbnail;
ImageComponent mMarquee;
VideoComponent* mVideo;
ImageComponent mImage;