2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
#pragma once
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "common/progress_callback.h"
|
2021-01-30 11:37:49 +00:00
|
|
|
#include "common/types.h"
|
2021-08-09 13:56:17 +00:00
|
|
|
#include <memory>
|
2022-07-11 13:03:29 +00:00
|
|
|
#include <string>
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2023-09-20 13:49:14 +00:00
|
|
|
class SmallStringBase;
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2022-09-21 12:58:18 +00:00
|
|
|
struct Settings;
|
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
namespace FullscreenUI {
|
2022-07-11 13:03:29 +00:00
|
|
|
bool Initialize();
|
2021-05-14 03:26:06 +00:00
|
|
|
bool IsInitialized();
|
2021-01-30 11:37:49 +00:00
|
|
|
bool HasActiveWindow();
|
2022-09-21 12:58:18 +00:00
|
|
|
void CheckForConfigChanges(const Settings& old_settings);
|
2022-07-11 13:03:29 +00:00
|
|
|
void OnSystemStarted();
|
|
|
|
void OnSystemPaused();
|
|
|
|
void OnSystemResumed();
|
|
|
|
void OnSystemDestroyed();
|
|
|
|
void OnRunningGameChanged();
|
2023-10-31 15:32:29 +00:00
|
|
|
|
|
|
|
#ifndef __ANDROID__
|
2022-07-11 13:03:29 +00:00
|
|
|
void OpenPauseMenu();
|
2023-09-18 12:29:47 +00:00
|
|
|
void OpenAchievementsWindow();
|
2023-09-07 10:13:48 +00:00
|
|
|
bool IsAchievementsWindowOpen();
|
2023-09-18 12:29:47 +00:00
|
|
|
void OpenLeaderboardsWindow();
|
2023-09-07 10:13:48 +00:00
|
|
|
bool IsLeaderboardsWindowOpen();
|
|
|
|
void ReturnToMainWindow();
|
2023-09-18 12:29:47 +00:00
|
|
|
void ReturnToPreviousWindow();
|
2023-10-31 15:32:29 +00:00
|
|
|
#endif
|
2021-06-21 02:10:49 +00:00
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
void Shutdown();
|
|
|
|
void Render();
|
2022-09-09 10:32:21 +00:00
|
|
|
void InvalidateCoverCache();
|
2023-09-20 13:49:14 +00:00
|
|
|
void TimeToPrintableString(SmallStringBase* str, time_t t);
|
2021-03-07 15:39:13 +00:00
|
|
|
|
2021-02-01 15:40:37 +00:00
|
|
|
// Returns true if the message has been dismissed.
|
|
|
|
bool DrawErrorWindow(const char* message);
|
|
|
|
bool DrawConfirmWindow(const char* message, bool* result);
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
class ProgressCallback final : public BaseProgressCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProgressCallback(std::string name);
|
|
|
|
~ProgressCallback() override;
|
|
|
|
|
2022-09-17 05:51:05 +00:00
|
|
|
ALWAYS_INLINE const std::string& GetName() const { return m_name; }
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void PushState() override;
|
|
|
|
void PopState() override;
|
|
|
|
|
|
|
|
void SetCancellable(bool cancellable) override;
|
|
|
|
void SetTitle(const char* title) override;
|
|
|
|
void SetStatusText(const char* text) override;
|
|
|
|
void SetProgressRange(u32 range) override;
|
|
|
|
void SetProgressValue(u32 value) override;
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void DisplayError(const char* message) override;
|
|
|
|
void DisplayWarning(const char* message) override;
|
|
|
|
void DisplayInformation(const char* message) override;
|
|
|
|
void DisplayDebugMessage(const char* message) override;
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void ModalError(const char* message) override;
|
|
|
|
bool ModalConfirmation(const char* message) override;
|
|
|
|
void ModalInformation(const char* message) override;
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void SetCancelled();
|
2021-01-30 11:37:49 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
private:
|
|
|
|
void Redraw(bool force);
|
|
|
|
|
|
|
|
std::string m_name;
|
|
|
|
int m_last_progress_percent = -1;
|
|
|
|
};
|
2021-01-30 11:37:49 +00:00
|
|
|
} // namespace FullscreenUI
|