Logo
Vector2.h
1#pragma once
2
3namespace SharpKmyMath
4{
5 public value struct Vector2 {
6
7 public:
8 float x, y;
9
10 Vector2(float v)
11 {
12 x = y = v;
13 }
14
15 Vector2(float _x, float _y)
16 {
17 x = _x;
18 y = _y;
19 }
20
22 {
23 Vector2 ret;
24 ret.x = v.x + v2.x;
25 ret.y = v.y + v2.y;
26 return ret;
27 }
28
30 {
31 Vector2 ret;
32 ret.x = v.x - v2.x;
33 ret.y = v.y - v2.y;
34 return ret;
35 }
36
37 static Vector2 operator / (Vector2 v, float f)
38 {
39 Vector2 ret;
40 ret.x = v.x / f;
41 ret.y = v.y / f;
42 return ret;
43 }
44
45 static Vector2 operator * (Vector2 v, float f)
46 {
47 Vector2 ret;
48 ret.x = v.x * f;
49 ret.y = v.y * f;
50 return ret;
51 }
52
54 {
55 Vector2 ret;
56 ret.x = -v.x;
57 ret.y = -v.y;
58 return ret;
59 }
60 };
61
62}
Definition: RefCapture.h:3
Definition: Vector2.h:5
float y
Definition: Vector2.h:8
static Vector2 operator-(Vector2 v, Vector2 v2)
Definition: Vector2.h:29
Vector2(float v)
Definition: Vector2.h:10
Vector2(float _x, float _y)
Definition: Vector2.h:15
float x
Definition: Vector2.h:8
static Vector2 operator+(Vector2 v, Vector2 v2)
Definition: Vector2.h:21
static Vector2 operator/(Vector2 v, float f)
Definition: Vector2.h:37
static Vector2 operator*(Vector2 v, float f)
Definition: Vector2.h:45