Mercurial > foo_out_sdl
comparison SDL3/SDL_metal.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 /* | |
| 2 Simple DirectMedia Layer | |
| 3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | |
| 4 | |
| 5 This software is provided 'as-is', without any express or implied | |
| 6 warranty. In no event will the authors be held liable for any damages | |
| 7 arising from the use of this software. | |
| 8 | |
| 9 Permission is granted to anyone to use this software for any purpose, | |
| 10 including commercial applications, and to alter it and redistribute it | |
| 11 freely, subject to the following restrictions: | |
| 12 | |
| 13 1. The origin of this software must not be misrepresented; you must not | |
| 14 claim that you wrote the original software. If you use this software | |
| 15 in a product, an acknowledgment in the product documentation would be | |
| 16 appreciated but is not required. | |
| 17 2. Altered source versions must be plainly marked as such, and must not be | |
| 18 misrepresented as being the original software. | |
| 19 3. This notice may not be removed or altered from any source distribution. | |
| 20 */ | |
| 21 | |
| 22 /** | |
| 23 * # CategoryMetal | |
| 24 * | |
| 25 * Functions to creating Metal layers and views on SDL windows. | |
| 26 * | |
| 27 * This provides some platform-specific glue for Apple platforms. Most macOS | |
| 28 * and iOS apps can use SDL without these functions, but this API they can be | |
| 29 * useful for specific OS-level integration tasks. | |
| 30 */ | |
| 31 | |
| 32 #ifndef SDL_metal_h_ | |
| 33 #define SDL_metal_h_ | |
| 34 | |
| 35 #include <SDL3/SDL_video.h> | |
| 36 | |
| 37 #include <SDL3/SDL_begin_code.h> | |
| 38 /* Set up for C function definitions, even when using C++ */ | |
| 39 #ifdef __cplusplus | |
| 40 extern "C" { | |
| 41 #endif | |
| 42 | |
| 43 /** | |
| 44 * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). | |
| 45 * | |
| 46 * \since This datatype is available since SDL 3.2.0. | |
| 47 */ | |
| 48 typedef void *SDL_MetalView; | |
| 49 | |
| 50 /** | |
| 51 * \name Metal support functions | |
| 52 */ | |
| 53 /* @{ */ | |
| 54 | |
| 55 /** | |
| 56 * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified | |
| 57 * window. | |
| 58 * | |
| 59 * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on | |
| 60 * its own. It is up to user code to do that. | |
| 61 * | |
| 62 * The returned handle can be casted directly to a NSView or UIView. To access | |
| 63 * the backing CAMetalLayer, call SDL_Metal_GetLayer(). | |
| 64 * | |
| 65 * \param window the window. | |
| 66 * \returns handle NSView or UIView. | |
| 67 * | |
| 68 * \since This function is available since SDL 3.2.0. | |
| 69 * | |
| 70 * \sa SDL_Metal_DestroyView | |
| 71 * \sa SDL_Metal_GetLayer | |
| 72 */ | |
| 73 extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window); | |
| 74 | |
| 75 /** | |
| 76 * Destroy an existing SDL_MetalView object. | |
| 77 * | |
| 78 * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was | |
| 79 * called after SDL_CreateWindow. | |
| 80 * | |
| 81 * \param view the SDL_MetalView object. | |
| 82 * | |
| 83 * \since This function is available since SDL 3.2.0. | |
| 84 * | |
| 85 * \sa SDL_Metal_CreateView | |
| 86 */ | |
| 87 extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); | |
| 88 | |
| 89 /** | |
| 90 * Get a pointer to the backing CAMetalLayer for the given view. | |
| 91 * | |
| 92 * \param view the SDL_MetalView object. | |
| 93 * \returns a pointer. | |
| 94 * | |
| 95 * \since This function is available since SDL 3.2.0. | |
| 96 */ | |
| 97 extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); | |
| 98 | |
| 99 /* @} *//* Metal support functions */ | |
| 100 | |
| 101 /* Ends C function definitions when using C++ */ | |
| 102 #ifdef __cplusplus | |
| 103 } | |
| 104 #endif | |
| 105 #include <SDL3/SDL_close_code.h> | |
| 106 | |
| 107 #endif /* SDL_metal_h_ */ |
