Exemplo n.º 1
0
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            this.isMouseDown = true;

            Point            pt  = e.GetPosition(this);
            MouseButtonState mb  = e.RightButton;
            MouseButtonState mbl = e.LeftButton;


            if (mb == MouseButtonState.Pressed)
            {
                mbpressed = Constants.Mousebutton.Right;
            }


            if (mbl == MouseButtonState.Pressed)
            {
                mbpressed = Constants.Mousebutton.Left;
            }


            int x = (int)((pt.X) / Constants.CELL_SIZE);
            int y = (int)((pt.Y) / Constants.CELL_SIZE);

            if (null != this.Click)
            {
                Click(this, new ClickEventArgs(x, y, mbpressed));
            }
        }
Exemplo n.º 2
0
 public ClickEventArgs(int x, int y, Constants.Mousebutton button)
     : base()
 {
     this.X      = x;
     this.Y      = y;
     this.BUTTON = button;
 }
Exemplo n.º 3
0
        public void ToggleCell(int x, int y, Constants.Mousebutton button)
        {
            int i = y * Constants.CELLS_X + x;

            if (i < Constants.CELLS_X * Constants.CELLS_Y)
            {
                if (button == Constants.Mousebutton.Left)
                {
                    EdTile.Do(i, ForegroundCol);
                }

                if (button == Constants.Mousebutton.Right)
                {
                    EdTile.Do(i, BackgroundCol);
                }
            }

            if (null != this.Update)
            {
                Update(this);
            }
        }