From 95cd9b1ad54f799d9513911e4cebc5bafc135d97 Mon Sep 17 00:00:00 2001 From: romulox_x Date: Sat, 23 May 2015 23:22:20 -0700 Subject: added response event for game center overlay closing --- platform/iphone/game_center.h | 2 ++ platform/iphone/game_center.mm | 10 +++++++++- platform/iphone/view_controller.mm | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'platform') diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h index 4fe13db8fc..8f180d1638 100644 --- a/platform/iphone/game_center.h +++ b/platform/iphone/game_center.h @@ -56,6 +56,8 @@ public: void request_achievement_descriptions(); Error show_game_center(Variant p_params); + void game_center_closed(); + int get_pending_event_count(); Variant pop_pending_event(); diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 9b4018a4ba..79c056776d 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -314,10 +314,18 @@ Error GameCenter::show_game_center(Variant p_params) { } [root_controller presentViewController: controller animated: YES completion:nil]; - + return OK; }; +void GameCenter::game_center_closed() { + + Dictionary ret; + ret["type"] = "show_game_center"; + ret["result"] = "ok"; + pending_events.push_back(ret); +} + int GameCenter::get_pending_event_count() { return pending_events.size(); diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index f04264cfd9..bc9950979e 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -130,7 +130,8 @@ int add_cmdline(int p_argc, char** p_args) { } - (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController*) gameCenterViewController { - printf("in finish"); + //[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone + GameCenter::get_singleton()->game_center_closed(); [gameCenterViewController dismissViewControllerAnimated:YES completion:nil]; } -- cgit v1.2.3