Better splash screen

This commit is contained in:
antopilo
2025-04-17 23:18:11 -04:00
parent 5c5289ee73
commit 4052c14567
5 changed files with 22 additions and 16 deletions

BIN
Data/Images/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@@ -2593,7 +2593,7 @@ namespace Nuake {
if (_WelcomeWindow->IsProjectQueued() && frameCount > 0)
{
// draw splash
LoadingSplash::Get().Draw();
LoadingSplash::Get().Draw(_WelcomeWindow->queuedProjectPath);
frameCount--;
if (frameCount == 0)

View File

@@ -4,7 +4,7 @@
#include <Nuake/Core/Maths.h>
#include "Nuake/Window.h"
#include "Nuake/UI/ImUI.h"
#include <imgui/imgui.h>
@@ -16,15 +16,15 @@ using namespace Nuake;
LoadingSplash::LoadingSplash()
{
_NuakeLogo = Nuake::TextureManager::Get()->GetTexture2(NUAKE_LOGO_PATH);
_NuakeSplash = Nuake::TextureManager::Get()->GetTexture2(NUAKE_SPLASH_PATH);
Nuake::Window::Get()->SetDecorated(false);
Nuake::Window::Get()->SetSize({ 640, 480 });
Nuake::Window::Get()->SetSize({ 640, 400 });
Nuake::Window::Get()->Center();
}
void LoadingSplash::Draw()
void LoadingSplash::Draw(const std::string& project)
{
// Make viewport fullscreen
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
@@ -32,17 +32,22 @@ void LoadingSplash::Draw()
ImGui::SetNextWindowViewport(viewport->ID);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(32.0f, 32.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("Welcome Screen", 0, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize);
{
// Draw Nuake logo
{
const Vector2 logoSize = _NuakeLogo->GetSize();
const ImVec2 imguiSize = ImVec2(logoSize.x, logoSize.y);
ImGui::Image((ImTextureID)_NuakeLogo->GetImGuiDescriptorSet(), imguiSize);
}
const Vector2 splashSize = _NuakeSplash->GetSize();
const ImVec2 splashImguiSize = ImVec2(splashSize.x, splashSize.y);
ImGui::Image((ImTextureID)_NuakeSplash->GetImGuiDescriptorSet(), splashImguiSize, {0, 1}, {1, 0});
ImGui::Text("LOADING SCENE...");
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 8.0f);
ImGui::SetCursorPosX(8.0f);
{
UIFont font(Fonts::Bold);
ImGui::Text("Loading project... ");
}
ImGui::SetCursorPosX(8.0f);
ImGui::TextColored({ 1.0, 1.0, 1.0, 0.5 }, project.c_str());
//ImGui::Text(project.c_str());
}
ImGui::End();

View File

@@ -14,8 +14,9 @@ class LoadingSplash
{
private:
const std::string NUAKE_LOGO_PATH = "Resources/Images/logo_white.png";
const std::string NUAKE_SPLASH_PATH = "Resources/Images/splash.png";
Ref<Nuake::VulkanImage> _NuakeLogo;
Ref<Nuake::VulkanImage> _NuakeSplash;
public:
static LoadingSplash& Get()
{
@@ -26,5 +27,5 @@ public:
LoadingSplash();
~LoadingSplash() = default;
void Draw();
void Draw(const std::string& projectPath);
};

View File

@@ -42,10 +42,10 @@ namespace Nuake
int32_t SelectedProject = -1;
std::vector<ProjectPreview> _Projects;
std::string queuedProjectPath;
std::string queuedRemovalPath;
public:
std::string queuedProjectPath;
WelcomeWindow(Nuake::EditorInterface* editor);
~WelcomeWindow() = default;