Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Window.hpp
1#pragma once
2#include "system/Config.hpp"
3#include "Common.hpp"
4#include "graphics/GPUTypes.hpp"
5
6
7struct GLFWwindow;
8struct ImGui_ImplVulkan_InitInfo;
9class Swapchain;
10
14class Window {
15 friend class GPU;
16
17public:
18
25 Window(const std::string & name, RenderingConfig & config, bool escapeQuit = true, bool hidden = false);
26
28 enum class Action : uint {
29 None,
30 Quit,
32 Vsync
33 };
34
38 void perform(Action action);
39
44 bool nextFrame();
45
47 void setViewport();
48
50 Texture& color();
51
53 Window(const Window &) = delete;
54
58 Window & operator=(const Window &) = delete;
59
61 Window(Window &&) = delete;
62
66 Window & operator=(Window &&) = delete;
67
69 ~Window();
70
71private:
73 void setupImGui();
74
76 GLFWwindow * _window = nullptr;
77 std::unique_ptr<Swapchain> _swapchain;
78 ImGui_ImplVulkan_InitInfo * _imgui = nullptr;
79 bool _frameStarted = false;
80 bool _allowEscape = false;
81};
Provide utility functions to communicate with the driver and GPU.
Definition: GPU.hpp:20
Configuration containing parameters for windows and renderers.
Definition: Config.hpp:113
A swapchain handles the creation and presentation of the backbuffer, along with GPU work submission a...
Definition: Swapchain.hpp:16
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Represent an OS window and its associated rendering context.
Definition: Window.hpp:14
void setupImGui()
Definition: Window.cpp:236
Action
Definition: Window.hpp:28
@ Fullscreen
Switch the window from/to fullscreen mode.
@ Quit
Quit the application.
@ Vsync
Switch the v-sync on/off.
@ None
Do nothing.
~Window()
Definition: Window.cpp:217
Window(Window &&)=delete
std::unique_ptr< Swapchain > _swapchain
The swapchain displaying backbuffers.
Definition: Window.hpp:77
ImGui_ImplVulkan_InitInfo * _imgui
ImGui setup information.
Definition: Window.hpp:78
bool _frameStarted
Has a frame been started.
Definition: Window.hpp:79
Window & operator=(const Window &)=delete
void setViewport()
Definition: Window.cpp:209
Window & operator=(Window &&)=delete
bool _allowEscape
Can the window be closed by pressing escape.
Definition: Window.hpp:80
void perform(Action action)
Definition: Window.cpp:97
Window(const Window &)=delete
RenderingConfig & _config
The window configuration.
Definition: Window.hpp:75
GLFWwindow * _window
Internal window handle.
Definition: Window.hpp:76
Texture & color()
Definition: Window.cpp:213
bool nextFrame()
Definition: Window.cpp:153