SDL_Metal_CreateView(3)

πŸ’– SDL_Metal_CreateView πŸ’–

okay bestie, so this is a page from the SDL3 functions manual, and today's main character is SDL_Metal_CreateView. she makes a CAMetalLayer-backed NSView/UIView and attaches it to the window you hand her. that's the whole vibe. ✨


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_metal.h>

SDL_MetalView SDL_Metal_CreateView(SDL_Window *window);

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, on macOS? this does not associate a MTLDevice with the CAMetalLayer on its own. it's literally not her job, she said no thank you 🫢. it is up to user code to do that. yes queen, that's you.

the handle she hands back can be casted directly to a NSView or a UIView β€” no extra steps, no drama. and if you wanna get to the backing CAMetalLayer underneath all that? just call SDL_Metal_GetLayer(). iykyk πŸ’…


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window. that's it. that's the parameter. she's lowkey uncomplicated like that 🌈

⭐ RETURN VALUE ⭐

she returns a handle β€” either an NSView or a UIView. iconic. no cap.


πŸ’€ THREAD SAFETY πŸ’€

⚠️ bestie listen to me: this function should only be called on the main thread. don't try to be sneaky and call her from some background thread, she will simply not be having it. main character energy only πŸ‘‘

✨ AVAILABILITY ✨

this function has been available since SDL 3.2.0 πŸ’œ


🌈 SEE ALSO 🌈


and that's the tea, bestie πŸ§šπŸ’– this page comes to you from the Simple Directmedia Layer crew, SDL 3.4.18 era β€” go forth and metal, periodt βœ¨πŸ’…πŸŒΈ

πŸ“¦ where this page comes from