Merge pull request #20930 from hrydgard/more-ui-work

More UI code cleanup, remove Exit button on Android.
This commit is contained in:
Henrik Rydgård
2025-10-29 00:54:03 +01:00
committed by GitHub
69 changed files with 827 additions and 748 deletions
+4
View File
@@ -1550,8 +1550,12 @@ list(APPEND NativeAppSource
UI/NativeApp.cpp
UI/BackgroundAudio.h
UI/BackgroundAudio.cpp
UI/Background.h
UI/Background.cpp
UI/ChatScreen.h
UI/ChatScreen.cpp
UI/BaseScreens.h
UI/BaseScreens.cpp
UI/DebugOverlay.cpp
UI/DebugOverlay.h
UI/DevScreens.cpp
+468
View File
@@ -0,0 +1,468 @@
#include <cmath>
#include "Common/GPU/thin3d.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Math/geom2d.h"
#include "Common/Math/curves.h"
#include "Common/Data/Random/Rng.h"
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/UI/Context.h"
#include "Common/UI/UI.h"
#include "Common/File/Path.h"
#include "Common/File/FileUtil.h"
#include "Common/TimeUtil.h"
#include "Common/Render/ManagedTexture.h"
#include "Common/System/System.h"
#include "Common/System/Display.h"
#include "Common/System/Request.h"
#include "Core/ConfigValues.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "Core/Util/RecentFiles.h"
#include "UI/Background.h"
#include "UI/GameInfoCache.h"
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
static Draw::Texture *bgTexture;
class Animation {
public:
virtual ~Animation() = default;
virtual void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) = 0;
};
class MovingBackground : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
if (!bgTexture)
return;
dc.Flush();
dc.GetDrawContext()->BindTexture(0, bgTexture);
Bounds bounds = dc.GetBounds();
x = std::min(std::max(x / bounds.w, 0.0f), 1.0f) * XFAC;
y = std::min(std::max(y / bounds.h, 0.0f), 1.0f) * YFAC;
z = 1.0f + std::max(XFAC, YFAC) + (z - 1.0f) * ZFAC;
lastX_ = abs(x - lastX_) > 0.001f ? x * XSPEED + lastX_ * (1.0f - XSPEED) : x;
lastY_ = abs(y - lastY_) > 0.001f ? y * YSPEED + lastY_ * (1.0f - YSPEED) : y;
lastZ_ = abs(z - lastZ_) > 0.001f ? z * ZSPEED + lastZ_ * (1.0f - ZSPEED) : z;
float u1 = lastX_ / lastZ_;
float v1 = lastY_ / lastZ_;
float u2 = (1.0f + lastX_) / lastZ_;
float v2 = (1.0f + lastY_) / lastZ_;
dc.Draw()->DrawTexRect(bounds, u1, v1, u2, v2, whiteAlpha(alpha));
dc.Flush();
dc.RebindTexture();
}
private:
static constexpr float XFAC = 0.3f;
static constexpr float YFAC = 0.3f;
static constexpr float ZFAC = 0.12f;
static constexpr float XSPEED = 0.05f;
static constexpr float YSPEED = 0.05f;
static constexpr float ZSPEED = 0.1f;
float lastX_ = 0.0f;
float lastY_ = 0.0f;
float lastZ_ = 1.0f + std::max(XFAC, YFAC);
};
class WaveAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
const uint32_t color = colorAlpha(0xFFFFFFFF, alpha * 0.2f);
const float speed = 1.0;
Bounds bounds = dc.GetBounds();
dc.Flush();
dc.BeginNoTex();
// 500 is enough for any resolution really. 24 * 500 = 12000 which fits handily in our UI vertex buffer (max 65536 per flush).
const int steps = std::max(20, std::min((int)g_display.dp_xres, 500));
float step = (float)g_display.dp_xres / (float)steps;
t *= speed;
for (int n = 0; n < steps; n++) {
float x = (float)n * step;
float nextX = (float)(n + 1) * step;
float i = x * 1280 / bounds.w;
float wave0 = sin(i * 0.005 + t * 0.8) * 0.05 + sin(i * 0.002 + t * 0.25) * 0.02 + sin(i * 0.001 + t * 0.3) * 0.03 + 0.625;
float wave1 = sin(i * 0.0044 + t * 0.4) * 0.07 + sin(i * 0.003 + t * 0.1) * 0.02 + sin(i * 0.001 + t * 0.3) * 0.01 + 0.625;
dc.Draw()->RectVGradient(x, wave0 * bounds.h, nextX, bounds.h, color, 0x00000000);
dc.Draw()->RectVGradient(x, wave1 * bounds.h, nextX, bounds.h, color, 0x00000000);
// Add some "antialiasing"
dc.Draw()->RectVGradient(x, wave0 * bounds.h - 3.0f * g_display.pixel_in_dps_y, nextX, wave0 * bounds.h, 0x00000000, color);
dc.Draw()->RectVGradient(x, wave1 * bounds.h - 3.0f * g_display.pixel_in_dps_y, nextX, wave1 * bounds.h, 0x00000000, color);
}
dc.Flush();
dc.Begin();
}
};
class FloatingSymbolsAnimation : public Animation {
public:
FloatingSymbolsAnimation(bool is_colored) {
this->is_colored = is_colored;
}
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
dc.Flush();
dc.Begin();
float xres = dc.GetBounds().w;
float yres = dc.GetBounds().h;
if (last_xres != xres || last_yres != yres) {
Regenerate(xres, yres);
}
for (int i = 0; i < COUNT; i++) {
float x = xbase[i] + dc.GetBounds().x;
float y = ybase[i] + dc.GetBounds().y + 40 * cosf(i * 7.2f + t * 1.3f);
float angle = (float)sin(i + t);
int n = i & 3;
Color color = is_colored ? colorAlpha(COLORS[n], alpha * 0.25f) : colorAlpha(DEFAULT_COLOR, alpha * 0.1f);
ui_draw2d.DrawImageRotated(SYMBOLS[n], x, y, 1.0f, angle, color);
}
dc.Flush();
}
private:
static constexpr int COUNT = 100;
static constexpr Color DEFAULT_COLOR = 0xC0FFFFFF;
static constexpr Color COLORS[4] = {0xFFE3B56F, 0xFF615BFF, 0xFFAA88F3, 0xFFC2CC7A,}; // X O D A
static const ImageID SYMBOLS[4];
bool is_colored = false;
float xbase[COUNT]{};
float ybase[COUNT]{};
float last_xres = 0;
float last_yres = 0;
void Regenerate(int xres, int yres) {
GMRng rng;
for (int i = 0; i < COUNT; i++) {
xbase[i] = rng.F() * xres;
ybase[i] = rng.F() * yres;
}
last_xres = xres;
last_yres = yres;
}
};
const ImageID FloatingSymbolsAnimation::SYMBOLS[4] = {
ImageID("I_CROSS"),
ImageID("I_CIRCLE"),
ImageID("I_SQUARE"),
ImageID("I_TRIANGLE"),
};
class RecentGamesAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
if (lastIndex_ == nextIndex_) {
CheckNext(dc, t);
} else if (t > nextT_) {
lastIndex_ = nextIndex_;
}
if (g_recentFiles.HasAny()) {
std::shared_ptr<GameInfo> lastInfo = GetInfo(dc, lastIndex_);
std::shared_ptr<GameInfo> nextInfo = GetInfo(dc, nextIndex_);
dc.Flush();
float lastAmount = Clamp((float)(nextT_ - t) * 1.0f / TRANSITION, 0.0f, 1.0f);
DrawTex(dc, lastInfo, lastAmount * alpha * 0.2f);
float nextAmount = lastAmount <= 0.0f ? 1.0f : 1.0f - lastAmount;
DrawTex(dc, nextInfo, nextAmount * alpha * 0.2f);
dc.RebindTexture();
}
}
private:
void CheckNext(UIContext &dc, double t) {
if (!g_recentFiles.HasAny()) {
return;
}
std::vector<std::string> recents = g_recentFiles.GetRecentFiles();
for (int index = lastIndex_ + 1; index != lastIndex_; ++index) {
if (index < 0 || index >= (int)recents.size()) {
if (lastIndex_ == -1)
break;
index = 0;
}
std::shared_ptr<GameInfo> ginfo = GetInfo(dc, index);
if (ginfo && !ginfo->Ready(GameInfoFlags::PIC1)) {
// Wait for it to load. It might be the next one.
break;
}
if (ginfo && ginfo->pic1.texture) {
nextIndex_ = index;
nextT_ = t + INTERVAL;
break;
}
// Otherwise, keep going. This skips games with no BG.
}
}
static std::shared_ptr<GameInfo> GetInfo(UIContext &dc, int index) {
if (index < 0) {
return nullptr;
}
const auto recentIsos = g_recentFiles.GetRecentFiles();
if (index >= (int)recentIsos.size())
return std::shared_ptr<GameInfo>();
return g_gameInfoCache->GetInfo(dc.GetDrawContext(), Path(recentIsos[index]), GameInfoFlags::PIC1);
}
static void DrawTex(UIContext &dc, std::shared_ptr<GameInfo> &ginfo, float amount) {
if (!ginfo || amount <= 0.0f)
return;
GameInfoTex *pic = ginfo->GetPIC1();
if (!pic)
return;
dc.GetDrawContext()->BindTexture(0, pic->texture);
uint32_t color = whiteAlpha(amount) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
}
static constexpr double INTERVAL = 8.0;
static constexpr float TRANSITION = 3.0f;
int lastIndex_ = -1;
int nextIndex_ = -1;
double nextT_ = -INTERVAL;
};
class BouncingIconAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
dc.Flush();
dc.Begin();
// Handle change in resolution.
float xres = dc.GetBounds().w;
float yres = dc.GetBounds().h;
if (last_xres != xres || last_yres != yres) {
Recalculate(xres, yres);
}
// Draw the image.
float xpos = xbase + dc.GetBounds().x;
float ypos = ybase + dc.GetBounds().y;
ImageID icon = !color_ix && System_GetPropertyBool(SYSPROP_APP_GOLD) ? ImageID("I_ICON_GOLD") : ImageID("I_ICON");
ui_draw2d.DrawImage(icon, xpos, ypos, scale, COLORS[color_ix], ALIGN_CENTER);
dc.Flush();
// Switch direction if within border.
bool should_recolor = true;
if (xbase > xres - border || xbase < border) {
xspeed *= -1.0f;
RandomizeColor();
should_recolor = false;
}
if (ybase > yres - border || ybase < border) {
yspeed *= -1.0f;
if (should_recolor) {
RandomizeColor();
}
}
// Place to border if out of bounds.
if (xbase > xres - border) xbase = xres - border;
else if (xbase < border) xbase = border;
if (ybase > yres - border) ybase = yres - border;
else if (ybase < border) ybase = border;
// Update location.
xbase += xspeed;
ybase += yspeed;
}
private:
static constexpr int COLOR_COUNT = 11;
static constexpr Color COLORS[COLOR_COUNT] = {0xFFFFFFFF, 0xFFFFFF00, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
0xFF00FFFF, 0xFFFF00FF, 0xFF4111D1, 0xFF3577F3, 0xFFAA77FF, 0xFF623B84};
float xbase = 0.0f;
float ybase = 0.0f;
float last_xres = 0.0f;
float last_yres = 0.0f;
float xspeed = 1.0f;
float yspeed = 1.0f;
float scale = 1.0f;
float border = 35.0f;
int color_ix = 0;
int last_color_ix = -1;
GMRng rng;
void Recalculate(int xres, int yres) {
// First calculation.
if (last_color_ix == -1) {
xbase = xres / 2.0f;
ybase = yres / 2.0f;
last_color_ix = 0;
// Determine initial direction.
if ((int)(rng.F() * xres) % 2) xspeed *= -1.0f;
if ((int)(rng.F() * yres) % 2) yspeed *= -1.0f;
}
// Scale certain attributes to resolution.
scale = std::min(xres, yres) / 400.0f;
float speed = scale < 2.5f ? scale * 0.58f : scale * 0.46f;
xspeed = std::signbit(xspeed) ? speed * -1.0f : speed;
yspeed = std::signbit(yspeed) ? speed * -1.0f : speed;
border = 35.0f * scale;
last_xres = xres;
last_yres = yres;
}
void RandomizeColor() {
do {
color_ix = (int)(rng.F() * xbase) % COLOR_COUNT;
} while (color_ix == last_color_ix);
last_color_ix = color_ix;
}
};
// TODO: Add more styles. Remember to add to the enum in ConfigValues.h and the selector in GameSettings too.
static BackgroundAnimation g_CurBackgroundAnimation = BackgroundAnimation::OFF;
static std::unique_ptr<Animation> g_Animation;
static bool bgTextureInited = false; // Separate variable because init could fail.
void UIBackgroundInit(UIContext &dc) {
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
if (File::Exists(bgPng) || File::Exists(bgJpg)) {
const Path &bgFile = File::Exists(bgPng) ? bgPng : bgJpg;
bgTexture = CreateTextureFromFile(dc.GetDrawContext(), bgFile.c_str(), ImageFileType::DETECT, true);
}
}
void UIBackgroundShutdown() {
if (bgTexture) {
bgTexture->Release();
bgTexture = nullptr;
}
bgTextureInited = false;
g_Animation.reset(nullptr);
g_CurBackgroundAnimation = BackgroundAnimation::OFF;
}
void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {
if (!bgTextureInited) {
UIBackgroundInit(dc);
bgTextureInited = true;
}
if (g_CurBackgroundAnimation != (BackgroundAnimation)g_Config.iBackgroundAnimation) {
g_CurBackgroundAnimation = (BackgroundAnimation)g_Config.iBackgroundAnimation;
switch (g_CurBackgroundAnimation) {
case BackgroundAnimation::FLOATING_SYMBOLS:
g_Animation.reset(new FloatingSymbolsAnimation(false));
break;
case BackgroundAnimation::RECENT_GAMES:
g_Animation.reset(new RecentGamesAnimation());
break;
case BackgroundAnimation::WAVE:
g_Animation.reset(new WaveAnimation());
break;
case BackgroundAnimation::MOVING_BACKGROUND:
g_Animation.reset(new MovingBackground());
break;
case BackgroundAnimation::BOUNCING_ICON:
g_Animation.reset(new BouncingIconAnimation());
break;
case BackgroundAnimation::FLOATING_SYMBOLS_COLORED:
g_Animation.reset(new FloatingSymbolsAnimation(true));
break;
default:
g_Animation.reset(nullptr);
}
}
uint32_t bgColor = whiteAlpha(alpha);
if (bgTexture != nullptr) {
dc.Flush();
dc.Begin();
dc.GetDrawContext()->BindTexture(0, bgTexture);
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, bgColor);
dc.Flush();
dc.RebindTexture();
} else {
// I_BG original color: 0xFF754D24
ImageID img = ImageID("I_BG");
dc.Begin();
dc.Draw()->DrawImageStretch(img, dc.GetBounds(), bgColor & dc.GetTheme().backgroundColor);
dc.Flush();
}
#if PPSSPP_PLATFORM(IOS)
// iOS uses an old screenshot when restoring the task, so to avoid an ugly
// jitter we accumulate time instead.
static int frameCount = 0.0;
frameCount++;
double t = (double)frameCount / System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE);
#else
double t = time_now_d();
#endif
if (g_Animation) {
g_Animation->Draw(dc, t, alpha, x, y, z);
}
}
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc) {
return colorAlpha(colorBlend(dc.GetTheme().backgroundColor, 0, 0.5f), 0.65f); // 0.65 = 166 = A6
}
void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, float z) {
using namespace Draw;
using namespace UI;
dc.Flush();
std::shared_ptr<GameInfo> ginfo;
if (!gamePath.empty()) {
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GameInfoFlags::PIC1);
}
GameInfoTex *pic = (ginfo && ginfo->Ready(GameInfoFlags::PIC1)) ? ginfo->GetPIC1() : nullptr;
if (pic) {
dc.GetDrawContext()->BindTexture(0, pic->texture);
uint32_t color = whiteAlpha(ease((time_now_d() - pic->timeLoaded) * 3)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
dc.RebindTexture();
} else {
::DrawBackground(dc, 1.0f, x, y, z);
dc.RebindTexture();
dc.Flush();
}
}
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include "Common/File/Path.h"
class UIContext;
extern Path boot_filename;
void UIBackgroundInit(UIContext &dc);
void UIBackgroundShutdown();
void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, float z);
void DrawBackground(UIContext &dc, float alpha, float x, float y, float z);
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc);
View File
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include "Common/File/Path.h"
#include "Common/UI/UIScreen.h"
// This doesn't have anything to do with the background anymore. It's just a PPSSPP UIScreen
// that knows how handle sendMessage properly. Same for all the below.
class UIBaseScreen : public UIScreen {
public:
UIBaseScreen() : UIScreen() {}
protected:
void sendMessage(UIMessage message, const char *value) override;
};
class UIBaseDialogScreen : public UIDialogScreen {
public:
UIBaseDialogScreen() : UIDialogScreen(), gamePath_() {}
explicit UIBaseDialogScreen(const Path &gamePath) : UIDialogScreen(), gamePath_(gamePath) {}
protected:
void sendMessage(UIMessage message, const char *value) override;
void AddStandardBack(UI::ViewGroup *parent);
Path gamePath_;
};
+6 -5
View File
@@ -44,6 +44,7 @@
#include "Core/System.h"
#include "Core/Config.h"
#include "UI/ControlMappingScreen.h"
#include "UI/PopupScreens.h"
#include "UI/GameSettingsScreen.h"
#include "UI/JoystickHistoryView.h"
#include "UI/OnScreenDisplay.h"
@@ -318,7 +319,7 @@ void ControlMappingScreen::update() {
RecreateViews();
}
UIDialogScreenWithGameBackground::update();
UIBaseDialogScreen::update();
SetVRAppMode(VRAppMode::VR_MENU_MODE);
}
@@ -504,7 +505,7 @@ void KeyMappingNewMouseKeyDialog::axis(const AxisInput &axis) {
}
}
AnalogCalibrationScreen::AnalogCalibrationScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
AnalogCalibrationScreen::AnalogCalibrationScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {
mapper_.SetCallbacks(
[](int vkey, bool down) {},
[](int vkey, float analogValue) {},
@@ -953,7 +954,7 @@ bool VisualMappingScreen::key(const KeyInput &key) {
}
}
}
return UIDialogScreenWithGameBackground::key(key);
return UIBaseDialogScreen::key(key);
}
void VisualMappingScreen::axis(const AxisInput &axis) {
@@ -976,11 +977,11 @@ void VisualMappingScreen::axis(const AxisInput &axis) {
break;
}
}
UIDialogScreenWithGameBackground::axis(axis);
UIBaseDialogScreen::axis(axis);
}
void VisualMappingScreen::resized() {
UIDialogScreenWithGameBackground::resized();
UIBaseDialogScreen::resized();
RecreateViews();
}
+6 -6
View File
@@ -30,13 +30,13 @@
#include "Core/ControlMapper.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
class SingleControlMapper;
class ControlMappingScreen : public UIDialogScreenWithGameBackground {
class ControlMappingScreen : public UIBaseDialogScreen {
public:
explicit ControlMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
explicit ControlMappingScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {
categoryToggles_[0] = true;
categoryToggles_[1] = true;
categoryToggles_[2] = true;
@@ -120,7 +120,7 @@ private:
class JoystickHistoryView;
class AnalogCalibrationScreen : public UIDialogScreenWithGameBackground {
class AnalogCalibrationScreen : public UIBaseDialogScreen {
public:
AnalogCalibrationScreen(const Path &gamePath);
@@ -149,9 +149,9 @@ private:
class MockPSP;
class VisualMappingScreen : public UIDialogScreenWithGameBackground {
class VisualMappingScreen : public UIBaseDialogScreen {
public:
VisualMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}
VisualMappingScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {}
const char *tag() const override { return "VisualMapping"; }
+1
View File
@@ -21,6 +21,7 @@
#include "Common/UI/Context.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/ScrollView.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Color/RGBAUtil.h"
+3 -3
View File
@@ -17,16 +17,16 @@
#pragma once
#include "MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/GamepadEmu.h"
namespace UI {
class CheckBox;
}
class CustomButtonMappingScreen : public UIDialogScreenWithGameBackground {
class CustomButtonMappingScreen : public UIBaseDialogScreen {
public:
CustomButtonMappingScreen(const Path &gamePath, int id) : UIDialogScreenWithGameBackground(gamePath), id_(id) {}
CustomButtonMappingScreen(const Path &gamePath, int id) : UIBaseDialogScreen(gamePath), id_(id) {}
const char *tag() const override { return "CustomButton"; }
+3 -2
View File
@@ -25,6 +25,7 @@
#include "Common/StringUtils.h"
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Common/UI/PopupScreens.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "Core/CwCheat.h"
@@ -40,7 +41,7 @@ static Path GetGlobalCheatFilePath() {
}
CwCheatScreen::CwCheatScreen(const Path &gamePath)
: UIDialogScreenWithGameBackground(gamePath) {
: UIBaseDialogScreen(gamePath) {
}
CwCheatScreen::~CwCheatScreen() {
@@ -155,7 +156,7 @@ void CwCheatScreen::update() {
fileCheckCounter_ = 0;
}
UIDialogScreenWithGameBackground::update();
UIBaseDialogScreen::update();
}
void CwCheatScreen::onFinish(DialogResult result) {
+2 -2
View File
@@ -23,12 +23,12 @@
#include "Common/UI/View.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/Context.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
struct CheatFileInfo;
class CWCheatEngine;
class CwCheatScreen : public UIDialogScreenWithGameBackground {
class CwCheatScreen : public UIBaseDialogScreen {
public:
CwCheatScreen(const Path &gamePath);
~CwCheatScreen();
+5 -4
View File
@@ -38,6 +38,7 @@
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Net/HTTPClient.h"
#include "Common/UI/Context.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/UI.h"
@@ -65,7 +66,7 @@
#include "GPU/Debugger/Record.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/DevScreens.h"
#include "UI/MainScreen.h"
#include "UI/EmuScreen.h"
@@ -253,7 +254,7 @@ void LogViewScreen::UpdateLog() {
}
void LogViewScreen::update() {
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
if (toBottom_) {
toBottom_ = false;
scroll_->ScrollToBottom();
@@ -524,7 +525,7 @@ bool ShaderViewScreen::key(const KeyInput &ki) {
System_CopyStringToClipboard(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC));
}
}
return UIDialogScreenWithBackground::key(ki);
return UIBaseDialogScreen::key(ki);
}
@@ -616,7 +617,7 @@ void FrameDumpTestScreen::update() {
}
void TouchTestScreen::touch(const TouchInput &touch) {
UIDialogScreenWithGameBackground::touch(touch);
UIBaseDialogScreen::touch(touch);
if (touch.flags & TOUCH_DOWN) {
bool found = false;
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
+11 -10
View File
@@ -25,7 +25,8 @@
#include "Common/Net/HTTPClient.h"
#include "Common/UI/UIScreen.h"
#include "UI/TabbedDialogScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/PopupScreens.h"
#include "GPU/Common/ShaderCommon.h"
class DevMenuScreen : public PopupScreen {
@@ -47,7 +48,7 @@ private:
Path gamePath_;
};
class JitDebugScreen : public UIDialogScreenWithBackground {
class JitDebugScreen : public UIBaseDialogScreen {
public:
JitDebugScreen() {}
void CreateViews() override;
@@ -59,7 +60,7 @@ private:
void OnDisableAll(UI::EventParams &e);
};
class LogConfigScreen : public UIDialogScreenWithBackground {
class LogConfigScreen : public UIBaseDialogScreen {
public:
LogConfigScreen() {}
void CreateViews() override;
@@ -74,7 +75,7 @@ private:
void OnLogLevelChange(UI::EventParams &e);
};
class LogViewScreen : public UIDialogScreenWithBackground {
class LogViewScreen : public UIBaseDialogScreen {
public:
void CreateViews() override;
void update() override;
@@ -108,9 +109,9 @@ protected:
void CreatePopupContents(UI::ViewGroup *parent) override;
};
class ShaderListScreen : public TabbedUIDialogScreenWithGameBackground {
class ShaderListScreen : public UITabbedBaseDialogScreen {
public:
ShaderListScreen() : TabbedUIDialogScreenWithGameBackground(Path()) {}
ShaderListScreen() : UITabbedBaseDialogScreen(Path()) {}
void CreateTabs() override;
const char *tag() const override { return "ShaderList"; }
@@ -122,7 +123,7 @@ private:
void OnShaderClick(UI::EventParams &e);
};
class ShaderViewScreen : public UIDialogScreenWithBackground {
class ShaderViewScreen : public UIBaseDialogScreen {
public:
ShaderViewScreen(std::string id, DebugShaderType type)
: id_(id), type_(type) {}
@@ -137,7 +138,7 @@ private:
DebugShaderType type_;
};
class FrameDumpTestScreen : public UIDialogScreenWithBackground {
class FrameDumpTestScreen : public UIBaseDialogScreen {
public:
FrameDumpTestScreen();
~FrameDumpTestScreen();
@@ -155,9 +156,9 @@ private:
std::shared_ptr<http::Request> dumpDownload_;
};
class TouchTestScreen : public UIDialogScreenWithGameBackground {
class TouchTestScreen : public UIBaseDialogScreen {
public:
TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
TouchTestScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
touches_[i].id = -1;
}
+1 -1
View File
@@ -711,7 +711,7 @@ void DeveloperToolsScreen::OnMIPSTracerClearTracer(UI::EventParams &e) {
}
void DeveloperToolsScreen::update() {
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER);
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
}
+2 -2
View File
@@ -4,9 +4,9 @@
#include "UI/TabbedDialogScreen.h"
class DeveloperToolsScreen : public TabbedUIDialogScreenWithGameBackground {
class DeveloperToolsScreen : public UITabbedBaseDialogScreen {
public:
DeveloperToolsScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
DeveloperToolsScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
void CreateTabs() override;
void update() override;
+3 -2
View File
@@ -33,6 +33,7 @@
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Data/Text/I18n.h"
#include "UI/DisplayLayoutScreen.h"
#include "UI/Background.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
@@ -117,7 +118,7 @@ private:
float startDisplayOffsetY_ = -1.0f;
};
DisplayLayoutScreen::DisplayLayoutScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) {}
DisplayLayoutScreen::DisplayLayoutScreen(const Path &filename) : UIBaseDialogScreen(filename) {}
void DisplayLayoutScreen::DrawBackground(UIContext &dc) {
if (PSP_GetBootState() == BootState::Complete && !g_Config.bSkipBufferEffects) {
@@ -181,7 +182,7 @@ static std::string PostShaderTranslateName(std::string_view value) {
}
void DisplayLayoutScreen::sendMessage(UIMessage message, const char *value) {
UIDialogScreenWithGameBackground::sendMessage(message, value);
UIBaseDialogScreen::sendMessage(message, value);
if (message == UIMessage::POSTSHADER_UPDATED) {
g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames));
RecreateViews();
+3 -3
View File
@@ -21,15 +21,15 @@
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/PopupScreens.h"
#include "GPU/Common/PostShader.h"
#include "MiscScreens.h"
#include "UI/MiscScreens.h"
namespace UI {
class ChoiceStrip;
}
class DisplayLayoutScreen : public UIDialogScreenWithGameBackground {
class DisplayLayoutScreen : public UIBaseDialogScreen {
public:
DisplayLayoutScreen(const Path &filename);
void CreateViews() override;
+5 -1
View File
@@ -1,8 +1,11 @@
#include "Common/File/VFS/ZipFileReader.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Text/I18n.h"
#include "Common/System/Request.h"
#include "Common/System/OSD.h"
#include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Common/UI/PopupScreens.h"
#include "Core/Config.h"
#include "Core/System.h"
@@ -11,6 +14,7 @@
#include "UI/DriverManagerScreen.h"
#include "UI/GameSettingsScreen.h" // for triggerrestart
#include "UI/OnScreenDisplay.h"
#include "UI/MiscScreens.h"
static Path GetDriverPath() {
if (g_Config.internalDataDirectory.empty()) {
@@ -142,7 +146,7 @@ DriverChoice::DriverChoice(const std::string &driverName, bool current, UI::Layo
}
}
DriverManagerScreen::DriverManagerScreen(const Path & gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
DriverManagerScreen::DriverManagerScreen(const Path & gamePath) : UITabbedBaseDialogScreen(gamePath) {}
void DriverManagerScreen::CreateTabs() {
using namespace UI;
+2 -2
View File
@@ -3,12 +3,12 @@
#include "ppsspp_config.h"
#include "Common/UI/UIScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/TabbedDialogScreen.h"
// Per-game settings screen - enables you to configure graphic options, control options, etc
// per game.
class DriverManagerScreen : public TabbedUIDialogScreenWithGameBackground {
class DriverManagerScreen : public UITabbedBaseDialogScreen {
public:
DriverManagerScreen(const Path &gamePath);
+2 -1
View File
@@ -84,10 +84,11 @@ using namespace std::placeholders;
#include "UI/GamepadEmu.h"
#include "UI/PauseScreen.h"
#include "UI/MainScreen.h"
#include "UI/Background.h"
#include "UI/EmuScreen.h"
#include "UI/DevScreens.h"
#include "UI/GameInfoCache.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/ControlMappingScreen.h"
#include "UI/DisplayLayoutScreen.h"
#include "UI/GameSettingsScreen.h"
+2 -2
View File
@@ -7,10 +7,10 @@
#include "Common/UI/TabHolder.h"
#include "Common/Log.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "Common/GPU/thin3d.h"
class GPUDriverTestScreen : public UIDialogScreenWithBackground {
class GPUDriverTestScreen : public UIBaseDialogScreen {
public:
GPUDriverTestScreen();
~GPUDriverTestScreen();
+3 -1
View File
@@ -41,11 +41,13 @@
#include "Core/HLE/Plugins.h"
#include "Core/Util/RecentFiles.h"
#include "UI/OnScreenDisplay.h"
#include "UI/Background.h"
#include "UI/CwCheatScreen.h"
#include "UI/EmuScreen.h"
#include "UI/GameScreen.h"
#include "UI/GameSettingsScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/BaseScreens.h"
#include "UI/MiscScreens.h"
#include "UI/MainScreen.h"
#include "UI/BackgroundAudio.h"
@@ -53,7 +55,7 @@
constexpr GameInfoFlags g_desiredFlags = GameInfoFlags::PARAM_SFO | GameInfoFlags::ICON | GameInfoFlags::PIC0 | GameInfoFlags::PIC1 | GameInfoFlags::UNCOMPRESSED_SIZE | GameInfoFlags::SIZE;
GameScreen::GameScreen(const Path &gamePath, bool inGame) : UIDialogScreenWithGameBackground(gamePath), inGame_(inGame) {
GameScreen::GameScreen(const Path &gamePath, bool inGame) : UIBaseDialogScreen(gamePath), inGame_(inGame) {
g_BackgroundAudio.SetGame(gamePath);
System_PostUIMessage(UIMessage::GAME_SELECTED, gamePath.ToString());
+2 -2
View File
@@ -19,7 +19,7 @@
#include <functional>
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "Common/UI/UIScreen.h"
#include "Common/File/Path.h"
@@ -33,7 +33,7 @@ class NoticeView;
// Uses GameInfoCache heavily to implement the functionality.
// Should possibly merge this with the PauseScreen.
class GameScreen : public UIDialogScreenWithGameBackground {
class GameScreen : public UIBaseDialogScreen {
public:
GameScreen(const Path &gamePath, bool inGame);
~GameScreen();
+3 -2
View File
@@ -40,11 +40,11 @@
#include "Common/Math/curves.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/UI/PopupScreens.h"
#include "UI/EmuScreen.h"
#include "UI/GameSettingsScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/GamepadEmu.h"
#include "UI/MiscScreens.h"
#include "UI/ControlMappingScreen.h"
#include "UI/DevScreens.h"
#include "UI/DeveloperToolsScreen.h"
@@ -60,6 +60,7 @@
#include "UI/RetroAchievementScreens.h"
#include "UI/OnScreenDisplay.h"
#include "UI/DiscordIntegration.h"
#include "UI/Background.h"
#include "UI/BackgroundAudio.h"
#include "Common/File/FileUtil.h"
@@ -115,7 +116,7 @@ void SetMemStickDirDarwin(int requesterToken) {
#endif
GameSettingsScreen::GameSettingsScreen(const Path &gamePath, std::string gameID, bool editThenRestore)
: TabbedUIDialogScreenWithGameBackground(gamePath), gameID_(gameID), editThenRestore_(editThenRestore) {
: UITabbedBaseDialogScreen(gamePath), gameID_(gameID), editThenRestore_(editThenRestore) {
prevInflightFrames_ = g_Config.iInflightFrames;
analogSpeedMapped_ = KeyMap::InputMappingsFromPspButton(VIRTKEY_SPEED_ANALOG, nullptr, true);
}
+5 -4
View File
@@ -23,15 +23,16 @@
#include <thread>
#include "Common/UI/UIScreen.h"
#include "Common/UI/PopupScreens.h"
#include "Core/ConfigValues.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/TabbedDialogScreen.h"
class Path;
// Per-game settings screen - enables you to configure graphic options, control options, etc
// per game.
class GameSettingsScreen : public TabbedUIDialogScreenWithGameBackground {
class GameSettingsScreen : public UITabbedBaseDialogScreen {
public:
GameSettingsScreen(const Path &gamePath, std::string gameID = "", bool editThenRestore = false);
@@ -183,9 +184,9 @@ private:
};
class GestureMappingScreen : public UIDialogScreenWithGameBackground {
class GestureMappingScreen : public UIBaseDialogScreen {
public:
GestureMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}
GestureMappingScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {}
void CreateViews() override;
const char *tag() const override { return "GestureMapping"; }
+5 -3
View File
@@ -1,11 +1,13 @@
// NOTE: This currently only used on iOS, to present the availablility of getting PPSSPP Gold through IAP.
#include "UI/IAPScreen.h"
#include "UI/OnScreenDisplay.h"
#include "UI/MiscScreens.h"
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Common/Data/Text/I18n.h"
#include "Common/System/OSD.h"
#include "Common/Render/DrawBuffer.h"
#include "UI/IAPScreen.h"
#include "UI/OnScreenDisplay.h"
#include "UI/MiscViews.h"
void IAPScreen::CreateViews() {
using namespace UI;
+2 -2
View File
@@ -4,9 +4,9 @@
#include "ppsspp_config.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
class IAPScreen : public UIDialogScreenWithBackground {
class IAPScreen : public UIBaseDialogScreen {
public:
void CreateViews() override;
const char *tag() const override { return "IAP"; }
+1 -1
View File
@@ -258,5 +258,5 @@ void InstallZipScreen::update() {
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(screenManager()->getDrawContext(), savedataToOverwrite_, GameInfoFlags::FILE_TYPE | GameInfoFlags::PARAM_SFO | GameInfoFlags::ICON | GameInfoFlags::SIZE);
existingSaveView_->UpdateGame(ginfo.get());
}
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
}
+2 -2
View File
@@ -24,11 +24,11 @@
#include "Common/UI/View.h"
#include "Common/UI/UIScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
class SavedataView;
class InstallZipScreen : public UIDialogScreenWithBackground {
class InstallZipScreen : public UIBaseDialogScreen {
public:
InstallZipScreen(const Path &zipPath);
void update() override;
+5 -2
View File
@@ -1,14 +1,17 @@
#include <algorithm>
#include "UI/JitCompareScreen.h"
#include "Common/Data/Text/I18n.h"
#include "Common/UI/ViewGroup.h"
#include "Common/Render/DrawBuffer.h"
#include "Core/MemMap.h"
#include "Core/MIPS/MIPSTables.h"
#include "Core/MIPS/JitCommon/JitBlockCache.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/MIPS/JitCommon/JitState.h"
#include "UI/PopupScreens.h"
JitCompareScreen::JitCompareScreen() : TabbedUIDialogScreenWithGameBackground(Path()) {
JitCompareScreen::JitCompareScreen() : UITabbedBaseDialogScreen(Path()) {
if (!MIPSComp::jit) {
return;
}
+2 -2
View File
@@ -1,9 +1,9 @@
#pragma once
#include "Common/UI/UIScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/TabbedDialogScreen.h"
class JitCompareScreen : public TabbedUIDialogScreenWithGameBackground {
class JitCompareScreen : public UITabbedBaseDialogScreen {
public:
JitCompareScreen();
void CreateTabs() override;
+5 -4
View File
@@ -55,7 +55,7 @@
#include "UI/GameScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/GameSettingsScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/ControlMappingScreen.h"
#include "UI/IAPScreen.h"
#include "UI/RemoteISOScreen.h"
@@ -1200,8 +1200,9 @@ void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool vertical) {
parent->Add(new Spacer(25.0));
}
#if !PPSSPP_PLATFORM(IOS_APP_STORE)
#if !PPSSPP_PLATFORM(IOS_APP_STORE) && !PPSSPP_PLATFORM(ANDROID)
// Officially, iOS apps should not have exit buttons. Remove it to maximize app store review chances.
// Additionally, the Exit button creates problems on Android.
parent->Add(new Choice(mm->T("Exit"), vertical ? new LinearLayoutParams() : nullptr))->OnClick.Handle(this, &MainScreen::OnExit);
#endif
}
@@ -1365,7 +1366,7 @@ bool MainScreen::key(const KeyInput &touch) {
searchKeyModifier_ = false;
}
return UIScreenWithBackground::key(touch);
return UIBaseScreen::key(touch);
}
void MainScreen::OnAllowStorage(UI::EventParams &e) {
@@ -1374,7 +1375,7 @@ void MainScreen::OnAllowStorage(UI::EventParams &e) {
void MainScreen::sendMessage(UIMessage message, const char *value) {
// Always call the base class method first to handle the most common messages.
UIScreenWithBackground::sendMessage(message, value);
UIBaseScreen::sendMessage(message, value);
if (message == UIMessage::REQUEST_GAME_BOOT) {
LaunchFile(screenManager(), this, Path(value));
+3 -3
View File
@@ -24,7 +24,7 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/TabHolder.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "Common/File/PathBrowser.h"
enum GameBrowserFlags {
@@ -118,7 +118,7 @@ private:
class RemoteISOBrowseScreen;
class MainScreen : public UIScreenWithBackground {
class MainScreen : public UIBaseScreen {
public:
MainScreen();
~MainScreen();
@@ -180,7 +180,7 @@ protected:
friend class RemoteISOBrowseScreen;
};
class UmdReplaceScreen : public UIDialogScreenWithBackground {
class UmdReplaceScreen : public UIBaseDialogScreen {
public:
const char *tag() const override { return "UmdReplace"; }
+4 -3
View File
@@ -39,6 +39,7 @@
#include "Common/File/DiskFree.h"
#include "Common/Thread/ThreadManager.h"
#include "Common/UI/ScrollView.h"
#include "Core/Config.h"
#include "Core/Reporting.h"
@@ -48,7 +49,7 @@
#include "UI/MemStickScreen.h"
#include "UI/MainScreen.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/OnScreenDisplay.h"
static std::string FormatSpaceString(int64_t space) {
@@ -447,7 +448,7 @@ void MemStickScreen::dialogFinished(const Screen *dialog, DialogResult result) {
}
void MemStickScreen::update() {
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
if (done_) {
TriggerFinish(DialogResult::DR_OK);
done_ = false;
@@ -567,7 +568,7 @@ void ConfirmMemstickMoveScreen::OnMoveDataClick(UI::EventParams &params) {
}
void ConfirmMemstickMoveScreen::update() {
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
auto ms = GetI18NCategory(I18NCat::MEMSTICK);
if (moveDataTask_) {
+5 -4
View File
@@ -29,13 +29,14 @@
#include "Core/Util/MemStick.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/MiscViews.h"
class NoticeView;
// MemStickScreen - let's you configure your memory stick directory.
// Currently only useful for Android.
class MemStickScreen : public UIDialogScreenWithBackground {
class MemStickScreen : public UIBaseDialogScreen {
public:
MemStickScreen(bool initialSetup);
~MemStickScreen() = default;
@@ -58,7 +59,7 @@ protected:
// Simple anti-flicker due to delayed finish.
if (!done_) {
// render as usual.
return UIDialogScreenWithBackground::render(mode);
return UIBaseDialogScreen::render(mode);
} else {
// no render. black frame insertion is better than flicker.
}
@@ -97,7 +98,7 @@ struct SpaceResult {
int64_t bytesFree;
};
class ConfirmMemstickMoveScreen : public UIDialogScreenWithBackground {
class ConfirmMemstickMoveScreen : public UIBaseDialogScreen {
public:
ConfirmMemstickMoveScreen(const Path &newMemstickFolder, bool initialSetup);
~ConfirmMemstickMoveScreen();
+7 -530
View File
@@ -37,7 +37,6 @@
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Random/Rng.h"
#include "Common/TimeUtil.h"
#include "Common/File/FileUtil.h"
#include "Common/Render/ManagedTexture.h"
@@ -52,460 +51,15 @@
#include "GPU/Common/PostShader.h"
#include "UI/ControlMappingScreen.h"
#include "UI/Background.h"
#include "UI/DisplayLayoutScreen.h"
#include "UI/EmuScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/GameSettingsScreen.h"
#include "UI/MainScreen.h"
#include "UI/MiscScreens.h"
#include "UI/MemStickScreen.h"
#include "UI/MiscViews.h"
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
static Draw::Texture *bgTexture;
class Animation {
public:
virtual ~Animation() = default;
virtual void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) = 0;
};
class MovingBackground : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
if (!bgTexture)
return;
dc.Flush();
dc.GetDrawContext()->BindTexture(0, bgTexture);
Bounds bounds = dc.GetBounds();
x = std::min(std::max(x/bounds.w, 0.0f), 1.0f) * XFAC;
y = std::min(std::max(y/bounds.h, 0.0f), 1.0f) * YFAC;
z = 1.0f + std::max(XFAC, YFAC) + (z-1.0f) * ZFAC;
lastX_ = abs(x-lastX_) > 0.001f ? x*XSPEED+lastX_*(1.0f-XSPEED) : x;
lastY_ = abs(y-lastY_) > 0.001f ? y*YSPEED+lastY_*(1.0f-YSPEED) : y;
lastZ_ = abs(z-lastZ_) > 0.001f ? z*ZSPEED+lastZ_*(1.0f-ZSPEED) : z;
float u1 = lastX_/lastZ_;
float v1 = lastY_/lastZ_;
float u2 = (1.0f+lastX_)/lastZ_;
float v2 = (1.0f+lastY_)/lastZ_;
dc.Draw()->DrawTexRect(bounds, u1, v1, u2, v2, whiteAlpha(alpha));
dc.Flush();
dc.RebindTexture();
}
private:
static constexpr float XFAC = 0.3f;
static constexpr float YFAC = 0.3f;
static constexpr float ZFAC = 0.12f;
static constexpr float XSPEED = 0.05f;
static constexpr float YSPEED = 0.05f;
static constexpr float ZSPEED = 0.1f;
float lastX_ = 0.0f;
float lastY_ = 0.0f;
float lastZ_ = 1.0f + std::max(XFAC, YFAC);
};
class WaveAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
const uint32_t color = colorAlpha(0xFFFFFFFF, alpha * 0.2f);
const float speed = 1.0;
Bounds bounds = dc.GetBounds();
dc.Flush();
dc.BeginNoTex();
// 500 is enough for any resolution really. 24 * 500 = 12000 which fits handily in our UI vertex buffer (max 65536 per flush).
const int steps = std::max(20, std::min((int)g_display.dp_xres, 500));
float step = (float)g_display.dp_xres / (float)steps;
t *= speed;
for (int n = 0; n < steps; n++) {
float x = (float)n * step;
float nextX = (float)(n + 1) * step;
float i = x * 1280 / bounds.w;
float wave0 = sin(i*0.005+t*0.8)*0.05 + sin(i*0.002+t*0.25)*0.02 + sin(i*0.001+t*0.3)*0.03 + 0.625;
float wave1 = sin(i*0.0044+t*0.4)*0.07 + sin(i*0.003+t*0.1)*0.02 + sin(i*0.001+t*0.3)*0.01 + 0.625;
dc.Draw()->RectVGradient(x, wave0*bounds.h, nextX, bounds.h, color, 0x00000000);
dc.Draw()->RectVGradient(x, wave1*bounds.h, nextX, bounds.h, color, 0x00000000);
// Add some "antialiasing"
dc.Draw()->RectVGradient(x, wave0*bounds.h-3.0f * g_display.pixel_in_dps_y, nextX, wave0 * bounds.h, 0x00000000, color);
dc.Draw()->RectVGradient(x, wave1*bounds.h-3.0f * g_display.pixel_in_dps_y, nextX, wave1 * bounds.h, 0x00000000, color);
}
dc.Flush();
dc.Begin();
}
};
class FloatingSymbolsAnimation : public Animation {
public:
FloatingSymbolsAnimation(bool is_colored) {
this->is_colored = is_colored;
}
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
dc.Flush();
dc.Begin();
float xres = dc.GetBounds().w;
float yres = dc.GetBounds().h;
if (last_xres != xres || last_yres != yres) {
Regenerate(xres, yres);
}
for (int i = 0; i < COUNT; i++) {
float x = xbase[i] + dc.GetBounds().x;
float y = ybase[i] + dc.GetBounds().y + 40 * cosf(i * 7.2f + t * 1.3f);
float angle = (float)sin(i + t);
int n = i & 3;
Color color = is_colored ? colorAlpha(COLORS[n], alpha * 0.25f) : colorAlpha(DEFAULT_COLOR, alpha * 0.1f);
ui_draw2d.DrawImageRotated(SYMBOLS[n], x, y, 1.0f, angle, color);
}
dc.Flush();
}
private:
static constexpr int COUNT = 100;
static constexpr Color DEFAULT_COLOR = 0xC0FFFFFF;
static constexpr Color COLORS[4] = { 0xFFE3B56F, 0xFF615BFF, 0xFFAA88F3, 0xFFC2CC7A, }; // X O D A
static const ImageID SYMBOLS[4];
bool is_colored = false;
float xbase[COUNT]{};
float ybase[COUNT]{};
float last_xres = 0;
float last_yres = 0;
void Regenerate(int xres, int yres) {
GMRng rng;
for (int i = 0; i < COUNT; i++) {
xbase[i] = rng.F() * xres;
ybase[i] = rng.F() * yres;
}
last_xres = xres;
last_yres = yres;
}
};
const ImageID FloatingSymbolsAnimation::SYMBOLS[4] = {
ImageID("I_CROSS"),
ImageID("I_CIRCLE"),
ImageID("I_SQUARE"),
ImageID("I_TRIANGLE"),
};
class RecentGamesAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
if (lastIndex_ == nextIndex_) {
CheckNext(dc, t);
} else if (t > nextT_) {
lastIndex_ = nextIndex_;
}
if (g_recentFiles.HasAny()) {
std::shared_ptr<GameInfo> lastInfo = GetInfo(dc, lastIndex_);
std::shared_ptr<GameInfo> nextInfo = GetInfo(dc, nextIndex_);
dc.Flush();
float lastAmount = Clamp((float)(nextT_ - t) * 1.0f / TRANSITION, 0.0f, 1.0f);
DrawTex(dc, lastInfo, lastAmount * alpha * 0.2f);
float nextAmount = lastAmount <= 0.0f ? 1.0f : 1.0f - lastAmount;
DrawTex(dc, nextInfo, nextAmount * alpha * 0.2f);
dc.RebindTexture();
}
}
private:
void CheckNext(UIContext &dc, double t) {
if (!g_recentFiles.HasAny()) {
return;
}
std::vector<std::string> recents = g_recentFiles.GetRecentFiles();
for (int index = lastIndex_ + 1; index != lastIndex_; ++index) {
if (index < 0 || index >= (int)recents.size()) {
if (lastIndex_ == -1)
break;
index = 0;
}
std::shared_ptr<GameInfo> ginfo = GetInfo(dc, index);
if (ginfo && !ginfo->Ready(GameInfoFlags::PIC1)) {
// Wait for it to load. It might be the next one.
break;
}
if (ginfo && ginfo->pic1.texture) {
nextIndex_ = index;
nextT_ = t + INTERVAL;
break;
}
// Otherwise, keep going. This skips games with no BG.
}
}
static std::shared_ptr<GameInfo> GetInfo(UIContext &dc, int index) {
if (index < 0) {
return nullptr;
}
const auto recentIsos = g_recentFiles.GetRecentFiles();
if (index >= (int)recentIsos.size())
return std::shared_ptr<GameInfo>();
return g_gameInfoCache->GetInfo(dc.GetDrawContext(), Path(recentIsos[index]), GameInfoFlags::PIC1);
}
static void DrawTex(UIContext &dc, std::shared_ptr<GameInfo> &ginfo, float amount) {
if (!ginfo || amount <= 0.0f)
return;
GameInfoTex *pic = ginfo->GetPIC1();
if (!pic)
return;
dc.GetDrawContext()->BindTexture(0, pic->texture);
uint32_t color = whiteAlpha(amount) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
}
static constexpr double INTERVAL = 8.0;
static constexpr float TRANSITION = 3.0f;
int lastIndex_ = -1;
int nextIndex_ = -1;
double nextT_ = -INTERVAL;
};
class BouncingIconAnimation : public Animation {
public:
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
dc.Flush();
dc.Begin();
// Handle change in resolution.
float xres = dc.GetBounds().w;
float yres = dc.GetBounds().h;
if (last_xres != xres || last_yres != yres) {
Recalculate(xres, yres);
}
// Draw the image.
float xpos = xbase + dc.GetBounds().x;
float ypos = ybase + dc.GetBounds().y;
ImageID icon = !color_ix && System_GetPropertyBool(SYSPROP_APP_GOLD) ? ImageID("I_ICON_GOLD") : ImageID("I_ICON");
ui_draw2d.DrawImage(icon, xpos, ypos, scale, COLORS[color_ix], ALIGN_CENTER);
dc.Flush();
// Switch direction if within border.
bool should_recolor = true;
if (xbase > xres - border || xbase < border) {
xspeed *= -1.0f;
RandomizeColor();
should_recolor = false;
}
if (ybase > yres - border || ybase < border) {
yspeed *= -1.0f;
if (should_recolor) {
RandomizeColor();
}
}
// Place to border if out of bounds.
if (xbase > xres - border) xbase = xres - border;
else if (xbase < border) xbase = border;
if (ybase > yres - border) ybase = yres - border;
else if (ybase < border) ybase = border;
// Update location.
xbase += xspeed;
ybase += yspeed;
}
private:
static constexpr int COLOR_COUNT = 11;
static constexpr Color COLORS[COLOR_COUNT] = { 0xFFFFFFFF, 0xFFFFFF00, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
0xFF00FFFF, 0xFFFF00FF, 0xFF4111D1, 0xFF3577F3, 0xFFAA77FF, 0xFF623B84 };
float xbase = 0.0f;
float ybase = 0.0f;
float last_xres = 0.0f;
float last_yres = 0.0f;
float xspeed = 1.0f;
float yspeed = 1.0f;
float scale = 1.0f;
float border = 35.0f;
int color_ix = 0;
int last_color_ix = -1;
GMRng rng;
void Recalculate(int xres, int yres) {
// First calculation.
if (last_color_ix == -1) {
xbase = xres / 2.0f;
ybase = yres / 2.0f;
last_color_ix = 0;
// Determine initial direction.
if ((int)(rng.F() * xres) % 2) xspeed *= -1.0f;
if ((int)(rng.F() * yres) % 2) yspeed *= -1.0f;
}
// Scale certain attributes to resolution.
scale = std::min(xres, yres) / 400.0f;
float speed = scale < 2.5f ? scale * 0.58f : scale * 0.46f;
xspeed = std::signbit(xspeed) ? speed * -1.0f : speed;
yspeed = std::signbit(yspeed) ? speed * -1.0f : speed;
border = 35.0f * scale;
last_xres = xres;
last_yres = yres;
}
void RandomizeColor() {
do {
color_ix = (int)(rng.F() * xbase) % COLOR_COUNT;
} while (color_ix == last_color_ix);
last_color_ix = color_ix;
}
};
// TODO: Add more styles. Remember to add to the enum in ConfigValues.h and the selector in GameSettings too.
static BackgroundAnimation g_CurBackgroundAnimation = BackgroundAnimation::OFF;
static std::unique_ptr<Animation> g_Animation;
static bool bgTextureInited = false; // Separate variable because init could fail.
void UIBackgroundInit(UIContext &dc) {
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
if (File::Exists(bgPng) || File::Exists(bgJpg)) {
const Path &bgFile = File::Exists(bgPng) ? bgPng : bgJpg;
bgTexture = CreateTextureFromFile(dc.GetDrawContext(), bgFile.c_str(), ImageFileType::DETECT, true);
}
}
void UIBackgroundShutdown() {
if (bgTexture) {
bgTexture->Release();
bgTexture = nullptr;
}
bgTextureInited = false;
g_Animation.reset(nullptr);
g_CurBackgroundAnimation = BackgroundAnimation::OFF;
}
void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {
if (!bgTextureInited) {
UIBackgroundInit(dc);
bgTextureInited = true;
}
if (g_CurBackgroundAnimation != (BackgroundAnimation)g_Config.iBackgroundAnimation) {
g_CurBackgroundAnimation = (BackgroundAnimation)g_Config.iBackgroundAnimation;
switch (g_CurBackgroundAnimation) {
case BackgroundAnimation::FLOATING_SYMBOLS:
g_Animation.reset(new FloatingSymbolsAnimation(false));
break;
case BackgroundAnimation::RECENT_GAMES:
g_Animation.reset(new RecentGamesAnimation());
break;
case BackgroundAnimation::WAVE:
g_Animation.reset(new WaveAnimation());
break;
case BackgroundAnimation::MOVING_BACKGROUND:
g_Animation.reset(new MovingBackground());
break;
case BackgroundAnimation::BOUNCING_ICON:
g_Animation.reset(new BouncingIconAnimation());
break;
case BackgroundAnimation::FLOATING_SYMBOLS_COLORED:
g_Animation.reset(new FloatingSymbolsAnimation(true));
break;
default:
g_Animation.reset(nullptr);
}
}
uint32_t bgColor = whiteAlpha(alpha);
if (bgTexture != nullptr) {
dc.Flush();
dc.Begin();
dc.GetDrawContext()->BindTexture(0, bgTexture);
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, bgColor);
dc.Flush();
dc.RebindTexture();
} else {
// I_BG original color: 0xFF754D24
ImageID img = ImageID("I_BG");
dc.Begin();
dc.Draw()->DrawImageStretch(img, dc.GetBounds(), bgColor & dc.GetTheme().backgroundColor);
dc.Flush();
}
#if PPSSPP_PLATFORM(IOS)
// iOS uses an old screenshot when restoring the task, so to avoid an ugly
// jitter we accumulate time instead.
static int frameCount = 0.0;
frameCount++;
double t = (double)frameCount / System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE);
#else
double t = time_now_d();
#endif
if (g_Animation) {
g_Animation->Draw(dc, t, alpha, x, y, z);
}
}
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc) {
return colorAlpha(colorBlend(dc.GetTheme().backgroundColor, 0, 0.5f), 0.65f); // 0.65 = 166 = A6
}
void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, float z) {
using namespace Draw;
using namespace UI;
dc.Flush();
std::shared_ptr<GameInfo> ginfo;
if (!gamePath.empty()) {
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GameInfoFlags::PIC1);
}
GameInfoTex *pic = (ginfo && ginfo->Ready(GameInfoFlags::PIC1)) ? ginfo->GetPIC1() : nullptr;
if (pic) {
dc.GetDrawContext()->BindTexture(0, pic->texture);
uint32_t color = whiteAlpha(ease((time_now_d() - pic->timeLoaded) * 3)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0,0,1,1, color);
dc.Flush();
dc.RebindTexture();
} else {
::DrawBackground(dc, 1.0f, x, y, z);
dc.RebindTexture();
dc.Flush();
}
}
void HandleCommonMessages(UIMessage message, const char *value, ScreenManager *manager, const Screen *activeScreen) {
bool isActiveScreen = manager->topScreen() == activeScreen;
@@ -585,38 +139,26 @@ void BackgroundScreen::sendMessage(UIMessage message, const char *value) {
}
}
void UIScreenWithGameBackground::sendMessage(UIMessage message, const char *value) {
void UIBaseDialogScreen::sendMessage(UIMessage message, const char *value) {
if (message == UIMessage::SHOW_SETTINGS && screenManager()->topScreen() == this) {
screenManager()->push(new GameSettingsScreen(gamePath_));
} else {
UIScreenWithBackground::sendMessage(message, value);
HandleCommonMessages(message, value, screenManager(), this);
}
}
void UIDialogScreenWithGameBackground::sendMessage(UIMessage message, const char *value) {
if (message == UIMessage::SHOW_SETTINGS && screenManager()->topScreen() == this) {
screenManager()->push(new GameSettingsScreen(gamePath_));
} else {
UIDialogScreenWithBackground::sendMessage(message, value);
}
}
void UIScreenWithBackground::sendMessage(UIMessage message, const char *value) {
void UIBaseScreen::sendMessage(UIMessage message, const char *value) {
HandleCommonMessages(message, value, screenManager(), this);
}
void UIDialogScreenWithBackground::AddStandardBack(UI::ViewGroup *parent) {
void UIBaseDialogScreen::AddStandardBack(UI::ViewGroup *parent) {
using namespace UI;
auto di = GetI18NCategory(I18NCat::DIALOG);
parent->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(190, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}
void UIDialogScreenWithBackground::sendMessage(UIMessage message, const char *value) {
HandleCommonMessages(message, value, screenManager(), this);
}
PromptScreen::PromptScreen(const Path &gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText, std::function<void(bool)> callback)
: UIDialogScreenWithGameBackground(gamePath), message_(message), callback_(callback) {
: UIBaseDialogScreen(gamePath), message_(message), callback_(callback) {
yesButtonText_ = yesButtonText;
noButtonText_ = noButtonText;
}
@@ -670,7 +212,7 @@ void PromptScreen::TriggerFinish(DialogResult result) {
if (callback_) {
callback_(result == DR_OK || result == DR_YES);
}
UIDialogScreenWithBackground::TriggerFinish(result);
UIBaseDialogScreen::TriggerFinish(result);
}
TextureShaderScreen::TextureShaderScreen(std::string_view title) : ListPopupScreen(title) {}
@@ -1194,68 +736,3 @@ void CreditsScroller::Draw(UIContext &dc) {
dc.Flush();
}
SettingInfoMessage::SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp)
: UI::LinearLayout(ORIENT_HORIZONTAL, lp), cutOffY_(cutOffY) {
using namespace UI;
SetSpacing(0.0f);
Add(new Spacer(10.0f));
text_ = Add(new TextView("", align, false, new LinearLayoutParams(1.0, Margins(0, 10))));
Add(new Spacer(10.0f));
}
void SettingInfoMessage::Show(std::string_view text, const UI::View *refView) {
if (refView) {
Bounds b = refView->GetBounds();
const UI::AnchorLayoutParams *lp = GetLayoutParams()->As<UI::AnchorLayoutParams>();
if (lp) {
if (cutOffY_ != -1.0f && b.y >= cutOffY_) {
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->center));
} else {
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, g_display.dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->center));
}
}
}
if (text_) {
text_->SetText(text);
}
timeShown_ = time_now_d();
}
void SettingInfoMessage::Draw(UIContext &dc) {
static const double FADE_TIME = 1.0;
static const float MAX_ALPHA = 0.9f;
// Let's show longer messages for more time (guesstimate at reading speed.)
// Note: this will give multibyte characters more time, but they often have shorter words anyway.
double timeToShow = std::max(1.5, text_->GetText().size() * 0.05);
double sinceShow = time_now_d() - timeShown_;
float alpha = MAX_ALPHA;
if (timeShown_ == 0.0 || sinceShow > timeToShow + FADE_TIME) {
alpha = 0.0f;
} else if (sinceShow > timeToShow) {
alpha = MAX_ALPHA - MAX_ALPHA * (float)((sinceShow - timeToShow) / FADE_TIME);
}
UI::Style style = dc.GetTheme().tooltipStyle;
if (alpha >= 0.001f) {
uint32_t bgColor = alphaMul(style.background.color, alpha);
dc.FillRect(UI::Drawable(bgColor), bounds_);
}
uint32_t textColor = alphaMul(style.fgColor, alpha);
text_->SetTextColor(textColor);
ViewGroup::Draw(dc);
showing_ = sinceShow <= timeToShow; // Don't consider fade time
}
std::string SettingInfoMessage::GetText() const {
return (showing_ && text_) ? text_->GetText() : "";
}
void ShinyIcon::Draw(UIContext &dc) {
UI::DrawIconShine(dc, bounds_, 1.0f, animated_);
UI::ImageView::Draw(dc);
}
+4 -71
View File
@@ -26,14 +26,11 @@
#include "Common/UI/PopupScreens.h"
#include "Common/File/DirListing.h"
#include "Common/File/Path.h"
#include "UI/BaseScreens.h"
struct ShaderInfo;
struct TextureShaderInfo;
extern Path boot_filename;
void UIBackgroundInit(UIContext &dc);
void UIBackgroundShutdown();
inline void NoOpVoidBool(bool) {}
class BackgroundScreen : public UIScreen {
@@ -48,46 +45,9 @@ private:
Path gamePath_;
};
// This doesn't have anything to do with the background anymore. It's just a PPSSPP UIScreen
// that knows how handle sendMessage properly. Same for all the below.
class UIScreenWithBackground : public UIScreen {
class PromptScreen : public UIBaseDialogScreen {
public:
UIScreenWithBackground() : UIScreen() {}
protected:
void sendMessage(UIMessage message, const char *value) override;
};
class UIScreenWithGameBackground : public UIScreenWithBackground {
public:
UIScreenWithGameBackground(const Path &gamePath) : UIScreenWithBackground(), gamePath_(gamePath) {}
void sendMessage(UIMessage message, const char *value) override;
protected:
Path gamePath_;
bool forceTransparent_ = false;
bool darkenGameBackground_ = true;
};
class UIDialogScreenWithBackground : public UIDialogScreen {
public:
UIDialogScreenWithBackground() : UIDialogScreen() {}
protected:
void sendMessage(UIMessage message, const char *value) override;
void AddStandardBack(UI::ViewGroup *parent);
};
class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground {
public:
UIDialogScreenWithGameBackground(const Path &gamePath)
: UIDialogScreenWithBackground(), gamePath_(gamePath) {}
void sendMessage(UIMessage message, const char *value) override;
protected:
Path gamePath_;
};
class PromptScreen : public UIDialogScreenWithGameBackground {
public:
PromptScreen(const Path& gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText,
PromptScreen(const Path &gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText,
std::function<void(bool)> callback = &NoOpVoidBool);
void CreateViews() override;
@@ -156,7 +116,7 @@ private:
AfterLogoScreen afterLogoScreen_;
};
class CreditsScreen : public UIDialogScreenWithBackground {
class CreditsScreen : public UIBaseDialogScreen {
public:
void update() override;
@@ -164,30 +124,3 @@ protected:
void CreateViews() override;
const char *tag() const override { return "Credits"; }
};
class SettingInfoMessage : public UI::LinearLayout {
public:
SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp);
void Show(std::string_view text, const UI::View *refView = nullptr);
void Draw(UIContext &dc) override;
std::string GetText() const;
private:
UI::TextView *text_ = nullptr;
double timeShown_ = 0.0;
float cutOffY_;
bool showing_ = false;
};
class ShinyIcon : public UI::ImageView {
public:
ShinyIcon(ImageID atlasImage, UI::LayoutParams *layoutParams = 0) : UI::ImageView(atlasImage, "", UI::IS_DEFAULT, layoutParams) {}
void Draw(UIContext &dc) override;
void SetAnimated(bool anim) { animated_ = anim; }
private:
bool animated_ = true;
};
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc);
+67
View File
@@ -1,6 +1,9 @@
#include "Common/UI/View.h"
#include "Common/UI/Context.h"
#include "Common/Render/DrawBuffer.h"
#include "Common/System/Request.h"
#include "Common/System/Display.h"
#include "Common/TimeUtil.h"
#include "UI/MiscViews.h"
TextWithImage::TextWithImage(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
@@ -53,3 +56,67 @@ TopBar::TopBar(std::string_view title, UI::LayoutParams *layoutParams) : UI::Lin
Add(new Spacer(50.0f));
}
}
SettingInfoMessage::SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp)
: UI::LinearLayout(ORIENT_HORIZONTAL, lp), cutOffY_(cutOffY) {
using namespace UI;
SetSpacing(0.0f);
Add(new Spacer(10.0f));
text_ = Add(new TextView("", align, false, new LinearLayoutParams(1.0, Margins(0, 10))));
Add(new Spacer(10.0f));
}
void SettingInfoMessage::Show(std::string_view text, const UI::View *refView) {
if (refView) {
Bounds b = refView->GetBounds();
const UI::AnchorLayoutParams *lp = GetLayoutParams()->As<UI::AnchorLayoutParams>();
if (lp) {
if (cutOffY_ != -1.0f && b.y >= cutOffY_) {
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->center));
} else {
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, g_display.dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->center));
}
}
}
if (text_) {
text_->SetText(text);
}
timeShown_ = time_now_d();
}
void SettingInfoMessage::Draw(UIContext &dc) {
static const double FADE_TIME = 1.0;
static const float MAX_ALPHA = 0.9f;
// Let's show longer messages for more time (guesstimate at reading speed.)
// Note: this will give multibyte characters more time, but they often have shorter words anyway.
double timeToShow = std::max(1.5, text_->GetText().size() * 0.05);
double sinceShow = time_now_d() - timeShown_;
float alpha = MAX_ALPHA;
if (timeShown_ == 0.0 || sinceShow > timeToShow + FADE_TIME) {
alpha = 0.0f;
} else if (sinceShow > timeToShow) {
alpha = MAX_ALPHA - MAX_ALPHA * (float)((sinceShow - timeToShow) / FADE_TIME);
}
UI::Style style = dc.GetTheme().tooltipStyle;
if (alpha >= 0.001f) {
uint32_t bgColor = alphaMul(style.background.color, alpha);
dc.FillRect(UI::Drawable(bgColor), bounds_);
}
uint32_t textColor = alphaMul(style.fgColor, alpha);
text_->SetTextColor(textColor);
ViewGroup::Draw(dc);
showing_ = sinceShow <= timeToShow; // Don't consider fade time
}
std::string SettingInfoMessage::GetText() const {
return (showing_ && text_) ? text_->GetText() : "";
}
void ShinyIcon::Draw(UIContext &dc) {
UI::DrawIconShine(dc, bounds_, 1.0f, animated_);
UI::ImageView::Draw(dc);
}
+25
View File
@@ -22,3 +22,28 @@ public:
private:
UI::Choice *backButton_ = nullptr;
};
class SettingInfoMessage : public UI::LinearLayout {
public:
SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp);
void Show(std::string_view text, const UI::View *refView = nullptr);
void Draw(UIContext &dc) override;
std::string GetText() const;
private:
UI::TextView *text_ = nullptr;
double timeShown_ = 0.0;
float cutOffY_;
bool showing_ = false;
};
class ShinyIcon : public UI::ImageView {
public:
ShinyIcon(ImageID atlasImage, UI::LayoutParams *layoutParams = 0) : UI::ImageView(atlasImage, "", UI::IS_DEFAULT, layoutParams) {}
void Draw(UIContext &dc) override;
void SetAnimated(bool anim) { animated_ = anim; }
private:
bool animated_ = true;
};
+2
View File
@@ -87,6 +87,7 @@
#include "Common/VR/PPSSPPVR.h"
#include "Common/Thread/ThreadManager.h"
#include "Common/Audio/AudioBackend.h"
#include "Common/UI/PopupScreens.h"
#include "Core/ControlMapper.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
@@ -116,6 +117,7 @@
#include "GPU/GPUCommon.h"
#include "GPU/Common/PresentationCommon.h"
#include "UI/AudioCommon.h"
#include "UI/Background.h"
#include "UI/BackgroundAudio.h"
#include "UI/ControlMappingScreen.h"
#include "UI/DevScreens.h"
+1 -1
View File
@@ -328,7 +328,7 @@ void GamePauseScreen::update() {
}
GamePauseScreen::GamePauseScreen(const Path &filename, bool bootPending)
: UIDialogScreenWithGameBackground(filename), bootPending_(bootPending) {
: UIBaseDialogScreen(filename), bootPending_(bootPending) {
// So we can tell if something blew up while on the pause screen.
std::string assertStr = "PauseScreen: " + filename.GetFilename();
SetExtraAssertInfo(assertStr.c_str());
+2 -2
View File
@@ -23,10 +23,10 @@
#include "Common/File/Path.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/Screen.h"
class GamePauseScreen : public UIDialogScreenWithGameBackground {
class GamePauseScreen : public UIBaseDialogScreen {
public:
GamePauseScreen(const Path &filename, bool bootPending);
~GamePauseScreen();
+4 -3
View File
@@ -35,6 +35,7 @@
#include "Common/System/Request.h"
#include "Common/File/PathBrowser.h"
#include "Common/UI/PopupScreens.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Common.h"
@@ -270,7 +271,7 @@ static bool LoadGameList(const Path &url, std::vector<Path> &games) {
return !games.empty();
}
RemoteISOScreen::RemoteISOScreen(const Path &filename) : TabbedUIDialogScreenWithGameBackground(filename) {}
RemoteISOScreen::RemoteISOScreen(const Path &filename) : UITabbedBaseDialogScreen(filename) {}
void RemoteISOScreen::CreateTabs() {
@@ -287,7 +288,7 @@ void RemoteISOScreen::CreateTabs() {
}
void RemoteISOScreen::update() {
TabbedUIDialogScreenWithGameBackground::update();
UITabbedBaseDialogScreen::update();
frameCount_++;
@@ -499,7 +500,7 @@ void RemoteISOConnectScreen::CreateViews() {
void RemoteISOConnectScreen::update() {
auto ri = GetI18NCategory(I18NCat::REMOTEISO);
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
ScanStatus s = GetStatus();
switch (s) {
+3 -3
View File
@@ -22,11 +22,11 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/MainScreen.h"
#include "UI/TabbedDialogScreen.h"
class RemoteISOScreen : public TabbedUIDialogScreenWithGameBackground {
class RemoteISOScreen : public UITabbedBaseDialogScreen {
public:
RemoteISOScreen(const Path &filename);
@@ -62,7 +62,7 @@ enum class ScanStatus {
LOADED,
};
class RemoteISOConnectScreen : public UIDialogScreenWithBackground {
class RemoteISOConnectScreen : public UIBaseDialogScreen {
public:
RemoteISOConnectScreen();
~RemoteISOConnectScreen();
+3 -3
View File
@@ -22,9 +22,7 @@
#include "Common/GPU/thin3d.h"
#include "Common/UI/AsyncImageFileView.h"
#include "Common/UI/Context.h"
#include "UI/PauseScreen.h"
#include "UI/ReportScreen.h"
#include "Common/UI/ScrollView.h"
#include "Common/Data/Text/I18n.h"
#include "Common/File/FileUtil.h"
#include "Common/Log.h"
@@ -36,6 +34,8 @@
#include "Core/Reporting.h"
#include "Core/Screenshot.h"
#include "Core/System.h"
#include "UI/PauseScreen.h"
#include "UI/ReportScreen.h"
using namespace UI;
+1 -1
View File
@@ -21,7 +21,7 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "Common/File/Path.h"
enum class ReportingOverallScore : int {
+5 -4
View File
@@ -1,11 +1,12 @@
#include "Common/Data/Text/I18n.h"
#include "Common/System/OSD.h"
#include "Common/System/Request.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/TabHolder.h"
#include "Common/UI/Context.h"
#include "Common/Data/Text/I18n.h"
#include "Common/UI/IconCache.h"
#include "Common/UI/PopupScreens.h"
#include "Common/StringUtils.h"
#include "Core/Config.h"
@@ -177,7 +178,7 @@ RetroAchievementsLeaderboardScreen::~RetroAchievementsLeaderboardScreen() {
}
RetroAchievementsLeaderboardScreen::RetroAchievementsLeaderboardScreen(const Path &gamePath, int leaderboardID)
: TabbedUIDialogScreenWithGameBackground(gamePath), leaderboardID_(leaderboardID) {
: UITabbedBaseDialogScreen(gamePath), leaderboardID_(leaderboardID) {
FetchEntries();
}
@@ -253,7 +254,7 @@ void RetroAchievementsLeaderboardScreen::Poll() {
}
void RetroAchievementsLeaderboardScreen::update() {
TabbedUIDialogScreenWithGameBackground::update();
UITabbedBaseDialogScreen::update();
Poll();
}
@@ -279,7 +280,7 @@ void RetroAchievementsSettingsScreen::CreateTabs() {
}
void RetroAchievementsSettingsScreen::sendMessage(UIMessage message, const char *value) {
TabbedUIDialogScreenWithGameBackground::sendMessage(message, value);
UITabbedBaseDialogScreen::sendMessage(message, value);
if (message == UIMessage::ACHIEVEMENT_LOGIN_STATE_CHANGE) {
RecreateViews();
+6 -6
View File
@@ -7,15 +7,15 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "Core/RetroAchievements.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/TabbedDialogScreen.h"
#include "ext/rcheevos/include/rc_client.h"
// Lists the achievements and leaderboards for one game.
class RetroAchievementsListScreen : public TabbedUIDialogScreenWithGameBackground {
class RetroAchievementsListScreen : public UITabbedBaseDialogScreen {
public:
RetroAchievementsListScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
RetroAchievementsListScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
const char *tag() const override { return "RetroAchievementsListScreen"; }
void CreateTabs() override;
@@ -30,9 +30,9 @@ private:
};
// Lets you manage your account, and shows some achievement stats and stuff.
class RetroAchievementsSettingsScreen : public TabbedUIDialogScreenWithGameBackground {
class RetroAchievementsSettingsScreen : public UITabbedBaseDialogScreen {
public:
RetroAchievementsSettingsScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
RetroAchievementsSettingsScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
~RetroAchievementsSettingsScreen();
const char *tag() const override { return "RetroAchievementsSettingsScreen"; }
@@ -50,7 +50,7 @@ private:
std::string password_;
};
class RetroAchievementsLeaderboardScreen : public TabbedUIDialogScreenWithGameBackground {
class RetroAchievementsLeaderboardScreen : public UITabbedBaseDialogScreen {
public:
RetroAchievementsLeaderboardScreen(const Path &gamePath, int leaderboardID);
~RetroAchievementsLeaderboardScreen();
+2 -2
View File
@@ -26,7 +26,6 @@
#include "Common/Data/Text/Parsers.h"
#include "Common/System/NativeApp.h"
#include "Common/System/Request.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/UI/Context.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
@@ -35,6 +34,7 @@
#include "UI/MainScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/PauseScreen.h"
#include "UI/MiscScreens.h"
#include "Common/File/FileUtil.h"
#include "Common/TimeUtil.h"
@@ -711,7 +711,7 @@ void SavedataScreen::dialogFinished(const Screen *dialog, DialogResult result) {
}
void SavedataScreen::sendMessage(UIMessage message, const char *value) {
UIDialogScreenWithGameBackground::sendMessage(message, value);
UIBaseDialogScreen::sendMessage(message, value);
if (message == UIMessage::SAVEDATA_SEARCH) {
EnsureTabs();
+3 -3
View File
@@ -26,7 +26,7 @@
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/GameInfoCache.h"
#include "UI/TabbedDialogScreen.h"
@@ -67,10 +67,10 @@ private:
bool searchPending_ = false;
};
class SavedataScreen : public TabbedUIDialogScreenWithGameBackground {
class SavedataScreen : public UITabbedBaseDialogScreen {
public:
// gamePath can be empty, in that case this screen will show all savedata in the save directory.
SavedataScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
SavedataScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
~SavedataScreen();
void dialogFinished(const Screen *dialog, DialogResult result) override;
+3 -4
View File
@@ -21,6 +21,7 @@
#include "Common/UI/Context.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/IconCache.h"
#include "Common/UI/ScrollView.h"
#include "Common/Render/DrawBuffer.h"
#include "Common/Log.h"
@@ -436,7 +437,7 @@ StoreScreen::~StoreScreen() {
// Handle async download tasks
void StoreScreen::update() {
UIDialogScreenWithBackground::update();
UIBaseDialogScreen::update();
g_DownloadManager.Update();
@@ -515,7 +516,7 @@ void StoreScreen::CreateViews() {
// Top bar
LinearLayout *topBar = root_->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, 64.0f)));
topBar->Add(new Choice(di->T("Back"), new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
topBar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
titleText_ = new TextView(mm->T("PPSSPP Homebrew Store"), ALIGN_VCENTER, false, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT));
titleText_->SetTextColor(screenManager()->getUIContext()->GetTheme().itemDownStyle.fgColor);
topBar->Add(titleText_);
@@ -528,9 +529,7 @@ void StoreScreen::CreateViews() {
content->Add(new TextView(loading_ ? std::string(st->T("Loading...")) : StringFromFormat("%s: %d", st->T_cstr("Connection Error"), resultCode_)));
if (!loading_) {
content->Add(new Button(di->T("Retry")))->OnClick.Handle(this, &StoreScreen::OnRetry);
}
content->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
scrollItemView_ = nullptr;
productPanel_ = nullptr;
+2 -2
View File
@@ -23,7 +23,7 @@
#include "Common/UI/ViewGroup.h"
#include "Common/Net/HTTPClient.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
// Game screen: Allows you to start a game, delete saves, delete the game,
// set game specific settings, etc.
@@ -60,7 +60,7 @@ struct StoreEntry {
u64 size;
};
class StoreScreen : public UIDialogScreenWithBackground {
class StoreScreen : public UIBaseDialogScreen {
public:
StoreScreen();
~StoreScreen();
+3 -2
View File
@@ -16,18 +16,19 @@
#include "Common/Data/Text/Parsers.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Render/Text/draw_text.h"
#include "Common/System/Request.h"
#include "Common/UI/Context.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "GPU/GPUState.h" // ugh
#include "UI/SystemInfoScreen.h"
#include "UI/IconCache.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/OnScreenDisplay.h"
#include "android/jni/app-android.h"
void SystemInfoScreen::update() {
TabbedUIDialogScreenWithGameBackground::update();
UITabbedBaseDialogScreen::update();
g_OSD.NudgeSidebar();
}
+2 -2
View File
@@ -7,9 +7,9 @@
#include "Common/UI/UIScreen.h"
#include "UI/TabbedDialogScreen.h"
class SystemInfoScreen : public TabbedUIDialogScreenWithGameBackground {
class SystemInfoScreen : public UITabbedBaseDialogScreen {
public:
SystemInfoScreen(const Path &filename) : TabbedUIDialogScreenWithGameBackground(filename) {}
SystemInfoScreen(const Path &filename) : UITabbedBaseDialogScreen(filename) {}
const char *tag() const override { return "SystemInfo"; }
+15 -9
View File
@@ -1,16 +1,22 @@
#include <algorithm>
#include "Common/Data/Text/I18n.h"
#include "Common/StringUtils.h"
#include "Common/System/NativeApp.h"
#include "Common/System/Request.h"
#include "Common/System/Display.h"
#include "Common/UI/TabHolder.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/ScrollView.h"
#include "Common/UI/PopupScreens.h"
#include "UI/MiscViews.h"
#include "UI/TabbedDialogScreen.h"
void TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string_view title, std::function<void(UI::LinearLayout *)> createCallback, TabFlags flags) {
void UITabbedBaseDialogScreen::AddTab(const char *tag, std::string_view title, std::function<void(UI::LinearLayout *)> createCallback, TabFlags flags) {
using namespace UI;
tabHolder_->AddTabDeferred(title, [createCallback = std::move(createCallback), tag, flags]() -> UI::ViewGroup * {
using namespace UI;
ViewGroup *scroll = nullptr;
if (!(flags & TabFlags::NonScrollable)) {
scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
@@ -28,7 +34,7 @@ void TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string
});
}
void TabbedUIDialogScreenWithGameBackground::CreateViews() {
void UITabbedBaseDialogScreen::CreateViews() {
PreCreateViews();
bool portrait = UsePortraitLayout() || ForceHorizontalTabs();
@@ -104,8 +110,8 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
}
}
void TabbedUIDialogScreenWithGameBackground::sendMessage(UIMessage message, const char *value) {
UIDialogScreenWithGameBackground::sendMessage(message, value);
void UITabbedBaseDialogScreen::sendMessage(UIMessage message, const char *value) {
UIBaseDialogScreen::sendMessage(message, value);
if (message == UIMessage::GAMESETTINGS_SEARCH) {
std::string filter = value ? value : "";
searchFilter_.resize(filter.size());
@@ -115,27 +121,27 @@ void TabbedUIDialogScreenWithGameBackground::sendMessage(UIMessage message, cons
}
}
void TabbedUIDialogScreenWithGameBackground::RecreateViews() {
void UITabbedBaseDialogScreen::RecreateViews() {
oldSettingInfo_ = settingInfo_ ? settingInfo_->GetText() : "N/A";
UIScreen::RecreateViews();
}
void TabbedUIDialogScreenWithGameBackground::EnsureTabs() {
void UITabbedBaseDialogScreen::EnsureTabs() {
_dbg_assert_(tabHolder_);
if (tabHolder_) {
tabHolder_->EnsureAllCreated();
}
}
int TabbedUIDialogScreenWithGameBackground::GetCurrentTab() const {
int UITabbedBaseDialogScreen::GetCurrentTab() const {
return tabHolder_->GetCurrentTab();
}
void TabbedUIDialogScreenWithGameBackground::SetCurrentTab(int tab) {
void UITabbedBaseDialogScreen::SetCurrentTab(int tab) {
tabHolder_->SetCurrentTab(tab);
}
void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
void UITabbedBaseDialogScreen::ApplySearchFilter() {
using namespace UI;
auto se = GetI18NCategory(I18NCat::SEARCH);
+5 -3
View File
@@ -6,7 +6,9 @@
#include "Common/UI/UIScreen.h"
#include "Common/System/System.h"
#include "Core/ConfigValues.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
class SettingInfoMessage;
namespace UI {
class TabHolder;
@@ -18,9 +20,9 @@ enum class TabFlags {
};
ENUM_CLASS_BITOPS(TabFlags);
class TabbedUIDialogScreenWithGameBackground : public UIDialogScreenWithGameBackground {
class UITabbedBaseDialogScreen : public UIBaseDialogScreen {
public:
TabbedUIDialogScreenWithGameBackground(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
UITabbedBaseDialogScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {
ignoreBottomInset_ = true;
}
+3 -1
View File
@@ -23,6 +23,8 @@
#include "Common/Math/math_util.h"
#include "Common/Log.h"
#include "Common/Data/Text/I18n.h"
#include "Common/UI/ScrollView.h"
#include "Common/UI/PopupScreens.h"
#include "UI/JoystickHistoryView.h"
#include "UI/GamepadEmu.h"
@@ -151,7 +153,7 @@ void TiltAnalogSettingsScreen::OnCalibrate(UI::EventParams &e) {
}
void TiltAnalogSettingsScreen::update() {
UIDialogScreenWithGameBackground::update();
UIBaseDialogScreen::update();
if (tilt_) {
tilt_->SetXY(
Clamp(TiltEventProcessor::rawTiltAnalogX, -1.0f, 1.0f),
+3 -3
View File
@@ -19,14 +19,14 @@
#include "Common/Math/math_util.h"
#include "Common/UI/View.h"
#include "MiscScreens.h"
#include "BaseScreens.h"
class JoystickHistoryView;
class GamepadView;
class TiltAnalogSettingsScreen : public UIDialogScreenWithGameBackground {
class TiltAnalogSettingsScreen : public UIBaseDialogScreen {
public:
TiltAnalogSettingsScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}
TiltAnalogSettingsScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {}
void CreateViews() override;
void update() override;
+2 -1
View File
@@ -24,6 +24,7 @@
#include "Common/Math/math_util.h"
#include "Common/System/Display.h"
#include "Common/UI/Context.h"
#include "Common/UI/PopupScreens.h"
#include "Common/CommonTypes.h"
#include "Common/Log.h"
@@ -605,7 +606,7 @@ void TouchControlLayoutScreen::OnMode(UI::EventParams &e) {
}
void TouchControlLayoutScreen::update() {
UIDialogScreenWithGameBackground::update();
UIBaseDialogScreen::update();
if (!layoutView_) {
return;
+3 -3
View File
@@ -20,13 +20,13 @@
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/TabHolder.h"
#include "MiscScreens.h"
#include "BaseScreens.h"
class ControlLayoutView;
class TouchControlLayoutScreen : public UIDialogScreenWithGameBackground {
class TouchControlLayoutScreen : public UIBaseDialogScreen {
public:
TouchControlLayoutScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}
TouchControlLayoutScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {}
void CreateViews() override;
void dialogFinished(const Screen *dialog, DialogResult result) override;
+2 -1
View File
@@ -15,11 +15,12 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/UI/TabHolder.h"
#include "Common/System/Display.h"
#include "Common/Render/TextureAtlas.h"
#include "Common/Data/Text/I18n.h"
#include "Common/StringUtils.h"
#include "Common/UI/TabHolder.h"
#include "Common/UI/PopupScreens.h"
#include "Core/Config.h"
+7 -5
View File
@@ -17,8 +17,10 @@
#pragma once
#include <vector>
#include <string>
#include "Common/Render/TextureAtlas.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "UI/TabbedDialogScreen.h"
namespace UI {
@@ -32,9 +34,9 @@ struct TouchButtonToggle {
std::function<void(UI::EventParams&)> handle;
};
class TouchControlVisibilityScreen : public TabbedUIDialogScreenWithGameBackground {
class TouchControlVisibilityScreen : public UITabbedBaseDialogScreen {
public:
TouchControlVisibilityScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
TouchControlVisibilityScreen(const Path &gamePath) : UITabbedBaseDialogScreen(gamePath) {}
void CreateTabs() override;
void onFinish(DialogResult result) override;
@@ -49,9 +51,9 @@ private:
bool nextToggleAll_ = true;
};
class RightAnalogMappingScreen : public UIDialogScreenWithGameBackground {
class RightAnalogMappingScreen : public UIBaseDialogScreen {
public:
RightAnalogMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}
RightAnalogMappingScreen(const Path &gamePath) : UIBaseDialogScreen(gamePath) {}
void CreateViews() override;
const char *tag() const override { return "RightAnalogMapping"; }
+4
View File
@@ -27,7 +27,9 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Background.cpp" />
<ClCompile Include="BackgroundAudio.cpp" />
<ClCompile Include="BaseScreens.cpp" />
<ClCompile Include="ChatScreen.cpp" />
<ClCompile Include="ControlMappingScreen.cpp" />
<ClCompile Include="CustomButtonMappingScreen.cpp" />
@@ -80,7 +82,9 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="AudioCommon.h" />
<ClInclude Include="Background.h" />
<ClInclude Include="BackgroundAudio.h" />
<ClInclude Include="BaseScreens.h" />
<ClInclude Include="ChatScreen.h" />
<ClInclude Include="ControlMappingScreen.h" />
<ClInclude Include="CustomButtonMappingScreen.h" />
+12
View File
@@ -135,6 +135,12 @@
<ClCompile Include="MiscViews.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="BaseScreens.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="Background.cpp">
<Filter>Screens</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameInfoCache.h" />
@@ -270,6 +276,12 @@
<ClInclude Include="MiscViews.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="BaseScreens.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="Background.h">
<Filter>Screens</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Screens">
+1
View File
@@ -4,6 +4,7 @@
#include "Common/File/DiskFree.h"
#include "Common/StringUtils.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Data/Text/I18n.h"
#include "Core/WebServer.h"
#include "UI/UploadScreen.h"
#include "UI/MiscViews.h"
+2 -2
View File
@@ -25,13 +25,13 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/BaseScreens.h"
#include "Common/TimeUtil.h"
// Upload screen: Shows the user an ip address to go to in a web browser on the same network,
// in order to upload game files to the current directory.
class UploadScreen : public UIDialogScreenWithBackground {
class UploadScreen : public UIBaseDialogScreen {
public:
UploadScreen(const Path &targetFolder);
~UploadScreen();
+4
View File
@@ -86,7 +86,9 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\UI\AudioCommon.h" />
<ClInclude Include="..\..\UI\Background.h" />
<ClInclude Include="..\..\UI\BackgroundAudio.h" />
<ClInclude Include="..\..\UI\BaseScreens.h" />
<ClInclude Include="..\..\UI\ChatScreen.h" />
<ClInclude Include="..\..\UI\ControlMappingScreen.h" />
<ClInclude Include="..\..\UI\CustomButtonMappingScreen.h" />
@@ -139,7 +141,9 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\UI\AudioCommon.cpp" />
<ClCompile Include="..\..\UI\Background.cpp" />
<ClCompile Include="..\..\UI\BackgroundAudio.cpp" />
<ClCompile Include="..\..\UI\BaseScreens.cpp" />
<ClCompile Include="..\..\UI\ChatScreen.cpp" />
<ClCompile Include="..\..\UI\ControlMappingScreen.cpp" />
<ClCompile Include="..\..\UI\CustomButtonMappingScreen.cpp" />
+4
View File
@@ -130,6 +130,8 @@
<ClCompile Include="..\..\UI\MiscViews.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="..\..\UI\Background.cpp" />
<ClCompile Include="..\..\UI\BaseScreens.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
@@ -261,6 +263,8 @@
<ClInclude Include="..\..\UI\MiscViews.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="..\..\UI\Background.h" />
<ClInclude Include="..\..\UI\BaseScreens.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="ImDebugger">
+2
View File
@@ -931,6 +931,8 @@ LOCAL_SRC_FILES := \
$(SRC)/UI/TiltAnalogSettingsScreen.cpp \
$(SRC)/UI/TouchControlLayoutScreen.cpp \
$(SRC)/UI/TouchControlVisibilityScreen.cpp \
$(SRC)/UI/BaseScreens.cpp \
$(SRC)/UI/Background.cpp \
$(SRC)/UI/CwCheatScreen.cpp \
$(SRC)/UI/InstallZipScreen.cpp \
$(SRC)/UI/JitCompareScreen.cpp \