GPR5100 - Rollback
Loading...
Searching...
No Matches
core
include
maths
vec2.h
1
#pragma once
2
3
#include <SFML/System/Vector2.hpp>
4
#include <
maths/angle.h
>
5
6
namespace
core
7
{
11
struct
Vec2f
12
{
13
float
x = 0.0f, y = 0.0f;
14
15
constexpr
Vec2f
() =
default
;
16
constexpr
Vec2f
(
float
newX,
float
newY) : x(newX), y(newY)
17
{
18
19
}
20
Vec2f
(sf::Vector2f v);
21
22
23
[[nodiscard]]
float
GetMagnitude()
const
;
24
void
Normalize();
25
[[nodiscard]]
Vec2f
GetNormalized()
const
;
26
[[nodiscard]]
float
GetSqrMagnitude()
const
;
27
[[nodiscard]]
Vec2f
Rotate(
Degree
rotation)
const
;
28
static
float
Dot(
Vec2f
a,
Vec2f
b);
29
static
Vec2f
Lerp(
Vec2f
a,
Vec2f
b,
float
t);
30
31
[[nodiscard]]
operator
sf::Vector2f()
const
{
return
{ x, y }; }
32
33
Vec2f
operator+(
Vec2f
v)
const
;
34
Vec2f
& operator+=(
Vec2f
v);
35
Vec2f
operator-(
Vec2f
v)
const
;
36
Vec2f
& operator-=(
Vec2f
v);
37
Vec2f
operator*(
float
f)
const
;
38
Vec2f
operator/(
float
f)
const
;
39
40
static
constexpr
Vec2f
zero() {
return
{}; }
41
static
constexpr
Vec2f
one() {
return
{1,1}; }
42
static
constexpr
Vec2f
up() {
return
{0,1}; }
43
static
constexpr
Vec2f
down() {
return
{0,-1}; }
44
static
constexpr
Vec2f
left() {
return
{-1,0}; }
45
static
constexpr
Vec2f
right() {
return
{1,0}; }
46
};
47
48
Vec2f
operator*(
float
f,
Vec2f
v);
49
50
}
angle.h
core::Degree
Degree is an utility class that describes degree angles (0 to 360). It can be easily converted to Rad...
Definition:
angle.h:56
core::Vec2f
Vec2f is a utility class that represents a mathematical 2d vector.
Definition:
vec2.h:12
Generated by
1.9.5