示例#1
0
 public void MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button.HasFlag(System.Windows.Forms.MouseButtons.Left)) leftButton = true;
     if (e.Button.HasFlag(System.Windows.Forms.MouseButtons.Right)) rightButton = true;
     mousePos = new int2(e.X, e.Y);
     dragStart = new int2(e.X, e.Y);
     UpdateMouseControls();
 }
示例#2
0
 public void MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     mousePos = new int2(e.X, e.Y);
     UpdateMouseControls();
     dragStart = new int2(e.X, e.Y);
 }
示例#3
0
 public double2(int2 i)
 {
     x = (double)i.x;
     y = (double)i.y;
 }
示例#4
0
 public void SetUndefined()
 {
     m_min = new int2(int.MaxValue, int.MaxValue);
     m_max = new int2(int.MinValue, int.MinValue);
 }
示例#5
0
 public float2(int2 i)
 {
     x = (float)i.x;
     y = (float)i.y;
 }
示例#6
0
 public void Intersection(BoxI2 box)
 {
     if (!Intersects(box))
     {
         SetUndefined();
         return;
     }
     m_min = m_min.Max(box.m_min);
     m_max = m_max.Min(box.m_max);
 }
示例#7
0
 public void MergePoint(int2 point1)
 {
     m_min = m_min.Min(point1);
     m_max = m_max.Max(point1);
 }
示例#8
0
 public BoxI2(Box2 b)
 {
     m_min = new int2(b.Min);
     m_max = new int2(b.Max);
 }
示例#9
0
 public bool Contains(int2 point)
 {
     if (!IsDefined()) return false;
     if (m_min.x > point.x) return false;
     if (m_min.y > point.y) return false;
     if (m_max.x < point.x) return false;
     if (m_max.y < point.y) return false;
     return true;
 }
示例#10
0
 public int2 Min(int2 v)
 {
     int2 ret = new int2();
     ret.x = x < v.x ? x : v.x;
     ret.y = y < v.y ? y : v.y;
     return ret;
 }
示例#11
0
 public BoxI2(int2 min, int2 max)
 {
     m_min = min.Min(max);
     m_max = min.Max(max);
 }
示例#12
0
 public int2 Max(int2 v)
 {
     int2 ret = new int2();
     ret.x = x > v.x ? x : v.x;
     ret.y = y > v.y ? y : v.y;
     return ret;
 }
示例#13
0
 // math functions
 public int Dot(int2 v)
 {
     return (x * v.x) + (y * v.y);
 }
示例#14
0
 public int Distance(int2 v)
 {
     int2 delta = v - this;
     int len = delta.Dot(delta);
     return (int)System.Math.Sqrt((double)len);
 }
示例#15
0
 public static int2 Lerp(int2 a, int2 b, int alpha)
 {
     throw new Exception("Not yet implemented");
 }
示例#16
0
 public int2(int2 f)
 {
     x = f.x;
     y = f.y;
 }