GUI: Add overlay to show demo status on thumbnails
This commit is contained in:
parent
cf88e250ef
commit
2b7dee23b6
4 changed files with 45 additions and 3 deletions
|
@ -136,6 +136,13 @@ void GridItemWidget::drawWidget() {
|
|||
g_gui.theme()->drawSurface(p, *flagGfx, true);
|
||||
}
|
||||
|
||||
// Draw Demo Overlay
|
||||
const Graphics::ManagedSurface *demoGfx = _grid->demoToSurface(_activeEntry->extra);
|
||||
if (demoGfx) {
|
||||
Common::Point p(_x + ((thumbWidth - demoGfx->w)/2) , _y + (thumbHeight - demoGfx->h - 10));
|
||||
g_gui.theme()->drawSurface(p, *demoGfx, true);
|
||||
}
|
||||
|
||||
// Draw Title
|
||||
if (_grid->_isTitlesVisible) {
|
||||
// TODO: Currently title is fixed to two lines at all times, we may want
|
||||
|
@ -345,6 +352,8 @@ GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
|
|||
_flagIconWidth = 0;
|
||||
_platformIconHeight = 0;
|
||||
_platformIconWidth = 0;
|
||||
_extraIconHeight = 0;
|
||||
_extraIconWidth = 0;
|
||||
_minGridXSpacing = 0;
|
||||
_minGridYSpacing = 0;
|
||||
_isTitlesVisible = 0;
|
||||
|
@ -381,6 +390,7 @@ GridWidget::GridWidget(GuiObject *boss, const Common::String &name)
|
|||
GridWidget::~GridWidget() {
|
||||
unloadSurfaces(_platformIcons);
|
||||
unloadSurfaces(_languageIcons);
|
||||
unloadSurfaces(_extraIcons);
|
||||
unloadSurfaces(_loadedSurfaces);
|
||||
_gridItems.clear();
|
||||
_dataEntryList.clear();
|
||||
|
@ -415,6 +425,12 @@ const Graphics::ManagedSurface *GridWidget::platformToSurface(Common::Platform p
|
|||
return _platformIcons[platformCode];
|
||||
}
|
||||
|
||||
const Graphics::ManagedSurface *GridWidget::demoToSurface(const Common::String extraString) {
|
||||
if (! extraString.contains("Demo") )
|
||||
return nullptr;
|
||||
return _extraIcons[0];
|
||||
}
|
||||
|
||||
void GridWidget::setEntryList(Common::Array<GridItemInfo> *list) {
|
||||
_dataEntryList.clear();
|
||||
_headerEntryList.clear();
|
||||
|
@ -671,6 +687,21 @@ void GridWidget::loadPlatformIcons() {
|
|||
}
|
||||
}
|
||||
|
||||
void GridWidget::loadExtraIcons() { // for now only the demo icon is available
|
||||
Graphics::ManagedSurface *gfx = loadSurfaceFromFile("icons/extra/demo.png");
|
||||
if (gfx) {
|
||||
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, _extraIconWidth, _extraIconHeight, true);
|
||||
_extraIcons[0] = scGfx;
|
||||
if (gfx != scGfx) {
|
||||
gfx->free();
|
||||
delete gfx;
|
||||
}
|
||||
} else {
|
||||
_extraIcons[0] = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GridWidget::destroyItems() {
|
||||
for (Common::Array<GridItemWidget *>::iterator i = _gridItems.begin(), end = _gridItems.end(); i != end; ++i) {
|
||||
removeWidget((*i));
|
||||
|
@ -891,12 +922,15 @@ void GridWidget::reflowLayout() {
|
|||
_flagIconWidth = _thumbnailWidth / 4;
|
||||
_flagIconHeight = _flagIconWidth / 2;
|
||||
_platformIconHeight = _platformIconWidth = _thumbnailWidth / 6;
|
||||
_extraIconWidth = _thumbnailWidth / 2;
|
||||
_extraIconHeight = _extraIconWidth / 4;
|
||||
|
||||
if ((oldThumbnailHeight != _thumbnailHeight) || (oldThumbnailWidth != _thumbnailWidth)) {
|
||||
unloadSurfaces(_loadedSurfaces);
|
||||
reloadThumbnails();
|
||||
loadFlagIcons();
|
||||
loadPlatformIcons();
|
||||
loadExtraIcons();
|
||||
}
|
||||
|
||||
_trayHeight = kLineHeight * 3;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue