blib/lib/SDL2/metal.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 22 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package SDL2::metal 0.01 {
2 use SDL2::Utils;
3 #
4 use SDL2::video;
5  
6 package SDL2::MetalView {
7 use SDL2::Utils;
8 our $TYPE = has();
9 };
10 attach metal => {
11 SDL_Metal_CreateView => [ ['SDL_Window'], 'SDL_MetalView' ],
12 SDL_Metal_DestroyView => [ ['SDL_MetalView'] ],
13 SDL_Metal_GetLayer => [ ['SDL_MetalView'], 'opaque' ],
14 SDL_Metal_GetDrawableSize => [ [ 'SDL_Window', 'int', 'int' ] ]
15 };
16  
17 =encoding utf-8
18  
19 =head1 NAME
20  
21 SDL2::metal - Metal Laysers and Views on SDL Windows
22  
23 =head1 SYNOPSIS
24  
25 use SDL2 qw[:metal];
26  
27 =head1 DESCRIPTION
28  
29 This package contains functions to creating Metal layers and views on SDL
30 windows.
31  
32 =head1 Functions
33  
34 These functions may be imported by name or with the C<:metal> tag.
35  
36 =head2 C<SDL_Metal_CreateView( ... )>
37  
38 Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
39 window.
40  
41 On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
42 own. It is up to user code to do that.
43  
44 Expected parameters include:
45  
46 =over
47  
48 =item C<window> - L<SDL2::Window> from which the drawable size should be queried
49  
50 =back
51  
52 The returned handle can be cast directly to a NSView or UIView. To access the
53 backing CAMetalLayer, call L<< C<SDL_Metal_GetLayer( ...
54 )>|C<SDL_Metal_GetLayer( ... )> >>.
55  
56 Note: window must be created with the C<SDL_WINDOW_METAL> flag.
57  
58 =head2 C<SDL_Metal_DestroyView( ... )>
59  
60 Destroy an existing L<SDL2::MetalView> object.
61  
62 This should be called before C<SDL_DestroyWindow( ... )>, if L<<
63 C<SDL_Metal_CreateView( ... )>|/C<SDL_Metal_CreateView( ... )> >> was called
64 after C<SDL_CreateWindow( ... )>.
65  
66 Expected parameters include:
67  
68 =over
69  
70 =item C<view> - L<SDL2::MetalView> to destroy
71  
72 =back
73  
74 =head2 C<SDL_Metal_GetLayer( ... )>
75  
76 Get a pointer to the backing CAMetalLayer for the given view.
77  
78 Expected parameters include:
79  
80 =over
81  
82 =item C<view> - L<SDL2::MetalView> to query
83  
84 =back
85  
86 Returns an opaque pointer.
87  
88 =head2 C<SDL_Metal_GetDrawableSize( ... )>
89  
90 Get the size of a window's underlying drawable in pixels (for use with setting
91 viewport, scissor & etc).
92  
93 Expected parameters include:
94  
95 =over
96  
97 =item C<window> - L<SDL2::Window> from which the drawable size should be queried
98  
99 =item C<w> - pointer to variable for storing the width in pixels, may be C<undef>
100  
101 =item C<h> - Pointer to variable for storing the height in pixels, may be <undef>
102  
103 =back
104  
105 This may differ from C<SDL_GetWindowSize( ... )> if we're rendering to a
106 high-DPI drawable, i.e. the window was created with C<SDL_WINDOW_ALLOW_HIGHDPI>
107 on a platform with high-DPI support (Apple calls this "Retina"), and not
108 disabled by the C<SDL_HINT_VIDEO_HIGHDPI_DISABLED> hint.
109  
110 Note: On macOS high-DPI support must be enabled for an application by setting
111 NSHighResolutionCapable to true in its Info.plist.
112  
113 =head1 LICENSE
114  
115 Copyright (C) Sanko Robinson.
116  
117 This library is free software; you can redistribute it and/or modify it under
118 the terms found in the Artistic License 2. Other copyrights, terms, and
119 conditions may apply to data transmitted through this module.
120  
121 =head1 AUTHOR
122  
123 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
124  
125 =begin stopwords
126  
127 MTLDevice
128  
129 =end stopwords
130  
131 =cut
132  
133 };
134 1;