mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-17 00:07:44 +00:00
Merge pull request #2040 from lakkatv/cocoa
Start displaying messageboxes in cocoa_touch
This commit is contained in:
commit
8f2a31a1f6
@ -395,11 +395,14 @@ void menu_driver_free(menu_handle_t *menu)
|
||||
void menu_driver_render_messagebox(const char *msg)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
if (driver->render_messagebox && msg[0] != '\0')
|
||||
driver->render_messagebox(msg);
|
||||
if (ui->render_messagebox && msg[0] != '\0')
|
||||
ui->render_messagebox(msg);
|
||||
}
|
||||
|
||||
void menu_driver_render(void)
|
||||
|
@ -596,6 +596,17 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
*/
|
||||
}
|
||||
|
||||
-(void)renderMessageBox:(NSString *)msg
|
||||
{
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Help"
|
||||
message:msg
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
|
||||
[message show];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface RAMainMenu : RAMenuBase<RAMenuActioner>
|
||||
|
@ -493,5 +493,6 @@ const ui_companion_driver_t ui_companion_cocoa = {
|
||||
ui_companion_cocoa_event_command,
|
||||
ui_companion_cocoa_notify_content_loaded,
|
||||
ui_companion_cocoa_notify_list_pushed,
|
||||
NULL,
|
||||
"cocoa",
|
||||
};
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "../../frontend/frontend.h"
|
||||
#include "../../runloop_data.h"
|
||||
|
||||
static char msg_old[PATH_MAX_LENGTH];
|
||||
static id apple_platform;
|
||||
static CFRunLoopObserverRef iterate_observer;
|
||||
|
||||
@ -403,6 +404,11 @@ enum
|
||||
[self.mainmenu reloadData];
|
||||
}
|
||||
|
||||
- (void)mainMenuRenderMessageBox:(NSString *)msg
|
||||
{
|
||||
[self.mainmenu renderMessageBox:msg];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -512,6 +518,17 @@ static void ui_companion_cocoatouch_notify_list_pushed(void *data,
|
||||
[ap mainMenuRefresh];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_render_messagebox(const char *msg)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
if (ap && strcmp(msg, msg_old))
|
||||
{
|
||||
[ap mainMenuRenderMessageBox: [NSString stringWithUTF8String:msg]];
|
||||
strlcpy(msg_old, msg, sizeof(msg_old));
|
||||
}
|
||||
}
|
||||
|
||||
const ui_companion_driver_t ui_companion_cocoatouch = {
|
||||
ui_companion_cocoatouch_init,
|
||||
ui_companion_cocoatouch_deinit,
|
||||
@ -520,5 +537,6 @@ const ui_companion_driver_t ui_companion_cocoatouch = {
|
||||
ui_companion_cocoatouch_event_command,
|
||||
ui_companion_cocoatouch_notify_content_loaded,
|
||||
ui_companion_cocoatouch_notify_list_pushed,
|
||||
ui_companion_cocoatouch_render_messagebox,
|
||||
"cocoatouch",
|
||||
};
|
||||
|
@ -41,6 +41,7 @@ typedef struct ui_companion_driver
|
||||
void (*event_command)(void *data, enum event_command action);
|
||||
void (*notify_content_loaded)(void *data);
|
||||
void (*notify_list_loaded)(void *data, file_list_t *list, file_list_t *menu_list);
|
||||
void (*render_messagebox)(const char *msg);
|
||||
const char *ident;
|
||||
} ui_companion_driver_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user