Jypeli  5
The simple game programming library
Grid.cs
Siirry tämän tiedoston dokumentaatioon.
1 using System;
2 using Jypeli;
3 
4 namespace Jypeli
5 {
6  public class Grid
7  {
8  public Color Color { get; set; }
9  public Vector CellSize { get; set; }
10 
11  public Grid()
12  {
13  Color = Color.Green;
14  CellSize = new Vector( 10, 10 );
15  }
16 
18  {
19  Vector result;
20  result.X = Math.Round( v.X / this.CellSize.X ) * this.CellSize.X;
21  result.Y = Math.Round( v.Y / this.CellSize.Y ) * this.CellSize.Y;
22  return result;
23  }
24  }
25 }
static readonly Color Green
Vihreä.
Definition: Color.cs:644
double Y
Definition: Vector.cs:275
double X
Definition: Vector.cs:274
Väri.
Definition: Color.cs:13
2D-vektori.
Definition: Vector.cs:56
Vector CellSize
Definition: Grid.cs:9
Vector SnapToLines(Vector v)
Definition: Grid.cs:17
Grid()
Definition: Grid.cs:11