{"action":"created","issue":{"url":"https://api.github.com/repos/mono/CocosSharp/issues/336","labels_url":"https://api.github.com/repos/mono/CocosSharp/issues/336/labels{/name}","comments_url":"https://api.github.com/repos/mono/CocosSharp/issues/336/comments","events_url":"https://api.github.com/repos/mono/CocosSharp/issues/336/events","html_url":"https://github.com/mono/CocosSharp/issues/336","id":122517900,"number":336,"title":"Allow to control \"ControllerUserInteractionEnabled\" on tvOS","user":{"login":"Krumelur","id":574373,"avatar_url":"https://avatars.githubusercontent.com/u/574373?v=3","gravatar_id":"","url":"https://api.github.com/users/Krumelur","html_url":"https://github.com/Krumelur","followers_url":"https://api.github.com/users/Krumelur/followers","following_url":"https://api.github.com/users/Krumelur/following{/other_user}","gists_url":"https://api.github.com/users/Krumelur/gists{/gist_id}","starred_url":"https://api.github.com/users/Krumelur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Krumelur/subscriptions","organizations_url":"https://api.github.com/users/Krumelur/orgs","repos_url":"https://api.github.com/users/Krumelur/repos","events_url":"https://api.github.com/users/Krumelur/events{/privacy}","received_events_url":"https://api.github.com/users/Krumelur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-16T14:40:40Z","updated_at":"2015-12-17T00:30:09Z","closed_at":null,"body":"Apple's HIG requires that the menu button of the remote exits the game to the home screen if you are on the first screen of an app.\r\nThis is achieved by\r\n\r\n* Setting `GCEventViewController.ControllerUserInteractionEnabled = true`\r\n* Calling `base.PressesBegan()` when handling input\r\n* Afterwards, the property can be set to false again.\r\n\r\nMonoGame handles this already correctly. IMHO it would not be the worst idea to derive from `iOSGameViewController` (which is unfortunately not public in MonoGame). This would prevent reinventing the wheel. Otherwise, CocosSharp should provide its own GCEventViewContrller subclass which handles this.\r\n\r\nAt the moment I handle it like this (changed CCGameView.tvOS.cs):\r\n\r\n```\r\npublic override void PressesBegan (NSSet<UIPress> presses, UIPressesEvent evt)\r\n        {\r\n            FillPressesCollection (presses);\r\n\r\n            if(this.UseDefaultBackButtonHandling && presses.AnyObject != null && presses.AnyObject.Type == UIPressType.Menu)\r\n            {\r\n                var eventController = UIApplication.SharedApplication.Delegate.GetWindow().RootViewController as GCEventViewController;\r\n                if(eventController != null)\r\n                {\r\n                    eventController.ControllerUserInteractionEnabled = true;\r\n                }\r\n                base.PressesBegan (presses, evt);\r\n                if(eventController != null)\r\n                {\r\n                    eventController.ControllerUserInteractionEnabled = false;\r\n                }\r\n            }\r\n        }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mono/CocosSharp/issues/comments/165299209","html_url":"https://github.com/mono/CocosSharp/issues/336#issuecomment-165299209","issue_url":"https://api.github.com/repos/mono/CocosSharp/issues/336","id":165299209,"user":{"login":"rtabbara","id":3273442,"avatar_url":"https://avatars.githubusercontent.com/u/3273442?v=3","gravatar_id":"","url":"https://api.github.com/users/rtabbara","html_url":"https://github.com/rtabbara","followers_url":"https://api.github.com/users/rtabbara/followers","following_url":"https://api.github.com/users/rtabbara/following{/other_user}","gists_url":"https://api.github.com/users/rtabbara/gists{/gist_id}","starred_url":"https://api.github.com/users/rtabbara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtabbara/subscriptions","organizations_url":"https://api.github.com/users/rtabbara/orgs","repos_url":"https://api.github.com/users/rtabbara/repos","events_url":"https://api.github.com/users/rtabbara/events{/privacy}","received_events_url":"https://api.github.com/users/rtabbara/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T00:30:09Z","updated_at":"2015-12-17T00:30:09Z","body":"@Krumelur I might need to see the code, but I'm not following your approach of moving this logic to the game view. As of CocosSharp 1.7.0.0-pre1, the setup is to essentially bring your own view controller and associate it with a <code>CCGameView</code>. So with respect to tvOS, why can't you simply subclass  <code>GCEventViewController</code> and slap a <code>CCGameView</code> onto it? As in, make sure the current ViewController is of type <code>GCEventViewController</code> rather than simply <code>UIViewController</code>. Then you can put the above logic within your subclassed view controller.\r\n\r\nYes, I suppose this is slightly more cumbersome than the current MG approach, but there's a few things to keep in mind. Firstly, the project templates can simply be updated to ensure the view controller is correctly setup when targeting tvOS. I think this is something that will have to be addressed not just for CocosSharp, but for all tvOS apps.\r\n\r\nSecondly, what happens when a user wants a multiple tabbed tvOS application? With the MG setup of taking over the entire application, this simply isn't possible. This was precisely the motivation for us to bring our interface up to the View level, to give developers control of the layout of their native application and the freedom to attach their game view where ever they see fit."}}