コード例 #1
0
        private void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (_mouseButtonDown)
            {
                _mouseButtonDown = false;
                Point endPoint = Mouse.GetPosition(canvas);

                int leftX = Math.Min((int)_startPoint.X, (int)endPoint.X);
                int upY   = Math.Min((int)_startPoint.Y, (int)endPoint.Y);

                int rightX = Math.Max((int)_startPoint.X, (int)endPoint.X);
                int downY  = Math.Max((int)_startPoint.Y, (int)endPoint.Y);

                SymEnt newEnt = _activeCommand.Exectue(leftX, rightX, upY, downY, _nextID);

                if (newEnt != null)
                {
                    _world.AddEnt(newEnt);
                    _world.Redraw(canvas);
                    ++_nextID;
                }

                _selectionRegion.Reset();
            }
        }
コード例 #2
0
 public void AddEnt(SymEnt newEnt)
 {
     _entities.Add(newEnt);
 }