Best WinAppDriver code snippet using Input.MultiTouchScenarios.Turn
MultiTouchScenarios.cs
Source:MultiTouchScenarios.cs
...63 /// Manipulation gesture.64 /// AKA Rotate65 /// </summary>66 [TestMethod, TestCategory("MultiTouch")]67 public void Turn()68 {69 throw new NotImplementedException();70 }71 /// <summary>72 /// Multiple fingers touch the screen and move closer together.73 /// Manipulation gesture.74 /// </summary>75 [TestMethod, TestCategory("MultiTouch")]76 public void Pinch()77 {78 var touchable = AppSession.FindElementByAccessibilityId("Touchable");79 var coords = touchable.Coordinates.LocationInViewport;80 var startSize = new Size(touchable.Size.Width, touchable.Size.Height);81 var x = coords.X + startSize.Width / 2;...
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Windows.UI.Input;7using Windows.UI.Xaml;8using Windows.UI.Xaml.Controls;9using Windows.UI.Xaml.Input;10using Windows.UI.Xaml.Media;11using Windows.UI.Xaml.Navigation;12{13 {14 public MainPage()15 {16 this.InitializeComponent();17 }18 protected override void OnNavigatedTo(NavigationEventArgs e)19 {20 }21 private void MyCanvas_PointerPressed(object sender, PointerRoutedEventArgs e)22 {23 Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(MyCanvas);24 if (pt.Properties.IsLeftButtonPressed)25 {26 Input.MultiTouchScenarios.Turn(MyCanvas, pt);27 }28 }29 }30}31using System;32using System.Collections.Generic;33using System.Linq;34using System.Text;35using System.Threading.Tasks;36using Windows.UI.Input;37using Windows.UI.Xaml;38using Windows.UI.Xaml.Controls;39using Windows.UI.Xaml.Input;40using Windows.UI.Xaml.Media;41using Windows.UI.Xaml.Navigation;42{43 {44 public MainPage()45 {46 this.InitializeComponent();47 }48 protected override void OnNavigatedTo(NavigationEventArgs e)49 {50 }51 private void MyCanvas_PointerPressed(object sender, PointerRoutedEventArgs e)52 {53 Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(MyCanvas);54 if (pt.Properties.IsLeftButtonPressed)55 {56 Input.MultiTouchScenarios.Zoom(MyCanvas, pt);57 }58 }59 }60}61using System;62using System.Collections.Generic;63using System.Linq;64using System.Text;65using System.Threading.Tasks;66using Windows.UI.Input;67using Windows.UI.Xaml;68using Windows.UI.Xaml.Controls;69using Windows.UI.Xaml.Input;70using Windows.UI.Xaml.Media;71using Windows.UI.Xaml.Navigation;72{73 {74 public MainPage()75 {76 this.InitializeComponent();77 }78 protected override void OnNavigatedTo(NavigationEventArgs e)79 {80 }81 private void MyCanvas_PointerPressed(object sender, PointerRoutedEventArgs e)82 {
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6{7 {8 static void Main(string[] args)9 {10 MultiTouchScenarios multiTouchScenarios = new MultiTouchScenarios();11 multiTouchScenarios.Turn();12 }13 }14}15using System;16using System.Collections.Generic;17using System.Linq;18using System.Text;19using System.Threading.Tasks;20{21 {22 static void Main(string[] args)23 {24 MultiTouchScenarios multiTouchScenarios = new MultiTouchScenarios();25 multiTouchScenarios.Turn();26 }27 }28}29using System;30using System.Collections.Generic;31using System.Linq;32using System.Text;33using System.Threading.Tasks;34{35 {36 static void Main(string[] args)37 {38 MultiTouchScenarios multiTouchScenarios = new MultiTouchScenarios();39 multiTouchScenarios.Turn();40 }41 }42}43using System;44using System.Collections.Generic;45using System.Linq;46using System.Text;47using System.Threading.Tasks;48{49 {50 static void Main(string[] args)51 {52 MultiTouchScenarios multiTouchScenarios = new MultiTouchScenarios();53 multiTouchScenarios.Turn();54 }55 }56}57using System;58using System.Collections.Generic;59using System.Linq;60using System.Text;61using System.Threading.Tasks;62{63 {64 static void Main(string[] args)65 {66 MultiTouchScenarios multiTouchScenarios = new MultiTouchScenarios();67 multiTouchScenarios.Turn();68 }69 }70}71using System;72using System.Collections.Generic;73using System.Linq;74using System.Text;75using System.Threading.Tasks;76{77 {78 static void Main(string[] args)79 {
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Windows.UI.Xaml.Controls;7{8 {9 public MainPage()10 {11 this.InitializeComponent();12 this.Loaded += MainPage_Loaded;13 }14 void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)15 {16 Input.MultiTouchScenarios.Turn();17 }18 }19}20using System;21using System.Collections.Generic;22using System.Linq;23using System.Text;24using System.Threading.Tasks;25using Windows.UI.Xaml.Controls;26{27 {28 public MainPage()29 {30 this.InitializeComponent();31 this.Loaded += MainPage_Loaded;32 }33 void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)34 {35 Input.MultiTouchScenarios.Zoom();36 }37 }38}
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Windows.UI.Xaml.Controls;7using Windows.UI.Xaml.Input;8using Windows.UI.Xaml.Media;9using Windows.UI.Xaml.Shapes;10using Windows.UI.Xaml;11using Windows.UI;12{13 {14 private void Turn(object sender, ManipulationDeltaRoutedEventArgs e)15 {16 Rectangle rectToRotate = sender as Rectangle;17 MatrixTransform rectTransform = rectToRotate.RenderTransform as MatrixTransform;18 double deltaRotation = e.Delta.Rotation;19 rectTransform.Matrix.Rotate(deltaRotation);20 txtRotation.Text = rectTransform.Matrix.ToString();21 }22 }23}24using System;25using System.Collections.Generic;26using System.Linq;27using System.Text;28using System.Threading.Tasks;29using Windows.UI.Xaml.Controls;30using Windows.UI.Xaml.Input;31using Windows.UI.Xaml.Media;32using Windows.UI.Xaml.Shapes;33using Windows.UI.Xaml;34using Windows.UI;35{36 {37 private void Zoom(object sender, ManipulationDeltaRoutedEventArgs e)38 {39 Rectangle rectToScale = sender as Rectangle;40 MatrixTransform rectTransform = rectToScale.RenderTransform as MatrixTransform;41 double deltaScale = e.Delta.Scale;42 rectTransform.Matrix.ScaleAt(deltaScale, deltaScale, e.Position.X, e.Position.Y);43 txtScale.Text = rectTransform.Matrix.ToString();44 }45 }46}47using System;48using System.Collections.Generic;49using System.Linq;50using System.Text;51using System.Threading.Tasks;52using Windows.UI.Xaml.Controls;53using Windows.UI.Xaml.Input;54using Windows.UI.Xaml.Media;55using Windows.UI.Xaml.Shapes;56using Windows.UI.Xaml;57using Windows.UI;58{59 {60 private void ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)61 {
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Windows.UI.Xaml.Controls;7using Windows.UI.Core;8using Windows.UI.Input;9using Windows.UI.Xaml;10using Windows.UI.Xaml.Input;11using Windows.UI.Xaml.Media;12using Windows.UI.Xaml.Navigation;13using Windows.UI.Xaml.Shapes;14using Windows.UI;15using Windows.UI.Xaml.Media.Imaging;16using Windows.UI.Xaml.Controls.Primitives;17using Windows.UI.Xaml.Automation.Peers;18using Windows.Foundation;19using Windows.UI.Input.Inking;20using Windows.UI.Input.Inking.Analysis;21using Windows.UI.Popups;22using Windows.UI.Xaml.Media.Animation;23using Windows.Storage;24using Windows.Storage.Streams;25using Windows.UI.Xaml.Media.Effects;26using Windows.UI.Xaml.Data;27using Windows.UI.Xaml.Documents;28using Windows.UI.Xaml.Hosting;29using Windows.UI.Xaml.Media.Animation;30using Windows.UI.Xaml.Navigation;31using Windows.UI.Xaml.Shapes;32using Windows.UI.Xaml.Media;33using Windows.UI.Xaml.Input;34using Windows.UI.Xaml.Controls;35using Windows.UI.Input;36using Windows.UI;37using Windows.UI.Xaml;38using Windows.UI.Core;39using Windows.UI.Xaml.Media.Imaging;40using Windows.UI.Xaml.Automation.Peers;41using Windows.Foundation;42using Windows.UI.Input.Inking;43using Windows.UI.Input.Inking.Analysis;44using Windows.UI.Popups;45using Windows.UI.Xaml.Media.Animation;46using Windows.Storage;47using Windows.Storage.Streams;48using Windows.UI.Xaml.Media.Effects;49using Windows.UI.Xaml.Data;50using Windows.UI.Xaml.Documents;51using Windows.UI.Xaml.Hosting;52using Windows.UI.Xaml.Media.Animation;53using Windows.UI.Xaml.Navigation;54using Windows.UI.Xaml.Shapes;55using Windows.UI.Xaml.Media;56using Windows.UI.Xaml.Input;57using Windows.UI.Xaml.Controls;58using Windows.UI.Input;59using Windows.UI;60using Windows.UI.Xaml;61using Windows.UI.Core;62using Windows.UI.Xaml.Media.Imaging;63using Windows.UI.Xaml.Automation.Peers;64using Windows.Foundation;65using Windows.UI.Input.Inking;66using Windows.UI.Input.Inking.Analysis;67using Windows.UI.Popups;68using Windows.UI.Xaml.Media.Animation;69using Windows.Storage;70using Windows.Storage.Streams;71using Windows.UI.Xaml.Media.Effects;72using Windows.UI.Xaml.Data;73using Windows.UI.Xaml.Documents;74using Windows.UI.Xaml.Hosting;75using Windows.UI.Xaml.Media.Animation;76using Windows.UI.Xaml.Navigation;77using Windows.UI.Xaml.Shapes;78using Windows.UI.Xaml.Media;79using Windows.UI.Xaml.Input;80using Windows.UI.Xaml.Controls;81using Windows.UI.Input;82using Windows.UI;83using Windows.UI.Xaml;84using Windows.UI.Core;
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Text;4using Microsoft.Xna.Framework;5using Microsoft.Xna.Framework.Input;6using Microsoft.Xna.Framework.Input.Touch;7{8 {9 GraphicsDeviceManager graphics;10 SpriteBatch spriteBatch;11 Texture2D image;12 Vector2 imagePosition;13 Vector2 imageOrigin;14 float imageRotation;15 public Turn()16 {17 graphics = new GraphicsDeviceManager(this);18 Content.RootDirectory = "Content";19 }20 protected override void Initialize()21 {22 base.Initialize();23 TouchPanel.EnabledGestures = GestureType.Tap | GestureType.FreeDrag;24 }25 protected override void LoadContent()26 {27 spriteBatch = new SpriteBatch(GraphicsDevice);28 image = Content.Load<Texture2D>("spider");29 imagePosition = new Vector2(0, 0);30 imageOrigin = new Vector2(image.Width / 2, image.Height / 2);31 imageRotation = 0;32 }33 protected override void Update(GameTime gameTime)34 {35 base.Update(gameTime);36 while (TouchPanel.IsGestureAvailable)37 {38 GestureSample gesture = TouchPanel.ReadGesture();39 switch (gesture.GestureType)40 {41 imageRotation += MathHelper.PiOver2;42 break;43 imagePosition += gesture.Delta;44 break;45 }46 }47 }48 protected override void Draw(GameTime gameTime)49 {50 GraphicsDevice.Clear(Color.CornflowerBlue);51 spriteBatch.Begin();52 spriteBatch.Draw(image, imagePosition, null, Color.White,53 imageRotation, imageOrigin, 1.0f, SpriteEffects.None, 0);54 spriteBatch.End();55 base.Draw(gameTime);56 }57 }58}59using System;60using System.Collections.Generic;61using System.Text;62using Microsoft.Xna.Framework;63using Microsoft.Xna.Framework.Input;64using Microsoft.Xna.Framework.Input.Touch;65{66 {67 GraphicsDeviceManager graphics;68 SpriteBatch spriteBatch;69 Texture2D image;70 Vector2 imagePosition;71 float imageScale;72 public Pinch()73 {74 graphics = new GraphicsDeviceManager(this);75 Content.RootDirectory = "Content";76 }
Turn
Using AI Code Generation
1using System;2using System.Windows.Forms;3using System.Drawing;4using System.Collections.Generic;5using System.Text;6using System.IO;7using System.Threading;8using Microsoft.SPOT;9using Microsoft.SPOT.Input;10using Microsoft.SPOT.Presentation;11using Microsoft.SPOT.Presentation.Media;12using Microsoft.SPOT.Presentation.Controls;13using Microsoft.SPOT.Presentation.Shapes;14using Microsoft.SPOT.Touch;15using Microsoft.SPOT.Hardware;16using System.IO.Ports;17using System.Text.RegularExpressions;18using System.Net;19using System.Net.Sockets;20using System.Net.NetworkInformation;21using System.Security.Cryptography.X509Certificates;22using Microsoft.SPOT.Net.NetworkInformation;23using System.Net.Security;24using System.Security.Cryptography;25using Microsoft.SPOT.Cryptoki;26{27 {28 private static Window mainWindow;29 private static Canvas canvas;30 private static Text text;31 private static Text text2;32 private static Text text3;33 private static Text text4;34 private static Text text5;35 private static Text text6;36 private static Text text7;37 private static Text text8;38 private static Text text9;39 private static Text text10;40 private static Text text11;41 private static Text text12;42 private static Text text13;43 private static Text text14;44 private static Text text15;45 private static Text text16;46 private static Text text17;47 private static Text text18;48 private static Text text19;49 private static Text text20;50 private static Text text21;51 private static Text text22;52 private static Text text23;53 private static Text text24;54 private static Text text25;55 private static Text text26;56 private static Text text27;57 private static Text text28;58 private static Text text29;59 private static Text text30;60 private static Text text31;61 private static Text text32;62 private static Text text33;63 private static Text text34;64 private static Text text35;65 private static Text text36;66 private static Text text37;67 private static Text text38;68 private static Text text39;69 private static Text text40;70 private static Text text41;71 private static Text text42;72 private static Text text43;73 private static Text text44;74 private static Text text45;75 private static Text text46;
Turn
Using AI Code Generation
1using System;2using Microsoft.SPOT;3using Microsoft.SPOT.Input;4using Microsoft.SPOT.Presentation;5using Microsoft.SPOT.Presentation.Controls;6using Microsoft.SPOT.Presentation.Media;7{8 {9 private Text text;10 private int angle;11 private int angleChange;12 private int oldAngle;13 public void Run()14 {15 Window mainWindow = new Window();16 mainWindow.Height = 240;17 mainWindow.Width = 320;18 text = new Text("Touch and drag the screen to turn the device");19 text.Font = Resources.GetFont(Resources.FontResources.NinaB);20 text.Height = 200;21 text.Width = 320;22 text.TextAlignment = TextAlignment.Center;23 text.VerticalAlignment = VerticalAlignment.Center;24 text.Visibility = Visibility.Visible;25 mainWindow.Child = text;26 mainWindow.TouchDown += new TouchEventHandler(mainWindow_TouchDown);27 mainWindow.TouchMove += new TouchEventHandler(mainWindow_TouchMove);28 mainWindow.TouchUp += new TouchEventHandler(mainWindow_TouchUp);29 InputManager input = new InputManager();30 input.InputDevices.Add(mainWindow);31 this.RootVisual = mainWindow;32 input.Enabled = true;33 InputManager.EnableInputProviderEvents = true;34 InputManager.EnableMultiTouch = true;35 InputManager.EnableMultiTouchScenarios = true;36 while (true)37 {38 Microsoft.SPOT.Hardware.PowerState.Reason reason = Microsoft.SPOT.Hardware.PowerState.WaitForInterrupt(-1, false);39 }40 }41 void mainWindow_TouchDown(object sender, TouchEventArgs e)42 {43 angle = Input.MultiTouchScenarios.TurnAngle(e.GetTouchPoint(null).Position.X, e.GetTouchPoint(null).Position.Y);44 angleChange = Input.MultiTouchScenarios.TurnAngleChange(angle, oldAngle);45 oldAngle = angle;46 }
Turn
Using AI Code Generation
1using System;2using System.Windows.Forms;3using System.Drawing;4using System.Collections.Generic;5using System.Windows.Input;6using System.Threading;7using System.Windows.Media;8{9 public static void Main()10 {11 Form form = new Form();12 Button button = new Button();13 form.Controls.Add(button);14 button.Text = "Touch Me!";15 button.Size = new Size(100, 100);16 button.Location = new Point(0, 0);17 Input.MultiTouchScenarios multiTouch = new Input.MultiTouchScenarios();18 multiTouch.Turn(button, 1.0, 0.0);19 Application.Run(form);20 }21}22using System;23using System.Windows.Forms;24using System.Drawing;25using System.Collections.Generic;26using System.Windows.Input;27using System.Threading;28using System.Windows.Media;29{30 public static void Main()31 {32 Form form = new Form();33 Button button = new Button();34 form.Controls.Add(button);35 button.Text = "Touch Me!";36 button.Size = new Size(100, 100);37 button.Location = new Point(0, 0);38 Input.MultiTouchScenarios multiTouch = new Input.MultiTouchScenarios();39 multiTouch.Pinch(button, 1.0, 0.0);40 Application.Run(form);41 }42}43using System;44using System.Windows.Forms;45using System.Drawing;46using System.Collections.Generic;47using System.Windows.Input;48using System.Threading;49using System.Windows.Media;50{51 public static void Main()52 {53 Form form = new Form();54 Button button = new Button();55 form.Controls.Add(button);56 button.Text = "Touch Me!";57 button.Size = new Size(100, 100);58 button.Location = new Point(0, 0);59using Microsoft.Xna.Framework.Input.Touch;60{61 {62 GraphicsDeviceManager graphics;63 SpriteBatch spriteBatch;64 Texture2D image;65 Vector2 imagePosition;66 Vector2 imageOrigin;67 float imageRotation;68 public Turn()69 {70 graphics = new GraphicsDeviceManager(this);71 Content.RootDirectory = "Content";72 }73 protected override void Initialize()74 {75 base.Initialize();76 TouchPanel.EnabledGestures = GestureType.Tap | GestureType.FreeDrag;77 }78 protected override void LoadContent()79 {80 spriteBatch = new SpriteBatch(GraphicsDevice);81 image = Content.Load<Texture2D>("spider");82 imagePosition = new Vector2(0, 0);83 imageOrigin = new Vector2(image.Width / 2, image.Height / 2);84 imageRotation = 0;85 }86 protected override void Update(GameTime gameTime)87 {88 base.Update(gameTime);89 while (TouchPanel.IsGestureAvailable)90 {91 GestureSample gesture = TouchPanel.ReadGesture();92 switch (gesture.GestureType)93 {94 imageRotation += MathHelper.PiOver2;95 break;96 imagePosition += gesture.Delta;97 break;98 }99 }100 }101 protected override void Draw(GameTime gameTime)102 {103 GraphicsDevice.Clear(Color.CornflowerBlue);104 spriteBatch.Begin();105 spriteBatch.Draw(image, imagePosition, null, Color.White,106 imageRotation, imageOrigin, 1.0f, SpriteEffects.None, 0);107 spriteBatch.End();108 base.Draw(gameTime);109 }110 }111}112using System;113using System.Collections.Generic;114using System.Text;115using Microsoft.Xna.Framework;116using Microsoft.Xna.Framework.Input;117using Microsoft.Xna.Framework.Input.Touch;118{119 {120 GraphicsDeviceManager graphics;121 SpriteBatch spriteBatch;122 Texture2D image;123 Vector2 imagePosition;124 float imageScale;125 public Pinch()126 {127 graphics = new GraphicsDeviceManager(this);128 Content.RootDirectory = "Content";129 }
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Windows.UI.Xaml.Controls;7using Windows.UI.Core;8using Windows.UI.Input;9using Windows.UI.Xaml;10using Windows.UI.Xaml.Input;11using Windows.UI.Xaml.Media;12using Windows.UI.Xaml.Navigation;13using Windows.UI.Xaml.Shapes;14using Windows.UI;15using Windows.UI.Xaml.Media.Imaging;16using Windows.UI.Xaml.Controls.Primitives;17using Windows.UI.Xaml.Automation.Peers;18using Windows.Foundation;19using Windows.UI.Input.Inking;20using Windows.UI.Input.Inking.Analysis;21using Windows.UI.Popups;22using Windows.UI.Xaml.Media.Animation;23using Windows.Storage;24using Windows.Storage.Streams;25using Windows.UI.Xaml.Media.Effects;26using Windows.UI.Xaml.Data;27using Windows.UI.Xaml.Documents;28using Windows.UI.Xaml.Hosting;29using Windows.UI.Xaml.Media.Animation;30using Windows.UI.Xaml.Navigation;31using Windows.UI.Xaml.Shapes;32using Windows.UI.Xaml.Media;33using Windows.UI.Xaml.Input;34using Windows.UI.Xaml.Controls;35using Windows.UI.Input;36using Windows.UI;37using Windows.UI.Xaml;38using Windows.UI.Core;39using Windows.UI.Xaml.Media.Imaging;40using Windows.UI.Xaml.Automation.Peers;41using Windows.Foundation;42using Windows.UI.Input.Inking;43using Windows.UI.Input.Inking.Analysis;44using Windows.UI.Popups;45using Windows.UI.Xaml.Media.Animation;46using Windows.Storage;47using Windows.Storage.Streams;48using Windows.UI.Xaml.Media.Effects;49using Windows.UI.Xaml.Data;50using Windows.UI.Xaml.Documents;51using Windows.UI.Xaml.Hosting;52using Windows.UI.Xaml.Media.Animation;53using Windows.UI.Xaml.Navigation;54using Windows.UI.Xaml.Shapes;55using Windows.UI.Xaml.Media;56using Windows.UI.Xaml.Input;57using Windows.UI.Xaml.Controls;58using Windows.UI.Input;59using Windows.UI;60using Windows.UI.Xaml;61using Windows.UI.Core;62using Windows.UI.Xaml.Media.Imaging;63using Windows.UI.Xaml.Automation.Peers;64using Windows.Foundation;65using Windows.UI.Input.Inking;66using Windows.UI.Input.Inking.Analysis;67using Windows.UI.Popups;68using Windows.UI.Xaml.Media.Animation;69using Windows.Storage;70using Windows.Storage.Streams;71using Windows.UI.Xaml.Media.Effects;72using Windows.UI.Xaml.Data;73using Windows.UI.Xaml.Documents;74using Windows.UI.Xaml.Hosting;75using Windows.UI.Xaml.Media.Animation;76using Windows.UI.Xaml.Navigation;77using Windows.UI.Xaml.Shapes;78using Windows.UI.Xaml.Media;79using Windows.UI.Xaml.Input;80using Windows.UI.Xaml.Controls;81using Windows.UI.Input;82using Windows.UI;83using Windows.UI.Xaml;84using Windows.UI.Core;
Turn
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Text;4using Microsoft.Xna.Framework;5using Microsoft.Xna.Framework.Input;6using Microsoft.Xna.Framework.Input.Touch;7{8 {9 GraphicsDeviceManager graphics;10 SpriteBatch spriteBatch;11 Texture2D image;12 Vector2 imagePosition;13 Vector2 imageOrigin;14 float imageRotation;15 public Turn()16 {17 graphics = new GraphicsDeviceManager(this);18 Content.RootDirectory = "Content";19 }20 protected override void Initialize()21 {22 base.Initialize();23 TouchPanel.EnabledGestures = GestureType.Tap | GestureType.FreeDrag;24 }25 protected override void LoadContent()26 {27 spriteBatch = new SpriteBatch(GraphicsDevice);28 image = Content.Load<Texture2D>("spider");29 imagePosition = new Vector2(0, 0);30 imageOrigin = new Vector2(image.Width / 2, image.Height / 2);31 imageRotation = 0;32 }33 protected override void Update(GameTime gameTime)34 {35 base.Update(gameTime);36 while (TouchPanel.IsGestureAvailable)37 {38 GestureSample gesture = TouchPanel.ReadGesture();39 switch (gesture.GestureType)40 {41 imageRotation += MathHelper.PiOver2;42 break;43 imagePosition += gesture.Delta;44 break;45 }46 }47 }48 protected override void Draw(GameTime gameTime)49 {50 GraphicsDevice.Clear(Color.CornflowerBlue);51 spriteBatch.Begin();52 spriteBatch.Draw(image, imagePosition, null, Color.White,53 imageRotation, imageOrigin, 1.0f, SpriteEffects.None, 0);54 spriteBatch.End();55 base.Draw(gameTime);56 }57 }58}59using System;60using System.Collections.Generic;61using System.Text;62using Microsoft.Xna.Framework;63using Microsoft.Xna.Framework.Input;64using Microsoft.Xna.Framework.Input.Touch;65{66 {67 GraphicsDeviceManager graphics;68 SpriteBatch spriteBatch;69 Texture2D image;70 Vector2 imagePosition;71 float imageScale;72 public Pinch()73 {74 graphics = new GraphicsDeviceManager(this);75 Content.RootDirectory = "Content";76 }
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!