Exemplo n.º 1
0
 private void ResumeHandler(object sender, InputDeviceEventArgs<MouseButtons, MouseState> args, MenuItem subscriber)
 {
     if (subscriber.Rectangle.Contains(new Point(args.State.X, args.State.Y)))
         Resume(Engine.Services.GetService<KeyboardDevice>(), Engine.Services.GetService<MouseDevice>());
 }
Exemplo n.º 2
0
 private void Terminate(object sender, InputDeviceEventArgs<MouseButtons, MouseState> args, MenuItem subscriber)
 {
     if (subscriber.Rectangle.Contains(new Point(args.State.X, args.State.Y)))
         Exit();
 }
Exemplo n.º 3
0
        private void pause(KeyboardDevice keyboard, MouseDevice mouse)
        {
            paused_mouse_position = mouse.Position;
            GameScreen pause = new GameScreen("Pause");
            mouse.ResetMouseAfterUpdate = false;
            this.IsMouseVisible = true;
            pause.Components.Add(keyboard);
            pause.Components.Add(mouse);
            Engine.blur.Visible = true;
            pause.BlocksUpdate = true;
            //MenuItem paused = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Paused", new Rectangle(350,100,100,30), pause);

            MenuItem resume = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Resume", new Rectangle(350, 150, 70, 30), pause);
            resume.Subscribe((object o, InputDeviceEventArgs<MouseButtons, MouseState> args) => ResumeHandler(o, args, resume));
            MenuItem exit = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Exit", new Rectangle(350, 200, 50, 30), pause);
            exit.Subscribe((object o, InputDeviceEventArgs<MouseButtons, MouseState> args) => Terminate(o, args, exit));
        }