🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.3 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_metal.h
  20. *
  21. * Header file for functions to creating Metal layers and views on SDL windows.
  22. */
  23. #ifndef SDL_metal_h_
  24. #define SDL_metal_h_
  25. #include "SDL_video.h"
  26. #include "begin_code.h"
  27. /* Set up for C function definitions, even when using C++ */
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**
  32. * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
  33. *
  34. * \note This can be cast directly to an NSView or UIView.
  35. */
  36. typedef void *SDL_MetalView;
  37. /**
  38. * \name Metal support functions
  39. */
  40. /* @{ */
  41. /**
  42. * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
  43. * window.
  44. *
  45. * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on
  46. * its own. It is up to user code to do that.
  47. *
  48. * The returned handle can be casted directly to a NSView or UIView. To access
  49. * the backing CAMetalLayer, call SDL_Metal_GetLayer().
  50. *
  51. * \since This function is available since SDL 2.0.12.
  52. *
  53. * \sa SDL_Metal_DestroyView
  54. * \sa SDL_Metal_GetLayer
  55. */
  56. extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
  57. /**
  58. * Destroy an existing SDL_MetalView object.
  59. *
  60. * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
  61. * called after SDL_CreateWindow.
  62. *
  63. * \since This function is available since SDL 2.0.12.
  64. *
  65. * \sa SDL_Metal_CreateView
  66. */
  67. extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
  68. /**
  69. * Get a pointer to the backing CAMetalLayer for the given view.
  70. *
  71. * \since This function is available since SDL 2.0.14.
  72. *
  73. * \sa SDL_MetalCreateView
  74. */
  75. extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
  76. /**
  77. * Get the size of a window's underlying drawable in pixels (for use with
  78. * setting viewport, scissor & etc).
  79. *
  80. * \param window SDL_Window from which the drawable size should be queried
  81. * \param w Pointer to variable for storing the width in pixels, may be NULL
  82. * \param h Pointer to variable for storing the height in pixels, may be NULL
  83. *
  84. * \since This function is available since SDL 2.0.14.
  85. *
  86. * \sa SDL_GetWindowSize
  87. * \sa SDL_CreateWindow
  88. */
  89. extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
  90. int *h);
  91. /* @} *//* Metal support functions */
  92. /* Ends C function definitions when using C++ */
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #include "close_code.h"
  97. #endif /* SDL_metal_h_ */