Jypeli 10
The simple game programming library
Layer.cs
Siirry tämän tiedoston dokumentaatioon.
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using Microsoft.Xna.Framework;
5using Jypeli.Effects;
6
7
8namespace Jypeli
9{
13 public enum DrawOrder
14 {
20
25 }
26
27
31 public class Layer : Updatable
32 {
36 static readonly Vector[] squareVertices =
37 {
38 new Vector( -0.5, -0.5 ),
39 new Vector( -0.5, 0.5 ),
40 new Vector( 0.5, -0.5 ),
41 new Vector( 0.5, 0.5 )
42 };
43
47 static readonly Int16[] squareIndices =
48 {
49 0, 1, 2,
50 2, 1, 3
51 };
52
56 static readonly Vector[] triangleVertices =
57 {
58 new Vector( 0f, 0.5f ),
59 new Vector( 0.5f, -0.5f ),
60 new Vector( -0.5f, -0.5f ),
61 };
62
66 static readonly Int16[] triangleIndices = { 0, 1, 2 };
67
69 {
70 TopLeft = new Vector2( 0.0f, 0.0f ),
71 TopRight = new Vector2( 1.0f, 0.0f ),
72 BottomLeft = new Vector2( 0.0f, 1.0f ),
73 BottomRight = new Vector2( 1.0f, 1.0f ),
74 };
75
80
85
86 private List<IGameObject> objectsWithImage = new List<IGameObject>();
87 private List<IGameObject> objectsWithoutImage = new List<IGameObject>();
88 private List<IGameObject> objectsWithDrawMethod = new List<IGameObject>();
89
90 private Vector _relativeTransition = new Vector( 1, 1 );
91
96 public bool IsUpdated
97 {
98 get { return true; }
99 }
100
104 public DrawOrder DrawOrder { get; set; }
105
111 {
112 get { return _relativeTransition; }
113 set { _relativeTransition = value; }
114 }
115
119 public bool IgnoresZoom { get; set; }
120
125 public Grid Grid { get; set; }
126
130 public Layer()
131 {
132 DrawOrder = DrawOrder.Irrelevant;
133 Objects.ItemAdded += ObjectAdded;
134 Objects.ItemRemoved += ObjectRemoved;
135 }
136
141 public static Layer CreateStaticLayer()
142 {
143 return new Layer() { RelativeTransition = Vector.Zero, IgnoresZoom = true };
144 }
145
146 private void ObjectAdded( IGameObject obj )
147 {
148 if (obj is ParticleSystem)
149 {
150 Effects.Add((ParticleSystem)obj);
151 }
152 else
153 if (obj is CustomDrawable)
154 {
155 objectsWithDrawMethod.Add(obj);
156 }
157 else if (obj.Image != null)
158 {
159 objectsWithImage.Add(obj);
160 }
161 else
162 {
163 objectsWithoutImage.Add(obj);
164 }
165
166 ( (IGameObjectInternal)obj ).Layer = this;
167 }
168
169 private void ObjectRemoved( IGameObject obj )
170 {
171 if (obj is ParticleSystem)
172 {
173 Effects.Remove((ParticleSystem)obj);
174 }
175 else
176 {
177 objectsWithDrawMethod.Remove(obj);
178 objectsWithImage.Remove(obj);
179 objectsWithoutImage.Remove(obj);
180 }
181
182 ((IGameObjectInternal)obj).Layer = null;
183 }
184
185 internal void Add( IGameObject o )
186 {
187 Objects.Add( o );
188 }
189
190 internal void Remove( IGameObject o )
191 {
192 Objects.Remove( o );
193 }
194
198 public void Clear()
199 {
200 Effects.Clear();
201 Objects.Clear();
202 objectsWithImage.Clear();
203 objectsWithoutImage.Clear();
204 objectsWithDrawMethod.Clear();
205 }
206
210 public void ApplyChanges()
211 {
212 Effects.UpdateChanges();
213 Objects.UpdateChanges();
214 }
215
220 public void Update( Time time )
221 {
222 Objects.Update( time );
223 Effects.Update(time);
224 }
225
226 internal void Draw( Camera camera )
227 {
228 var zoomMatrix = IgnoresZoom ? Matrix.Identity : Matrix.CreateScale( (float)( camera.ZoomFactor ), (float)( camera.ZoomFactor ), 1f );
229 var worldMatrix =
230 Matrix.CreateTranslation( (float)( -camera.Position.X * RelativeTransition.X ), (float)( -camera.Position.Y * RelativeTransition.Y ), 0 )
231 * zoomMatrix;
232
233 switch ( DrawOrder )
234 {
235 case DrawOrder.Irrelevant:
236 DrawEfficientlyInNoParticularOrder( ref worldMatrix );
237 break;
238 case DrawOrder.FirstToLast:
239 DrawInOrderFromFirstToLast( ref worldMatrix );
240 break;
241 default:
242 break;
243 }
244
245 Effects.ForEach( e => e.Draw(worldMatrix) );
246
247 if ( Grid != null )
248 {
249 DrawGrid( ref worldMatrix );
250 }
251 }
252
253 private void DrawGrid( ref Matrix matrix )
254 {
255 Graphics.LineBatch.Begin( ref matrix );
256
257 var camera = Game.Instance.Camera;
258 var screen = Game.Screen;
259 Vector topLeft = camera.ScreenToWorld( new Vector( screen.Left, screen.Top ) );
260 Vector topRight = camera.ScreenToWorld( new Vector( screen.Right, screen.Top ) );
261 Vector bottomLeft = camera.ScreenToWorld( new Vector( screen.Left, screen.Bottom ) );
262 Vector bottomRight = camera.ScreenToWorld( new Vector( screen.Right, screen.Bottom ) );
263
264 int horizontalCount = (int)Math.Ceiling( ( topRight.X - topLeft.X ) / Grid.CellSize.X );
265 int leftmostLine = (int)Math.Ceiling( topLeft.X / Grid.CellSize.X );
266 double leftmostX = leftmostLine * Grid.CellSize.X;
267
268 for ( int i = 0; i < horizontalCount; i++ )
269 {
270 double x = leftmostX + i * Grid.CellSize.X;
271 Vector startPoint = new Vector( x, topLeft.Y );
272 Vector endPoint = new Vector( x, bottomLeft.Y );
273 Graphics.LineBatch.Draw( startPoint, endPoint, Grid.Color );
274 }
275
276 int verticalCount = (int)Math.Ceiling( ( topRight.Y - bottomRight.Y ) / Grid.CellSize.Y );
277 int bottommostLine = (int)Math.Ceiling( bottomRight.Y / Grid.CellSize.Y );
278 double bottommostY = bottommostLine * Grid.CellSize.Y;
279
280 for ( int i = 0; i < verticalCount; i++ )
281 {
282 double y = bottommostY + i * Grid.CellSize.Y;
283
284 // Doesn't draw the line when y is 0! Wonder why...
285 if ( y == 0.0 ) y += 0.1;
286
287 Vector startPoint = new Vector( bottomLeft.X, y );
288 Vector endPoint = new Vector( bottomRight.X, y );
289 Graphics.LineBatch.Draw( startPoint, endPoint, Grid.Color );
290 }
291
293 }
294
295 private void DrawInOrderFromFirstToLast( ref Matrix worldMatrix )
296 {
298
299 foreach ( var o in Objects )
300 {
301 if (o is CustomDrawable)
302 {
303 if (o.IsVisible) ((CustomDrawable)o).Draw(worldMatrix);
304 }
305 else
306 {
307 Renderer.LightingEnabled = !o.IgnoresLighting;
308 Draw(o, ref worldMatrix);
309 }
310 }
311
312 DrawChildObjects( worldMatrix );
313
315 }
316
318 {
319 if ( o1.Image == null || o2.Image == null ) return 0;
320
321 int hash1 = RuntimeHelpers.GetHashCode( o1.Image );
322 int hash2 = RuntimeHelpers.GetHashCode( o2.Image );
323
324 if ( hash1 == hash2 )
325 {
326 // Because the sorting algorithm of the List class is not stable,
327 // objects with similar images on top of each other flicker rather
328 // annoyingly. Therefore, compare object references in order to keep
329 // the sorting stable.
330 return RuntimeHelpers.GetHashCode( o1 ) - RuntimeHelpers.GetHashCode( o2 );
331 }
332 return hash1 - hash2;
333 }
334
335 private void DrawEfficientlyInNoParticularOrder( ref Matrix worldMatrix )
336 {
338 DrawObjectsWithoutImages( worldMatrix );
339 DrawObjectsWithImages( worldMatrix );
340 DrawCustomDrawables( worldMatrix );
341 DrawChildObjects( worldMatrix );
343 }
344
345 private void DrawObjectsWithoutImages( Matrix worldMatrix )
346 {
347 Graphics.ShapeBatch.Begin( ref worldMatrix );
348 foreach ( var o in objectsWithoutImage )
349 {
350 if ( !o.IsVisible || !Game.Instance.IsObjectOnScreen(o) )
351 continue;
352
353 bool hasChildObjects = o.ObjectCount > 0;
354 bool isSimple = !hasChildObjects && !o.TextureFillsShape;
355
356 Renderer.LightingEnabled = !o.IgnoresLighting;
357
358 if ( isSimple && ( o.Image == null ) && ( o.Shape == Shape.Rectangle || o.Shape == Shape.Triangle ) )
359 {
360 DrawShape( o, ref worldMatrix );
361 }
362 else
363 {
364 Draw( o, ref worldMatrix );
365 }
366 }
368 }
369
370 private void DrawObjectsWithImages( Matrix worldMatrix )
371 {
372 // By sorting the images first, we get objects with same
373 // images in succession. This allows us to use the ImageBatch
374 // class more efficiently.
376
377 // Passing null for image here does not hurt, because the first
378 // ReferenceEquals-comparison calls End() without drawing a single
379 // image.
380 Graphics.ImageBatch.Begin( ref worldMatrix, null );
381
382 Image previousImage = null;
383
384 foreach ( var o in objectsWithImage )
385 {
386 if ( !o.IsVisible || !Game.Instance.IsObjectOnScreen(o) )
387 continue;
388
389 bool hasChildObjects = o.ObjectCount > 0;
390 bool isSimple = !hasChildObjects && !o.TextureFillsShape;
391
392 Renderer.LightingEnabled = !o.IgnoresLighting;
393
394 if ( isSimple && ( o.Image != null ) )
395 {
396 if ( !Object.ReferenceEquals( o.Image, previousImage ) )
397 {
398 // Object o has different image than the previous one,
399 // so let's start a new batch with the new image. The objects
400 // should be sorted at this point.
402 Graphics.ImageBatch.Begin( ref worldMatrix, o.Image.XNATexture );
403 previousImage = o.Image;
404 }
405 DrawTexture( o, ref worldMatrix );
406 }
407 else
408 {
409 Draw( o, ref worldMatrix );
410 }
411 }
412
414 }
415
416 private void DrawCustomDrawables( Matrix worldMatrix )
417 {
419 {
420 if ( o.IsVisible )
421 o.Draw( worldMatrix );
422 }
423 }
424
425 private void DrawChildObjects( Matrix worldMatrix )
426 {
427 Vector drawScale = new Vector( 1, 1 );
428
429 for ( int i = 0; i < Objects.Count; i++ )
430 {
431 var go = Objects[i] as GameObject;
432 if ( go == null || go._childObjects == null || go is Window )
433 continue;
434
435 if ( go.Shape.IsUnitSize )
436 drawScale = go.Size;
437
438 // recursively draw children, their children and so on.
439 drawChildren(go._childObjects);
440
441 void drawChildren(SynchronousList<GameObject> children){
442 for (int j = 0; j < children.Count; j++)
443 {
444 GameObject go = children[j];
445 Draw(go, ref worldMatrix);
446 if (go._childObjects != null) drawChildren(go._childObjects);
447
448 }
449 }
450 }
451 }
452
453 private void DrawTexture( IGameObject o, ref Matrix parentTransformation )
454 {
455 Vector2 position = new Vector2( (float)o.Position.X, (float)o.Position.Y );
456 Vector2 scale = new Vector2( (float)o.Size.X, (float)o.Size.Y );
457 float rotation = o.RotateImage ? (float)o.Angle.Radians : 0;
458
459 if ( o.IsVisible )
460 {
462 {
463 Graphics.ImageBatch.Draw( defaultCoords, position, scale, rotation );
464 }
465 else
466 {
467 float wx = (float)( Math.Sign( o.TextureWrapSize.X ) );
468 float wy = (float)( Math.Sign( o.TextureWrapSize.Y ) );
469 float left = (float)( -wx / 2 + 0.5 );
470 float right = (float)( wx / 2 + 0.5 );
471 float top = (float)( -wy / 2 + 0.5 );
472 float bottom = (float)( wy / 2 + 0.5 );
473
474 TextureCoordinates customCoords = new TextureCoordinates()
475 {
476 TopLeft = new Vector2( left, top ),
477 TopRight = new Vector2( right, top ),
478 BottomLeft = new Vector2( left, bottom ),
479 BottomRight = new Vector2( right, bottom ),
480 };
481
482 if ( o.TextureWrapSize.X == wx && o.TextureWrapSize.Y == wy )
483 {
484 // Draw only once
485 Graphics.ImageBatch.Draw( customCoords, position, scale, rotation );
486 return;
487 }
488
489 float topLeftX = -(float)( o.TextureWrapSize.X - 1 ) / 2;
490 float topLeftY = -(float)( o.TextureWrapSize.Y - 1 ) / 2;
491
492 Vector2 newScale = new Vector2(
493 scale.X / ( wx * (float)o.TextureWrapSize.X ),
494 scale.Y / ( wy * (float)o.TextureWrapSize.Y ) );
495
496 for ( int y = 0; y < o.TextureWrapSize.Y; y++ )
497 {
498 for ( int x = 0; x < o.TextureWrapSize.X; x++ )
499 {
500 Vector2 newPosition = position + new Vector2( ( topLeftX + x ) * newScale.X, ( topLeftY + y ) * newScale.Y );
501 Graphics.ImageBatch.Draw( customCoords, newPosition, newScale, rotation );
502 }
503 }
504 }
505 }
506 }
507
508 private void DrawShape( IGameObject o, ref Matrix parentTransformation )
509 {
510 Vector2 position = new Vector2( (float)o.Position.X, (float)o.Position.Y );
511 Vector2 scale = new Vector2( (float)o.Size.X, (float)o.Size.Y );
512 float rotation = (float)o.Angle.Radians;
513
514 if ( o.IsVisible )
515 {
516 Vector[] vertices;
517 Int16[] indices;
518
519 if ( o.Shape == Shape.Rectangle )
520 {
521 vertices = squareVertices;
522 indices = squareIndices;
523 }
524 else if ( o.Shape == Shape.Triangle )
525 {
526 vertices = triangleVertices;
527 indices = triangleIndices;
528 }
529 else
530 {
531 vertices = new Vector[] { };
532 indices = new Int16[] { };
533 }
534
535 Graphics.ShapeBatch.Draw( vertices, indices, o.Color, position, scale, rotation );
536 }
537 }
538
539 private void Draw( IGameObject o, ref Matrix parentTransformation )
540 {
541 Vector drawScale = new Vector( 1, 1 );
542 if ( o.Shape.IsUnitSize )
543 drawScale = o.Size;
544
545 Vector2 position = new Vector2( (float)o.Position.X, (float)o.Position.Y );
546 Vector2 scale = new Vector2( (float)drawScale.X, (float)drawScale.Y );
547 float rotation = o.RotateImage ? (float)o.Angle.Radians : 0;
548
549 if ( o.IsVisible )
550 {
551 Matrix transformation =
552 Matrix.CreateScale( scale.X, scale.Y, 1f )
553 * Matrix.CreateRotationZ( rotation )
554 * Matrix.CreateTranslation( position.X, position.Y, 0f )
555 * parentTransformation;
556
557 if ( o is CustomDrawable )
558 {
559 ( (CustomDrawable)o ).Draw( parentTransformation );
560 }
561 else if ( o.Image != null && ( !o.TextureFillsShape ) )
562 {
563 Renderer.DrawImage( o.Image, ref transformation, o.TextureWrapSize );
564 }
565 else if ( o.Image != null )
566 {
567 Renderer.DrawShape( o.Shape, ref transformation, ref transformation, o.Image, o.TextureWrapSize, o.Color );
568 }
569 else
570 {
571 Renderer.DrawShape( o.Shape, ref transformation, o.Color );
572 }
573 }
574 }
575
576 internal void GetObjectsAboutToBeAdded( List<IGameObject> result )
577 {
578 result.AddRange( Objects.GetObjectsAboutToBeAdded() );
579 }
580 }
581}
System.Numerics.Vector2 Vector2
Kamera. Määrittää mikä osa pelitasosta on kerralla näkyvissä.
Definition: Camera.cs:40
Vector Position
Kameran sijainti.
Definition: Camera.cs:53
double ZoomFactor
Kameran zoomauskerroin. Oletuksena 1.0. Mitä suurempi zoomauskerroin, sitä lähempänä kamera on (esim ...
Definition: Camera.cs:99
Järjestelmä partikkelien käsittelyyn
bool IsObjectOnScreen(IGameObject g)
Kertoo onko objekti ruudulla näkyvällä alueella.
Definition: Layers.cs:278
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
SynchronousList< GameObject > _childObjects
Definition: ChildObjects.cs:39
Contains graphics resources.
Definition: Graphics.cs:36
static LineBatch LineBatch
Definition: Graphics.cs:49
static ShapeBatch ShapeBatch
Definition: Graphics.cs:48
static ImageBatch ImageBatch
Definition: Graphics.cs:47
Avustava luokka ruutukarttojen käsittelyyn. Lisää tämä olio Layerille, jos haluat viivat näkyviin.
Definition: Grid.cs:10
Vector CellSize
Ruudun koko, oletuksena 10,10
Definition: Grid.cs:19
Color Color
Ruudukon väri, oletuksena Color.Green
Definition: Grid.cs:14
void Begin(ref Matrix matrix, Texture2D texture)
Definition: ImageBatch.cs:74
void Draw(TextureCoordinates c, Vector2 position, Vector2 size, float angle)
Definition: ImageBatch.cs:119
Kuva.
Definition: Image.cs:30
Kerros. Vastaa olioiden piirtämisestä.
Definition: Layer.cs:32
static readonly Int16[] squareIndices
Indices for the vertex array of the square.
Definition: Layer.cs:47
void DrawTexture(IGameObject o, ref Matrix parentTransformation)
Definition: Layer.cs:453
void ObjectRemoved(IGameObject obj)
Definition: Layer.cs:169
void Remove(IGameObject o)
Definition: Layer.cs:190
Vector _relativeTransition
Definition: Layer.cs:90
void DrawShape(IGameObject o, ref Matrix parentTransformation)
Definition: Layer.cs:508
void Draw(Camera camera)
Definition: Layer.cs:226
void DrawInOrderFromFirstToLast(ref Matrix worldMatrix)
Definition: Layer.cs:295
static readonly Int16[] triangleIndices
Indices for the vertex array of the triangle.
Definition: Layer.cs:66
SynchronousList< ParticleSystem > Effects
Kerroksen efektit
Definition: Layer.cs:84
void DrawChildObjects(Matrix worldMatrix)
Definition: Layer.cs:425
void DrawCustomDrawables(Matrix worldMatrix)
Definition: Layer.cs:416
bool IgnoresZoom
Jättää kameran zoomin huomiotta jos asetettu.
Definition: Layer.cs:119
static readonly Vector[] squareVertices
Vertices for drawing a filled square.
Definition: Layer.cs:36
List< IGameObject > objectsWithDrawMethod
Definition: Layer.cs:88
void Add(IGameObject o)
Definition: Layer.cs:185
Vector RelativeTransition
Kuinka paljon tämän kerroksen olioiden paikka muuttuu kameran siirtyessä suhteessa muihin kerroksiin....
Definition: Layer.cs:111
static readonly TextureCoordinates defaultCoords
Definition: Layer.cs:68
List< IGameObject > objectsWithImage
Definition: Layer.cs:86
void DrawGrid(ref Matrix matrix)
Definition: Layer.cs:253
List< IGameObject > objectsWithoutImage
Definition: Layer.cs:87
void ObjectAdded(IGameObject obj)
Definition: Layer.cs:146
void ApplyChanges()
Instantly applies changes made to the layer's objects.
Definition: Layer.cs:210
void Update(Time time)
Ajaa päivityksen kerroksen olioille ja efekteille
Definition: Layer.cs:220
void Clear()
Tyhjentää kerroksen olioista
Definition: Layer.cs:198
void DrawObjectsWithImages(Matrix worldMatrix)
Definition: Layer.cs:370
static Layer CreateStaticLayer()
Luo staattisen kerroksen (ei liiku kameran mukana)
Definition: Layer.cs:141
void DrawObjectsWithoutImages(Matrix worldMatrix)
Definition: Layer.cs:345
SynchronousList< IGameObject > Objects
Kerroksen oliot
Definition: Layer.cs:79
void Draw(IGameObject o, ref Matrix parentTransformation)
Definition: Layer.cs:539
int CompareByImageReference(IGameObject o1, IGameObject o2)
Definition: Layer.cs:317
static readonly Vector[] triangleVertices
Vertices for drawing a filled triangle.
Definition: Layer.cs:56
Layer()
Muodostaa uuden kerroksen
Definition: Layer.cs:130
bool IsUpdated
Ajetaanko kerrokselle päivitystä (Aina kyllä)
Definition: Layer.cs:97
void DrawEfficientlyInNoParticularOrder(ref Matrix worldMatrix)
Definition: Layer.cs:335
void GetObjectsAboutToBeAdded(List< IGameObject > result)
Definition: Layer.cs:576
void Draw(Vector startPoint, Vector endPoint, Color color)
Definition: LineBatch.cs:48
void Begin(ref Matrix matrix)
Definition: LineBatch.cs:17
Luokka, joka sisältää metodeita kuvioiden ja tekstuurien piirtämiseen 2D-tasossa.
Definition: Renderer.cs:50
static void DrawShape(Shape shape, ref Matrix transformation, ref Matrix textureTransformation, Image texture, Vector textureWrapSize, Color color)
Piirtää kuvion niin, että tekstuuri täyttää sen.
Definition: Renderer.cs:336
static void DrawImage(Image texture, ref Matrix matrix, Vector wrapSize)
Piirtää kuvan
Definition: Renderer.cs:133
static bool LightingEnabled
Onko valaistus käytössä
Definition: Renderer.cs:74
void Begin(ref Matrix matrix)
Definition: ShapeBatch.cs:65
void Draw(Vector[] vertices, Int16[] indices, Color color, Vector2 position, Vector2 size, float angle)
Definition: ShapeBatch.cs:104
Kuvio.
Definition: Shapes.cs:47
static readonly Rectangle Rectangle
Suorakulmio.
Definition: Shapes.cs:73
abstract bool IsUnitSize
If true, the shape must be scaled by the size of the object that has the shape. Typically,...
Definition: Shapes.cs:53
static readonly Triangle Triangle
Tasasivuinen kolmio.
Definition: Shapes.cs:78
Synkroninen lista, eli lista joka päivittyy vasta kun sen Update-metodia kutsutaan....
int Count
Kuinka monta elementtiä listassa nyt on. Ei laske mukaan samalla päivityskierroksella tehtyjä muutoks...
Ikkuna.
Definition: Window.cs:37
Rajapinta olioille, joilla on oma Draw-metodi.
new Vector Size
Koko.
Definition: Dimensional.cs:72
Yhteinen rajapinta kaikille peliolioille.
Definition: IGameObject.cs:11
Vector TextureWrapSize
Definition: IGameObject.cs:44
Jypelin sisäiset metodit ja propertyt joihin käyttäjän ei tarvitse päästä käsiksi kuuluvat tÃ...
Definition: IGameObject.cs:79
new Vector Position
Paikka.
Definition: Positional.cs:32
Rajapinta päivittyville olioille.
Definition: Updatable.cs:7
DrawOrder
Piirtojärjestys.
Definition: Layer.cs:14
@ FirstToLast
Oliot piirretään siinä järjestyksessä missä ne on lisätty peliin.
@ Irrelevant
Ei väliä.
Microsoft.Xna.Framework.Matrix Matrix
Definition: Mouse.cs:36
double Radians
Palauttaa tai asettaa kulman radiaaneina.
Definition: Angle.cs:85
Sisältää tiedon ajasta, joka on kulunut pelin alusta ja viime päivityksestä.
Definition: Time.cs:14
2D-vektori.
Definition: Vector.cs:67
double Y
Vektorin Y-komponentti
Definition: Vector.cs:339
static readonly Vector Zero
Nollavektori.
Definition: Vector.cs:71
double X
Vektorin X-komponentti.
Definition: Vector.cs:334
static readonly Vector Diagonal
Diagonaalivektori (1,1)
Definition: Vector.cs:91