Пример #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            //Check Mouse Collisions
            MouseState mouse = Mouse.GetState();
            _mouseBox = new Box(new Vector2(mouse.X, mouse.Y), new Vector2(125, 20));

            if (mouse.LeftButton == ButtonState.Pressed)
            {
                if (_selectedMenuItem != -1 && MouseClick != null)
                {
                    MouseClick(this, new MenuSelectEvent(_selectedMenuItem));
                }
            }
        }
Пример #2
0
 public static bool Intersect(Box box1, Box box2)
 {
     return (Math.Abs(box1.Location.X - box2.Location.X)*2 < (box1.Width + box2.Width)) &&
            (Math.Abs(box1.Location.Y - box2.Location.Y)*2 < (box1.Height + box2.Height));
 }
Пример #3
0
 public override void Initialize()
 {
     base.Initialize();
     _mouseBox = new Box(new Vector2(0, 0), new Vector2(0, 0));
 }