コード例 #1
0
 public static BVector operator -(BVector a)
 {
     BVector ret = new BVector();
     ret.x = - a.x;
     ret.y = - a.y;
     return ret;
 }
コード例 #2
0
 public static BVector operator *(BVector a, float b)
 {
     BVector ret = new BVector();
     ret.x = a.x * b;
     ret.y = a.y * b;
     return ret;
 }
コード例 #3
0
 public static BVector operator +(BVector a, BVector b)
 {
     BVector ret = new BVector();
     ret.x = a.x + b.x;
     ret.y = a.y + b.y;
     return ret;
 }
コード例 #4
0
        static void Main(string[] args)
        {
            BVector v1, v2, v3;

            v1 = new BVector(5, 8);
            v2 = new BVector(2, 5);

            v3 = v1 + v2;
            Console.WriteLine("v1: " + v1);
            Console.WriteLine("v2: " + v2);
            Console.WriteLine("v3: " + v3);

            v1 += v2;

            v1 = v2 - v3;

            float f = 10.0f;
            v1.X = 5;
            v1.Y = 5;
            v2 = v1 * f;
            Console.WriteLine(v2);
            Console.ReadLine();
        }
コード例 #5
0
 public static BVector operator -(BVector a, BVector b)
 {
     BVector ret = new BVector();
     ret = a + (-b);
     return ret;
 }