mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 10:04:39 +00:00
Removing Pause and Fullscreen buttons + Hiding Play button when game is running and Creating a Tip for them on game start.
This commit is contained in:
parent
e7ba1cb303
commit
903400328c
@ -29,6 +29,9 @@ using L = ::Core::Devtools::Layer;
|
||||
static bool show_simple_fps = false;
|
||||
static bool visibility_toggled = false;
|
||||
|
||||
static bool show_fullscreen_tip = true;
|
||||
static float fullscreen_tip_timer = 5.0f;
|
||||
|
||||
static float fps_scale = 1.0f;
|
||||
static int dump_frame_count = 1;
|
||||
|
||||
@ -360,6 +363,18 @@ void L::Draw() {
|
||||
const auto io = GetIO();
|
||||
PushID("DevtoolsLayer");
|
||||
|
||||
if (show_fullscreen_tip) {
|
||||
fullscreen_tip_timer -= io.DeltaTime;
|
||||
if (fullscreen_tip_timer <= 0.0f) {
|
||||
show_fullscreen_tip = false;
|
||||
} else {
|
||||
// Display the fullscreen tip near the top-left corner, below pause message if needed
|
||||
ImVec2 pos(10, 30); // adjust Y so it doesn't overlap pause text at y=10
|
||||
ImU32 color = IM_COL32(255, 255, 255, 255);
|
||||
ImGui::GetForegroundDrawList()->AddText(
|
||||
pos, color, "Press F11 to toggle FullScreen and F9 to Pause Emulation");
|
||||
}
|
||||
}
|
||||
if (!DebugState.IsGuestThreadsPaused()) {
|
||||
const auto fn = DebugState.flip_frame_count.load();
|
||||
frame_graph.AddFrame(fn, DebugState.FrameDeltaTime);
|
||||
|
@ -130,15 +130,6 @@ void MainWindow::CreateActions() {
|
||||
m_theme_act_group->addAction(ui->setThemeOled);
|
||||
}
|
||||
|
||||
void MainWindow::PauseGame() {
|
||||
SDL_Event event;
|
||||
SDL_memset(&event, 0, sizeof(event));
|
||||
event.type = SDL_EVENT_TOGGLE_PAUSE;
|
||||
is_paused = !is_paused;
|
||||
UpdateToolbarButtons();
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void MainWindow::toggleLabelsUnderIcons() {
|
||||
bool showLabels = ui->toggleLabelsAct->isChecked();
|
||||
m_gui_settings->SetValue(gui::mw_showLabelsUnderIcons, showLabels);
|
||||
@ -148,13 +139,6 @@ void MainWindow::toggleLabelsUnderIcons() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleFullscreen() {
|
||||
SDL_Event event;
|
||||
SDL_memset(&event, 0, sizeof(event));
|
||||
event.type = SDL_EVENT_TOGGLE_FULLSCREEN;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createButtonWithLabel(QPushButton* button, const QString& labelText,
|
||||
bool showLabel) {
|
||||
QWidget* container = new QWidget(this);
|
||||
@ -194,13 +178,11 @@ void MainWindow::AddUiWidgets() {
|
||||
|
||||
ui->toolBar->addWidget(createSpacer(this));
|
||||
ui->toolBar->addWidget(createButtonWithLabel(ui->playButton, tr("Play"), showLabels));
|
||||
ui->toolBar->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause"), showLabels));
|
||||
ui->toolBar->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop"), showLabels));
|
||||
ui->toolBar->addWidget(createButtonWithLabel(ui->restartButton, tr("Restart"), showLabels));
|
||||
ui->toolBar->addWidget(createSpacer(this));
|
||||
ui->toolBar->addWidget(createButtonWithLabel(ui->settingsButton, tr("Settings"), showLabels));
|
||||
ui->toolBar->addWidget(
|
||||
createButtonWithLabel(ui->fullscreenButton, tr("Full Screen"), showLabels));
|
||||
|
||||
ui->toolBar->addWidget(createSpacer(this));
|
||||
ui->toolBar->addWidget(
|
||||
createButtonWithLabel(ui->controllerButton, tr("Controllers"), showLabels));
|
||||
@ -212,12 +194,7 @@ void MainWindow::AddUiWidgets() {
|
||||
line->setMinimumWidth(2);
|
||||
ui->toolBar->addWidget(line);
|
||||
ui->toolBar->addWidget(createSpacer(this));
|
||||
if (showLabels) {
|
||||
QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild<QLabel*>();
|
||||
if (pauseButtonLabel) {
|
||||
pauseButtonLabel->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
ui->toolBar->addWidget(
|
||||
createButtonWithLabel(ui->refreshButton, tr("Refresh List"), showLabels));
|
||||
ui->toolBar->addWidget(createSpacer(this));
|
||||
@ -243,41 +220,24 @@ void MainWindow::AddUiWidgets() {
|
||||
if (!showLabels) {
|
||||
toolbarLayout->addWidget(searchSliderContainer);
|
||||
}
|
||||
|
||||
ui->playButton->setVisible(true);
|
||||
ui->pauseButton->setVisible(false);
|
||||
}
|
||||
|
||||
void MainWindow::UpdateToolbarButtons() {
|
||||
// add toolbar widgets when game is running
|
||||
bool showLabels = ui->toggleLabelsAct->isChecked();
|
||||
|
||||
ui->playButton->setVisible(false);
|
||||
ui->pauseButton->setVisible(true);
|
||||
|
||||
if (showLabels) {
|
||||
QLabel* playButtonLabel = ui->playButton->parentWidget()->findChild<QLabel*>();
|
||||
if (playButtonLabel)
|
||||
playButtonLabel->setVisible(false);
|
||||
}
|
||||
|
||||
if (is_paused) {
|
||||
ui->pauseButton->setIcon(ui->playButton->icon());
|
||||
ui->pauseButton->setToolTip(tr("Resume"));
|
||||
} else {
|
||||
if (isIconBlack) {
|
||||
ui->pauseButton->setIcon(QIcon(":images/pause_icon.png"));
|
||||
} else {
|
||||
ui->pauseButton->setIcon(RecolorIcon(QIcon(":images/pause_icon.png"), isWhite));
|
||||
if (isGameRunning) {
|
||||
ui->playButton->setVisible(false);
|
||||
if (showLabels) {
|
||||
QLabel* playButtonLabel = ui->playButton->parentWidget()->findChild<QLabel*>();
|
||||
if (playButtonLabel)
|
||||
playButtonLabel->setVisible(false);
|
||||
}
|
||||
ui->pauseButton->setToolTip(tr("Pause"));
|
||||
}
|
||||
|
||||
if (showLabels) {
|
||||
QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild<QLabel*>();
|
||||
if (pauseButtonLabel) {
|
||||
pauseButtonLabel->setText(is_paused ? tr("Resume") : tr("Pause"));
|
||||
pauseButtonLabel->setVisible(true);
|
||||
} else {
|
||||
ui->playButton->setVisible(true);
|
||||
if (showLabels) {
|
||||
QLabel* playButtonLabel = ui->playButton->parentWidget()->findChild<QLabel*>();
|
||||
if (playButtonLabel)
|
||||
playButtonLabel->setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -375,7 +335,6 @@ void MainWindow::CreateConnects() {
|
||||
connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::RefreshGameTable);
|
||||
connect(ui->showGameListAct, &QAction::triggered, this, &MainWindow::ShowGameList);
|
||||
connect(ui->toggleLabelsAct, &QAction::toggled, this, &MainWindow::toggleLabelsUnderIcons);
|
||||
connect(ui->fullscreenButton, &QPushButton::clicked, this, &MainWindow::toggleFullscreen);
|
||||
|
||||
connect(ui->sizeSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||
if (isTableList) {
|
||||
@ -400,7 +359,6 @@ void MainWindow::CreateConnects() {
|
||||
|
||||
connect(ui->playButton, &QPushButton::clicked, this, &MainWindow::StartGame);
|
||||
connect(ui->stopButton, &QPushButton::clicked, this, &MainWindow::StopGame);
|
||||
connect(ui->pauseButton, &QPushButton::clicked, this, &MainWindow::PauseGame);
|
||||
connect(ui->restartButton, &QPushButton::clicked, this, &MainWindow::RestartGame);
|
||||
connect(m_game_grid_frame.get(), &QTableWidget::cellDoubleClicked, this,
|
||||
&MainWindow::StartGame);
|
||||
@ -1115,12 +1073,10 @@ void MainWindow::SetUiIcons(bool isWhite) {
|
||||
ui->menuGame_List_Icons->setIcon(RecolorIcon(ui->menuGame_List_Icons->icon(), isWhite));
|
||||
ui->menuUtils->setIcon(RecolorIcon(ui->menuUtils->icon(), isWhite));
|
||||
ui->playButton->setIcon(RecolorIcon(ui->playButton->icon(), isWhite));
|
||||
ui->pauseButton->setIcon(RecolorIcon(ui->pauseButton->icon(), isWhite));
|
||||
ui->stopButton->setIcon(RecolorIcon(ui->stopButton->icon(), isWhite));
|
||||
ui->refreshButton->setIcon(RecolorIcon(ui->refreshButton->icon(), isWhite));
|
||||
ui->restartButton->setIcon(RecolorIcon(ui->restartButton->icon(), isWhite));
|
||||
ui->settingsButton->setIcon(RecolorIcon(ui->settingsButton->icon(), isWhite));
|
||||
ui->fullscreenButton->setIcon(RecolorIcon(ui->fullscreenButton->icon(), isWhite));
|
||||
ui->controllerButton->setIcon(RecolorIcon(ui->controllerButton->icon(), isWhite));
|
||||
ui->keyboardButton->setIcon(RecolorIcon(ui->keyboardButton->icon(), isWhite));
|
||||
ui->refreshGameListAct->setIcon(RecolorIcon(ui->refreshGameListAct->icon(), isWhite));
|
||||
|
@ -38,7 +38,6 @@ public:
|
||||
void InstallDirectory();
|
||||
void StartGame();
|
||||
void StartGameWithPath(const QString&);
|
||||
void PauseGame();
|
||||
bool showLabels;
|
||||
void StopGame();
|
||||
void RestartGame();
|
||||
@ -63,7 +62,6 @@ private:
|
||||
void UpdateToolbarButtons();
|
||||
QWidget* createButtonWithLabel(QPushButton* button, const QString& labelText, bool showLabel);
|
||||
void CreateActions();
|
||||
void toggleFullscreen();
|
||||
void CreateRecentGameActions();
|
||||
void CreateDockWindows();
|
||||
void LoadGameLists();
|
||||
|
@ -43,13 +43,11 @@ public:
|
||||
QWidget* centralWidget;
|
||||
QLineEdit* mw_searchbar;
|
||||
QPushButton* playButton;
|
||||
QPushButton* pauseButton;
|
||||
QPushButton* stopButton;
|
||||
QPushButton* refreshButton;
|
||||
QPushButton* settingsButton;
|
||||
QPushButton* controllerButton;
|
||||
QPushButton* keyboardButton;
|
||||
QPushButton* fullscreenButton;
|
||||
QPushButton* restartButton;
|
||||
|
||||
QWidget* sizeSliderContainer;
|
||||
@ -200,10 +198,6 @@ public:
|
||||
playButton->setFlat(true);
|
||||
playButton->setIcon(QIcon(":images/play_icon.png"));
|
||||
playButton->setIconSize(QSize(40, 40));
|
||||
pauseButton = new QPushButton(centralWidget);
|
||||
pauseButton->setFlat(true);
|
||||
pauseButton->setIcon(QIcon(":images/pause_icon.png"));
|
||||
pauseButton->setIconSize(QSize(40, 40));
|
||||
stopButton = new QPushButton(centralWidget);
|
||||
stopButton->setFlat(true);
|
||||
stopButton->setIcon(QIcon(":images/stop_icon.png"));
|
||||
@ -212,10 +206,6 @@ public:
|
||||
refreshButton->setFlat(true);
|
||||
refreshButton->setIcon(QIcon(":images/refreshlist_icon.png"));
|
||||
refreshButton->setIconSize(QSize(40, 40));
|
||||
fullscreenButton = new QPushButton(centralWidget);
|
||||
fullscreenButton->setFlat(true);
|
||||
fullscreenButton->setIcon(QIcon(":images/fullscreen_icon.png"));
|
||||
fullscreenButton->setIconSize(QSize(38, 38));
|
||||
settingsButton = new QPushButton(centralWidget);
|
||||
settingsButton->setFlat(true);
|
||||
settingsButton->setIcon(QIcon(":images/settings_icon.png"));
|
||||
|
Loading…
Reference in New Issue
Block a user