Handles touch events for a hWnd
Inheritance: Handler
Beispiel #1
0
        public RawInputForm()
        {
            InitializeComponent();

            int size = Marshal.SizeOf(typeof(SRawInputDevice));
            SRawInputDevice[] devices = new SRawInputDevice[1];

            // UsagePage=1,Usage=2 �Ń}�E�X�f�o�C�X��w��
            devices[0].UsagePage = 1;
            devices[0].Usage = 2;

            //WM_INPUT ��󂯎��E�B���h�E
            devices[0].Target = this.Handle;

            //WM_INPUT ��L���ɂ���f�o�C�X�Q�Cdevices �̐��CRawInputDevice �̍\���̃T�C�Y
            RegisterRawInputDevices(devices, 1, size);

            //touchMap =
            //pointingDevices = pdCollection;
            #region touchDevice

            if (Windows7.Multitouch.TouchHandler.DigitizerCapabilities.IsMultiTouchReady)
            {
                _touchHandler = Factory.CreateHandler<TouchHandler>(Browser.Instance.control);
                _touchHandler.TouchDown += new EventHandler<TouchEventArgs>(_touchHandler_TouchDown);
                _touchHandler.TouchUp += new EventHandler<TouchEventArgs>(_touchHandler_TouchUp);
                _touchHandler.TouchMove += new EventHandler<TouchEventArgs>(_touchHandler_TouchMove);
                //touchPoints = new List<PointingDevice>();
            }
            #endregion
        }
Beispiel #2
0
 public static void init()
 {
     handler = Factory.CreateHandler<TouchHandler>(Global.Game.Window.Handle);
     handler.TouchDown += new EventHandler<TouchEventArgs>(handler_TouchDown);
     handler.TouchUp += new EventHandler<TouchEventArgs>(handler_TouchUp);
     handler.TouchMove += new EventHandler<TouchEventArgs>(handler_TouchMove);
     
 }
        public TouchManipulationEdit()
        {
            InitializeComponent();
            _handler = Factory.CreateHandler<TouchHandler>(this);
            _processor = new ManipulationProcessor(ProcessorManipulations.TRANSLATE_X);

            _handler.TouchDown += (s, e) => { _processor.ProcessDown((uint)e.Id, e.Location); };
            _handler.TouchUp += (s, e) => { _processor.ProcessUp((uint)e.Id, e.Location); };
            _handler.TouchMove += (s, e) => { _processor.ProcessMove((uint)e.Id, e.Location); };

            _processor.ManipulationStarted += (s, e) => { CaptureStartValue(); };
            _processor.ManipulationDelta += (s, e) => { UpdateValue(e); };
            
        }
Beispiel #4
0
        public MainForm()
        {
            InitializeComponent();
            _touchHandler = Factory.CreateHandler<TouchHandler>(this);
            
            _processor = new ManipulationProcessor(ProcessorManipulations.ALL);

            _objectList = new List<DrawingObject>
                { new DrawingObject(Size),
                    new DrawingObject(Size),
                    new DrawingObject(Size)
                };

            _touchHandler.TouchDown += (s,e ) => { _processor.ProcessDown((uint)e.Id, e.Location); };
            _touchHandler.TouchUp += (s, e) => { _processor.ProcessUp((uint)e.Id, e.Location); };
            _touchHandler.TouchMove += (s, e) => { _processor.ProcessMove((uint)e.Id, e.Location); };

            _processor.ManipulationDelta += ProcessManipulationDelta;
            _processor.PivotRadius = 2;
        }
Beispiel #5
0
        public MainForm()
        {
            InitializeComponent();
            
            //Load pictures from MyPictures
            if (!LoadPictures())
            {
                MessageBox.Show("No Pictures in MyPicture folder");
                Environment.Exit(0);
            }

            //Create the touch handler
            _touchHandler = Factory.CreateHandler<TouchHandler>(this);

            _pictureTrackerManager = new PictureTrackerManager(_canvas, this);

            //Register for touch events
            _touchHandler.TouchDown += _pictureTrackerManager.ProcessDown;
            _touchHandler.TouchUp += _pictureTrackerManager.ProcessUp;
            _touchHandler.TouchMove += _pictureTrackerManager.ProcessMove;

            Paint += (s, e) => { _canvas.Draw(e.Graphics); };
        }
Beispiel #6
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            int w = fieldBuffers[0].Width;
            int h = fieldBuffers[0].Height;
            rdFX = Content.Load<Effect>("RDEffect");
            rdFX.Parameters["dp"].SetValue(new Vector2(1.0f / w, 1.0f / h));

            asteroid = Content.Load<Texture2D>("a");

            gameWindowForm = (Form)Form.FromHandle(this.Window.Handle);

            if (!Windows7.Multitouch.TouchHandler.DigitizerCapabilities.IsMultiTouchReady) {
                Console.WriteLine("Multitouch is not availible");
            }
            else {
                tHandler = Factory.CreateHandler<TouchHandler>(gameWindowForm);
                tHandler.TouchDown += (s, e) => { TouchDown((uint)e.Id, e.Location); };
                tHandler.TouchMove += (s, e) => { TouchMove((uint)e.Id, e.Location); };
                tHandler.TouchUp   += (s, e) => { TouchUp((uint)e.Id, e.Location); };
            }
        }
Beispiel #7
0
        private void InitializeSurfaceInput()
        {
            System.Diagnostics.Debug.Assert(Window != null && Window.Handle != IntPtr.Zero, "Window initialization must be complete before InitializeSurfaceInput is called");
            if (Window == null || Window.Handle == IntPtr.Zero)
            {
                return;
            }
            System.Diagnostics.Debug.Assert(touchTarget == null, "Surface input already initialized");
            if (touchTarget != null)
            {
                return;
            }

            // Create a target for surface input.
            touchTarget = Windows7.Multitouch.WinForms.Factory.CreateHandler<Windows7.Multitouch.TouchHandler>(form);
            touchTarget.DisablePalmRejection = true;
            //touchTarget.EnableInput();

            touchTarget.TouchDown += new EventHandler<TouchEventArgs>(touchTarget_TouchDown);
            touchTarget.TouchMove += new EventHandler<TouchEventArgs>(touchTarget_TouchMove);
            touchTarget.TouchUp += new EventHandler<TouchEventArgs>(touchTarget_TouchUp);

            //form.KeyDown += new KeyEventHandler(form_KeyDown);

            //form.MouseDown += new MouseEventHandler(form_MouseDown);
            //form.MouseMove += new MouseEventHandler(form_MouseMove);
            //form.MouseUp += new MouseEventHandler(form_MouseUp);

            touchPoints = new Dictionary<int, Touch>();
        }
Beispiel #8
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         IDisposable graphicsDispose = graphics as IDisposable;
         if (graphicsDispose != null)
         {
             graphicsDispose.Dispose();
         }
         if (spriteBatch != null)
         {
             spriteBatch.Dispose();
             spriteBatch = null;
         }
         if (touchTarget != null)
         {
             //touchTarget.Dispose();
             touchTarget = null;
         }
         /*
         if (scatterView != null)
         {
             scatterView.Dispose();
             scatterView = null;
         }
         //*/
     }
     base.Dispose(disposing);
 }
        /// <summary>
        /// Initializes the mouse to be controled by a touch screen.
        /// </summary>
        /// <param name="screenPointer"></param>
        public void InitializeTouch(IntPtr screenPointer)
        {
            TouchEnabled = true;

            touchHandler = Factory.CreateHandler<TouchHandler>(screenPointer);

            touchHandler.TouchDown += TouchDownHandler;
            touchHandler.TouchUp += TouchUpHandler;
            touchHandler.TouchMove += TouchMoveHandler;

            touchQueue = new Queue();
        }