Jypeli 10
The simple game programming library
Mouse.cs
Siirry tämän tiedoston dokumentaatioon.
1#region MIT License
2/*
3 * Copyright (c) 2009 University of Jyväskylä, Department of Mathematical
4 * Information Technology.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24#endregion
25
26/*
27 * Authors: Tero Jäntti, Tomi Karppinen, Janne Nikkanen.
28 */
29
30using System;
31using System.Collections.Generic;
32using Jypeli.Controls;
33
34namespace Jypeli
35{
36 using Matrix = Microsoft.Xna.Framework.Matrix;
37 using XnaV2 = Microsoft.Xna.Framework.Vector2;
38 using XnaMouse = Microsoft.Xna.Framework.Input.Mouse;
39 using MouseState = Microsoft.Xna.Framework.Input.MouseState;
40 using XnaButtonState = Microsoft.Xna.Framework.Input.ButtonState;
41
45 public class Mouse : Controller<MouseState, MouseButton>
46 {
47 private static readonly Dictionary<MouseButton, Func<MouseState, bool>> GetButtonDown = new Dictionary<MouseButton, Func<MouseState, bool>>( 5 )
48 {
49 { MouseButton.Left, delegate( MouseState state ) { return state.LeftButton == XnaButtonState.Pressed; } },
50 { MouseButton.Right, delegate( MouseState state ) { return state.RightButton == XnaButtonState.Pressed; } },
51 { MouseButton.Middle, delegate( MouseState state ) { return state.MiddleButton == XnaButtonState.Pressed; } },
52 { MouseButton.XButton1, delegate( MouseState state ) { return state.XButton1 == XnaButtonState.Pressed; } },
53 { MouseButton.XButton2, delegate( MouseState state ) { return state.XButton2 == XnaButtonState.Pressed; } }
54 };
55
57
65 public bool IsCursorVisible
66 {
67 get { return Game.Instance.IsMouseVisible; }
68 set { Game.Instance.IsMouseVisible = value; }
69 }
70
75 {
76 get
77 {
79 }
80 set
81 {
82#if !WINRT && !WINDOWS_PHONE && !ANDROID
83 // Not supported on WinRT... only sets xna coords
84 Vector pos = value.Transform( screen.GetScreenInverse() );
86
87 //CurrentState = new MouseState( CurrentState, xnapos );
89 (int)xnapos.X, (int)xnapos.Y, CurrentState.ScrollWheelValue,
90 CurrentState.LeftButton, CurrentState.MiddleButton, CurrentState.RightButton,
91 CurrentState.XButton1, CurrentState.XButton2 );
92 XnaMouse.SetPosition( (int)xnapos.X, (int)xnapos.Y );
93#endif
94 }
95 }
96
101 {
102 get
103 {
105 }
106 set
107 {
109 }
110 }
111
116 {
117 get
118 {
119 Matrix screenTransform = screen.GetScreenTransform();
120
121 XnaV2 curXna = new XnaV2( CurrentState.X, CurrentState.Y );
122 XnaV2 prevXna = new XnaV2( PrevState.X, PrevState.Y );
125 Vector curr = curScr.Transform( screenTransform );
126 Vector prev = prevScr.Transform( screenTransform );
127
128 return curr - prev;
129 }
130 }
131
136 {
137 get
138 {
139 Matrix screenTransform = screen.GetScreenTransform();
140
141 XnaV2 curXna = new XnaV2( CurrentState.X, CurrentState.Y );
142 XnaV2 prevXna = new XnaV2( PrevState.X, PrevState.Y );
145 Vector curr = curScr.Transform( screenTransform );
146 Vector prev = prevScr.Transform( screenTransform );
147
149 }
150 }
151
155 public int WheelState
156 {
157 get
158 {
159 return CurrentState.ScrollWheelValue / 120;
160 }
161 }
162
167 public int WheelChange
168 {
169 get
170 {
171 return ( CurrentState.ScrollWheelValue - PrevState.ScrollWheelValue ) / 120;
172 }
173 }
174
176 {
177 this.screen = screen;
178 this.CurrentState = XnaMouse.GetState();
179 }
180
182 {
183 XnaV2 xnaPos = new XnaV2( state.X, state.Y );
185 return pos.Transform( screen.GetScreenTransform() );
186 }
187
189 {
191 }
192
193 private void SetPosition( Vector pos )
194 {
195#if !WINRT && !WINDOWS_PHONE
196 // Not supported on WinRT... only sets xna coords
197 Vector screenpos = pos.Transform( screen.GetScreenInverse() );
198 XnaV2 center = ScreenView.ToXnaCoords( screenpos, screen.ViewportSize, Vector.Zero );
199 XnaMouse.SetPosition( (int)center.X, (int)center.Y );
200#endif
201 }
202
203 internal override MouseState GetState()
204 {
205#if WINDOWS_PHONE || ANDROID
206 return new MouseState();
207#elif WINRT
208 return XnaMouse.GetState();
209#else
210 if ( !IsCursorVisible )
211 {
212 // Reset the mouse to the center of the screen
214 }
215
216 return XnaMouse.GetState();
217#endif
218 }
219
220 private static ButtonState GetButtonState( MouseState oldState, MouseState newState, MouseButton button )
221 {
222#if WINDOWS_PHONE
223 return ButtonState.Up;
224#endif
225
226 bool prevDown = GetButtonDown[button]( oldState );
227 bool currDown = GetButtonDown[button]( newState );
228
229 if ( prevDown && currDown ) return ButtonState.Down;
230 if ( !prevDown && !currDown ) return ButtonState.Up;
231 if ( !prevDown && currDown ) return ButtonState.Pressed;
232 return ButtonState.Released;
233 }
234
235 private static HoverState GetHoverState( MouseState oldState, MouseState newState, GameObject obj )
236 {
237#if WINDOWS_PHONE || ANDROID
238 return HoverState.Off;
239#else
240 bool prevOn = IsCursorOn( Game.Screen, oldState, obj );
241 bool currOn = IsCursorOn( Game.Screen, newState, obj );
242
243 if ( prevOn && currOn ) return HoverState.On;
244 if ( !prevOn && !currOn ) return HoverState.Off;
245 if ( !prevOn && currOn ) return HoverState.Enter;
246 return HoverState.Exit;
247#endif
248 }
249
256 {
257 return GetButtonState( PrevState, CurrentState, button );
258 }
259
260 private ChangePredicate<MouseState> MakeTriggerRule( MouseButton button, ButtonState state )
261 {
262 if ( button == MouseButton.None || state == ButtonState.Irrelevant )
263 return AlwaysTrigger;
264
265 return delegate( MouseState prev, MouseState curr ) { return GetButtonState( prev, curr, button ) == state; };
266 }
267
268 private ChangePredicate<MouseState> MakeTriggerRule( GameObject obj, HoverState hover, MouseButton button, ButtonState state )
269 {
270 if ( button == MouseButton.None || state == ButtonState.Irrelevant )
271 {
272 return delegate( MouseState prev, MouseState curr )
273 {
274 if ( obj == null || obj.IsDestroyed || obj.Layer == null ) return false;
275 return GetHoverState( prev, curr, obj ) == hover;
276 };
277 }
278
279 return delegate( MouseState prev, MouseState curr )
280 {
281 if ( obj == null || obj.IsDestroyed || obj.Layer == null ) return false;
282 return GetButtonState( prev, curr, button ) == state && GetHoverState( prev, curr, obj ) == hover;
283 };
284 }
285
286 private ChangePredicate<MouseState> MakeTriggerRule( double moveTrigger )
287 {
288 return delegate( MouseState prev, MouseState curr )
289 {
290 double xdist = prev.X - curr.X;
291 double ydist = prev.Y - curr.Y;
292 return xdist * xdist + ydist * ydist > moveTrigger * moveTrigger;
293 };
294 }
295
296 private ChangePredicate<MouseState> MakeWheelTriggerRule()
297 {
298 return delegate (MouseState prev, MouseState curr)
299 {
300 return prev.ScrollWheelValue != curr.ScrollWheelValue;
301 };
302 }
303
304 private string GetButtonName( MouseButton b )
305 {
306 return "Mouse " + b.ToString();
307 }
308
309 private string GetButtonName( MouseButton b, GameObject obj )
310 {
311 if ( obj != null && obj.Tag != null )
312 return string.Format( "{0} on {1}", GetButtonName( b ), obj.Tag );
313
314 return GetButtonName( b );
315 }
316
320 private static bool IsCursorOn( ScreenView screen, MouseState state, GameObject obj )
321 {
322#if WINDOWS_PHONE
323 return false;
324#else
325 if ( obj == null || obj.Layer == null || obj.IsDestroyed ) return false;
327#endif
328 }
329
333 public bool IsCursorOn( GameObject obj )
334 {
335#if WINDOWS_PHONE || ANDROID
336 return false;
337#else
338 if ( obj == null || obj.Layer == null || obj.IsDestroyed ) return false;
339 return obj.IsInside( Game.Instance.Camera.ScreenToWorld( this.PositionOnScreen, obj.Layer ) );
340#endif
341 }
342
350 public Listener Listen( MouseButton button, ButtonState state, Action handler, string helpText )
351 {
352 ChangePredicate<MouseState> rule = MakeTriggerRule( button, state );
353 return AddListener( rule, button, GetButtonName( button ), helpText, handler );
354 }
355
365 public Listener Listen<T>( MouseButton button, ButtonState state, Action<T> handler, string helpText, T p )
366 {
367 ChangePredicate<MouseState> rule = MakeTriggerRule( button, state );
368 return AddListener( rule, button, GetButtonName( button ), helpText, handler, p );
369 }
370
382 public Listener Listen<T1, T2>( MouseButton button, ButtonState state, Action<T1, T2> handler, string helpText, T1 p1, T2 p2 )
383 {
384 ChangePredicate<MouseState> rule = MakeTriggerRule( button, state );
385 return AddListener( rule, button, GetButtonName( button ), helpText, handler, p1, p2 );
386 }
387
401 public Listener Listen<T1, T2, T3>( MouseButton button, ButtonState state, Action<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
402 {
403 ChangePredicate<MouseState> rule = MakeTriggerRule( button, state );
404 return AddListener( rule, button, GetButtonName( button ), helpText, handler, p1, p2, p3 );
405 }
406
413 public Listener ListenMovement( double trigger, Action handler, string helpText )
414 {
415 ChangePredicate<MouseState> rule = MakeTriggerRule( trigger );
416 return AddListener( rule, MouseButton.None, "Mouse movement", helpText, handler );
417 }
418
427 public Listener ListenMovement<T>( double trigger, Action<T> handler, string helpText, T p )
428 {
429 ChangePredicate<MouseState> rule = MakeTriggerRule( trigger );
430 return AddListener( rule, MouseButton.None, "Mouse movement", helpText, handler, p );
431 }
432
443 public Listener ListenMovement<T1, T2>( double trigger, Action<T1, T2> handler, string helpText, T1 p1, T2 p2 )
444 {
445 ChangePredicate<MouseState> rule = MakeTriggerRule( trigger );
446 return AddListener( rule, MouseButton.None, "Mouse movement", helpText, handler, p1, p2 );
447 }
448
461 public Listener ListenMovement<T1, T2, T3>( double trigger, Action<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
462 {
463 ChangePredicate<MouseState> rule = MakeTriggerRule( trigger );
464 return AddListener( rule, MouseButton.None, "Mouse movement", helpText, handler, p1, p2, p3 );
465 }
466
476 public Listener ListenOn( GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action handler, string helpText )
477 {
478 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, hoverstate, button, state );
479 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler );
480 }
481
494 public Listener ListenOn<T>( GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action<T> handler, string helpText, T p )
495 {
496 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, hoverstate, button, state );
497 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p );
498 }
499
514 public Listener ListenOn<T1, T2>( GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action<T1, T2> handler, string helpText, T1 p1, T2 p2 )
515 {
516 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, hoverstate, button, state );
517 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p1, p2 );
518 }
519
536 public Listener ListenOn<T1, T2, T3>( GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
537 {
538 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, hoverstate, button, state );
539 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p1, p2, p3 );
540 }
541
548 public Listener ListenWheel(Action handler, string helpText) => ListenWheelGeneric(handler, helpText, null);
549
558 public Listener ListenWheel<T>(Action<T> handler, string helpText, T p) => ListenWheelGeneric(handler, helpText, p);
559
570 public Listener ListenWheel<T1, T2>(Action<T1, T2> handler, string helpText, T1 p1, T2 p2) => ListenWheelGeneric(handler, helpText, p1, p2);
571
584 public Listener ListenWheel<T1, T2, T3>(Action<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3) => ListenWheelGeneric(handler, helpText, p1, p2, p3);
585
593 public Listener ListenWheelGeneric(Delegate handler, string helpText, params object[] parameters)
594 {
595 // Olisi selkeämpää antaa vain tämä käyttäjän käyttöön, mutta koska kaikki
596 // muut Jypelin kuuntelijat myös vaativat parametrien tyyppien määrittelemistä,
597 // niin vaaditaan sitten hiiren rullankin kanssa jotta toimintamalli on yhtenäinen.
598 // Toki tyypin määrittelyssä on oppilaille suunnatussa kirjastossa se hyvä puoli,
599 // että se tarkistaa että määritellyt tyypit (esim. T1 ja T2) eivät poikkea
600 // parametrien tyypeistä (ellei parametrien tyyppejä haeta automaattisesti, mikä
601 // yleensä tapahtuu).
602 ChangePredicate<MouseState> rule = MakeWheelTriggerRule();
603 return AddListener(rule, MouseButton.None, "Mouse wheel", helpText, handler, parameters);
604 }
605
614 public Listener ListenOn( GameObject obj, MouseButton button, ButtonState state, Action handler, string helpText )
615 {
616 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, HoverState.On, button, state );
617 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler );
618 }
619
630 public Listener ListenOn<T>( GameObject obj, MouseButton button, ButtonState state, Action<T> handler, string helpText, T p )
631 {
632 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, HoverState.On, button, state );
633 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p );
634 }
635
648 public Listener ListenOn<T1, T2>( GameObject obj, MouseButton button, ButtonState state, Action<T1, T2> handler, string helpText, T1 p1, T2 p2 )
649 {
650 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, HoverState.On, button, state );
651 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p1, p2 );
652 }
653
668 public Listener ListenOn<T1, T2, T3>( GameObject obj, MouseButton button, ButtonState state, Action<T1, T2, T3> handler, string helpText, T1 p1, T2 p2, T3 p3 )
669 {
670 ChangePredicate<MouseState> rule = MakeTriggerRule( obj, HoverState.On, button, state );
671 return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler, p1, p2, p3 );
672 }
673 }
674}
Vector WorldToScreen(Vector point)
Muuntaa annetun pisteen maailmankoordinaateista ruutukoordinaatteihin.
Definition: Camera.cs:175
Vector ScreenToWorld(Vector point)
Muuntaa annetun pisteen ruutukoordinaateista maailmankoordinaatteihin.
Definition: Camera.cs:167
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
object Tag
Vapaasti asetettava muuttuja.
bool IsDestroyed
Onko olio tuhottu.
Layer Layer
Kerros, jolle peliolio on lisätty.
Hiiri.
Definition: Mouse.cs:46
static Vector GetPositionOnWorld(ScreenView screen, MouseState state)
Definition: Mouse.cs:188
Listener ListenOn< T1, T2 >(GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action< T1, T2 > handler, string helpText, T1 p1, T2 p2)
Kuuntelee hiirenpainalluksia annetun peliolion päällä.
Definition: Mouse.cs:514
static ButtonState GetButtonState(MouseState oldState, MouseState newState, MouseButton button)
Definition: Mouse.cs:220
ChangePredicate< MouseState > MakeTriggerRule(MouseButton button, ButtonState state)
Definition: Mouse.cs:260
int WheelState
Rullan asento. Vähenee alaspäin ja kasvaa ylöspäin rullattaessa.
Definition: Mouse.cs:156
static HoverState GetHoverState(MouseState oldState, MouseState newState, GameObject obj)
Definition: Mouse.cs:235
int WheelChange
Rullan asennon muutos viime tarkistuksesta. Vähenee alaspäin ja kasvaa ylöspäin rullattaessa....
Definition: Mouse.cs:168
bool IsCursorVisible
Käytetäänkö hiiren kursoria. Jos käytetään, hiiren paikka ruudulla on mitattavissa,...
Definition: Mouse.cs:66
Vector MovementOnScreen
Kursorin viimeisin liike ruutukoordinaateissa.
Definition: Mouse.cs:116
Listener ListenWheel< T1, T2, T3 >(Action< T1, T2, T3 > handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee hiiren rullaa
Listener ListenWheel< T >(Action< T > handler, string helpText, T p)
Kuuntelee hiiren rullaa
string GetButtonName(MouseButton b, GameObject obj)
Definition: Mouse.cs:309
Listener ListenMovement< T1, T2, T3 >(double trigger, Action< T1, T2, T3 > handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee hiiren liikettä.
Definition: Mouse.cs:461
Listener ListenOn< T >(GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action< T > handler, string helpText, T p)
Kuuntelee hiirenpainalluksia annetun peliolion päällä.
Definition: Mouse.cs:494
Listener Listen< T1, T2, T3 >(MouseButton button, ButtonState state, Action< T1, T2, T3 > handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee hiiren nappulan painalluksia.
Definition: Mouse.cs:401
void SetPosition(Vector pos)
Definition: Mouse.cs:193
ChangePredicate< MouseState > MakeWheelTriggerRule()
Definition: Mouse.cs:296
Listener ListenMovement< T1, T2 >(double trigger, Action< T1, T2 > handler, string helpText, T1 p1, T2 p2)
Kuuntelee hiiren liikettä.
Definition: Mouse.cs:443
Listener ListenWheel< T1, T2 >(Action< T1, T2 > handler, string helpText, T1 p1, T2 p2)
Kuuntelee hiiren rullaa
Listener Listen< T1, T2 >(MouseButton button, ButtonState state, Action< T1, T2 > handler, string helpText, T1 p1, T2 p2)
Kuuntelee hiiren nappulan painalluksia.
Definition: Mouse.cs:382
bool IsCursorOn(GameObject obj)
Onko hiiren kursori annetun olion päällä.
Definition: Mouse.cs:333
static readonly Dictionary< MouseButton, Func< MouseState, bool > > GetButtonDown
Definition: Mouse.cs:47
Vector PositionOnScreen
Kursorin paikka ruutukoordinaateissa.
Definition: Mouse.cs:75
Listener ListenOn(GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action handler, string helpText)
Kuuntelee hiirenpainalluksia annetun peliolion päällä.
Definition: Mouse.cs:476
Listener ListenOn(GameObject obj, MouseButton button, ButtonState state, Action handler, string helpText)
Kuuntelee hiirenpainalluksia annetun peliolion päällä.
Definition: Mouse.cs:614
ChangePredicate< MouseState > MakeTriggerRule(GameObject obj, HoverState hover, MouseButton button, ButtonState state)
Definition: Mouse.cs:268
Listener Listen(MouseButton button, ButtonState state, Action handler, string helpText)
Kuuntelee hiiren nappulan painalluksia.
Definition: Mouse.cs:350
static bool IsCursorOn(ScreenView screen, MouseState state, GameObject obj)
Onko hiiren kursori annetun olion päällä.
Definition: Mouse.cs:320
string GetButtonName(MouseButton b)
Definition: Mouse.cs:304
Listener ListenMovement(double trigger, Action handler, string helpText)
Kuuntelee hiiren liikettä.
Definition: Mouse.cs:413
Mouse(ScreenView screen)
Definition: Mouse.cs:175
ChangePredicate< MouseState > MakeTriggerRule(double moveTrigger)
Definition: Mouse.cs:286
Vector PositionOnWorld
Kursorin paikka maailmankoordinaateissa.
Definition: Mouse.cs:101
override MouseState GetState()
Lukee ja palauttaa laitteen viimeisimmän tilan.
Definition: Mouse.cs:203
Listener ListenMovement< T >(double trigger, Action< T > handler, string helpText, T p)
Kuuntelee hiiren liikettä.
Definition: Mouse.cs:427
ScreenView screen
Definition: Mouse.cs:56
Listener ListenWheel(Action handler, string helpText)
Kuuntelee hiiren rullaa
Listener Listen< T >(MouseButton button, ButtonState state, Action< T > handler, string helpText, T p)
Kuuntelee hiiren nappulan painalluksia.
Definition: Mouse.cs:365
Vector MovementOnWorld
Kursorin viimeisin liike maailmankoordinaateissa.
Definition: Mouse.cs:136
static Vector GetPositionOnScreen(ScreenView screen, MouseState state)
Definition: Mouse.cs:181
Listener ListenOn< T1, T2, T3 >(GameObject obj, HoverState hoverstate, MouseButton button, ButtonState state, Action< T1, T2, T3 > handler, string helpText, T1 p1, T2 p2, T3 p3)
Kuuntelee hiirenpainalluksia annetun peliolion päällä.
Definition: Mouse.cs:536
ButtonState GetButtonState(MouseButton button)
Palauttaa napin tilan.
Definition: Mouse.cs:255
Listener ListenWheelGeneric(Delegate handler, string helpText, params object[] parameters)
Kuuntelee hiiren rullaa.
Definition: Mouse.cs:593
Sisältää näytön leveyden ja korkeuden sekä reunojen koordinaatit. Y-koordinaatti kasvaa ylöspäin....
Definition: View.cs:45
Matrix GetScreenInverse()
Palauttaa käänteisen transformaatiomatriisin jolla voi ottaa huomioon ruudun kokoon,...
Definition: View.cs:435
Vector ViewportSize
Näytön todellinen koko.
Definition: View.cs:284
static Vector2 ToXnaCoords(Vector position, Vector screenSize, Vector objectSize)
Muuntaa Jypelin ruutukoordinaateista XNA:n ruutukoordinaateiksi.
Definition: View.cs:390
Matrix GetScreenTransform()
Palauttaa transformaatiomatriisin jolla voi ottaa huomioon ruudun kokoon, kiertoon ja paikkaan tehdyt...
Definition: View.cs:421
static Vector FromXnaCoords(Vector2 position, Vector screenSize, Vector objectSize)
Muuntaa XNA:n ruutukoordinaateista Jypelin ruutukoordinaateiksi.
Definition: View.cs:366
Listener AddListener(ChangePredicate< ControllerState > rule, Control control, string controlName, string helpText, Delegate handler, params object[] args)
Definition: Controller.cs:102
static readonly ChangePredicate< ControllerState > AlwaysTrigger
Definition: Controller.cs:66
Ohjaintapahtumien kuuntelija.
Definition: Listener.cs:72
ButtonState
Napin (minkä tahansa) asento.
Definition: ButtonState.cs:37
Microsoft.Xna.Framework.Vector2 XnaV2
Definition: Mouse.cs:37
Microsoft.Xna.Framework.Input.MouseState MouseState
Definition: Mouse.cs:39
HoverState
Tilatieto olion päällä olemisesta
Definition: HoverState.cs:7
Microsoft.Xna.Framework.Matrix Matrix
Definition: Mouse.cs:36
Microsoft.Xna.Framework.Input.ButtonState XnaButtonState
Definition: Mouse.cs:40
Microsoft.Xna.Framework.Input.Mouse XnaMouse
Definition: Mouse.cs:38
MouseButton
Hiiren napit.
Definition: MouseButton.cs:7
2D-vektori.
Definition: Vector.cs:67
Vector Transform(Matrix matrix)
Kertoo vektorin matriisilla.
Definition: Vector.cs:227
static readonly Vector Zero
Nollavektori.
Definition: Vector.cs:71