wren
Vulkan-based game engine
Loading...
Searching...
No Matches
window.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <SDL3/SDL.h>
4#include <SDL3/SDL_video.h>
5
6#include <boost/describe/enum.hpp>
7#include <vulkan/vulkan.hpp>
9
10#include "event.hpp"
11
12namespace wren {
13
14DEFINE_ERROR("WindowErrors", WindowErrors, SdlInit, SdlWindow,
15 SdlVulkanExtension);
16
17class Window {
18 public:
19 static auto create(const std::string& application_name) -> expected<Window>;
20
21 void shutdown();
22
23 auto create_surface(const ::vk::Instance& instance)
25
26 void dispatch_events(const event::Dispatcher& dispatcher);
27
28 [[nodiscard]] auto get_required_vulkan_extension() const
30
31 auto get_size() -> std::pair<int32_t, int32_t> {
32 int w = 0, h = 0;
33 SDL_GetWindowSize(window_, &w, &h);
34 return {w, h};
35 }
36
37 [[nodiscard]] auto native_handle() const { return window_; }
38
39 private:
40 explicit Window(SDL_Window* window) : window_(window) {}
41
42 SDL_Window* window_;
43};
44
45} // namespace wren
auto get_size() -> std::pair< int32_t, int32_t >
Definition window.hpp:31
auto get_required_vulkan_extension() const -> expected< std::vector< std::string_view > >
Definition window.cpp:49
void dispatch_events(const event::Dispatcher &dispatcher)
Definition window.cpp:279
auto native_handle() const
Definition window.hpp:37
Window(SDL_Window *window)
Definition window.hpp:40
void shutdown()
Definition window.cpp:39
auto create_surface(const ::vk::Instance &instance) -> expected<::vk::SurfaceKHR >
Definition window.cpp:41
SDL_Window * window_
Definition window.hpp:42
static auto create(const std::string &application_name) -> expected< Window >
Definition window.cpp:20
Definition event.hpp:75
Definition editor_scene.hpp:5
std::expected< T, Err > expected
Definition result.hpp:43
#define DEFINE_ERROR(cat_name, name,...)
Definition result.hpp:105