예제 #1
0
        private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e)
        {
            try
            {
                MouseManager.BeginDrag(e.Location);

                if (e.Button.HasFlag(MouseButtons.Left))
                {
                    int tx = (int)Math.Round(-OffsetX + e.X + GLSurface.FieldW / 2 - 0.5);
                    int ty = (int)Math.Round(-OffsetY + e.Y + GLSurface.FieldH / 2 - 0.5);

                    if (GLSurface.GetTile(tx, ty) == null)
                    {
                        GLSurface.PlaceTile(TileComboBox.SelectedIndex <= 0 ? TileName : (string)TileComboBox.SelectedItem, tx, ty);
                        MouseState = MouseStatus.Placing;
                    }
                    else
                    {
                        GLSurface.PlaceTile(null, tx, ty);
                        MouseState = MouseStatus.Removing;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e)
        {
            try
            {
                MouseManager.BeginDrag(e.Location);

                float b  = LoadedResource.PointBoundsX / GLSurface.Zoom;
                float x1 = LoadedResource.FirePointX;
                float y1 = LoadedResource.FirePointY;
                float x2 = x1 + LoadedResource.FireVectorX;
                float y2 = y1 + LoadedResource.FireVectorY;

                if (MouseManager.CurrentLocation.X >= OffsetX + x2 - b &&
                    MouseManager.CurrentLocation.X <= OffsetX + x2 + b &&
                    MouseManager.CurrentLocation.Y >= OffsetY + y2 - b &&
                    MouseManager.CurrentLocation.Y <= OffsetY + y2 + b)
                {
                    CapturedPoint = 2;
                }
                else
                if (MouseManager.CurrentLocation.X >= OffsetX + x1 - b &&
                    MouseManager.CurrentLocation.X <= OffsetX + x1 + b &&
                    MouseManager.CurrentLocation.Y >= OffsetY + y1 - b &&
                    MouseManager.CurrentLocation.Y <= OffsetY + y1 + b)
                {
                    CapturedPoint = 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
 private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e)
 {
     try
     {
         MouseManager.BeginDrag(e.Location);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
0
        private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e)
        {
            try
            {
                MouseManager.BeginDrag(e.Location);

                float b = LoadedResource.PointBoundsX / GLSurface.Zoom;
                if (MouseManager.CurrentLocation.X >= OffsetX - b &&
                    MouseManager.CurrentLocation.X <= OffsetX + b &&
                    MouseManager.CurrentLocation.Y >= OffsetY - b &&
                    MouseManager.CurrentLocation.Y <= OffsetY + b)
                {
                    PointCaptured = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }