wren
Vulkan-based game engine
Loading...
Searching...
No Matches
window.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <SDL2/SDL.h>
4#include <SDL2/SDL_video.h>
5#include <spdlog/spdlog.h>
6
7#include <boost/describe/enum.hpp>
8#include <vulkan/vulkan.hpp>
10
11#include "event.hpp"
12
13namespace wren {
14
15DEFINE_ERROR("WindowErrors", WindowErrors, SDL_INIT, SDL_WINDOW,
16 SDL_VULKAN_EXTENSION);
17
18class Window {
19 public:
20 static auto create(std::string const &application_name)
22
23 void shutdown();
24
25 auto create_surface(::vk::Instance const &instance)
27
28 void dispatch_events(event::Dispatcher const &dispatcher);
29
30 [[nodiscard]] auto get_required_vulkan_extension() const
32
33 auto get_size() -> std::pair<int32_t, int32_t> {
34 int w = 0, h = 0;
35 SDL_GetWindowSize(window_, &w, &h);
36 return {w, h};
37 }
38
39 [[nodiscard]] auto native_handle() const { return window_; }
40
41 private:
42 explicit Window(SDL_Window *window) : window_(window) {}
43
44 SDL_Window *window_;
45};
46
47} // namespace wren
Definition window.hpp:18
auto get_size() -> std::pair< int32_t, int32_t >
Definition window.hpp:33
static auto create(std::string const &application_name) -> expected< Window >
Definition window.cpp:19
auto get_required_vulkan_extension() const -> expected< std::vector< std::string_view > >
Definition window.cpp:48
auto native_handle() const
Definition window.hpp:39
void dispatch_events(event::Dispatcher const &dispatcher)
Definition window.cpp:423
void shutdown()
Definition window.cpp:38
auto create_surface(::vk::Instance const &instance) -> expected<::vk::SurfaceKHR >
Definition window.cpp:40
Definition event.hpp:75
Definition editor.hpp:14
tl::expected< T, Err > expected
Definition errors.hpp:49
#define DEFINE_ERROR(cat_name, name,...)
This macro defines an enum with BOOST_DEFINE_ENUM_CLASS and hooks into the std::error_code system The...
Definition errors.hpp:90