Jypeli 10
The simple game programming library
Touch.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
28 */
29
30using Microsoft.Xna.Framework;
31using Microsoft.Xna.Framework.Input.Touch;
32
33namespace Jypeli
34{
38 public class Touch
39 {
42 protected Vector2 _position;
43 protected Vector2 _movement;
44
45 internal long DurationInTicks = 0;
46
50 public int Id { get; private set; }
51
55 public object Tag { get; set; }
56
61 {
62 get
63 {
65 }
66 }
67
72 {
73 get
74 {
76 }
77 }
78
83 {
84 get
85 {
87 }
88 }
89
94 {
95 get
96 {
98 }
99 }
100
105 {
106 get
107 {
109 }
110 }
111
116 {
117 get
118 {
120 }
121 }
122
123 public TouchLocationState State { get; internal set; }
124
125 internal Touch( ScreenView screen, TouchLocation location )
126 {
127 this.screen = screen;
128 this.Id = location.Id;
129 this._position = this._previousPosition = location.Position;
130 }
131
132 internal Touch( Vector2 position, Vector2 movement )
133 {
134 this._position = position;
135 this._movement = movement;
136 }
137
138 internal void Update( TouchLocation location )
139 {
141 _position = location.Position;
143 State = location.State;
145 }
146 }
147}
System.Numerics.Vector2 Vector2
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
Sisältää näytön leveyden ja korkeuden sekä reunojen koordinaatit. Y-koordinaatti kasvaa ylöspäin....
Definition: View.cs:45
Vector ViewportSize
Näytön todellinen koko.
Definition: View.cs:284
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
Kosketuspaneelin kosketus.
Definition: Touch.cs:39
Vector MovementOnScreen
Kosketuksen liike ruudulla.
Definition: Touch.cs:105
Vector PrevPositionOnWorld
Kosketuksen edellinen paikka pelimaailmassa.
Definition: Touch.cs:94
Vector PrevPositionOnScreen
Kosketuksen edellinen paikka ruudulla.
Definition: Touch.cs:83
Vector2 _position
Definition: Touch.cs:42
Vector MovementOnWorld
Kosketuksen liike pelimaailmassa.
Definition: Touch.cs:116
object Tag
Vapaasti asetettava muuttuja.
Definition: Touch.cs:55
Vector PositionOnWorld
Kosketuksen paikka pelimaailmassa.
Definition: Touch.cs:72
Vector2 _movement
Definition: Touch.cs:43
Touch(Vector2 position, Vector2 movement)
Definition: Touch.cs:132
void Update(TouchLocation location)
Definition: Touch.cs:138
Vector PositionOnScreen
Kosketuksen paikka ruudulla.
Definition: Touch.cs:61
long DurationInTicks
Definition: Touch.cs:45
ScreenView screen
Definition: Touch.cs:40
Vector2 _previousPosition
Definition: Touch.cs:41
TouchLocationState State
Definition: Touch.cs:123
Touch(ScreenView screen, TouchLocation location)
Definition: Touch.cs:125
int Id
Id-tunnus tälle kosketukselle.
Definition: Touch.cs:50
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