wren
Vulkan-based game engine
Toggle main menu visibility
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>
8
#include <
wren/utils/result.hpp
>
9
10
#include "
event.hpp
"
11
12
namespace
wren
{
13
14
DEFINE_ERROR
(
"WindowErrors"
, WindowErrors, SdlInit, SdlWindow,
15
SdlVulkanExtension);
16
17
class
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)
24
->
expected<::vk::SurfaceKHR>
;
25
26
void
dispatch_events
(
const
event::Dispatcher
& dispatcher);
27
28
[[nodiscard]]
auto
get_required_vulkan_extension
()
const
29
->
expected<std::vector<std::string_view>
>;
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
wren::Window::get_size
auto get_size() -> std::pair< int32_t, int32_t >
Definition
window.hpp:31
wren::Window::get_required_vulkan_extension
auto get_required_vulkan_extension() const -> expected< std::vector< std::string_view > >
Definition
window.cpp:49
wren::Window::dispatch_events
void dispatch_events(const event::Dispatcher &dispatcher)
Definition
window.cpp:279
wren::Window::native_handle
auto native_handle() const
Definition
window.hpp:37
wren::Window::Window
Window(SDL_Window *window)
Definition
window.hpp:40
wren::Window::shutdown
void shutdown()
Definition
window.cpp:39
wren::Window::create_surface
auto create_surface(const ::vk::Instance &instance) -> expected<::vk::SurfaceKHR >
Definition
window.cpp:41
wren::Window::window_
SDL_Window * window_
Definition
window.hpp:42
wren::Window::create
static auto create(const std::string &application_name) -> expected< Window >
Definition
window.cpp:20
wren::event::Dispatcher
Definition
event.hpp:75
event.hpp
wren
Definition
editor_scene.hpp:5
wren::expected
std::expected< T, Err > expected
Definition
result.hpp:43
result.hpp
DEFINE_ERROR
#define DEFINE_ERROR(cat_name, name,...)
Definition
result.hpp:105
wren
include
wren
window.hpp
Generated by
1.17.0