SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
Metal Support

Functions to creating Metal layers and views on SDL windows. More...

Collaboration diagram for Metal Support:

Classes

struct  SDL::MetalViewParam
 Safely wrap MetalView for non owning parameters. More...
 
class  SDL::MetalView
 A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). More...
 
struct  SDL::MetalViewRef
 Semi-safe reference for MetalView. More...
 

Typedefs

using SDL::MetalViewRaw = SDL_MetalView
 Alias to raw representation for MetalView.
 

Functions

MetalView SDL::Metal_CreateView (WindowParam window)
 Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window. More...
 
void SDL::Metal_DestroyView (MetalViewRaw view)
 Destroy an existing MetalView object. More...
 
void * SDL::Metal_GetLayer (MetalViewParam view)
 Get a pointer to the backing CAMetalLayer for the given view. More...
 
void SDL::MetalView::Destroy ()
 Destroy an existing MetalView object. More...
 
void * SDL::MetalView::GetLayer ()
 Get a pointer to the backing CAMetalLayer for the given view. More...
 

Detailed Description

This provides some platform-specific glue for Apple platforms. Most macOS and iOS apps can use SDL without these functions, but this API they can be useful for specific OS-level integration tasks.

Function Documentation

◆ Destroy()

void SDL::MetalView::Destroy ( )
inline

This should be called before Window.Destroy, if MetalView.MetalView was called after Window.Window.

Since
This function is available since SDL 3.2.0.
See also
MetalView.MetalView

◆ GetLayer()

void * SDL::MetalView::GetLayer ( )
inline
Returns
a pointer.
Since
This function is available since SDL 3.2.0.

◆ Metal_CreateView()

MetalView SDL::Metal_CreateView ( 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.
Returns
handle NSView or UIView.
Since
This function is available since SDL 3.2.0.
See also
MetalView.Destroy
MetalView.GetLayer

◆ Metal_DestroyView()

void SDL::Metal_DestroyView ( MetalViewRaw  view)
inline

This should be called before Window.Destroy, if MetalView.MetalView was called after Window.Window.

Parameters
viewthe MetalView object.
Since
This function is available since SDL 3.2.0.
See also
MetalView.MetalView

◆ Metal_GetLayer()

void * SDL::Metal_GetLayer ( MetalViewParam  view)
inline
Parameters
viewthe MetalView object.
Returns
a pointer.
Since
This function is available since SDL 3.2.0.