RetroArch/ui/drivers/cocoa/apple_platform.h

109 lines
2.4 KiB
C
Raw Normal View History

2019-11-19 05:54:01 +01:00
#ifndef COCOA_APPLE_PLATFORM_H
#define COCOA_APPLE_PLATFORM_H
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
#ifdef HAVE_COCOA_METAL
2019-11-19 12:00:24 +07:00
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
#endif
2019-11-19 12:00:24 +07:00
#if !defined(HAVE_COCOATOUCH)
2019-11-30 12:49:52 +07:00
@interface WindowListener : NSResponder<NSWindowDelegate>
2019-11-19 12:00:24 +07:00
@end
@implementation WindowListener
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/
2019-11-30 12:49:52 +07:00
- (void)flagsChanged:(NSEvent *)event {
2019-11-19 12:00:24 +07:00
}
2019-11-30 12:49:52 +07:00
- (void)keyDown:(NSEvent *)event {
2019-11-19 12:00:24 +07:00
}
2019-11-30 12:49:52 +07:00
- (void)keyUp:(NSEvent *)event {
2019-11-19 12:00:24 +07:00
}
@end
#endif
2019-11-19 12:00:24 +07:00
2019-11-30 12:49:52 +07:00
@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
extern id<ApplePlatform> apple_platform;
2019-11-19 05:54:01 +01:00
id<ApplePlatform> apple_platform;
#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) RAMenuBase* mainmenu;
@property (nonatomic) int menu_count;
+ (RetroArch_iOS*)get;
- (void)showGameView;
- (void)toggleUI;
- (void)supportOtherAudioSessions;
- (void)refreshSystemConfig;
- (void)mainMenuPushPop: (bool)pushp;
- (void)mainMenuRefresh;
@end
#else
2019-11-30 12:49:52 +07:00
@interface RetroArch_OSX : NSObject<ApplePlatform, NSApplicationDelegate> {
NSWindow *_window;
apple_view_type_t _vt;
NSView *_renderView;
id _sleepActivity;
WindowListener *_listener;
2019-11-19 05:54:01 +01:00
}
#endif
2019-11-19 05:54:01 +01:00
#elif defined(HAVE_COCOA)
id apple_platform;
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@interface RetroArch_OSX : NSObject
#else
2019-11-30 12:49:52 +07:00
@interface RetroArch_OSX : NSObject<NSApplicationDelegate>
2019-11-19 05:54:01 +01:00
#endif
{
2019-11-30 12:49:52 +07:00
NSWindow *_window;
2019-11-19 05:54:01 +01:00
}
#endif
#if TARGET_OS_OSX
2019-11-19 12:00:24 +07:00
@property(nonatomic, retain) NSWindow IBOutlet *window;
2019-11-19 05:54:01 +01:00
@end
2019-11-20 02:58:17 +01:00
#endif
2019-11-19 05:54:01 +01:00
#endif