LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Vector2< T > Class Template Reference

A 2D vector. More...

#include <vectors.h>

Public Member Functions

 Vector2 (T pX, T pY)
 
void Set (T pX, T pY)
 
void Set (Vector2< T > &v)
 
Json::Value Save ()
 
void Load (Json::Value val)
 
Vector2< T > operator+ (Vector2< T > val) const
 Operators.
 
Vector2< T > operator- (Vector2< T > val) const
 
Vector2< T > & operator+= (Vector2< T > val)
 
bool operator== (Vector2< T > val) const
 
Vector2< T > operator* (Vector2< T > val) const
 
Vector2< T > operator* (float val) const
 
Vector2< T > operator/ (Vector2< T > val) const
 
Vector2< T > operator/ (float val) const
 
 operator Vector2< int > () const
 Conversions.
 
 operator Vector2< float > () const
 
 operator Vector2< double > () const
 
 operator SDL_Point () const
 
 operator std::string () const
 

Public Attributes

x
 
y
 

Detailed Description

template<class T>
class Vector2< T >

A 2D vector.

A 2D vector

Constructor & Destructor Documentation

template<class T>
Vector2< T >::Vector2 ( pX,
pY 
)
inline

Setup the vector with an x & y value

Parameters
pXThe x value to set
pYThe y value to set

Member Function Documentation

template<class T>
void Vector2< T >::Load ( Json::Value  val)
inline

Load the vector from a Json::Value

Parameters
valThe Json::Value to load from
template<class T>
Json::Value Vector2< T >::Save ( )
inline

Save the vector to a Json::Value

Returns
The Json::Value containg the vector data
template<class T>
void Vector2< T >::Set ( pX,
pY 
)
inline

Setup the vector with an x & y value

Parameters
pXThe x value to set
pYThe y value to set
template<class T>
void Vector2< T >::Set ( Vector2< T > &  v)
inline

Set the vector with the same values as another vector

Parameters
vthe vector to get vals from

The documentation for this class was generated from the following file: