nCine  2025.04.r498-9d36345
A cross-platform 2D game engine
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
ncine::Vector2< T > Class Template Reference

A two component vector based on templates. More...

#include <Vector2.h>

Collaboration diagram for ncine::Vector2< T >:
Collaboration graph
[legend]

Public Member Functions

 Vector2 (T s)
 
 Vector2 (T xx, T yy)
 
 Vector2 (const Vector2 &other)
 
Vector2operator= (const Vector2 &other)
 
void set (T xx, T yy)
 
T * data ()
 
const T * data () const
 
T & operator[] (unsigned int index)
 
const T & operator[] (unsigned int index) const
 
bool operator== (const Vector2 &v) const
 
Vector2 operator- () const
 
Vector2operator+= (const Vector2 &v)
 
Vector2operator-= (const Vector2 &v)
 
Vector2operator*= (const Vector2 &v)
 
Vector2operator/= (const Vector2 &v)
 
Vector2operator+= (T s)
 
Vector2operator-= (T s)
 
Vector2operator*= (T s)
 
Vector2operator/= (T s)
 
Vector2 operator+ (const Vector2 &v) const
 
Vector2 operator- (const Vector2 &v) const
 
Vector2 operator* (const Vector2 &v) const
 
Vector2 operator/ (const Vector2 &v) const
 
Vector2 operator+ (T s) const
 
Vector2 operator- (T s) const
 
Vector2 operator* (T s) const
 
Vector2 operator/ (T s) const
 
length () const
 
sqrLength () const
 
Vector2 normalized () const
 
Vector2normalize ()
 
template<class S >
Vector2< T > convertType (const Vector2< S > &other)
 

Static Public Member Functions

template<class S >
static Vector2 convertType (const Vector2< S > &other)
 

Public Attributes

x
 
y
 

Static Public Attributes

static const Vector2 Zero
 A vector with all zero elements.
 
static const Vector2 XAxis
 A unit vector on the X axis.
 
static const Vector2 YAxis
 A unit vector on the Y axis.
 

Friends

template<class S >
Vector2< S > operator* (S s, const Vector2< S > &v)
 
template<class S >
dot (const Vector2< S > &v1, const Vector2< S > &v2)
 

Detailed Description

template<class T>
class ncine::Vector2< T >

A two component vector based on templates.


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