public GameController(Input input) : base() { this.input = input; if (Application.RenderingBackend == RenderingBackend.Vulkan) { if (!MetalGameView.IsMetalSupported()) { throw new NotSupportedException("Metal is not supported on the device"); } View = new MetalGameView(UIScreen.MainScreen.Bounds); } else { View = new GLGameView(UIScreen.MainScreen.Bounds); } View.MultipleTouchEnabled = true; ((IGameView)View).UpdateFrame += (delta) => ProcessTextInput(); softKeyboard = new SoftKeyboard(this); Application.SoftKeyboard = softKeyboard; UIAccelerometer.SharedAccelerometer.UpdateInterval = 0.05; UIAccelerometer.SharedAccelerometer.Acceleration += OnAcceleration; Application.SupportedDeviceOrientationsChanged += ResetDeviceOrientation; Initialize3DTouchOnTheLeftSideWorkaround(); textView = new CustomUITextView(this); textView.Delegate = new TextViewDelegate(input); textView.AutocorrectionType = UITextAutocorrectionType.No; textView.AutocapitalizationType = UITextAutocapitalizationType.None; View.Add(textView); }
public NSTimerTimeSource(GLGameView view, double updatesPerSecond) { this.view = view; // Can't use TimeSpan.FromSeconds() as that only has 1ms // resolution, and we need better(e.g. 60fps doesn't fit nicely // in 1ms resolution, but does in ticks). timeout = new TimeSpan((long)(((1.0 * TimeSpan.TicksPerSecond) / updatesPerSecond) + 0.5)); }
public CADisplayLinkTimeSource(GLGameView view, int frameInterval) { this.view = view; if (displayLink != null) { displayLink.Invalidate(); } displayLink = CADisplayLink.Create(this, selRunIteration); displayLink.FrameInterval = frameInterval; displayLink.Paused = true; }