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

A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). More...

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

Public Member Functions

constexpr MetalView ()=default
 Default ctor.
 
constexpr MetalView (const MetalViewRaw resource)
 Constructs from MetalViewParam. More...
 
constexpr MetalView (const MetalView &other)=delete
 Copy constructor.
 
constexpr MetalView (MetalView &&other)
 Move constructor.
 
constexpr MetalView (const MetalViewRef &other)=delete
 
constexpr MetalView (MetalViewRef &&other)=delete
 
 MetalView (WindowParam window)
 Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window. More...
 
 ~MetalView ()
 Destructor.
 
MetalViewoperator= (MetalView other)
 Assignment operator.
 
constexpr MetalViewRaw get () const
 Retrieves underlying MetalViewRaw.
 
constexpr MetalViewRaw release ()
 Retrieves underlying MetalViewRaw and clear this.
 
constexpr auto operator<=> (const MetalView &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator MetalViewParam () const
 Converts to MetalViewParam.
 
void Destroy ()
 Destroy an existing MetalView object. More...
 
void * GetLayer ()
 Get a pointer to the backing CAMetalLayer for the given view. More...
 

Detailed Description

Since
This datatype is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ MetalView() [1/2]

constexpr SDL::MetalView::MetalView ( const MetalViewRaw  resource)
inlineexplicitconstexpr
Parameters
resourcea MetalViewRaw to be wrapped.

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

◆ MetalView() [2/2]

SDL::MetalView::MetalView ( WindowParam  window)
inline

On macOS, this does not associate a MTLDevice with the CAMetalLayer on its own. It is up to user code to do that.

The returned handle can be casted directly to a NSView or UIView. To access the backing CAMetalLayer, call MetalView.GetLayer().

Parameters
windowthe window.
Postcondition
handle NSView or UIView.
Since
This function is available since SDL 3.2.0.
See also
MetalView.Destroy
MetalView.GetLayer

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