This article focuses on the unique gesture event on a multi-touch device (Android and iOS have a much more similar package for this event). This oneThe event is a higher-level package for touch event, and as with touch, it also includes Gesturestart,gesturechange,Gestureend Three event callbacks:
ges tu
Goal
In this hands-on experiment, we'll learn how to manage gesture events, including:
• Understand the meaning of manipulating objects using gesture events
• Check the presence and readiness of multi-touch hardware
• Extract information from the gesture Windows message
System Requirements
To complete this experiment, you must have the following tools:
Microsoft Visual Studio 2008 SP1
windows 7
Win
According to foreign media reports, although most users do not have touch screen devices, Windows 7 supports multi-touch. Therefore, if you purchase a touch screen device, Windows 7 users can use the multi-touch function. However,
After more exploration, there is no way to re-return to the Silverlight low-level touch event. However, gesturelistener is still reluctant to handle. After all, that operation is convenient. I can't help it now. I only need to write it myself. Just simulate it.
Now rewrite the previous live direction control disk.
First, complete the interface:
Interface is not available. It is basically the same as the previous interface, that is, the color is not
). matrix; VaR Deltamanipulation = E. deltamanipulation; Point Center = New Point (Element. actualwidth/2, element. actualheight/2 );Center = matrix. Transform (center );Matrix. scaleat (deltamanipulation. Scale. X, deltamanipulation. Scale. Y, Center. X, Center. y );Matrix. rotateat (E. deltamanipulation. rotation, Center. X, Center. y );Matrix. Translate (E. deltamanipulation. Translation. X, E. deltamanipulation. Translation. y );(( Matrixtransform ) Element. rendertransform). Matrix = matri
The previous article has already brought everybody to realize the free enlargement to reduce the picture, introduced the next matrix simply; Please refer to: Android to achieve gesture sliding multi-touch zoom translation Image effect, this article continues to improve our imageview.
First add the amplification after the move.
1, free to move
We are in the ontouchevent, plus the moving code, of course, m
Used to bind reference object Var Target:transform; Scaling factor var distance = 10.0; Left and right sliding movement speed var xspeed = 250.0; var yspeed = 120.0; Scaling Limit factor var yminlimit =-20; var ymaxlimit = 80; Location of the camera var x = 0.0; var y = 0.0; Record the last time the phone touch location to determine whether the user is in the left or zoom out gesture private Var Oldposition1:vector2; private Var Oldposition
; // amplification factorPrivate Static final double zoom_out_scale = 0.8; // reduce the Coefficient// We can be in one of these 3 statesStatic final int none = 0;Static final int drag = 1;Static final int zoom = 2;Int mode = none;
@ OverridePublic void oncreate (bundle savedinstancestate ){Super. oncreate (savedinstancestate );Setcontentview (R. layout. Main );// Zoom in buttonZoomin = (button) findviewbyid (R. Id. zoom_in );// Zoom out buttonZoomout = (button) findviewbyid (R. Id. zoom_out );Z
(deltamanipulation. scale. x, deltamanipulation. scale. y, center. x, center. y); matrix. rotateat (E. deltamanipulation. rotation, center. x, center. y); matrix. translate (E. deltamanipulation. translation. x, E. deltamanipulation. translation. Y );(( Matrixtransform ) Element. rendertransform). Matrix = matrix ;}
Finally, when the finger leaves the touch screen, the operation ends. The image_manipulationcompleted event is triggered, and the image
"Dog Planing Learning Net"Summarize:Input.touchcount gets the current number of touch points, 1 is a single touch, more than 1 is multi-touchClick events by: Input.gettouch (num). Phase = = Touchphase.began formatCode:Using Unityengine;Using System.Collections;public class Click2:monobehaviour {Set the picture to be displayed when clickedPublic texture2d img;void
Android multi-touch is essentially supported by LCD drivers and programming. Currently, mobile phones that use capacitive screen touch can support multi-touch multitouch technology, provides a better user experience for webpage scaling and gesture operations. On the Android
According to the previous official announcement of Ubuntu, the latest Ubuntu10.10NetbookEdition has a built-in multi-touch uTouch function. But the problem is that in real life, we have very few tablet devices with touch screens, so this feature is not available to most users. However, just a few days ago, Canonical posted a video on its official Blog on the Unit
There are a lot of questions on the unity forums about how to handle multi-touch on iPhone. we 've done a few experiments with multi-touch-although nothing in a game yet-but here's one solution. this had a few goals:
Avoid etoonetouchphase, Which is unreliable (maid with the remote)
Abstract
Android Multi-point touch knowledge points
1, Scalegesturedetector2, Onscalegesturelistener3. Matrix4, Ontouchlistener
Four points of knowledge need to be aware that the matrix in memory is a one-dimensional array, manipulating the image of the matrxi is a 3x3 matrix, in memory is a size of 9 one-dimensional array.
Realize multi-
During project development, a big map can be dragged by pressing and sliding with one finger. The two fingers can be opened or closed to zoom in and out the map.
To achieve this function, you need to use the cocos2d-x multi-touch function.
The multi-touch event does not mean that when you press two fingers and execute
appropriate time by the event dispatcher, and then invokes the appropriate type of listener.Here we are mainly to understand how multi-touch scaling in touch events under the cocos2d3.x version is achieved[CPP] view plaincopy
void NewScene::o Ntouchesbegan ( const std::vector "began" );}
void helloworld::ontouchesmoved (const std::vector
{
http://www.ptrackapp.com/apclassys-notes/embedded-linux-multitouch/Embedded Linux Multitouch with Qt, Tuio, and TslibThis tutorial describes how to set up multi-touch and Single-touch touchscreen inputFor Qt for embedded Linux. I assume so received a driver from your touchscreenManufacturer or there is a existing one can use in the Kernel source.First things firs
Knowledge points involved in Android multi-touch1, Scalegesturedetector2, Onscalegesturelistener3. Matrix4, OntouchlistenerFour knowledge points need to understand, it should be noted that the matrix in memory is a one-dimensional array, manipulating the image of the matrxi is a 3x3 matrix, in memory is a size 9 of a one-dimensional array.Achieve multi-touch, fre
I recently studied multi-touch and wrote a program that uses multi-touch to control image size and single-touch to control image movement.
In Android, The ontouchevent method is used to listen to touch events. Its parameter is mo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.