Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ParadoxGameController.iOS.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 #if SILICONSTUDIO_PLATFORM_IOS
4 
5 using MonoTouch.Foundation;
6 using MonoTouch.UIKit;
7 using MonoTouch.ObjCRuntime;
8 
9 namespace SiliconStudio.Paradox.Games
10 {
11  public class ParadoxGameController : UIViewController
12  {
13  public delegate void OnTouchesBegan(NSSet touchesSet, UIEvent evt);
14  public delegate void OnTouchesMoved(NSSet touchesSet, UIEvent evt);
15  public delegate void OnTouchesCancelled(NSSet touchesSet, UIEvent evt);
16  public delegate void OnTouchesEnded(NSSet touchesSet, UIEvent evt);
17 
18  internal OnTouchesBegan TouchesBeganDelegate;
19  internal OnTouchesMoved TouchesMovedDelegate;
20  internal OnTouchesCancelled TouchesCancelledDelegate;
21  internal OnTouchesEnded TouchesEndedDelegate;
22 
23  public override void ViewDidLoad()
24  {
25  base.ViewDidLoad();
26 
27  // This lines of code are to set to fullscreen mode
28  var sel = new Selector("setNeedsStatusBarAppearanceUpdate");
29 
30  if (RespondsToSelector(sel))
31  {
32  // iOS 7
33  PerformSelector(sel, this, 0.0);
34  }
35  else
36  {
37  // iOS 6 and prior
38  UIApplication.SharedApplication.SetStatusBarHidden(true, false);
39  }
40  }
41 
42  public override bool PrefersStatusBarHidden()
43  {
44  // iOS 7
45  return true;
46  }
47 
48  public override void TouchesBegan(NSSet touches, UIEvent evt)
49  {
50  base.TouchesBegan(touches, evt);
51  TouchesBeganDelegate(touches, evt);
52  }
53 
54  public override void TouchesMoved(NSSet touches, UIEvent evt)
55  {
56  base.TouchesMoved(touches, evt);
57  TouchesMovedDelegate(touches, evt);
58  }
59 
60  public override void TouchesEnded(NSSet touches, UIEvent evt)
61  {
62  base.TouchesEnded(touches, evt);
63  TouchesEndedDelegate(touches, evt);
64  }
65 
66  public override void TouchesCancelled(NSSet touches, UIEvent evt)
67  {
68  base.TouchesCancelled(touches, evt);
69  TouchesCancelledDelegate(touches, evt);
70  }
71  }
72 }
73 
74 #endif