| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Metal
Contents
Description
Functions to creating Metal layers and views on SDL windows.
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. A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
FFI conventions
Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Metal.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.
Full conventions: SDL3.Sys.
Since: 3.2.0
Synopsis
- module SDL3.Sys.Bindgen.Metal
- metalCreateView :: Ptr SDL_Window -> IO SDL_MetalView
- metalCreateViewSafe :: Ptr SDL_Window -> IO SDL_MetalView
- metalDestroyView :: SDL_MetalView -> IO ()
- metalDestroyViewSafe :: SDL_MetalView -> IO ()
- metalGetLayer :: SDL_MetalView -> IO (Ptr Void)
- metalGetLayerSafe :: SDL_MetalView -> IO (Ptr Void)
Documentation
module SDL3.Sys.Bindgen.Metal
Function aliases
Arguments
| :: Ptr SDL_Window |
|
| -> IO SDL_MetalView |
Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.
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 .metalGetLayer
- Returns
- handle NSView or UIView.
- Thread safety
- This function should only be called on the main thread.
- See also
metalDestroyView,metalGetLayer
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_Metal_CreateView. The safe flavor ismetalCreateViewSafe. - C declaration
SDL_Metal_CreateView, defined atSDL3/SDL_metal.h 75:43
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO SDL_MetalView |
Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.
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 .metalGetLayer
- Returns
- handle NSView or UIView.
- Thread safety
- This function should only be called on the main thread.
- See also
metalDestroyView,metalGetLayer
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_Metal_CreateView. The unsafe flavor ismetalCreateView. - C declaration
SDL_Metal_CreateView, defined atSDL3/SDL_metal.h 75:43
Since: 3.2.0
Arguments
| :: SDL_MetalView |
|
| -> IO () |
Destroy an existing SDL_MetalView object.
This should be called before destroyWindow, if metalCreateView was called after createWindow.
- Thread safety
- This function should only be called on the main thread.
- See also
metalCreateView
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_Metal_DestroyView. The safe flavor ismetalDestroyViewSafe. - C declaration
SDL_Metal_DestroyView, defined atSDL3/SDL_metal.h 91:34
Since: 3.2.0
Arguments
| :: SDL_MetalView |
|
| -> IO () |
Destroy an existing SDL_MetalView object.
This should be called before destroyWindow, if metalCreateView was called after createWindow.
- Thread safety
- This function should only be called on the main thread.
- See also
metalCreateView
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_Metal_DestroyView. The unsafe flavor ismetalDestroyView. - C declaration
SDL_Metal_DestroyView, defined atSDL3/SDL_metal.h 91:34
Since: 3.2.0
Arguments
| :: SDL_MetalView |
|
| -> IO (Ptr Void) |
Get a pointer to the backing CAMetalLayer for the given view.
- Returns
- a pointer.
- Thread safety
- This function should only be called on the main thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_Metal_GetLayer. The safe flavor ismetalGetLayerSafe. - C declaration
SDL_Metal_GetLayer, defined atSDL3/SDL_metal.h 103:36
Since: 3.2.0
Arguments
| :: SDL_MetalView |
|
| -> IO (Ptr Void) |
Get a pointer to the backing CAMetalLayer for the given view.
- Returns
- a pointer.
- Thread safety
- This function should only be called on the main thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_Metal_GetLayer. The unsafe flavor ismetalGetLayer. - C declaration
SDL_Metal_GetLayer, defined atSDL3/SDL_metal.h 103:36
Since: 3.2.0