#include "gfx.hpp" #include #include "platform.hpp" int oldWindowX = 0, oldWindowY = 0; void GFX::MakeContextCurrent() { glfwMakeContextCurrent(static_cast(Platform::GetUserData())); glfwSwapInterval(1); } void GFX::SwapBuffers() { glfwSwapBuffers(static_cast(Platform::GetUserData())); } void GFX::GoFullscreen() { GLFWwindow* window = static_cast(Platform::GetUserData()); glfwGetWindowPos(window, &oldWindowX, &oldWindowY); //save window pos for later const GLFWvidmode* videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowMonitor(window, glfwGetPrimaryMonitor(), 0, 0, videoMode->width, videoMode->height, videoMode->refreshRate); } void GFX::ExitFullscreen() { GLFWwindow* window = static_cast(Platform::GetUserData()); if(oldWindowX == 0 || oldWindowY == 0) glfwGetWindowPos(window, &oldWindowX, &oldWindowY); //save window pos glfwSetWindowMonitor(window, nullptr, oldWindowX, oldWindowY, 1600, 900, GLFW_DONT_CARE); } VkSurfaceKHR GFX::CreateVulkanSurface(VkInstance instance) { VkSurfaceKHR surface; glfwCreateWindowSurface(instance, static_cast(Platform::GetUserData()), nullptr, &surface); return surface; }