Example #1
0
 public Vector2 DesktopToLocal(Vector2 desktopPosition)
 {
     return(SDToLime.Convert(
                renderControl.PointToClient(LimeToSD.ConvertToPoint(desktopPosition, PixelScale)),
                PixelScale
                ));
 }
Example #2
0
 public Vector2 DesktopToLocal(Vector2 desktopPosition)
 {
     return(SDToLime.Convert(
                renderControl.PointToClient(new Point((int)desktopPosition.X, (int)desktopPosition.Y)),
                PixelScale
                ));
 }
Example #3
0
        private void UpdateCursorPosition(bool forced = false)
        {
            var pos = mWindow.PointToClient(Cursor.Position);

            if (LastMouseIntersection == null || pos.X != mLastCursorPosition.X || pos.Y != mLastCursorPosition.Y || forced)
            {
                mLastCursorPosition   = new Point(pos.X, pos.Y);
                LastMouseIntersection = new IntersectionParams(ActiveCamera.ViewInverse, ActiveCamera.ProjectionInverse,
                                                               new Vector2(mLastCursorPosition.X, mLastCursorPosition.Y));

                MapManager.Intersect(LastMouseIntersection);

                EditManager.Instance.MousePosition = LastMouseIntersection.TerrainPosition;
                mGlobalBufferStore.mousePosition   = new Vector4(LastMouseIntersection.TerrainPosition, 0.0f);
                mGlobalBufferChanged = true;

                EditManager.Instance.IsTerrainHovered = LastMouseIntersection.TerrainHit;
                EditManager.Instance.MousePosition    = LastMouseIntersection.TerrainPosition;

                ChunkEditManager.Instance.OnFrame();
            }
        }
Example #4
0
        /// <summary>
        /// Time to paint my dear !
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RenderControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            RenderControl.MakeCurrent();

            // Stop the draw timer
            DrawTimer.Stop();

            // Clear the background
            Display.ClearBuffers();

            Batch.Begin();

            // Background texture


            // Background texture
            Rectangle dst = new Rectangle(Point.Empty, RenderControl.Size);

            Batch.Draw(CheckerBoard, dst, dst, Color.White);


            // Draw the layout
            CurrentLayout.Draw(Batch);


            // Draw the selection box
            SelectionBox.Draw(Batch);

            // If no action and mouse over an element, draw its bounding box
            if (SelectionBox.MouseTool == MouseTools.NoTool)
            {
                Control elem = FindElementAt(RenderControl.PointToClient(System.Windows.Forms.Control.MousePosition));
                if (elem != null)
                {
                    //Display.DrawRectangle(elem.Rectangle, Color.White);
                }
            }

            Batch.End();
            RenderControl.SwapBuffers();

            // Start the draw timer
            DrawTimer.Start();
        }
Example #5
0
 private new void MouseMove(object sender, MouseEventArgs e)
 {
     System.Drawing.Point MousePosition = renderControl.PointToClient(Cursor.Position);
     positionText.Set(MousePosition.X + "," + MousePosition.Y, new Vector2(0, 0), font, Color.Red);
     if (resizing == true)
     {
         if (mouseType == MouseType.MOUSE_POINT)
         {
             if (TSItree.SelectedNode.Level == 1)
             {
                 if ((e.X - tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].X > 0) && (e.Y - tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].Y > 0))
                 {
                     tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].Width  = e.X - tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].X;
                     tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].Height = e.Y - tsi.listDDS[TSItree.SelectedNode.Parent.Index].ListDDS_element[TSItree.SelectedNode.Index].Y;
                     ElementChanged(TSItree.SelectedNode.Parent.Index, TSItree.SelectedNode.Index);
                 }
             }
         }
     }
 }