Graphical window that can be rendered to.
More...
#include <donut/graphics/Window.hpp>
Graphical window that can be rendered to.
- Examples
- example_game.cpp, and example_rectangle.cpp.
◆ Window() [1/3]
Create a new window.
- Parameters
-
- Exceptions
-
graphics::Error | if context or window setup failed. |
std::bad_alloc | on allocation failure. |
◆ ~Window()
donut::graphics::Window::~Window |
( |
| ) |
|
|
default |
◆ Window() [2/3]
donut::graphics::Window::Window |
( |
const Window & |
| ) |
|
|
delete |
Copying a window is not allowed, since it manages global state.
◆ Window() [3/3]
donut::graphics::Window::Window |
( |
Window && |
| ) |
|
|
delete |
Moving a window is not allowed, since it manages global state.
◆ operator=() [1/2]
Window& donut::graphics::Window::operator= |
( |
const Window & |
| ) |
|
|
delete |
Copying a window is not allowed, since it manages global state.
◆ operator=() [2/2]
Moving a window is not allowed, since it manages global state.
◆ present()
void donut::graphics::Window::present |
( |
| ) |
|
Swap the window's front and back buffers, showing what has been rendered to the framebuffer since the last presentation.
◆ setTitle()
void donut::graphics::Window::setTitle |
( |
const char * |
title | ) |
|
Set the displayed title of the window.
- Parameters
-
title | non-owning pointer to a null-terminated UTF-8 string containing the title. Must not be nullptr. |
- See also
- WindowOptions::title
◆ setSize()
void donut::graphics::Window::setSize |
( |
ivec2 |
size | ) |
|
Set the size of the window.
- Parameters
-
size | a 2D vector representing the desired size of the window, in screen coordinates (typically pixels), where:
- the x component represents the width, and
- the y component represents the height. Both the width and height must be positive.
|
- See also
- WindowOptions::size
◆ setResizable()
void donut::graphics::Window::setResizable |
( |
bool |
resizable | ) |
|
Set whether to allow the window to be resized by the user or not.
- Parameters
-
resizable | true to allow resizing, false to disallow. |
- See also
- WindowOptions::resizable
◆ setFullscreen()
void donut::graphics::Window::setFullscreen |
( |
bool |
fullscreen | ) |
|
Set the fullscreen state of the window.
- Parameters
-
fullscreen | true for fullscreen mode, false for windowed mode. |
- See also
- WindowOptions::fullscreen
◆ setVSync()
void donut::graphics::Window::setVSync |
( |
bool |
vSync | ) |
|
Enable or disable vertical synchronization for the window.
- Parameters
-
vSync | true to enable VSync, false to disable. |
- See also
- WindowOptions::vSync
◆ isScreenKeyboardShown()
bool donut::graphics::Window::isScreenKeyboardShown |
( |
| ) |
const |
|
noexcept |
◆ isFullscreen()
bool donut::graphics::Window::isFullscreen |
( |
| ) |
const |
|
noexcept |
Check if the window is currently in fullscreen mode.
- Returns
- true if the window is in fullscreen mode, false otherwise.
◆ getSize()
ivec2 donut::graphics::Window::getSize |
( |
| ) |
const |
|
noexcept |
Get the size of the window.
- Returns
- a 2D vector representing the current size of the window, in screen coordinates (typically pixels), where:
- the x component represents the width, and
- the y component represents the height.
◆ getDrawableSize()
ivec2 donut::graphics::Window::getDrawableSize |
( |
| ) |
const |
|
noexcept |
Get the drawable size of the window.
- Returns
- a 2D vector representing the current drawable size of the window, in pixels, where:
- the x component represents the width, and
- the y component represents the height.
◆ getId()
std::uint32_t donut::graphics::Window::getId |
( |
| ) |
const |
Get a unique identifier for this window.
- Returns
- the identifier corresponding to this window.
◆ getFramebuffer()
Framebuffer& donut::graphics::Window::getFramebuffer |
( |
| ) |
|
Get the Framebuffer for rendering to this window.
- Returns
- a reference to the default framebuffer, with the GL context associated with this window made current.
The documentation for this class was generated from the following file: