Example #1
0
        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            var mouseEventArgs = new EngineNS.Input.Device.Mouse.MouseInputEventArgs();

            mouseEventArgs.DeviceType = EngineNS.Input.Device.DeviceType.Mouse;
            var mouseEvent = new EngineNS.Input.Device.Mouse.MouseEventArgs();

            mouseEvent.Button         = (EngineNS.Input.Device.Mouse.MouseButtons)e.Button;
            mouseEvent.State          = EngineNS.Input.Device.Mouse.ButtonState.Up;
            mouseEvent.X              = e.X;
            mouseEvent.Y              = e.Y;
            mouseEvent.OffsetX        = e.X - PrevMouseX;
            mouseEvent.OffsetY        = e.Y - PrevMouseY;
            PrevMouseX                = e.X;
            PrevMouseY                = e.Y;
            mouseEvent.Delta          = e.Delta;
            mouseEventArgs.MouseEvent = mouseEvent;
            EngineNS.CEngine.Instance.InputServerInstance?.OnInputEvnet(mouseEventArgs);
        }
Example #2
0
        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            //ResourceLibrary.Win32.POINT point = new ResourceLibrary.Win32.POINT();
            //ResourceLibrary.Win32.GetCursorPos(ref point);
            //var mousePoint = mGameForm.PointToClient(new System.Drawing.Point(point.X, point.Y));
            var mouseEventArgs = new EngineNS.Input.Device.Mouse.MouseInputEventArgs();

            mouseEventArgs.DeviceType = EngineNS.Input.Device.DeviceType.Mouse;
            var mouseEvent = new EngineNS.Input.Device.Mouse.MouseEventArgs();

            mouseEvent.Button         = (EngineNS.Input.Device.Mouse.MouseButtons)e.Button;
            mouseEvent.State          = EngineNS.Input.Device.Mouse.ButtonState.Move;
            mouseEvent.X              = e.X;
            mouseEvent.Y              = e.Y;
            mouseEvent.OffsetX        = e.X - PrevMouseX;
            mouseEvent.OffsetY        = e.Y - PrevMouseY;
            PrevMouseX                = e.X;
            PrevMouseY                = e.Y;
            mouseEvent.Delta          = e.Delta;
            mouseEventArgs.MouseEvent = mouseEvent;
            EngineNS.CEngine.Instance?.InputServerInstance?.OnInputEvnet(mouseEventArgs);
        }
Example #3
0
        public override void MouseDown(object host, object sender, EngineNS.Input.Device.Mouse.MouseInputEventArgs e)
        {
            if (this.World == null)
            {
                return;
            }
            var sg = this.World.DefaultScene;

            if (sg == null)
            {
                return;
            }

            if (host == MainEdViewport)
            {
                Vector3 start = MainEdViewport.Camera.CameraData.Position;
                Vector3 dir   = new Vector3();
                if (MainEdViewport.Camera.GetPickRay(ref dir, e.MouseEvent.X, e.MouseEvent.Y, (float)MainEdViewport.GetViewPortWidth(), (float)MainEdViewport.GetViewPortHeight()))
                {
                    var hitResult = new EngineNS.GamePlay.SceneGraph.VHitResult();
                    var end       = start + dir * 1000;
                    if (sg.LineCheck(ref start, ref end, ref hitResult))
                    {
                        var hitActor = this.World.DefaultScene.GetHitActor(ref hitResult);
                        if (hitActor != null)
                        {
                            System.Diagnostics.Debug.WriteLine($"LineCheck Actor {hitActor.Tag}");
                        }
                    }
                }
            }
            base.MouseDown(host, sender, e);

            //// debug
            //TestComputeShader();
        }