RetroArch
cocoa_common_metal.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2013-2014 - Jason Fetters
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __COCOA_COMMON_METAL_H
18 #define __COCOA_COMMON_METAL_H
19 
20 #include <Foundation/Foundation.h>
21 
22 #ifdef HAVE_MENU
23 #include "../../menu/menu_setting.h"
24 #include "../../menu/menu_driver.h"
25 #endif
26 
27 #ifdef HAVE_CORELOCATION
28 #include <CoreLocation/CoreLocation.h>
29 #endif
30 
31 typedef enum apple_view_type {
38 
39 #ifdef HAVE_METAL
40 #import <MetalKit/MetalKit.h>
41 
42 @interface MetalView : MTKView
43 @end
44 
45 #endif
46 
47 @protocol ApplePlatform
48 
50 @property (readonly) id renderView;
51 
53 @property (readonly) bool hasFocus;
54 
55 @property (readwrite) apple_view_type_t viewType;
56 
58 - (void)setVideoMode:(gfx_ctx_mode_t)mode;
59 
61 - (void)setCursorVisible:(bool)v;
62 
66 - (bool)setDisableDisplaySleep:(bool)disable;
67 @end
68 
70 
71 #if defined(HAVE_COCOATOUCH)
72 #include <UIKit/UIKit.h>
73 
74 #ifdef HAVE_AVFOUNDATION
75 #import <AVFoundation/AVCaptureOutput.h>
76 #endif
77 
78 
79 /*********************************************/
80 /* RAMenuBase */
81 /* A menu class that displays RAMenuItemBase */
82 /* objects. */
83 /*********************************************/
84 @interface RAMenuBase : UITableViewController
85 @property (nonatomic) NSMutableArray* sections;
86 @property (nonatomic) BOOL hidesHeaders;
87 @property (nonatomic) RAMenuBase* last_menu;
88 @property (nonatomic) UILabel *osdmessage;
89 
90 - (id)initWithStyle:(UITableViewStyle)style;
91 - (id)itemForIndexPath:(NSIndexPath*)indexPath;
92 
93 @end
94 
95 typedef struct
96 {
97  char orientations[32];
98  unsigned orientation_flags;
99  char bluetooth_mode[64];
100 } apple_frontend_settings_t;
101 extern apple_frontend_settings_t apple_frontend_settings;
102 
103 @interface CocoaView : UIViewController<CLLocationManagerDelegate,
104 AVCaptureAudioDataOutputSampleBufferDelegate>
105 + (CocoaView*)get;
106 @end
107 
108 @interface RetroArch_iOS : UINavigationController<UIApplicationDelegate,
109 UINavigationControllerDelegate, ApplePlatform>
110 
111 @property (nonatomic) UIWindow* window;
112 @property (nonatomic) NSString* documentsDirectory;
113 @property (nonatomic) RAMenuBase* mainmenu;
114 @property (nonatomic) int menu_count;
115 
116 + (RetroArch_iOS*)get;
117 
118 - (void)showGameView;
119 - (void)toggleUI;
120 - (void)supportOtherAudioSessions;
121 
122 - (void)refreshSystemConfig;
123 - (void)mainMenuPushPop: (bool)pushp;
124 - (void)mainMenuRefresh;
125 @end
126 
127 void get_ios_version(int *major, int *minor);
128 
129 #elif defined(HAVE_COCOA_METAL)
130 #include <AppKit/AppKit.h>
131 
132 @interface CocoaView : NSView
133 #ifdef HAVE_CORELOCATION
134 <CLLocationManagerDelegate>
135 #endif
136 
137 + (CocoaView*)get;
138 #if !defined(HAVE_COCOA_METAL)
139 - (void)display;
140 #endif
141 
142 @end
143 
144 #endif
145 
146 #define BOXSTRING(x) [NSString stringWithUTF8String:x]
147 #define BOXINT(x) [NSNumber numberWithInt:x]
148 #define BOXUINT(x) [NSNumber numberWithUnsignedInt:x]
149 #define BOXFLOAT(x) [NSNumber numberWithDouble:x]
150 
151 #if __has_feature(objc_arc)
152 #define RELEASE(x) x = nil
153 #define BRIDGE __bridge
154 #define UNSAFE_UNRETAINED __unsafe_unretained
155 #else
156 #define RELEASE(x) [x release]; \
157  x = nil
158 #define BRIDGE
159 #define UNSAFE_UNRETAINED
160 #endif
161 
162 #endif
id< ApplePlatform > apple_platform
Definition: ui_cocoa.m:41
Definition: cocoa_common.m:59
apple_frontend_settings_t apple_frontend_settings
Definition: ui_cocoatouch.m:106
GLenum GLuint id
Definition: glext.h:6233
Definition: cocoa_common_metal.h:36
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
Definition: cocoa_common_metal.h:32
typedef bool(RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index
id renderView
renderView returns the current render view based on the viewType
Definition: cocoa_common_metal.h:50
Definition: cocoa_common_metal.m:46
Definition: cocoatouch_menu.m:582
bool hasFocus
isActive returns true if the application has focus
Definition: cocoa_common_metal.h:53
Definition: cocoa_common_metal.h:47
Definition: video_driver.h:638
Definition: cocoa_common_metal.h:33
Definition: cocoa_common_metal.h:35
enum apple_view_type apple_view_type_t
CocoaView * get()
Definition: cocoa_common.m:70
Definition: nk_menu.h:45
Definition: ui_cocoatouch.m:328
unsigned int BOOL
Definition: gctypes.h:51
Definition: cocoa_common_metal.h:34
apple_view_type
Definition: cocoa_common_metal.h:31
apple_view_type_t viewType
Definition: cocoa_common_metal.h:55
void get_ios_version(int *major, int *minor)
Definition: ui_cocoatouch.m:108