RetroArch/ui/drivers/cocoa/apple_platform.h
Autechre a49b02c44b
(Mac) Makefile changes for supporting Metal build (#11929)
* (QB) Add rule for Metal - define HAVE_COCOA_METAL for now
when building for Metal, and HAVE_COCOA for non-Metal build

* Make necessary changes to Makefile.common and qb/config.libs.sh:
- Disable OpenGL for now for Metal build
- Take Metal conditional out of OpenGL block in Makefile.common

* (Metal) Header fixes for compiling without Xcode/Griffin

* (Mac) Some buildfixes for non-Xcode building

* (cocoa_common.h) Restructure to no longer use -DOSX

* (Apple) More buildfixes

* (Apple) Cleanups
2021-01-22 22:20:38 +01:00

95 lines
2.3 KiB
Objective-C

#ifndef COCOA_APPLE_PLATFORM_H
#define COCOA_APPLE_PLATFORM_H
#ifdef HAVE_METAL
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
#endif
#if defined(HAVE_COCOA_METAL) && !defined(HAVE_COCOATOUCH)
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@implementation WindowListener
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/
- (void)flagsChanged:(NSEvent *)event { }
- (void)keyDown:(NSEvent *)event { }
- (void)keyUp:(NSEvent *)event { }
@end
#endif
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
@protocol ApplePlatform
/*! @brief renderView returns the current render view based on the viewType */
@property(readonly) id renderView;
/*! @brief isActive returns true if the application has focus */
@property(readonly) bool hasFocus;
@property(readwrite) apple_view_type_t viewType;
/*! @brief setVideoMode adjusts the video display to the specified mode */
- (void)setVideoMode:(gfx_ctx_mode_t)mode;
/*! @brief setCursorVisible specifies whether the cursor is visible */
- (void)setCursorVisible:(bool)v;
/*! @brief controls whether the screen saver should be disabled and
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
@end
#endif
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
extern id<ApplePlatform> apple_platform;
id<ApplePlatform> apple_platform;
#else
id apple_platform;
#endif
#if defined(HAVE_COCOATOUCH)
@interface RetroArch_iOS : UINavigationController<ApplePlatform, UIApplicationDelegate,
UINavigationControllerDelegate> {
UIView *_renderView;
apple_view_type_t _vt;
}
@property (nonatomic) UIWindow* window;
@property (nonatomic) NSString* documentsDirectory;
@property (nonatomic) int menu_count;
+ (RetroArch_iOS*)get;
- (void)showGameView;
- (void)supportOtherAudioSessions;
- (void)refreshSystemConfig;
@end
#else
#if defined(HAVE_COCOA_METAL)
@interface RetroArch_OSX : NSObject<ApplePlatform, NSApplicationDelegate> {
#elif (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@interface RetroArch_OSX : NSObject {
#else
@interface RetroArch_OSX : NSObject<NSApplicationDelegate> {
#endif
NSWindow *_window;
apple_view_type_t _vt;
NSView *_renderView;
id _sleepActivity;
#if defined(HAVE_COCOA_METAL)
WindowListener *_listener;
#endif
}
@property(nonatomic, retain) NSWindow IBOutlet *window;
@end
#endif
#endif