Building Game Engines
Vec2 Class Reference

2d vector object to represent position and velocity. More...

#include <Vec2.hpp>

Collaboration diagram for Vec2:
Collaboration graph

Public Member Functions

 Vec2 ()
 default initializer More...
 
 Vec2 (float x, float y)
 specified initializer More...
 
Vec2 operator+ (Vec2 const &rhs)
 specify 2-d vector addition More...
 
Vec2operator+= (Vec2 const &rhs)
 specify 2-d vector incrementation More...
 
Vec2 operator* (float rhs)
 specify 2-d vector scaling by multipling with a number More...
 

Public Attributes

float x
 
float y
 the x and y values More...
 

Detailed Description

2d vector object to represent position and velocity.

Constructor & Destructor Documentation

◆ Vec2() [1/2]

Vec2::Vec2 ( )
inline

default initializer

◆ Vec2() [2/2]

Vec2::Vec2 ( float  x,
float  y 
)
inline

specified initializer

Member Function Documentation

◆ operator*()

Vec2 Vec2::operator* ( float  rhs)
inline

specify 2-d vector scaling by multipling with a number

◆ operator+()

Vec2 Vec2::operator+ ( Vec2 const &  rhs)
inline

specify 2-d vector addition

◆ operator+=()

Vec2& Vec2::operator+= ( Vec2 const &  rhs)
inline

specify 2-d vector incrementation

Member Data Documentation

◆ x

float Vec2::x

◆ y

float Vec2::y

the x and y values