mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 11:55:37 +00:00
FrontendCommon: Add duck icon to loading screens
This commit is contained in:
parent
defe70794b
commit
5bc61849eb
|
@ -482,7 +482,8 @@ bool QtHostInterface::AcquireHostDisplay()
|
||||||
createImGuiContext(display_widget->devicePixelRatioFromScreen());
|
createImGuiContext(display_widget->devicePixelRatioFromScreen());
|
||||||
|
|
||||||
if (!m_display->MakeRenderContextCurrent() ||
|
if (!m_display->MakeRenderContextCurrent() ||
|
||||||
!m_display->InitializeRenderDevice(GetShaderCacheBasePath(), g_settings.gpu_use_debug_device))
|
!m_display->InitializeRenderDevice(GetShaderCacheBasePath(), g_settings.gpu_use_debug_device) ||
|
||||||
|
!CreateHostDisplayResources())
|
||||||
{
|
{
|
||||||
destroyImGuiContext();
|
destroyImGuiContext();
|
||||||
m_display->DestroyRenderDevice();
|
m_display->DestroyRenderDevice();
|
||||||
|
@ -561,6 +562,7 @@ void QtHostInterface::ReleaseHostDisplay()
|
||||||
{
|
{
|
||||||
Assert(m_display);
|
Assert(m_display);
|
||||||
|
|
||||||
|
ReleaseHostDisplayResources();
|
||||||
m_display->DestroyRenderDevice();
|
m_display->DestroyRenderDevice();
|
||||||
destroyImGuiContext();
|
destroyImGuiContext();
|
||||||
emit destroyDisplayRequested();
|
emit destroyDisplayRequested();
|
||||||
|
|
|
@ -248,11 +248,16 @@ bool SDLHostInterface::AcquireHostDisplay()
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CreateHostDisplayResources())
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLHostInterface::ReleaseHostDisplay()
|
void SDLHostInterface::ReleaseHostDisplay()
|
||||||
{
|
{
|
||||||
|
ReleaseHostDisplayResources();
|
||||||
|
|
||||||
if (m_fullscreen)
|
if (m_fullscreen)
|
||||||
SetFullscreen(false);
|
SetFullscreen(false);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "core/system.h"
|
#include "core/system.h"
|
||||||
#include "core/timers.h"
|
#include "core/timers.h"
|
||||||
#include "game_list.h"
|
#include "game_list.h"
|
||||||
|
#include "icon.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "ini_settings_interface.h"
|
#include "ini_settings_interface.h"
|
||||||
#include "save_state_selector_ui.h"
|
#include "save_state_selector_ui.h"
|
||||||
|
@ -432,6 +433,21 @@ bool CommonHostInterface::SetFullscreen(bool enabled)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommonHostInterface::CreateHostDisplayResources()
|
||||||
|
{
|
||||||
|
m_logo_texture =
|
||||||
|
m_display->CreateTexture(APP_ICON_WIDTH, APP_ICON_HEIGHT, APP_ICON_DATA, sizeof(u32) * APP_ICON_WIDTH, false);
|
||||||
|
if (!m_logo_texture)
|
||||||
|
Log_WarningPrintf("Failed to create logo texture");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommonHostInterface::ReleaseHostDisplayResources()
|
||||||
|
{
|
||||||
|
m_logo_texture.reset();
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<AudioStream> CommonHostInterface::CreateAudioStream(AudioBackend backend)
|
std::unique_ptr<AudioStream> CommonHostInterface::CreateAudioStream(AudioBackend backend)
|
||||||
{
|
{
|
||||||
switch (backend)
|
switch (backend)
|
||||||
|
@ -2035,9 +2051,26 @@ void CommonHostInterface::DisplayLoadingScreen(const char* message, int progress
|
||||||
// ImGui::EndFrame();
|
// ImGui::EndFrame();
|
||||||
// ImGui::NewFrame();
|
// ImGui::NewFrame();
|
||||||
|
|
||||||
|
const float logo_width = static_cast<float>(APP_ICON_WIDTH) * scale;
|
||||||
|
const float logo_height = static_cast<float>(APP_ICON_HEIGHT) * scale;
|
||||||
|
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(logo_width, logo_height), ImGuiCond_Always);
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, (io.DisplaySize.y * 0.5f) - (50.0f * scale)),
|
||||||
|
ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||||
|
if (ImGui::Begin("LoadingScreenLogo", nullptr,
|
||||||
|
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
||||||
|
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav |
|
||||||
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing |
|
||||||
|
ImGuiWindowFlags_NoBackground))
|
||||||
|
{
|
||||||
|
if (m_logo_texture)
|
||||||
|
ImGui::Image(m_logo_texture->GetHandle(), ImVec2(logo_width, logo_height));
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(width, (has_progress ? 50.0f : 30.0f) * scale), ImGuiCond_Always);
|
ImGui::SetNextWindowSize(ImVec2(width, (has_progress ? 50.0f : 30.0f) * scale), ImGuiCond_Always);
|
||||||
ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f), ImGuiCond_Always,
|
ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, (io.DisplaySize.y * 0.5f) + (100.0f * scale)),
|
||||||
ImVec2(0.5f, 0.5f));
|
ImGuiCond_Always, ImVec2(0.5f, 0.0f));
|
||||||
if (ImGui::Begin("LoadingScreen", nullptr,
|
if (ImGui::Begin("LoadingScreen", nullptr,
|
||||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
||||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav |
|
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav |
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class HostDisplayTexture;
|
||||||
|
|
||||||
class ControllerInterface;
|
class ControllerInterface;
|
||||||
|
|
||||||
namespace FrontendCommon {
|
namespace FrontendCommon {
|
||||||
|
@ -296,6 +298,9 @@ protected:
|
||||||
|
|
||||||
void ApplyGameSettings(bool display_osd_messages);
|
void ApplyGameSettings(bool display_osd_messages);
|
||||||
|
|
||||||
|
bool CreateHostDisplayResources();
|
||||||
|
void ReleaseHostDisplayResources();
|
||||||
|
|
||||||
virtual void DrawImGuiWindows();
|
virtual void DrawImGuiWindows();
|
||||||
|
|
||||||
void DrawFPSWindow();
|
void DrawFPSWindow();
|
||||||
|
@ -307,6 +312,8 @@ protected:
|
||||||
|
|
||||||
std::unique_ptr<ControllerInterface> m_controller_interface;
|
std::unique_ptr<ControllerInterface> m_controller_interface;
|
||||||
|
|
||||||
|
std::unique_ptr<HostDisplayTexture> m_logo_texture;
|
||||||
|
|
||||||
std::deque<OSDMessage> m_osd_messages;
|
std::deque<OSDMessage> m_osd_messages;
|
||||||
std::mutex m_osd_messages_lock;
|
std::mutex m_osd_messages_lock;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue