hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/core/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/window.cpp')
-rw-r--r--src/core/window.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/core/window.cpp b/src/core/window.cpp
index cb93d04..0a9ac8b 100644
--- a/src/core/window.cpp
+++ b/src/core/window.cpp
@@ -1,6 +1,7 @@
#include <glad/glad.h>
#include "window.h"
#include "theme_manager.h"
+#include "rendering/renderer.h"
#include <cstdint>
@@ -42,12 +43,19 @@ namespace Donut
DONUT_INFO("GLFW initialized successfully");
}
+ if (RendererAPI::get_api() == RendererAPI::API::Vulkan)
+ {
+ glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
+ }
+ else
+ {
#ifdef __APPLE__
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
+ glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
+ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
#endif
+ }
m_window = glfwCreateWindow(m_width, m_height, m_title.c_str(), nullptr, nullptr);
if (!m_window)
@@ -59,7 +67,8 @@ namespace Donut
DONUT_INFO("GLFW window created successfully");
- glfwMakeContextCurrent(m_window);
+ if (RendererAPI::get_api() != RendererAPI::API::Vulkan)
+ glfwMakeContextCurrent(m_window);
glfwSetWindowUserPointer(m_window, this);
glfwSetErrorCallback(glfw_error_callback);
@@ -96,7 +105,8 @@ namespace Donut
void Window::on_update() const
{
glfwPollEvents();
- glfwSwapBuffers(m_window);
+ if (RendererAPI::get_api() != RendererAPI::API::Vulkan)
+ glfwSwapBuffers(m_window);
}
bool Window::should_close() const
@@ -208,7 +218,7 @@ namespace Donut
void Window::glfw_error_callback(int error, const char* description)
{
- DONUT_ERROR("GLFW Error (", error, "): ", description);
+ DONUT_ERROR("GLFW Error ({}): {}", error, description ? description : "");
}
void Window::glfw_window_close_callback(GLFWwindow* window)