Jypeli 10
The simple game programming library
TouchPanel.cs
Siirry tämän tiedoston dokumentaatioon.
1using System;
2using System.Collections.Generic;
3using Microsoft.Xna.Framework.Input.Touch;
4using Jypeli.Controls;
5
6namespace Jypeli
7{
8 using XnaTouchPanel = Microsoft.Xna.Framework.Input.Touch.TouchPanel;
9 using XnaGestureType = Microsoft.Xna.Framework.Input.Touch.GestureType;
10
11 public delegate void TouchHandler( Touch touch );
12 public delegate void TouchHandler<T>( Touch touch, T p );
13 public delegate void TouchHandler<T1, T2>( Touch touch, T1 p1, T2 p2 );
14 public delegate void TouchHandler<T1, T2, T3>( Touch touch, T1 p1, T2 p2, T3 p3 );
15
19 public class TouchPanel : Controls.Controller
20 {
21 protected static readonly Predicate<Touch> AlwaysTrigger = delegate { return true; };
22
24 private TouchPanelCapabilities caps;
25 private List<Touch> touches;
26 private List<Touch> newTouches;
27 private List<Gesture> gestures;
28
33
36
40 public bool IsConnected
41 {
42 get { return caps.IsConnected; }
43 }
44
48 public int ActiveChannels
49 {
50 get { return touches.Count + gestures.Count; }
51 }
52
56 public int NumTouches
57 {
58 get { return touches.Count; }
59 }
60
64 public int MaxTouches
65 {
66 get { return caps.MaximumTouchCount; }
67 }
68
72 public int NumGestures
73 {
74 get { return gestures.Count; }
75 }
76
80 public bool FollowSnipping
81 {
82 get { return _snipContext != null; }
83 set
84 {
85 TouchHandler handler = delegate ( Touch t ) { Game.Instance.Camera.Position -= t.MovementOnWorld; };
86 ContextHandler op = delegate ( ListenContext ctx ) { Listen( ButtonState.Down, handler, "Move around" ).InContext( ctx ); };
87 setContext( ref _snipContext, value, op );
88 }
89 }
90
94 public bool FollowPinching
95 {
96 get { return _pinchContext != null; }
97 set
98 {
99 TouchHandler handler = delegate ( Touch t )
100 {
101 Gesture g = (Gesture)t;
103 };
104 ContextHandler op = delegate ( ListenContext ctx ) { ListenGesture( GestureType.Pinch, handler, "Zoom" ); };
105 setContext( ref _pinchContext, value, op );
106 }
107 }
108
109 delegate void ContextHandler( ListenContext ctx );
110
111 private void setContext( ref ListenContext context, bool enable, ContextHandler operation )
112 {
113 if ( ( context != null ) == enable ) return;
114 if ( enable )
115 {
117 context.Active = true;
118 operation( context );
119 }
120 else
121 {
122 context.Destroy();
123 context = null;
124 }
125 }
126
128 {
129 this.screen = screen;
130
131 try
132 {
133 this.caps = XnaTouchPanel.GetCapabilities();
134 }
135 catch (TypeLoadException)
136 {
137 this.caps = new TouchPanelCapabilities();
138 }
139
140 this.touches = new List<Touch>( caps.MaximumTouchCount );
141 this.newTouches = new List<Touch>( caps.MaximumTouchCount );
142 }
143
147 private static bool IsBeingTouched( ScreenView screen, Vector touchOnScreen, GameObject obj )
148 {
149 if ( obj == null || obj.Layer == null || obj.IsDestroyed ) return false;
150 return obj.IsInside( Game.Instance.Camera.ScreenToWorld( touchOnScreen, obj.Layer ) );
151 }
152
153 private static HoverState GetHoverState( Touch touch, GameObject obj )
154 {
155 bool prevOn = IsBeingTouched( Game.Screen, touch.PrevPositionOnScreen, obj );
156 bool currOn = IsBeingTouched( Game.Screen, touch.PositionOnScreen, obj );
157
158 if ( prevOn && currOn ) return HoverState.On;
159 if ( !prevOn && !currOn ) return HoverState.Off;
160 if ( !prevOn && currOn ) return HoverState.Enter;
161 return HoverState.Exit;
162 }
163
164 private Predicate<Touch> MakeTriggerRule( GameObject obj, HoverState hover )
165 {
166 return delegate( Touch touch )
167 {
168 if ( obj == null || obj.IsDestroyed || obj.Layer == null ) return false;
169 return GetHoverState( touch, obj ) == hover;
170 };
171 }
172
173 public void Update()
174 {
177 }
178
179 public void UpdateTouches()
180 {
181 var xnaTouches = XnaTouchPanel.GetState();
182
183 for ( int i = 0; i < xnaTouches.Count; i++ )
184 {
185 Touch prevTouch = touches.Find( s => s.Id == xnaTouches[i].Id );
186 Touch thisTouch = prevTouch != null ? prevTouch : new Touch( screen, xnaTouches[i] );
187
188 newTouches.Add( thisTouch );
189 DownListeners.ForEach( dl => dl.CheckAndInvoke( thisTouch ) );
190
191 if ( prevTouch == null )
192 {
193 // New touch
194 PressListeners.ForEach( dl => dl.CheckAndInvoke( thisTouch ) );
195 }
196 else
197 {
198 // Existing touch
199 touches.Remove( thisTouch );
200 thisTouch.Update( xnaTouches[i] );
201 }
202 }
203
204 for ( int i = 0; i < touches.Count; i++ )
205 {
206 // Released touch
207 ReleaseListeners.ForEach( dl => dl.CheckAndInvoke( touches[i] ) );
208 }
209
210 DownListeners.UpdateChanges();
211 PressListeners.UpdateChanges();
212 ReleaseListeners.UpdateChanges();
213
214 touches.Clear();
215 var empty = touches;
217 newTouches = empty;
218 }
219
220 public void UpdateGestures()
221 {
222 var samples = new List<Gesture>();
223
224 if ( XnaTouchPanel.EnabledGestures == XnaGestureType.None )
225 return;
226
227 while ( XnaTouchPanel.IsGestureAvailable )
228 samples.Add( new Gesture( XnaTouchPanel.ReadGesture() ) );
229
230 this.GestureListeners.UpdateChanges();
231 this.gestures = samples;
232 }
233
234 public void Clear()
235 {
236 DownListeners.Clear();
237 PressListeners.Clear();
238 ReleaseListeners.Clear();
239 GestureListeners.Clear();
240 }
241
242 public IEnumerable<string> GetHelpTexts()
243 {
244 foreach ( var l in PressListeners )
245 {
246 if ( l.HelpText != null )
247 yield return String.Format( "TouchPanel Press", l.HelpText );
248 }
249
250 foreach ( var l in DownListeners )
251 {
252 if ( l.HelpText != null )
253 yield return String.Format( "TouchPanel Down", l.HelpText );
254 }
255
256 foreach ( var l in ReleaseListeners )
257 {
258 if ( l.HelpText != null )
259 yield return String.Format( "TouchPanel Release", l.HelpText );
260 }
261 }
262
264 {
265 switch ( state )
266 {
267 case ButtonState.Down: return DownListeners;
268 case ButtonState.Pressed: return PressListeners;
269 case ButtonState.Released: return ReleaseListeners;
270 }
271
272 throw new ArgumentException( "Button state is not supported" );
273 }
274
275 private Listener AddListener( SynchronousList<TouchListener> list, Predicate<Touch> rule, string helpText, Delegate handler, params object[] args )
276 {
277 var l = new TouchListener( rule, Game.Instance.ControlContext, helpText, handler, args );
278 list.Add( l );
279 return l;
280 }
281
282 private Listener AddGestureListener( Predicate<Gesture> rule, string helpText, Delegate handler, params object[] args )
283 {
284 Predicate<Touch> touchRule = ( Touch t ) => t is Gesture && rule( (Gesture)t );
285 var l = new TouchListener( touchRule, Game.Instance.ControlContext, helpText, handler, args );
286 GestureListeners.Add( l );
287 return l;
288 }
289
296 public Listener Listen( ButtonState state, TouchHandler handler, string helpText )
297 {
298 return AddListener( GetList( state ), AlwaysTrigger, helpText, handler );
299 }
300
309 public Listener Listen<T>( ButtonState state, TouchHandler handler, string helpText, T p )
310 {
311 return AddListener( GetList( state ), AlwaysTrigger, helpText, handler, p );
312 }
313
324 public Listener Listen<T1, T2>( ButtonState state, TouchHandler handler, string helpText, T1 p1, T2 p2 )
325 {
326 return AddListener( GetList( state ), AlwaysTrigger, helpText, handler, p1, p2 );
327 }
328
341 public Listener Listen<T1, T2, T3>( ButtonState state, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3 )
342 {
343 return AddListener( GetList( state ), AlwaysTrigger, helpText, handler, p1, p2, p3 );
344 }
345
354 public Listener ListenOn( GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler handler, string helpText )
355 {
356 Predicate<Touch> rule = MakeTriggerRule( obj, hoverstate );
357 return AddListener( GetList( buttonstate ), rule, helpText, handler );
358 }
359
370 public Listener ListenOn<T>( GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler<T> handler, string helpText, T p )
371 {
372 Predicate<Touch> rule = MakeTriggerRule( obj, hoverstate );
373 return AddListener( GetList( buttonstate ), rule, helpText, handler, p );
374 }
375
388 public Listener ListenOn<T1, T2>( GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler<T1, T2> handler, string helpText, T1 p1, T2 p2 )
389 {
390 Predicate<Touch> rule = MakeTriggerRule( obj, hoverstate );
391 return AddListener( GetList( buttonstate ), rule, helpText, handler, p1, p2 );
392 }
393
408 public Listener ListenOn<T1, T2, T3>( GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
409 {
410 Predicate<Touch> rule = MakeTriggerRule( obj, hoverstate );
411 return AddListener( GetList( buttonstate ), rule, helpText, handler, p1, p2, p3 );
412 }
413
421 public Listener ListenOn( GameObject obj, ButtonState buttonstate, TouchHandler handler, string helpText )
422 {
423 return ListenOn( obj, HoverState.On, buttonstate, handler, helpText );
424 }
425
435 public Listener ListenOn<T>( GameObject obj, ButtonState buttonstate, TouchHandler<T> handler, string helpText, T p )
436 {
437 return ListenOn( obj, HoverState.On, buttonstate, handler, helpText, p );
438 }
439
451 public Listener ListenOn<T1, T2>( GameObject obj, ButtonState buttonstate, TouchHandler<T1, T2> handler, string helpText, T1 p1, T2 p2 )
452 {
453 return ListenOn( obj, HoverState.On, buttonstate, handler, helpText, p1, p2 );
454 }
455
469 public Listener ListenOn<T1, T2, T3>( GameObject obj, ButtonState buttonstate, TouchHandler<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
470 {
471 return ListenOn( obj, HoverState.On, buttonstate, handler, helpText, p1, p2, p3 );
472 }
473
480 public Listener ListenGesture( GestureType type, TouchHandler handler, string helpText )
481 {
482 XnaTouchPanel.EnabledGestures |= (XnaGestureType)type;
483 return AddGestureListener( ( Gesture g ) => g.GestureType == type, helpText, handler );
484 }
485
494 public Listener ListenGestureOn( GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText )
495 {
496 Predicate<Touch> hover = MakeTriggerRule( obj, hoverstate );
497 return AddGestureListener( (Gesture g) => g.GestureType == type && hover(g), helpText, handler );
498 }
499
507 public Listener ListenGestureOn( GameObject obj, GestureType type, TouchHandler handler, string helpText )
508 {
509 return ListenGestureOn( obj, HoverState.On, type, handler, helpText );
510 }
511
520 public Listener ListenGesture<T1>( GestureType type, TouchHandler handler, string helpText, T1 p1 )
521 {
522 XnaTouchPanel.EnabledGestures |= (XnaGestureType)type;
523 return AddGestureListener( ( Gesture g ) => g.GestureType == type, helpText, handler, p1 );
524 }
525
536 public Listener ListenGestureOn<T1>( GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1 )
537 {
538 Predicate<Touch> hover = MakeTriggerRule( obj, hoverstate );
539 return AddGestureListener( ( Gesture g ) => g.GestureType == type && hover( g ), helpText, handler, p1 );
540 }
541
551 public Listener ListenGestureOn<T1>( GameObject obj, GestureType type, TouchHandler handler, string helpText, T1 p1 )
552 {
553 return ListenGestureOn( obj, HoverState.On, type, handler, helpText, p1 );
554 }
555
566 public Listener ListenGesture<T1, T2>( GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2 )
567 {
568 XnaTouchPanel.EnabledGestures |= (XnaGestureType)type;
569 return AddGestureListener( ( Gesture g ) => g.GestureType == type, helpText, handler, p1, p2 );
570 }
571
584 public Listener ListenGestureOn<T1, T2>( GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2 )
585 {
586 Predicate<Touch> hover = MakeTriggerRule( obj, hoverstate );
587 return AddGestureListener( ( Gesture g ) => g.GestureType == type && hover( g ), helpText, handler, p1, p2 );
588 }
589
601 public Listener ListenGestureOn<T1, T2>( GameObject obj, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2 )
602 {
603 return ListenGestureOn( obj, HoverState.On, type, handler, helpText, p1 );
604 }
605
618 public Listener ListenGesture<T1, T2, T3>( GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3 )
619 {
620 XnaTouchPanel.EnabledGestures |= (XnaGestureType)type;
621 return AddGestureListener( ( Gesture g ) => g.GestureType == type, helpText, handler, p1, p2 );
622 }
623
638 public Listener ListenGestureOn<T1, T2, T3>( GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3 )
639 {
640 Predicate<Touch> hover = MakeTriggerRule( obj, hoverstate );
641 return AddGestureListener( ( Gesture g ) => g.GestureType == type && hover( g ), helpText, handler, p1, p2 );
642 }
643
657 public Listener ListenGestureOn<T1, T2, T3>( GameObject obj, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3 )
658 {
659 return ListenGestureOn( obj, HoverState.On, type, handler, helpText, p1 );
660 }
661 }
662}
Vector Position
Kameran sijainti.
Definition: Camera.cs:53
Vector ScreenToWorld(Vector point)
Muuntaa annetun pisteen ruutukoordinaateista maailmankoordinaatteihin.
Definition: Camera.cs:167
void Zoom(double zoom)
Zoomaa.
Definition: Camera.cs:224
Kuuntelukonteksti ohjaimia varten
bool Active
Onko tämä konteksti tällä hetkellä aktiivinen
ListenContext CreateSubcontext()
Muodostaa uuden ohjainkontekstin tämän lapseksi
ListenContext ControlContext
Pelin pääohjainkonteksti.
Definition: Controls.cs:98
Camera Camera
Kamera, joka näyttää ruudulla näkyvän osan kentästä. Kameraa voidaan siirtää, zoomata tai asettaa seu...
Definition: Game.cs:130
static Game Instance
Käynnissä olevan pelin pääolio.
Definition: Game.cs:96
static ScreenView Screen
Näytön dimensiot, eli koko ja reunat.
Definition: Graphics.cs:90
Pelialueella liikkuva olio. Käytä fysiikkapeleissä PhysicsObject-olioita.
Definition: Appearance.cs:34
bool IsInside(Vector point)
Onko piste p tämän olion sisäpuolella.
Definition: Dimensions.cs:155
bool IsDestroyed
Onko olio tuhottu.
Layer Layer
Kerros, jolle peliolio on lisätty.
GestureType GestureType
Kosketuseleen tyyppi.
Definition: Gesture.cs:14
Vector WorldDistanceBefore
Sormien etäisyysvektori maailmassa eleen alussa.
Definition: Gesture.cs:64
Vector WorldDistanceAfter
Sormien etäisyysvektori maailmassa eleen lopussa.
Definition: Gesture.cs:75
Sisältää näytön leveyden ja korkeuden sekä reunojen koordinaatit. Y-koordinaatti kasvaa ylöspäin....
Definition: View.cs:45
Synkroninen lista, eli lista joka päivittyy vasta kun sen Update-metodia kutsutaan....
Kosketuspaneelin kosketus.
Definition: Touch.cs:39
Vector PrevPositionOnScreen
Kosketuksen edellinen paikka ruudulla.
Definition: Touch.cs:83
Vector MovementOnWorld
Kosketuksen liike pelimaailmassa.
Definition: Touch.cs:116
void Update(TouchLocation location)
Definition: Touch.cs:138
Vector PositionOnScreen
Kosketuksen paikka ruudulla.
Definition: Touch.cs:61
Touch(ScreenView screen, TouchLocation location)
Definition: Touch.cs:125
Kuuntelija kosketusnäytölle.
Kosketusnäyttö.
Definition: TouchPanel.cs:20
delegate void ContextHandler(ListenContext ctx)
Listener ListenOn< T1, T2 >(GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler< T1, T2 > handler, string helpText, T1 p1, T2 p2)
Kuuntelee kosketusnäyttöä olion päällä.
Definition: TouchPanel.cs:388
int ActiveChannels
Kuinka monta kosketusta näytöllä on aktiivisena.
Definition: TouchPanel.cs:49
void Clear()
Poistaa kaikki kuuntelijat.
Definition: TouchPanel.cs:234
List< Touch > newTouches
Definition: TouchPanel.cs:26
int NumGestures
Kuinka monta elettä näytöllä on aktiivisena.
Definition: TouchPanel.cs:73
IEnumerable< string > GetHelpTexts()
Palauttaa asetettujen kuuntelijoiden ohjetekstit.
Definition: TouchPanel.cs:242
bool IsConnected
Onko kosketusnäyttö kytketty.
Definition: TouchPanel.cs:41
Predicate< Touch > MakeTriggerRule(GameObject obj, HoverState hover)
Definition: TouchPanel.cs:164
Listener ListenOn< T1, T2, T3 >(GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler< T1, T2, T3 > handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee kosketusnäyttöä olion päällä.
Definition: TouchPanel.cs:408
readonly SynchronousList< TouchListener > PressListeners
Definition: TouchPanel.cs:30
Listener ListenOn(GameObject obj, ButtonState buttonstate, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttöä olion päällä.
Definition: TouchPanel.cs:421
List< Gesture > gestures
Definition: TouchPanel.cs:27
Listener Listen< T1, T2, T3 >(ButtonState state, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee kosketusnäyttöä.
Definition: TouchPanel.cs:341
Listener ListenOn(GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttöä olion päällä.
Definition: TouchPanel.cs:354
readonly SynchronousList< TouchListener > DownListeners
Definition: TouchPanel.cs:29
TouchPanelCapabilities caps
Definition: TouchPanel.cs:24
TouchPanel(ScreenView screen)
Definition: TouchPanel.cs:127
static readonly Predicate< Touch > AlwaysTrigger
Definition: TouchPanel.cs:21
Listener ListenGesture< T1, T2, T3 >(GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee kosketusnäyttön elettä.
Definition: TouchPanel.cs:618
Listener AddListener(SynchronousList< TouchListener > list, Predicate< Touch > rule, string helpText, Delegate handler, params object[] args)
Definition: TouchPanel.cs:275
static bool IsBeingTouched(ScreenView screen, Vector touchOnScreen, GameObject obj)
Kosketetaako oliota.
Definition: TouchPanel.cs:147
Listener ListenGestureOn< T1, T2 >(GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2)
Kuuntelee kosketusnäyttön elettä olion päällä.
Definition: TouchPanel.cs:584
int NumTouches
Kuinka monta kosketusta tällä hetkellä ruudulla.
Definition: TouchPanel.cs:57
Listener Listen< T >(ButtonState state, TouchHandler handler, string helpText, T p)
Kuuntelee kosketusnäyttöä.
Definition: TouchPanel.cs:309
void setContext(ref ListenContext context, bool enable, ContextHandler operation)
Definition: TouchPanel.cs:111
Listener Listen< T1, T2 >(ButtonState state, TouchHandler handler, string helpText, T1 p1, T2 p2)
Kuuntelee kosketusnäyttöä.
Definition: TouchPanel.cs:324
ListenContext _pinchContext
Definition: TouchPanel.cs:35
Listener Listen(ButtonState state, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttöä.
Definition: TouchPanel.cs:296
Listener ListenOn< T >(GameObject obj, HoverState hoverstate, ButtonState buttonstate, TouchHandler< T > handler, string helpText, T p)
Kuuntelee kosketusnäyttöä olion päällä.
Definition: TouchPanel.cs:370
Listener ListenGestureOn(GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttön elettä olion päällä.
Definition: TouchPanel.cs:494
bool FollowSnipping
Seurataanko kosketusta kameralla.
Definition: TouchPanel.cs:81
Listener AddGestureListener(Predicate< Gesture > rule, string helpText, Delegate handler, params object[] args)
Definition: TouchPanel.cs:282
ScreenView screen
Definition: TouchPanel.cs:23
List< Touch > touches
Definition: TouchPanel.cs:25
void UpdateTouches()
Definition: TouchPanel.cs:179
bool FollowPinching
Zoomataanko kameralla kun käyttäjä tekee nipistyseleen
Definition: TouchPanel.cs:95
Listener ListenGestureOn(GameObject obj, GestureType type, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttön elettä olion päällä.
Definition: TouchPanel.cs:507
Listener ListenGestureOn< T1, T2, T3 >(GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee kosketusnäyttön elettä olion päällä.
Definition: TouchPanel.cs:638
readonly SynchronousList< TouchListener > ReleaseListeners
Definition: TouchPanel.cs:31
readonly SynchronousList< TouchListener > GestureListeners
Definition: TouchPanel.cs:32
Listener ListenGestureOn< T1 >(GameObject obj, HoverState hoverstate, GestureType type, TouchHandler handler, string helpText, T1 p1)
Kuuntelee kosketusnäyttön elettä olion päällä.
Definition: TouchPanel.cs:536
Listener ListenGesture(GestureType type, TouchHandler handler, string helpText)
Kuuntelee kosketusnäyttön elettä.
Definition: TouchPanel.cs:480
Listener ListenGesture< T1, T2 >(GestureType type, TouchHandler handler, string helpText, T1 p1, T2 p2)
Kuuntelee kosketusnäyttön elettä.
Definition: TouchPanel.cs:566
int MaxTouches
Kuinka monta yhtäaikaista kosketusta näyttö tukee.
Definition: TouchPanel.cs:65
static HoverState GetHoverState(Touch touch, GameObject obj)
Definition: TouchPanel.cs:153
void UpdateGestures()
Definition: TouchPanel.cs:220
SynchronousList< TouchListener > GetList(ButtonState state)
Definition: TouchPanel.cs:263
Listener ListenGesture< T1 >(GestureType type, TouchHandler handler, string helpText, T1 p1)
Kuuntelee kosketusnäyttön elettä.
Definition: TouchPanel.cs:520
ListenContext _snipContext
Definition: TouchPanel.cs:34
void Update()
Lukee uuden tilan laitteelta ja päivittää sen nykyiseksi sekä laukaisee tapahtumia.
Definition: TouchPanel.cs:173
Ohjaintapahtumien kuuntelija.
Definition: Listener.cs:72
Listener InContext(ListenContext context)
Kuuntelee tapahtumaa vain tietyssä kontekstissa.
ButtonState
Napin (minkä tahansa) asento.
Definition: ButtonState.cs:37
Microsoft.Xna.Framework.Input.Touch.TouchPanel XnaTouchPanel
Definition: TouchPanel.cs:8
Microsoft.Xna.Framework.Input.Touch.GestureType XnaGestureType
Definition: TouchPanel.cs:9
delegate void TouchHandler< T >(Touch touch, T p)
HoverState
Tilatieto olion päällä olemisesta
Definition: HoverState.cs:7
delegate void TouchHandler< T1, T2, T3 >(Touch touch, T1 p1, T2 p2, T3 p3)
delegate void TouchHandler< T1, T2 >(Touch touch, T1 p1, T2 p2)
delegate void TouchHandler(Touch touch)
2D-vektori.
Definition: Vector.cs:67
double Magnitude
Vektorin pituus.
Definition: Vector.cs:345