Create ui_companion_cocoa

This commit is contained in:
twinaphex 2015-04-20 12:43:07 +02:00
parent 0cbc577324
commit 96ae9c718a
4 changed files with 102 additions and 2 deletions

View File

@ -30,16 +30,18 @@
#if defined(HAVE_COCOATOUCH)
#if TARGET_OS_IPHONE
#include "../apple/iOS/platform.m"
#include "../apple/iOS/menu.m"
#include "../apple/iOS/browser.m"
#include "../apple/iOS/platform.m"
#include "../ui/drivers/ui_cocoatouch.m"
#endif
#elif defined(HAVE_COCOA)
#include "../apple/OSX/platform.m"
#include "../apple/OSX/settings.m"
#include "../ui/drivers/ui_cocoa.m"
#endif
#endif

94
ui/drivers/ui_cocoa.m Normal file
View File

@ -0,0 +1,94 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - 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/>.
*/
#include "../../apple/common/RetroArch_Apple.h"
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <file/file_path.h>
#include "../ui_companion_driver.h"
typedef struct ui_companion_cocoa
{
void *empty;
} ui_companion_cocoa_t;
static void ui_companion_cocoa_notify_content_loaded(void *data)
{
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
(void)data;
if (ap)
[ap showGameView];
}
static void ui_companion_cocoa_toggle(void *data)
{
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
(void)data;
if (ap)
[ap toggleUI];
}
static int ui_companion_cocoa_iterate(void *data, unsigned action)
{
(void)data;
return 0;
}
static void ui_companion_cocoa_deinit(void *data)
{
ui_companion_cocoa_t *handle = (ui_companion_cocoa_t*)data;
if (handle)
free(handle);
}
static void *ui_companion_cocoa_init(void)
{
ui_companion_cocoa_t *handle = (ui_companion_cocoa_t*)calloc(1, sizeof(*handle));
if (!handle)
return NULL;
return handle;
}
static void ui_companion_cocoa_event_command(void *data, unsigned cmd)
{
ui_companion_cocoa_t *handle = (ui_companion_cocoa_t*)data;
if (!handle)
return;
event_command(cmd);
}
const ui_companion_driver_t ui_companion_cocoa = {
ui_companion_cocoa_init,
ui_companion_cocoa_deinit,
ui_companion_cocoa_iterate,
ui_companion_cocoa_toggle,
ui_companion_cocoa_event_command,
ui_companion_cocoa_notify_content_loaded,
"cocoa",
};

View File

@ -22,6 +22,9 @@
#endif
static const ui_companion_driver_t *ui_companion_drivers[] = {
#ifdef HAVE_COCOA
&ui_companion_cocoa,
#endif
#ifdef HAVE_COCOATOUCH
&ui_companion_cocoatouch,
#endif

View File

@ -43,6 +43,7 @@ typedef struct ui_companion_driver
} ui_companion_driver_t;
extern const ui_companion_driver_t ui_companion_null;
extern const ui_companion_driver_t ui_companion_cocoa;
extern const ui_companion_driver_t ui_companion_cocoatouch;
extern const ui_companion_driver_t ui_companion_qt;