1 #ifndef DONUT_GRAPHICS_WINDOW_HPP
2 #define DONUT_GRAPHICS_WINDOW_HPP
23 const char*
title =
"Application";
205 [[nodiscard]] std::uint32_t
getId() const;
216 struct VideoContext {
220 VideoContext(
const VideoContext&) =
delete;
221 VideoContext(VideoContext&&) =
delete;
222 VideoContext&
operator=(
const VideoContext&) =
delete;
223 VideoContext&
operator=(VideoContext&&) =
delete;
226 struct WindowDeleter {
227 void operator()(
void* handle)
const noexcept;
230 struct GLContextDeleter {
231 void operator()(
void* handle)
const noexcept;
234 [[no_unique_address]] VideoContext videoContext{};
235 UniqueHandle<void*, WindowDeleter> window{};
236 UniqueHandle<void*, GLContextDeleter> glContext{};
237 Framebuffer framebuffer{
Handle{}};
Unique resource handle with exclusive ownership of a GPU framebuffer.
Definition: Framebuffer.hpp:15
Graphical window that can be rendered to.
Definition: Window.hpp:81
std::uint32_t getId() const
Get a unique identifier for this window.
void setVSync(bool vSync)
Enable or disable vertical synchronization for the window.
~Window()=default
Destructor.
void setResizable(bool resizable)
Set whether to allow the window to be resized by the user or not.
ivec2 getDrawableSize() const noexcept
Get the drawable size of the window.
ivec2 getSize() const noexcept
Get the size of the window.
Window(const WindowOptions &options)
Create a new window.
void present()
Swap the window's front and back buffers, showing what has been rendered to the framebuffer since the...
bool isScreenKeyboardShown() const noexcept
Check if the screen keyboard is currently open.
void setFullscreen(bool fullscreen)
Set the fullscreen state of the window.
Window(Window &&)=delete
Moving a window is not allowed, since it manages global state.
bool isFullscreen() const noexcept
Check if the window is currently in fullscreen mode.
void setSize(ivec2 size)
Set the size of the window.
Framebuffer & getFramebuffer()
Get the Framebuffer for rendering to this window.
Window & operator=(Window &&)=delete
Moving a window is not allowed, since it manages global state.
Window & operator=(const Window &)=delete
Copying a window is not allowed, since it manages global state.
Window(const Window &)=delete
Copying a window is not allowed, since it manages global state.
void setTitle(const char *title)
Set the displayed title of the window.
std::uint32_t Handle
Generic GPU resource handle.
Definition: Handle.hpp:11
Configuration options for a Window.
Definition: Window.hpp:16
bool fullscreen
Whether the window should start in fullscreen mode or not.
Definition: Window.hpp:43
bool vSync
Whether the window should use vertical synchronization or not.
Definition: Window.hpp:60
const char * title
Non-owning pointer to a null-terminated UTF-8 string of the displayed title of the window.
Definition: Window.hpp:23
ivec2 size
The desired size of the window, in screen coordinates (typically pixels).
Definition: Window.hpp:33
int msaaLevel
Number of samples used for multisample anti-aliasing (MSAA) when rendering a pixel to the window via ...
Definition: Window.hpp:75
bool resizable
Whether the user should be allowed to resize the window or not.
Definition: Window.hpp:38