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

Semi-safe reference for MetalView.

Inheritance diagram for SDL::MetalViewRef:
Inheritance graph
[legend]
Collaboration diagram for SDL::MetalViewRef:
Collaboration graph
[legend]

Public Member Functions

 MetalViewRef (MetalViewParam resource) noexcept
 Constructs from MetalViewParam. More...
 
 MetalViewRef (MetalViewRaw resource) noexcept
 Constructs from MetalViewParam. More...
 
constexpr MetalViewRef (const MetalViewRef &other) noexcept=default
 Copy constructor.
 
 ~MetalViewRef ()
 Destructor.
 
constexpr MetalView (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr MetalView (const MetalViewRaw resource) noexcept
 Constructs from MetalViewParam. More...
 
constexpr MetalView (const MetalView &other) noexcept=default
 Copy constructor.
 
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...
 
- Public Member Functions inherited from SDL::MetalView
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...
 

Additional Inherited Members

- Protected Member Functions inherited from SDL::MetalView
constexpr MetalView (const MetalView &other) noexcept=default
 Copy constructor.
 
constexpr MetalViewoperator= (const MetalView &other) noexcept=default
 Assignment operator.
 

Constructor & Destructor Documentation

◆ MetalViewRef() [1/2]

SDL::MetalViewRef::MetalViewRef ( MetalViewParam  resource)
inlinenoexcept
Parameters
resourcea MetalViewRaw or MetalView.

This does not takes ownership!

◆ MetalViewRef() [2/2]

SDL::MetalViewRef::MetalViewRef ( MetalViewRaw  resource)
inlinenoexcept
Parameters
resourcea MetalViewRaw or MetalView.

This does not takes ownership!

Member Function 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 struct was generated from the following file: