4#ifndef GREM_GRAPHICS_WINDOW_HPP
5#define GREM_GRAPHICS_WINDOW_HPP
554 return implementation.multisampleCount;
660 [[nodiscard]]
void*
get() noexcept {
661 return implementation.window;
674 [[nodiscard]]
const void*
get() const noexcept {
675 return implementation.window;
690 return implementation.surface;
705 return implementation.surface;
709 struct Implementation {
710 void* window =
nullptr;
711 void* surface =
nullptr;
712 uint32_t multisampleCount;
715 GREM_API(
graphics) ~Implementation();
717 Implementation(
const Implementation&) =
delete;
718 Implementation(Implementation&&) =
delete;
719 Implementation& operator=(
const Implementation&) =
delete;
720 Implementation& operator=(Implementation&&) =
delete;
723 Implementation implementation;
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Information about a display on the host system.
Definition Display.hpp:95
Graphical window that can be rendered to.
Definition Window.hpp:131
void setTitle(CStringView newTitle)
Set the displayed title of the window.
bool isResizable() const
Check if the window is currently resizable.
bool isHighPixelDensity() const
Check if the window's backbuffer is high pixel density.
bool isTextInputActive() const
Check if text input events are currently being accepted.
void setResizable(bool newResizable)
Set whether to allow the window to be resized by the user or not.
void raise()
Request the window to be raised above other windows and gain focus.
~Window()=default
Destructor.
Offset2D getPosition() const
Get the position of the window as reported by the windowing system.
static Window * findByID(uint32_t id)
Get the window with a specific identifier.
bool hasFocus() const
Check if the window currently has input focus.
static Window * getFocused()
Get the window that currently has keyboard focus.
bool isMinimized() const
Check if the window is currently minimized.
void setOpacity(float newOpacity)
Set the opacity of the window.
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 stopTextInput()
Stop accepting text input events.
void setTextInputArea(const Region2D &area, int32_t cursorOffset)
Set the window's input area for text input.
Optional< DisplayMode > getFullscreenDisplayMode() const
Get the fullscreen display mode of the window.
void setFullscreen(bool newFullscreen)
Set the fullscreen state of the window.
Window(Window &parent, const WindowOptions &options)
Create a new child window.
void hide()
Hide the window.
float getOpacity() const
Get the opacity of the window.
void setSize(Extent2D newSize)
Set the size of the window.
void startTextInput()
Start accepting text input events in the current text input rectangle.
Window * getParent() const
Get the parent of the window.
Display getDisplay() const
Get the display that this window is associated with.
bool hasScreenKeyboardSupport() const
Check if the application supports a screen keyboard.
Window(const WindowOptions &options)
Create a new standalone window.
bool isScreenKeyboardShown() const
Check if the screen keyboard is currently open.
Window & operator=(const Window &)=delete
Copying a window is not allowed, since it manages global state.
void show(bool activate=true)
Show the window.
Window(Window &&)=delete
Moving a window is not allowed, since it manages global state.
void minimize()
Request the window to be minimized to the taskbar.
const void * getSurface() const noexcept
Get an opaque pointer to the internal representation of the window surface.
Definition Window.hpp:704
Window(const Window &)=delete
Copying a window is not allowed, since it manages global state.
const void * getNativeHandle() const
Get a pointer to the native handle of the window, if available for the current platform.
Definition Window.hpp:646
void * getNativeHandle()
Get a pointer to the native handle of the window, if available for the current platform.
void setIcon(const resource::ImageView &newIconImage)
Set the icon of the window.
float getDisplayScale() const
Get the content display scale relative to the window's pixel size.
uint32_t getID() const
Get a unique identifier for this window.
uint32_t getMultisampleCount() const
Get the number of samples used for multisample anti-aliasing (MSAA) when rendering to the window.
Definition Window.hpp:553
bool isFullscreen() const
Check if the window is currently in fullscreen mode.
void * getSurface() noexcept
Get an opaque pointer to the internal representation of the window surface.
Definition Window.hpp:689
Extent2D getSize() const
Get the size of the window.
void * get() noexcept
Get an opaque pointer to the internal representation of the window.
Definition Window.hpp:660
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.
Extent2D getDrawableSize() const
Get the drawable size of the window.
const void * get() const noexcept
Get an opaque pointer to the internal representation of the window.
Definition Window.hpp:674
void setPosition(Offset2D newPosition)
Set the position of the window in the windowing system.
Read-only non-owning view over a 2D image.
Definition Image.hpp:108
Definition buffer_layouts.hpp:20
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
Region< 2 > Region2D
Rectangular region of 2D data.
Definition extents.hpp:819
Offset< 2 > Offset2D
Offset in a 2D data region.
Definition extents.hpp:21
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635
Configuration options for a Window.
Definition Window.hpp:24
Optional< int32_t > positionY
The desired vertical position of the window, in screen coordinates (typically pixels),...
Definition Window.hpp:42
String title
Null-terminated UTF-8 string of the displayed title of the window.
Definition Window.hpp:28
bool minimized
Whether the window should start minimized or not.
Definition Window.hpp:90
bool hideFromTaskbar
Whether the window should be hidden from the taskbar and window list and be treated as a utility wind...
Definition Window.hpp:111
Optional< int32_t > positionX
The desired horizontal position of the window, in screen coordinates (typically pixels),...
Definition Window.hpp:35
bool fullscreen
Whether the window should start in fullscreen mode or not.
Definition Window.hpp:100
Extent2D size
The desired size of the window, in screen coordinates (typically pixels).
Definition Window.hpp:49
bool hidden
Whether the window should start hidden or not.
Definition Window.hpp:80
float opacity
Opacity of the window, from 0 (transparent) to 1 (opaque).
Definition Window.hpp:69
bool resizable
Whether the user should be allowed to resize the window or not.
Definition Window.hpp:95
bool relativeMouseMode
Whether the window should start with relative mouse mode enabled or not.
Definition Window.hpp:125
bool highPixelDensity
Whether the window's backbuffer should have high pixel density (if possible) or not.
Definition Window.hpp:75
bool focus
Whether the window should start with input focus or not.
Definition Window.hpp:85
uint32_t multisampleCount
Number of samples used for multisample anti-aliasing (MSAA) when rendering directly to the window.
Definition Window.hpp:64
bool borderless
Whether the window should be borderless or not.
Definition Window.hpp:105
bool alwaysOnTop
Whether the window should always be on top of other windows or not.
Definition Window.hpp:116