SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Window Struct Reference

Handle to an owned window. More...

Inheritance diagram for SDL::Window:
Inheritance graph
[legend]

Public Member Functions

constexpr Window (SDL_Window *resource={})
 Constructs from the underlying resource.
 
constexpr Window (const Window &other)=delete
 
constexpr Window (Window &&other)=default
 Move constructor.
 
 ~Window ()
 Frees up resource when object goes out of scope.
 
Windowoperator= (Window other)
 Assignment operator.
 
constexpr WindowRef (const WindowRef &other)
 Copy constructor.
 
constexpr WindowRef (WindowRef &&other)
 Move constructor.
 
- Public Member Functions inherited from SDL::WindowRef
constexpr WindowRef (const WindowRef &other)
 Copy constructor.
 
constexpr WindowRef (WindowRef &&other)
 Move constructor.
 
constexpr ~WindowRef ()=default
 Default constructor.
 
WindowRefoperator= (WindowRef other)
 Assignment operator.
 
void reset (SDL_Window *newResource={})
 Destroy a window.
 
 WindowBase (StringParam title, SDL_Point size, WindowFlags flags=0)
 Create a window with the specified dimensions and flags.
 
 WindowBase (WindowBase &parent, SDL_Point offset, SDL_Point size, WindowFlags flags=0)
 Create a child popup window of the specified parent window.
 
 WindowBase (PropertiesBase &props)
 Create a window with the specified properties.
 
- Public Member Functions inherited from SDL::WindowBase
 WindowBase (StringParam title, SDL_Point size, WindowFlags flags=0)
 Create a window with the specified dimensions and flags.
 
 WindowBase (WindowBase &parent, SDL_Point offset, SDL_Point size, WindowFlags flags=0)
 Create a child popup window of the specified parent window.
 
 WindowBase (PropertiesBase &props)
 Create a window with the specified properties.
 
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 (size_t *size) 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 (SurfaceBase &icon)
 Set the icon for a window.
 
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.
 
void SetPosition (SDL_Point p)
 Request that the window's position be set.
 
Point GetPosition () const
 Get the position of a window.
 
void GetPosition (int *x, int *y) const
 Get the position of a window.
 
void SetSize (SDL_Point p)
 Request that the size of a window's client area be set.
 
Point GetSize () const
 Get the size of a window's client area.
 
void GetSize (int *w, int *h) const
 Get the size of a window's client area.
 
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 size 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.
 
Point GetSizeInPixels () const
 Get the size of a window's client area, in pixels.
 
void GetSizeInPixels (int *w, int *h) const
 Get the size of a window's client area, in pixels.
 
void SetMinimumSize (SDL_Point 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 (SDL_Point 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 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.
 
void Sync ()
 Block until any pending window state is finalized.
 
bool HasSurface () const
 Return whether the window has a surface associated with it.
 
SurfaceRef 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 SDL_Rect > 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 SDL_Rect &rect)
 Confines the cursor to the specified area of a window.
 
const SDL_Rect * GetMouseRect () 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 (OptionalWindow 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 (SDL_Point p)
 Display the system-level window menu.
 
void SetHitTest (HitTestCB callback)
 Provide a callback that decides if a window region has special properties.
 
void SetHitTest (HitTest callback, void *callback_data)
 Provide a callback that decides if a window region has special properties.
 
void SetShape (SurfaceBase &shape)
 Set the shape of a transparent window.
 
void Flash (FlashOperation operation)
 Request a window to demand attention from the user.
 
RendererRef GetRenderer () const
 Get the renderer associated with a window.
 
void StartTextInput ()
 Start accepting Unicode text input events in a window.
 
void StartTextInput (PropertiesBase &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 SDL_Rect &rect, int cursor)
 Set the area used to type Unicode text input.
 
void GetTextInputArea (Rect *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 (float x, float y)
 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.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_Window * >
constexpr Resource (SDL_Window * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_Window * get () const
 Return contained resource;.
 
constexpr SDL_Window * release (SDL_Window * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_Window * operator-> () const
 Access to fields.
 
constexpr SDL_Window * operator-> ()
 Access to fields.
 

Additional Inherited Members

- Static Public Member Functions inherited from SDL::WindowRef
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.
 

Detailed Description

Category:
Resource
See also
WindowBase
WindowRef

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