|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Graphical window that can be rendered to. More...
#include <GREM/graphics/Window.hpp>
Public Member Functions | |
| Window (const WindowOptions &options) | |
| Create a new standalone window. | |
| Window (Window &parent, const WindowOptions &options) | |
| Create a new child window. | |
| ~Window ()=default | |
| Destructor. | |
| Window (const Window &)=delete | |
| Copying a window is not allowed, since it manages global state. | |
| Window (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 & | operator= (Window &&)=delete |
| Moving a window is not allowed, since it manages global state. | |
| void | setParent (Window *newParent) |
| Set the parent window of the window. | |
| void | setIcon (const resource::ImageView &newIconImage) |
| Set the icon of the window. | |
| void | setTitle (CStringView newTitle) |
| Set the displayed title of the window. | |
| void | setPosition (Offset2D newPosition) |
| Set the position of the window in the windowing system. | |
| void | setSize (Extent2D newSize) |
| Set the size of the window. | |
| void | setOpacity (float newOpacity) |
| Set the opacity of the window. | |
| void | show (bool activate=true) |
| Show the window. | |
| void | hide () |
| Hide the window. | |
| void | raise () |
| Request the window to be raised above other windows and gain focus. | |
| void | minimize () |
| Request the window to be minimized to the taskbar. | |
| void | setResizable (bool newResizable) |
| Set whether to allow the window to be resized by the user or not. | |
| void | setFullscreen (bool newFullscreen) |
| Set the fullscreen state of the window. | |
| void | setFullscreenDisplayMode (Optional< DisplayMode > newDisplayMode) |
| Set the display mode that will be used in fullscreen for this window if the window is not resizable. | |
| void | setRelativeMouseMode (bool newRelativeMouseMode) |
| Enable or disable relative mouse mode for this window. | |
| void | setTextInputArea (const Region2D &area, int32_t cursorOffset) |
| Set the window's input area for text input. | |
| void | startTextInput () |
| Start accepting text input events in the current text input rectangle. | |
| void | stopTextInput () |
| Stop accepting text input events. | |
| bool | isTextInputActive () const |
| Check if text input events are currently being accepted. | |
| bool | hasScreenKeyboardSupport () const |
| Check if the application supports a screen keyboard. | |
| bool | isScreenKeyboardShown () const |
| Check if the screen keyboard is currently open. | |
| bool | isHighPixelDensity () const |
| Check if the window's backbuffer is high pixel density. | |
| bool | hasFocus () const |
| Check if the window currently has input focus. | |
| bool | isMinimized () const |
| Check if the window is currently minimized. | |
| bool | isResizable () const |
| Check if the window is currently resizable. | |
| bool | isFullscreen () const |
| Check if the window is currently in fullscreen mode. | |
| Window * | getParent () const |
| Get the parent of the window. | |
| Offset2D | getPosition () const |
| Get the position of the window as reported by the windowing system. | |
| Extent2D | getSize () const |
| Get the size of the window. | |
| Extent2D | getDrawableSize () const |
| Get the drawable size of the window. | |
| uint32_t | getMultisampleCount () const |
| Get the number of samples used for multisample anti-aliasing (MSAA) when rendering to the window. | |
| float | getDisplayScale () const |
| Get the content display scale relative to the window's pixel size. | |
| float | getOpacity () const |
| Get the opacity of the window. | |
| Display | getDisplay () const |
| Get the display that this window is associated with. | |
| Optional< DisplayMode > | getFullscreenDisplayMode () const |
| Get the fullscreen display mode of the window. | |
| uint32_t | getID () const |
| Get a unique identifier for this window. | |
| void * | getNativeHandle () |
| Get a pointer to the native handle of the window, if available for the current platform. | |
| const void * | getNativeHandle () const |
| Get a pointer to the native handle of the window, if available for the current platform. | |
| void * | get () noexcept |
| Get an opaque pointer to the internal representation of the window. | |
| const void * | get () const noexcept |
| Get an opaque pointer to the internal representation of the window. | |
| void * | getSurface () noexcept |
| Get an opaque pointer to the internal representation of the window surface. | |
| const void * | getSurface () const noexcept |
| Get an opaque pointer to the internal representation of the window surface. | |
Static Public Member Functions | |
| static Window * | getFocused () |
| Get the window that currently has keyboard focus. | |
| static Window * | findByID (uint32_t id) |
| Get the window with a specific identifier. | |
Graphical window that can be rendered to.
|
explicit |
Create a new standalone window.
| options | initial configuration of the window, see WindowOptions. |
| graphics::Error | if context or window setup failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| grem::graphics::Window::Window | ( | Window & | parent, |
| const WindowOptions & | options ) |
Create a new child window.
| parent | parent window to create this window from. |
| options | initial configuration of the window, see WindowOptions. |
| graphics::Error | if context or window setup failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
default |
Destructor.
|
delete |
Copying a window is not allowed, since it manages global state.
|
delete |
Moving a window is not allowed, since it manages global state.
|
staticnodiscard |
Get the window that currently has keyboard focus.
|
staticnodiscard |
Get the window with a specific identifier.
| id | identifier to get the window of. |
Copying a window is not allowed, since it manages global state.
Moving a window is not allowed, since it manages global state.
| void grem::graphics::Window::setParent | ( | Window * | newParent | ) |
Set the parent window of the window.
| newParent | window to parent the window to, or nullptr to make the window standalone. Must not be a current sibling or child of this window. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setIcon | ( | const resource::ImageView & | newIconImage | ) |
Set the icon of the window.
| newIconImage | new icon image to set. Should be a 2D image in resource::ImageFormat::R8G8B8A8_UINT format in sRGB color. |
| graphics::Error | on failure, or if the image type/size/format is invalid. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setTitle | ( | CStringView | newTitle | ) |
Set the displayed title of the window.
| newTitle | null-terminated UTF-8 string containing the title. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setPosition | ( | Offset2D | newPosition | ) |
Set the position of the window in the windowing system.
| newPosition | new position of the window. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setSize | ( | Extent2D | newSize | ) |
Set the size of the window.
| newSize | new size of the window, in screen coordinates (typically pixels). Both the width and height must be positive. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setOpacity | ( | float | newOpacity | ) |
Set the opacity of the window.
| newOpacity | new opacity of the window, from 0 (transparent) to 1 (opaque). |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::show | ( | bool | activate = true | ) |
Show the window.
| activate | whether the window should be activated when shown or not. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::hide | ( | ) |
Hide the window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::raise | ( | ) |
Request the window to be raised above other windows and gain focus.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::minimize | ( | ) |
Request the window to be minimized to the taskbar.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setResizable | ( | bool | newResizable | ) |
Set whether to allow the window to be resized by the user or not.
| newResizable | true to allow resizing, false to disallow. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setFullscreen | ( | bool | newFullscreen | ) |
Set the fullscreen state of the window.
| newFullscreen | true for fullscreen mode, false for windowed mode. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setFullscreenDisplayMode | ( | Optional< DisplayMode > | newDisplayMode | ) |
Set the display mode that will be used in fullscreen for this window if the window is not resizable.
| newDisplayMode | the display mode to use in fullscreen, or an empty optional for borderless desktop display mode. |
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setRelativeMouseMode | ( | bool | newRelativeMouseMode | ) |
Enable or disable relative mouse mode for this window.
When relative mouse mode is enabled, it hides the mouse cursor, locks it to the window and causes all further mouse motion to be provided as relative motion events until it is disabled again.
| newRelativeMouseMode | true to enable relative mouse mode, false to disable. |
| graphics::Error | on failure to set the relative mouse mode. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::setTextInputArea | ( | const Region2D & | area, |
| int32_t | cursorOffset ) |
Set the window's input area for text input.
| area | input area rectangle, in screen coordinates. |
| cursorOffset | horizontal offset of the cursor from area.offset.x, in screen coordinates. |
| graphics::Error | on failure to set the input area. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::startTextInput | ( | ) |
Start accepting text input events in the current text input rectangle.
| graphics::Error | on failure to start text input. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::Window::stopTextInput | ( | ) |
Stop accepting text input events.
| graphics::Error | on failure to stop text input. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Check if text input events are currently being accepted.
|
nodiscard |
Check if the application supports a screen keyboard.
|
nodiscard |
Check if the screen keyboard is currently open.
|
nodiscard |
Check if the window's backbuffer is high pixel density.
|
nodiscard |
Check if the window currently has input focus.
|
nodiscard |
Check if the window is currently minimized.
|
nodiscard |
Check if the window is currently resizable.
|
nodiscard |
Check if the window is currently in fullscreen mode.
|
nodiscard |
Get the parent of the window.
|
nodiscard |
Get the position of the window as reported by the windowing system.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get the size of the window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get the drawable size of the window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscard |
Get the number of samples used for multisample anti-aliasing (MSAA) when rendering to the window.
|
nodiscard |
Get the content display scale relative to the window's pixel size.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get the opacity of the window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get the display that this window is associated with.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get the fullscreen display mode of the window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get a unique identifier for this window.
| graphics::Error | on failure. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Get a pointer to the native handle of the window, if available for the current platform.
| graphics::Error | on failure to get the handle on a supported platform. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscard |
Get a pointer to the native handle of the window, if available for the current platform.
| graphics::Error | on failure to get the handle on a supported platform. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardnoexcept |
Get an opaque pointer to the internal representation of the window.
|
inlinenodiscardnoexcept |
Get an opaque pointer to the internal representation of the window.
|
inlinenodiscardnoexcept |
Get an opaque pointer to the internal representation of the window surface.
|
inlinenodiscardnoexcept |
Get an opaque pointer to the internal representation of the window surface.