yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Yuzu UI: Add button for Anti Alias

This commit is contained in:
Fernando Sahmkow 2021-10-22 22:56:08 +02:00
parent 21a8ba0437
commit a96c9c803b
3 changed files with 45 additions and 0 deletions

View File

@ -76,6 +76,7 @@ enum class ScalingFilter : u32 {
enum class AntiAliasing : u32 { enum class AntiAliasing : u32 {
None = 0, None = 0,
Fxaa = 1, Fxaa = 1,
LastAA = Fxaa,
}; };
struct ResolutionScalingInfo { struct ResolutionScalingInfo {

View File

@ -774,6 +774,26 @@ void GMainWindow::InitializeWidgets() {
tas_label->setFocusPolicy(Qt::NoFocus); tas_label->setFocusPolicy(Qt::NoFocus);
statusBar()->insertPermanentWidget(0, tas_label); statusBar()->insertPermanentWidget(0, tas_label);
// setup AA button
aa_status_button = new QPushButton();
aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
aa_status_button->setFocusPolicy(Qt::NoFocus);
connect(aa_status_button, &QPushButton::clicked, [&] {
auto aa_mode = Settings::values.anti_aliasing.GetValue();
if (aa_mode == Settings::AntiAliasing::LastAA) {
aa_mode = Settings::AntiAliasing::None;
} else {
aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1);
}
Settings::values.anti_aliasing.SetValue(aa_mode);
aa_status_button->setChecked(true);
UpdateAAText();
});
UpdateAAText();
aa_status_button->setCheckable(true);
aa_status_button->setChecked(true);
statusBar()->insertPermanentWidget(0, aa_status_button);
// Setup Filter button // Setup Filter button
filter_status_button = new QPushButton(); filter_status_button = new QPushButton();
filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
@ -800,6 +820,7 @@ void GMainWindow::InitializeWidgets() {
} }
UpdateFilterText(); UpdateFilterText();
filter_status_button->setCheckable(true); filter_status_button->setCheckable(true);
filter_status_button->setChecked(true);
statusBar()->insertPermanentWidget(0, filter_status_button); statusBar()->insertPermanentWidget(0, filter_status_button);
// Setup Dock button // Setup Dock button
@ -872,6 +893,11 @@ void GMainWindow::InitializeWidgets() {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan); Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan);
} else { } else {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
const auto filter = Settings::values.scaling_filter.GetValue();
if (filter == Settings::ScalingFilter::Fsr) {
Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor);
UpdateFilterText();
}
} }
system->ApplySettings(); system->ApplySettings();
@ -3088,12 +3114,28 @@ void GMainWindow::UpdateFilterText() {
} }
} }
void GMainWindow::UpdateAAText() {
const auto aa_mode = Settings::values.anti_aliasing.GetValue();
switch (aa_mode) {
case Settings::AntiAliasing::Fxaa:
aa_status_button->setText(tr("FXAA"));
break;
case Settings::AntiAliasing::None:
aa_status_button->setText(tr("NO AA"));
break;
default:
aa_status_button->setText(tr("FXAA"));
break;
}
}
void GMainWindow::UpdateStatusButtons() { void GMainWindow::UpdateStatusButtons() {
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan); Settings::RendererBackend::Vulkan);
UpdateGPUAccuracyButton(); UpdateGPUAccuracyButton();
UpdateFilterText(); UpdateFilterText();
UpdateAAText();
} }
void GMainWindow::UpdateUISettings() { void GMainWindow::UpdateUISettings() {

View File

@ -303,6 +303,7 @@ private:
void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {},
std::string_view gpu_vendor = {}); std::string_view gpu_vendor = {});
void UpdateFilterText(); void UpdateFilterText();
void UpdateAAText();
void UpdateStatusBar(); void UpdateStatusBar();
void UpdateGPUAccuracyButton(); void UpdateGPUAccuracyButton();
void UpdateStatusButtons(); void UpdateStatusButtons();
@ -338,6 +339,7 @@ private:
QPushButton* renderer_status_button = nullptr; QPushButton* renderer_status_button = nullptr;
QPushButton* dock_status_button = nullptr; QPushButton* dock_status_button = nullptr;
QPushButton* filter_status_button = nullptr; QPushButton* filter_status_button = nullptr;
QPushButton* aa_status_button = nullptr;
QTimer status_bar_update_timer; QTimer status_bar_update_timer;
std::unique_ptr<Config> config; std::unique_ptr<Config> config;