Skip to content

Commit e4369ef

Browse files
Add SDL_metal.inc
1 parent 5efa184 commit e4369ef

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

units/SDL3.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ interface
119119
{$I SDL_filesystem.inc} // 3.2.0
120120
{$I SDL_atomic.inc} // 3.2.0
121121
{$I SDL_hidapi.inc} // 3.2.0
122+
{$I SDL_metal.inc} // 3.2.0
122123

123124

124125

units/SDL_metal.inc

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
This file is part of:
3+
4+
SDL3 for Pascal
5+
(https://github.com/PascalGameDevelopment/SDL3-for-Pascal)
6+
SPDX-License-Identifier: Zlib
7+
}
8+
9+
{*
10+
* # CategoryMetal
11+
*
12+
* Functions to creating Metal layers and views on SDL windows.
13+
*
14+
* This provides some platform-specific glue for Apple platforms. Most macOS
15+
* and iOS apps can use SDL without these functions, but this API they can be
16+
* useful for specific OS-level integration tasks.
17+
}
18+
19+
{*
20+
* A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
21+
*
22+
* \since This datatype is available since SDL 3.2.0.
23+
}
24+
type
25+
PPSDL_MetalView = ^PSDL_MetalView;
26+
PSDL_MetalView = ^TSDL_MetalView;
27+
TSDL_MetalView = Pointer;
28+
29+
{*
30+
* \name Metal support functions
31+
}
32+
33+
{*
34+
* Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
35+
* window.
36+
*
37+
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on
38+
* its own. It is up to user code to do that.
39+
*
40+
* The returned handle can be casted directly to a NSView or UIView. To access
41+
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
42+
*
43+
* \param window the window.
44+
* \returns handle NSView or UIView.
45+
*
46+
* \since This function is available since SDL 3.2.0.
47+
*
48+
* \sa SDL_Metal_DestroyView
49+
* \sa SDL_Metal_GetLayer
50+
}
51+
function SDL_Metal_CreateView(window: PSDL_Window): TSDL_MetalView; cdecl;
52+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Metal_CreateView' {$ENDIF} {$ENDIF};
53+
54+
{*
55+
* Destroy an existing SDL_MetalView object.
56+
*
57+
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
58+
* called after SDL_CreateWindow.
59+
*
60+
* \param view the SDL_MetalView object.
61+
*
62+
* \since This function is available since SDL 3.2.0.
63+
*
64+
* \sa SDL_Metal_CreateView
65+
}
66+
procedure SDL_Metal_DestroyView(view: TSDL_MetalView); cdecl;
67+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Metal_DestroyView' {$ENDIF} {$ENDIF};
68+
69+
{*
70+
* Get a Pointer to the backing CAMetalLayer for the given view.
71+
*
72+
* \param view the SDL_MetalView object.
73+
* \returns a Pointer.
74+
*
75+
* \since This function is available since SDL 3.2.0.
76+
}
77+
function SDL_Metal_GetLayer(view: TSDL_MetalView): Pointer; cdecl;
78+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Metal_GetLayer' {$ENDIF} {$ENDIF};
79+

0 commit comments

Comments
 (0)