Refactor UI background rendering. There's now a BackgroundScreen.

This commit is contained in:
Henrik Rydgård committed 2023-12-10 22:26:46 +01:00
1 parent 48d60d8613
commit 6d51fbc1e6
15 files changed
+171 -120

No files matched your search

+4 -7
View File
@@ -117,19 +117,15 @@ private:
float startDisplayOffsetY_ = -1.0f;
};
DisplayLayoutScreen::DisplayLayoutScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) {
// Show background at full brightness
darkenGameBackground_ = false;
forceTransparent_ = true;
}
DisplayLayoutScreen::DisplayLayoutScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) {}
void DisplayLayoutScreen::DrawBackground(UIContext &dc) {
if (PSP_IsInited() && !g_Config.bSkipBufferEffects) {
// We normally rely on the PSP screen.
UIDialogScreenWithGameBackground::DrawBackground(dc);
// We normally rely on the PSP screen showing through.
} else {
// But if it's not present (we're not in game, or skip buffer effects is used),
// we have to draw a substitute ourselves.
UIContext &dc = *screenManager()->getUIContext();
// TODO: Clean this up a bit, this GetScreenFrame/CenterDisplay combo is too common.
FRect screenFrame = GetScreenFrame(g_display.pixel_xres, g_display.pixel_yres);
@@ -138,6 +134,7 @@ void DisplayLayoutScreen::DrawBackground(UIContext &dc) {
dc.Flush();
ImageID bg = ImageID("I_PSP_DISPLAY");
dc.Draw()->DrawImageStretch(bg, dc.GetBounds(), 0x7F000000);
dc.Draw()->DrawImageStretch(bg, FRectToBounds(rc), 0x7FFFFFFF);
}
}