Added splash screen

This commit is contained in:
Antoine Pilote
2023-07-23 00:47:10 -04:00
parent acfe261ab5
commit 0b87dd1585
7 changed files with 176 additions and 20 deletions

View File

@@ -180,6 +180,12 @@ namespace Nuake
glfwSetWindowSize(m_Window, size.x, size.y);
}
void Window::SetPosition(const Vector2& position)
{
m_Position = position;
glfwSetWindowPos(m_Window, position.x, position.y);
}
void Window::SetMonitor(int monitorIdx)
{
int monitorCount;
@@ -193,6 +199,23 @@ namespace Nuake
}
}
void Window::Center()
{
const int windowWidth = 640;
const int windowHeight = 360;
// Get the primary monitor's video mode
const GLFWvidmode* mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
// Calculate the position to center the window
const int xPos = (mode->width - m_Width) / 2;
const int yPos = (mode->height - m_Height) / 2;
// Set the window's position
Nuake::Window::Get()->SetSize({ m_Width, m_Height });
Nuake::Window::Get()->SetPosition({ xPos, yPos });
}
Ref<Scene> Window::GetScene()
{
return m_Scene;
@@ -228,6 +251,11 @@ namespace Nuake
glfwSwapInterval(enabled ? 0 : 1);
}
void Window::SetDecorated(bool enabled)
{
glfwSetWindowAttrib(m_Window, GLFW_DECORATED, enabled);
}
void Window::InitImgui()
{
ImGui::CreateContext();