PauseScreen: Make the savestate numbers more visible by moving them out

This commit is contained in:
Henrik Rydgård
2025-11-22 14:56:19 +01:00
parent e711fdb735
commit 24bcc10985
3 changed files with 8 additions and 19 deletions
-7
View File
@@ -95,10 +95,6 @@ void AsyncImageFileView::Draw(UIContext &dc) {
dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_);
dc.Flush();
dc.RebindTexture();
if (!text_.empty()) {
dc.DrawText(text_, bounds_.centerX() + 1, bounds_.centerY() + 1, 0x80000000, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
dc.DrawText(text_, bounds_.centerX(), bounds_.centerY(), 0xFFFFFFFF, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
}
} else {
if (!texture_ || texture_->Failed()) {
if (!filename_.empty()) {
@@ -109,8 +105,5 @@ void AsyncImageFileView::Draw(UIContext &dc) {
dc.FillRect(UI::Drawable(0x50202020), GetBounds());
}
}
if (!text_.empty()) {
dc.DrawText(text_, bounds_.centerX(), bounds_.centerY(), 0xFFFFFFFF, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
}
}
}
-3
View File
@@ -15,14 +15,12 @@ public:
void GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const override;
void Draw(UIContext &dc) override;
std::string DescribeText() const override { return text_; }
void DeviceLost() override;
void DeviceRestored(Draw::DrawContext *draw) override;
void SetFilename(const Path &filename);
void SetColor(uint32_t color) { color_ = color; }
void SetOverlayText(const std::string &text) { text_ = text; }
void SetFixedSize(float fixW, float fixH) { fixedSizeW_ = fixW; fixedSizeH_ = fixH; }
void SetCanBeFocused(bool can) { canFocus_ = can; }
@@ -33,7 +31,6 @@ public:
private:
bool canFocus_;
Path filename_;
std::string text_;
uint32_t color_;
UI::ImageSizeMode sizeMode_;
+8 -9
View File
@@ -212,7 +212,6 @@ public:
UI::Event OnScreenshotClicked;
private:
void OnScreenshotClick(UI::EventParams &e);
void OnSaveState(UI::EventParams &e);
void OnLoadState(UI::EventParams &e);
@@ -228,10 +227,13 @@ SaveSlotView::SaveSlotView(const Path &gameFilename, int slot, UI::LayoutParams
using namespace UI;
screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION);
std::string number = StringFromFormat("%d", slot + 1);
Add(new Spacer(5));
Add(new TextView(number, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, 0.0f, Gravity::G_VCENTER)))->SetBig(true);
AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, new UI::LayoutParams(82 * 2, 47 * 2)));
fv->SetOverlayText(StringFromFormat("%d", slot_ + 1));
auto pa = GetI18NCategory(I18NCat::PAUSE);
@@ -248,7 +250,10 @@ SaveSlotView::SaveSlotView(const Path &gameFilename, int slot, UI::LayoutParams
saveStateButton_ = buttons->Add(new Button(pa->T("Save State"), new LinearLayoutParams(0.0, Gravity::G_VCENTER)));
saveStateButton_->OnClick.Handle(this, &SaveSlotView::OnSaveState);
fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick);
fv->OnClick.Add([this](UI::EventParams &e) {
e.v = this;
OnScreenshotClicked.Trigger(e);
});
if (SaveState::HasSaveInSlot(gamePath_, slot)) {
if (!Achievements::HardcoreModeActive()) {
@@ -295,12 +300,6 @@ void SaveSlotView::OnSaveState(UI::EventParams &e) {
}
}
void SaveSlotView::OnScreenshotClick(UI::EventParams &e) {
UI::EventParams e2{};
e2.v = this;
OnScreenshotClicked.Trigger(e2);
}
void GamePauseScreen::update() {
UpdateUIState(UISTATE_PAUSEMENU);
UIScreen::update();