bootleg-game-engine/include/vector.h

49 lines
897 B
C
Raw Normal View History

2024-09-06 09:34:29 +00:00
#pragma once
class float_vec2
{
public:
float x, y;
float_vec2 operator+(float_vec2 vec)
{
return { x + vec.x, y + vec.y };
}
float_vec2 operator*(float v)
{
return { x * v, y * v };
}
float_vec2 operator*(float_vec2 vec)
{
return { x * vec.x, y * vec.y };
}
float_vec2 operator-(float_vec2 vec)
{
return { x - vec.x, y - vec.y };
}
float_vec2 operator-(float v)
{
return { x - v, y - v };
}
};
class int_vec2
{
public:
int x, y;
int_vec2 operator+(int_vec2 vec)
{
return { x + vec.x, y + vec.y };
}
int_vec2 operator*(int v)
{
return { x * v, y * v };
}
int_vec2 operator*(int_vec2 vec)
{
return { x * vec.x, y * vec.y };
}
int_vec2 operator-(int_vec2 vec)
{
return { x - vec.x, y - vec.y };
}
};