Simulant  21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
smlt::Vec2 Struct Reference

Public Member Functions

 Vec2 (float x, float y)
 
Vec2 rotated_by (const Degrees &degrees) const
 
float length () const
 
float length_squared () const
 
void normalize ()
 
Vec2 normalized () const
 
void limit (float l)
 
Vec2 operator* (float rhs) const
 
Vec2operator*= (float rhs)
 
Vec2operator+= (const Vec2 &rhs)
 
Vec2operator-= (const Vec2 &rhs)
 
Vec2 operator+ (const Vec2 &rhs) const
 
Vec2operator/= (float rhs)
 
Vec2 operator/ (float rhs) const
 
Vec2 operator- () const
 
Vec2 operator- (const Vec2 &rhs) const
 
float dot (const Vec2 &rhs) const
 
Vec3 xyz (float z=0.0f) const
 
Vec4 xyzw (float z=0.0f, float w=1.0f) const
 
bool equals (const Vec2 &rhs) const
 

Public Attributes

float x
 
float y
 

Static Public Attributes

static const Vec2 NEGATIVE_X = Vec2(-1, 0)
 
static const Vec2 POSITIVE_X = Vec2(1, 0)
 
static const Vec2 NEGATIVE_Y = Vec2(0, -1)
 
static const Vec2 POSITIVE_Y = Vec2(0, 1)
 
static const Vec2 DOWN = Vec2::NEGATIVE_Y
 
static const Vec2 LEFT = Vec2::NEGATIVE_X
 
static const Vec2 ONE = Vec2(1, 1)
 
static const Vec2 RIGHT = Vec2::POSITIVE_X
 
static const Vec2 UP = Vec2::POSITIVE_Y
 
static const Vec2 ZERO = Vec2()
 

Friends

std::ostream & operator<< (std::ostream &stream, const Vec2 &vec)
 
bool operator== (const Vec2 &lhs, const Vec2 &rhs)
 

The documentation for this struct was generated from the following files: