2 Simple DirectMedia Layer
3 Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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.
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:
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.
22 * @author Mark Callow, www.edgewise-consulting.com.
24 * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing
25 * how to add a CAMetalLayer backed view.
28 #ifndef SDL_cocoametalview_h_
29 #define SDL_cocoametalview_h_
31 #import "../SDL_sysvideo.h"
32 #import "SDL_cocoawindow.h"
34 #if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL)
36 #import <Cocoa/Cocoa.h>
37 #import <Metal/Metal.h>
38 #import <QuartzCore/CAMetalLayer.h>
40 #define METALVIEW_TAG 255
42 @interface SDL_cocoametalview : NSView {
46 - (instancetype)initWithFrame:(NSRect)frame
49 /* Override superclass tag so this class can set it. */
50 @property (assign, readonly) NSInteger tag;
54 SDL_cocoametalview* Cocoa_Mtl_AddMetalView(SDL_Window* window);
56 void Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h);
58 #endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */
60 #endif /* SDL_cocoametalview_h_ */
62 /* vi: set ts=4 sw=4 expandtab: */