Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            NSCursor.Hide();

            // Do any additional setup after loading the view.
            NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.KeyDown, (theEvent) =>
            {
                this.KeyDown(theEvent);
                return(null);
            });

            MainTimer          = new Timer(1000);
            MainTimer.Elapsed += (sender, e) =>
            {
                TimeLeft--;
                // Format the remaining time nicely for the label
                TimeSpan time       = TimeSpan.FromSeconds(TimeLeft);
                string   timeString = time.ToString(@"mm\:ss");
                InvokeOnMainThread(() =>
                {
                    //We want to interact with the UI from a different thread,
                    // so we must invoke this change on the main thread

                    timerLevel.DoubleValue = (1.0) * (15 * 60 - TimeLeft);
                });
            };
            MainTimer.Start();
        }
Exemplo n.º 2
0
        internal void GoFullScreen()
        {
            bool wasActive = IsActive;

            IsActive = false;

            //Some games set fullscreen in their initialize function,
            //before we have sized the window and set it active.
            //Do that now, or else mouse tracking breaks.
            _mainWindow.MakeKeyAndOrderFront(_mainWindow);
            ResetWindowBounds();

            _wasResizeable = IsAllowUserResizing;

            string oldTitle = _view.Title;

            NSMenu.MenuBarVisible         = false;
            _mainWindow.StyleMask         = NSWindowStyle.Borderless;
            _mainWindow.HidesOnDeactivate = true;

            ResetWindowBounds();

            if (oldTitle != null)
            {
                _view.Title = oldTitle;
            }

            if (!IsMouseVisible)
            {
                NSCursor.Hide();
            }

            IsActive = wasActive;
        }
Exemplo n.º 3
0
 public override void MouseEntered(NSEvent theEvent)
 {
     if (!game.IsMouseVisible)
     {
         NSCursor.Hide();
     }
 }
Exemplo n.º 4
0
 partial void ToogleCursor(NSObject sender)
 {
     Hidden = false;
     if (Hidden)
     {
         NSCursor.Unhide();
         Hidden = false;
     }
     else
     {
         NSCursor.Hide();
         Hidden = true;
     }
 }