-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindow.cpp
More file actions
35 lines (31 loc) · 1.02 KB
/
Window.cpp
File metadata and controls
35 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "Window.hpp"
#include "Log.hpp"
#include <glm/vec2.hpp>
#include <sdl2/SDL_vulkan.h>
Window::Window(
const char* title, glm::i32vec2 pos, glm::i32vec2 size, uint32_t flags)
{
m_Window = SDL_CreateWindow(title, pos.x, pos.y, size.x, size.y, flags);
if (m_Window == nullptr)
{
LogError(fmt::format("Error creating SDL window: {}", SDL_GetError()));
}
}
Window::~Window() { SDL_DestroyWindow(m_Window); }
SDL_Window* Window::Get() { return m_Window; }
std::vector<const char*> Window::GetRequiredExtensionNames() const
{
unsigned int numExtentions;
if (SDL_Vulkan_GetInstanceExtensions(m_Window, &numExtentions, nullptr) !=
SDL_TRUE)
{
LogError("Error getting SDL required vulkan exension count");
}
std::vector<const char*> sdlExtNames(numExtentions);
if (SDL_Vulkan_GetInstanceExtensions(
m_Window, &numExtentions, sdlExtNames.data()) != SDL_TRUE)
{
LogError("Error getting SDL required vulkan extensions");
}
return sdlExtNames;
}