2019-02-09 04:40:38 +01:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2013-2014 - Jason Fetters
|
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COCOA_COMMON_SHARED_H
|
|
|
|
#define __COCOA_COMMON_SHARED_H
|
|
|
|
|
|
|
|
#include <Foundation/Foundation.h>
|
|
|
|
|
2019-02-10 02:11:22 +01:00
|
|
|
#if defined(HAVE_COCOATOUCH)
|
2021-01-16 22:04:11 +01:00
|
|
|
#include <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
#if TARGET_OS_TV
|
|
|
|
#import <GameController/GameController.h>
|
|
|
|
#endif
|
|
|
|
|
2019-02-10 02:11:22 +01:00
|
|
|
#define RAScreen UIScreen
|
|
|
|
|
|
|
|
#ifndef UIUserInterfaceIdiomTV
|
|
|
|
#define UIUserInterfaceIdiomTV 2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef UIUserInterfaceIdiomCarPlay
|
|
|
|
#define UIUserInterfaceIdiomCarPlay 3
|
|
|
|
#endif
|
|
|
|
#else
|
2021-01-16 22:04:11 +01:00
|
|
|
|
2019-02-10 02:11:22 +01:00
|
|
|
#define RAScreen NSScreen
|
|
|
|
#endif
|
|
|
|
|
2021-01-16 22:04:11 +01:00
|
|
|
#if TARGET_OS_OSX
|
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum apple_view_type
|
|
|
|
{
|
|
|
|
APPLE_VIEW_TYPE_NONE = 0,
|
2019-02-09 04:40:38 +01:00
|
|
|
APPLE_VIEW_TYPE_OPENGL_ES,
|
|
|
|
APPLE_VIEW_TYPE_OPENGL,
|
|
|
|
APPLE_VIEW_TYPE_VULKAN,
|
2021-01-16 22:04:11 +01:00
|
|
|
APPLE_VIEW_TYPE_METAL
|
2019-02-09 04:40:38 +01:00
|
|
|
} apple_view_type_t;
|
|
|
|
|
|
|
|
#if defined(HAVE_COCOATOUCH)
|
|
|
|
|
|
|
|
#if TARGET_OS_IOS
|
2019-02-09 04:43:15 +01:00
|
|
|
@interface CocoaView : UIViewController
|
2019-02-09 04:40:38 +01:00
|
|
|
#elif TARGET_OS_TV
|
|
|
|
@interface CocoaView : GCEventViewController
|
|
|
|
#endif
|
|
|
|
+ (CocoaView*)get;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void get_ios_version(int *major, int *minor);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char orientations[32];
|
|
|
|
unsigned orientation_flags;
|
|
|
|
char bluetooth_mode[64];
|
|
|
|
} apple_frontend_settings_t;
|
|
|
|
extern apple_frontend_settings_t apple_frontend_settings;
|
|
|
|
|
2020-07-19 07:57:10 -10:00
|
|
|
#if TARGET_OS_OSX
|
2019-02-09 04:40:38 +01:00
|
|
|
@interface CocoaView : NSView
|
|
|
|
|
|
|
|
+ (CocoaView*)get;
|
|
|
|
#if !defined(HAVE_COCOA) && !defined(HAVE_COCOA_METAL)
|
|
|
|
- (void)display;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BOXSTRING(x) [NSString stringWithUTF8String:x]
|
|
|
|
#define BOXINT(x) [NSNumber numberWithInt:x]
|
|
|
|
#define BOXUINT(x) [NSNumber numberWithUnsignedInt:x]
|
|
|
|
#define BOXFLOAT(x) [NSNumber numberWithDouble:x]
|
|
|
|
|
|
|
|
#if __has_feature(objc_arc)
|
|
|
|
#define RELEASE(x) x = nil
|
|
|
|
#define BRIDGE __bridge
|
|
|
|
#define UNSAFE_UNRETAINED __unsafe_unretained
|
|
|
|
#else
|
|
|
|
#define RELEASE(x) [x release]; \
|
|
|
|
x = nil
|
|
|
|
#define BRIDGE
|
|
|
|
#define UNSAFE_UNRETAINED
|
|
|
|
#endif
|
|
|
|
|
2019-11-20 11:19:18 +01:00
|
|
|
void *nsview_get_ptr(void);
|
|
|
|
|
2021-01-16 20:37:56 +01:00
|
|
|
void nsview_set_ptr(CocoaView *ptr);
|
2019-11-20 11:19:18 +01:00
|
|
|
|
2019-02-10 02:13:57 +01:00
|
|
|
void *get_chosen_screen(void);
|
|
|
|
|
2019-02-09 04:40:38 +01:00
|
|
|
#endif
|