Skip to content

Commit 9bb3e44

Browse files
authored
Merge pull request hrydgard#20888 from NABN00B/pinned-folder-icons
Draw pin icon for pinned folders in grid style
2 parents 42be865 + 0011814 commit 9bb3e44

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

UI/MainScreen.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ void GameButton::Draw(UIContext &dc) {
237237
style = dc.GetTheme().itemDownStyle;
238238

239239
if (!gridStyle_ || !texture) {
240-
h = 50;
241240
if (HasFocus())
242241
style = down_ ? dc.GetTheme().itemDownStyle : dc.GetTheme().itemFocusedStyle;
243242

@@ -321,10 +320,10 @@ void GameButton::Draw(UIContext &dc) {
321320
dc.RebindTexture();
322321
dc.SetFontStyle(dc.GetTheme().uiFont);
323322
if (gridStyle_ && ginfo->fileType == IdentifiedFileType::PPSSPP_GE_DUMP) {
324-
// Super simple drawing for ge dumps.
323+
// Super simple drawing for GE dumps.
325324
dc.PushScissor(bounds_);
326325
const std::string currentTitle = ginfo->GetTitle();
327-
dc.SetFontScale(0.6f, 0.6f);
326+
dc.SetFontScale(0.6f * g_Config.fGameGridScale, 0.6f * g_Config.fGameGridScale);
328327
dc.DrawText(title_, bounds_.x + 4.0f, bounds_.centerY(), style.fgColor, ALIGN_VCENTER | ALIGN_LEFT);
329328
dc.SetFontScale(1.0f, 1.0f);
330329
title_ = currentTitle;
@@ -484,10 +483,15 @@ void DirButton::Draw(UIContext &dc) {
484483
dc.SetFontScale(g_Config.fGameGridScale, g_Config.fGameGridScale);
485484
}
486485
if (compact) {
487-
// No icon, except "up"
486+
// No folder icon, except "up"
488487
dc.PushScissor(bounds_);
489488
if (image == ImageID("I_FOLDER") || image == ImageID("I_FOLDER_PINNED")) {
490489
dc.DrawText(text, bounds_.x + 5, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
490+
if (pinned_) {
491+
ImageID pinID = ImageID("I_PIN");
492+
const AtlasImage *pinImg = dc.Draw()->GetAtlas()->getImage(pinID);
493+
dc.Draw()->DrawImage(pinID, bounds_.x + bounds_.w - pinImg->w * g_Config.fGameGridScale, bounds_.y, g_Config.fGameGridScale);
494+
}
491495
} else {
492496
dc.Draw()->DrawImage(image, bounds_.centerX(), bounds_.centerY(), gridStyle_ ? g_Config.fGameGridScale : 1.0, style.fgColor, ALIGN_CENTER);
493497
}
@@ -921,8 +925,6 @@ void GameBrowser::Refresh() {
921925
pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick);
922926
pinnedDir->SetPinned(true);
923927
}
924-
925-
// Add a separator?
926928
}
927929

928930
if (listingPending_) {

0 commit comments

Comments
 (0)