mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-21 11:57:44 +00:00
Qt5 for macOS can actually use the same code as on Linux/Win, but apparently no one wants to build it with Vulkan support. Instead, we spawn a standalone SDL2 window.
20 lines
583 B
C++
20 lines
583 B
C++
#include "standalonewindow.h"
|
|
|
|
#include <SDL.h>
|
|
#include <SDL_vulkan.h>
|
|
|
|
StandaloneWindow::StandaloneWindow(Renderer* renderer) : m_renderer(renderer) {
|
|
SDL_Init(SDL_INIT_EVERYTHING);
|
|
|
|
m_window = SDL_CreateWindow("mdlviewer viewport", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_VULKAN);
|
|
}
|
|
|
|
VkSurfaceKHR StandaloneWindow::getSurface(VkInstance instance) {
|
|
VkSurfaceKHR surface = VK_NULL_HANDLE;
|
|
SDL_Vulkan_CreateSurface(m_window, instance, &surface);
|
|
return surface;
|
|
}
|
|
|
|
void StandaloneWindow::render() {
|
|
m_renderer->render(models);
|
|
}
|