SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::Window Struct Reference

The struct used as an opaque handle to a window. More...

Inheritance diagram for SDL::Window:
[legend]

Public Member Functions

constexpr Window (WindowRaw resource) noexcept
 Constructs from raw Window.
constexpr Window (const Window &other)=delete
 Copy constructor.
constexpr Window (Window &&other) noexcept
 Move constructor.
constexpr Window (const WindowRef &other)=delete
constexpr Window (WindowRef &&other)=delete
 Window (StringParam title, const PointRaw &size, WindowFlags window_flags, RendererRef *renderer)
 Create a window and default renderer.
 Window (StringParam title, const PointRaw &size, WindowFlags flags=0)
 Create a window with the specified dimensions and flags.
 Window (WindowRef parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags=0)
 Create a child popup window of the specified parent window.
 Window (PropertiesRef props)
 Create a window with the specified properties.
 ~Window ()
 Destructor.
constexpr Windowoperator= (Window &&other) noexcept
 Assignment operator.
Windowoperator= (const Window &other)=delete
 Assignment operator.
void Destroy ()
 Destroy a window.
Display GetDisplay () const
 Get the display associated with a window.
float GetPixelDensity () const
 Get the pixel density of a window.
float GetDisplayScale () const
 Get the content display scale relative to a window's pixel size.
void SetFullscreenMode (OptionalRef< const DisplayMode > mode)
 Set the display mode to use when a window is visible and fullscreen.
const DisplayModeGetFullscreenMode () const
 Query the display mode to use when a window is visible at fullscreen.
OwnPtr< void > GetICCProfile () const
 Get the raw ICC profile data for the screen the window is currently on.
PixelFormat GetPixelFormat () const
 Get the pixel format associated with the window.
WindowID GetID () const
 Get the numeric ID of a window.
WindowRef GetParent () const
 Get parent of a window.
PropertiesRef GetProperties () const
 Get the properties associated with a window.
WindowFlags GetFlags () const
 Get the window flags.
void SetTitle (StringParam title)
 Set the title of a window.
const char * GetTitle () const
 Get the title of a window.
void SetIcon (SurfaceRef icon)
 Set the icon for a window.
void SetPosition (const PointRaw &p)
 Request that the window's position be set.
void GetPosition (int *x, int *y) const
 Get the position of a window.
Point GetPosition () const
 Get the position of a window.
void SetSize (const PointRaw &size)
 Request that the size of a window's client area be set.
void GetSize (int *w, int *h) const
 Get the size of a window's client area.
Point GetSize () const
 Get the size of a window's client area.
void SetRect (Rect rect)
 Request the window's position and size to be set.
Rect GetRect () const
 Get the position and client size of a window.
Rect GetSafeArea () const
 Get the safe area for this window.
void SetAspectRatio (float min_aspect, float max_aspect)
 Request that the aspect ratio of a window's client area be set.
void GetAspectRatio (float *min_aspect, float *max_aspect) const
 Get the aspect ratio of a window's client area.
void GetBordersSize (int *top, int *left, int *bottom, int *right) const
 Get the size of a window's borders (decorations) around the client area.
void GetSizeInPixels (int *w, int *h) const
 Get the size of a window's client area, in pixels.
Point GetSizeInPixels () const
 Get the size of a window's client area, in pixels.
void SetMinimumSize (const PointRaw &p)
 Set the minimum size of a window's client area.
void GetMinimumSize (int *w, int *h) const
 Get the minimum size of a window's client area.
void SetMaximumSize (const PointRaw &p)
 Set the maximum size of a window's client area.
void GetMaximumSize (int *w, int *h) const
 Get the maximum size of a window's client area.
void SetBordered (bool bordered)
 Set the border state of a window.
void SetResizable (bool resizable)
 Set the user-resizable state of a window.
void SetAlwaysOnTop (bool on_top)
 Set the window to always be above the others.
void SetFillDocument (bool fill)
 Set the window to fill the current document space (Emscripten only).
void Show ()
 Show a window.
void Hide ()
 Hide a window.
void Raise ()
 Request that a window be raised above other windows and gain the input focus.
void Maximize ()
 Request that the window be made as large as possible.
void Minimize ()
 Request that the window be minimized to an iconic representation.
void Restore ()
 Request that the size and position of a minimized or maximized window be restored.
void SetFullscreen (bool fullscreen)
 Request that the window's fullscreen state be changed.
bool Sync ()
 Block until any pending window state is finalized.
bool HasSurface () const
 Return whether the window has a surface associated with it.
Surface GetSurface ()
 Get the SDL surface associated with the window.
void SetSurfaceVSync (int vsync)
 Toggle VSync for the window surface.
int GetSurfaceVSync () const
 Get VSync for the window surface.
void UpdateSurface ()
 Copy the window surface to the screen.
void UpdateSurfaceRects (SpanRef< const RectRaw > rects)
 Copy areas of the window surface to the screen.
void DestroySurface ()
 Destroy the surface associated with the window.
void SetKeyboardGrab (bool grabbed)
 Set a window's keyboard grab mode.
void SetMouseGrab (bool grabbed)
 Set a window's mouse grab mode.
bool GetKeyboardGrab () const
 Get a window's keyboard grab mode.
bool GetMouseGrab () const
 Get a window's mouse grab mode.
void SetMouseRect (const RectRaw &rect)
 Confines the cursor to the specified area of a window.
const RectRawGetMouseRect () const
 Get the mouse confinement rectangle of a window.
void SetOpacity (float opacity)
 Set the opacity for a window.
float GetOpacity () const
 Get the opacity of a window.
void SetParent (WindowRef parent)
 Set the window as a child of a parent window.
void SetModal (bool modal)
 Toggle the state of the window as modal.
void SetFocusable (bool focusable)
 Set whether the window may have input focus.
void ShowSystemMenu (const PointRaw &p)
 Display the system-level window menu.
void SetHitTest (HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties.
void SetHitTest (HitTestCB callback)
 Provide a callback that decides if a window region has special properties.
void SetShape (SurfaceRef shape)
 Set the shape of a transparent window.
void Flash (FlashOperation operation)
 Request a window to demand attention from the user.
void SetProgressState (ProgressState state)
 Sets the state of the progress bar for the given window’s taskbar icon.
ProgressState GetProgressState ()
 Get the state of the progress bar for the given window’s taskbar icon.
void SetProgressValue (float value)
 Sets the value of the progress bar for the given window’s taskbar icon.
float GetProgressValue ()
 Get the value of the progress bar for the given window’s taskbar icon.
GLContext CreateGLContext ()
 Create an OpenGL context for an OpenGL window, and make it current.
void MakeCurrent (GLContext context)
 Set up an OpenGL context for rendering into an OpenGL window.
EGLSurface GetEGLSurface ()
 Get the EGL surface associated with the window.
void GL_Swap ()
 Update a window with OpenGL rendering.
void StartTextInput ()
 Start accepting Unicode text input events in a window.
void StartTextInput (PropertiesRef props)
 Start accepting Unicode text input events in a window, with properties describing the input.
bool IsTextInputActive () const
 Check whether or not Unicode text input events are enabled for a window.
void StopTextInput ()
 Stop receiving any text input events in a window.
void ClearComposition ()
 Dismiss the composition window/IME without disabling the subsystem.
void SetTextInputArea (const RectRaw &rect, int cursor)
 Set the area used to type Unicode text input.
void GetTextInputArea (RectRaw *rect, int *cursor)
 Get the area used to type Unicode text input.
bool IsScreenKeyboardShown () const
 Check whether the screen keyboard is shown for given window.
void WarpMouse (const FPointRaw &p)
 Move the mouse cursor to the given position within the window.
void SetRelativeMouseMode (bool enabled)
 Set relative mouse mode for a window.
bool GetRelativeMouseMode () const
 Query whether relative mouse mode is enabled for a window.
RendererRef GetRenderer () const
 Get the renderer associated with a window.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< WindowRaw >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Static Public Member Functions

static WindowRef FromID (WindowID id)
 Get a window from a stored ID.
static WindowRef GetGrabbed ()
 Get the window that currently has an input grab enabled.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< WindowRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

The struct used as an opaque handle to a window.

Since
This struct is available since SDL 3.2.0.
Category:
Resource
See also
CreateWindow

Constructor & Destructor Documentation

◆ Window()

SDL::Window::Window ( WindowRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Window.

Parameters
resourcea WindowRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


The documentation for this struct was generated from the following files: