SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Protected 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 (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr MetalView (const MetalViewRaw resource) noexcept
 Constructs from MetalViewParam. More...
 
constexpr MetalView (MetalView &&other) noexcept
 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.
 
constexpr MetalViewoperator= (MetalView &&other) noexcept
 Assignment operator.
 
constexpr MetalViewRaw get () const noexcept
 Retrieves underlying MetalViewRaw.
 
constexpr MetalViewRaw release () noexcept
 Retrieves underlying MetalViewRaw and clear this.
 
constexpr auto operator<=> (const MetalView &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
constexpr operator MetalViewParam () const noexcept
 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...
 

Protected Member Functions

constexpr MetalView (const MetalView &other) noexcept=default
 Copy constructor.
 
constexpr MetalViewoperator= (const MetalView &other) noexcept=default
 Assignment operator.
 

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)
inlineexplicitconstexprnoexcept
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: