TheAtlasEngine
 
Loading...
Searching...
No Matches
window.hpp
1#pragma once
2#include <GLFW/glfw3.h>
3#include <core/core.hpp>
4#include <vulkan/vulkan.h>
5#include <core/utilities/types.hpp>
6#include <drivers/vulkan-cpp/vk_swapchain.hpp>
7#include <vulkan-cpp/command_buffer.hpp>
8
9namespace atlas {
10
18 class window {
19 public:
20 virtual ~window() = default;
21
25 [[nodiscard]] uint32_t width() const;
26
30 [[nodiscard]] uint32_t height() const;
31
35 [[nodiscard]] bool available() const;
36
40 [[nodiscard]] float aspect_ratio() const;
41
48 [[nodiscard]] uint32_t acquired_next_frame() {
49 return read_acquired_next_frame();
50 }
51
55 [[nodiscard]] vk::vk_swapchain current_swapchain() const {
56 return window_swapchain();
57 }
58
66 ::vk::command_buffer active_command(uint32_t p_frame_index) {
67 return current_active_command(p_frame_index);
68 }
69
74 operator GLFWwindow*() const { return native_window(); }
75
80 operator GLFWwindow*() { return native_window(); }
81
85 void close();
86
94 void present(const uint32_t& p_current_frame_idx);
95
96 private:
97 [[nodiscard]] virtual window_settings settings() const = 0;
98 [[nodiscard]] virtual GLFWwindow* native_window() const = 0;
99 [[nodiscard]] virtual uint32_t read_acquired_next_frame() = 0;
100 [[nodiscard]] virtual vk::vk_swapchain window_swapchain() const = 0;
101
102 [[nodiscard]] virtual ::vk::command_buffer current_active_command(
103 uint32_t p_frame_idx) = 0;
104
105 virtual void presentation_process(const uint32_t& p_current_frame) = 0;
106 };
107
118 ref<window> create_window(const window_settings& p_settings);
119};
Definition vk_swapchain.hpp:19
Represent an entire window that lives throughout the entire duration of the application.
Definition window.hpp:18
void present(const uint32_t &p_current_frame_idx)
does the presentation operation that is operated internally with the vulkan swapchain
uint32_t height() const
Returns the height dimension of the window.
void close()
Closing the window operation.
::vk::command_buffer active_command(uint32_t p_frame_index)
retrieves the current command buffer using the current frame index to ensure we are processing comman...
Definition window.hpp:66
uint32_t width() const
Returns the width dimension of the window.
vk::vk_swapchain current_swapchain() const
Returns the window's currently selected swapchain.
Definition window.hpp:55
float aspect_ratio() const
Returns the aspect ratio of the current window.
uint32_t acquired_next_frame()
gives you the next presentable image to use and the index to retrieving that image
Definition window.hpp:48
bool available() const
Checks if window is available to close.
settings for specification for atlas::window
Definition types.hpp:9