basic create surface
Some checks failed
Build and Test verification / build (push) Failing after 25s
Build and Test verification / test (push) Has been skipped

This commit is contained in:
2026-05-23 18:29:44 -05:00
parent bcd19f1e60
commit 65d21cd3c4
10 changed files with 118 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
#include "Window.hpp"
#include <SDL3/SDL_events.h>
#include <iostream>
Window::Window() {
@@ -43,3 +44,26 @@ void Window::handleEvent(SDL_Event& event) {
rendering_ = true;
}
}
bool Window::createSurface(vk::raii::SurfaceKHR* surface) {
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] createSurface()" << std::endl;
#ifdef __WIN32
vk::Win32SurfaceCreateInfoKHR createInfo {
.hinstance = GetModuleHandle(nullptr),
.hwnd = (HWND)SDL_GetPointerProperty(SDL_GetWindowProperties(sdlWindow_), "SDL.window.win32.hwnd", nullptr);
}
surface = &instance_.createWin32SurfaceKHR(createInfo);
#else // __WIN32
#endif // __WIN32
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] attempted to createSurface" << std::endl;
if(surface != nullptr) {
return true;
} else {
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Error: unable to create window surface." << std::endl;
return false;
}
}