Arcade Shooter
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
KatanaEngine::Point Class Reference

Defines a point in 2D space. More...

#include <Point.h>

Public Member Functions

 Point (const int x=0, const int y=0)
 Instantiates a new point object. More...
 
void Set (const int x, const int y)
 Sets the components of the point. More...
 
void Set (const Point point)
 Sets the components of the vecpointtor. More...
 
bool IsOrigin () const
 Determines if the point is located at the origin. More...
 
const Vector2 ToVector2 () const
 Converts the point into a vector. More...
 
std::string ToString () const
 Gets a string representation of the point. More...
 
void Display () const
 Prints the point to the console.
 
Pointoperator= (const Point &point)
 Assigns the reference of a point. More...
 
Pointoperator+= (const Point &point)
 Adds a point. More...
 
Pointoperator-= (const Point &point)
 Subtracts a point. More...
 
const Point operator+ (const Point &point) const
 Adds two points. More...
 
const Point operator- (const Point &point) const
 Subtracts a point from another. More...
 
bool operator== (const Point &point) const
 Determines if two points are equal. More...
 
bool operator!= (const Point &point) const
 Determines if two points are not equal. More...
 

Public Attributes

int X
 The x-coordinate of the point.
 
int Y
 The y-coordinate of the point.
 

Static Public Attributes

static const Point Origin = Point(0, 0)
 A point located at the origin.
 

Detailed Description

Defines a point in 2D space.

Constructor & Destructor Documentation

◆ Point()

KatanaEngine::Point::Point ( const int  x = 0,
const int  y = 0 
)

Instantiates a new point object.

Parameters
xThe X component
yThe Y component

Member Function Documentation

◆ IsOrigin()

bool KatanaEngine::Point::IsOrigin ( ) const
inline

Determines if the point is located at the origin.

Returns
Returns true if both components are zero, false otherwise.

◆ operator!=()

bool KatanaEngine::Point::operator!= ( const Point point) const

Determines if two points are not equal.

Parameters
pointThe point to compare.
Returns
Returns true if the points are not equal, false otherwise.

◆ operator+()

const Point KatanaEngine::Point::operator+ ( const Point point) const

Adds two points.

Parameters
pointThe point to add.
Returns
Returns the resulting point.

◆ operator+=()

Point & KatanaEngine::Point::operator+= ( const Point point)

Adds a point.

Parameters
pointThe point to add.
Returns
Returns the resulting point.

◆ operator-()

const Point KatanaEngine::Point::operator- ( const Point point) const

Subtracts a point from another.

Parameters
pointThe point to subtract.
Returns
Returns the resulting point.

◆ operator-=()

Point & KatanaEngine::Point::operator-= ( const Point point)

Subtracts a point.

Parameters
pointThe point to subtract.
Returns
Returns the resulting point.

◆ operator=()

Point & KatanaEngine::Point::operator= ( const Point point)

Assigns the reference of a point.

Parameters
pointThe reference point.
Returns
Returns the resulting point.

◆ operator==()

bool KatanaEngine::Point::operator== ( const Point point) const

Determines if two points are equal.

Parameters
pointThe point to compare.
Returns
Returns true if the points are equal, false otherwise.

◆ Set() [1/2]

void KatanaEngine::Point::Set ( const int  x,
const int  y 
)

Sets the components of the point.

Parameters
xThe X component.
yThe Y component.

◆ Set() [2/2]

void KatanaEngine::Point::Set ( const Point  point)

Sets the components of the vecpointtor.

Parameters
pointThe point whose components to copy.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ ToString()

std::string KatanaEngine::Point::ToString ( ) const

Gets a string representation of the point.

Returns
Returns a string displaying the components of the point.

◆ ToVector2()

const Vector2 KatanaEngine::Point::ToVector2 ( ) const

Converts the point into a vector.

Returns
Returns a displacement vector to the point.

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