KTech 1.1.0
C++ 2D terminal game engine library
Loading...
Searching...
No Matches
KTech::UPoint Struct Reference

Unsigned 2D vector, mostly used to store sizes and 2D indexes. More...

#include <upoint.hpp>

Public Member Functions

constexpr UPoint (uint32_t x=0, uint32_t y=0)
 Construct a UPoint.
 
constexpr auto operator== (const UPoint &uPoint) const -> bool
 Compare 2 UPoints.
 
constexpr auto operator+ (const UPoint &uPoint) const -> UPoint
 Add 2 UPoints together.
 
constexpr auto operator- (const UPoint &uPoint) const -> UPoint
 Subtract UPoint from another.
 
constexpr auto operator+= (const UPoint &uPoint) -> UPoint &
 Add a UPoint to this UPoint.
 
constexpr auto operator-= (const UPoint &uPoint) -> UPoint &
 Subtract a UPoint from this UPoint.
 

Public Attributes

uint32_t x
 X axis.
 
uint32_t y
 Y axis.
 

Detailed Description

Unsigned 2D vector, mostly used to store sizes and 2D indexes.

Constructor & Destructor Documentation

◆ UPoint()

KTech::UPoint::UPoint ( uint32_t x = 0,
uint32_t y = 0 )
inlineconstexpr

Construct a UPoint.

Parameters
[in]xX axis.
[in]yY axis.

Member Function Documentation

◆ operator+()

auto KTech::UPoint::operator+ ( const UPoint & uPoint) const -> UPoint
inlineconstexpr

Add 2 UPoints together.

Parameters
[in]uPointThe UPoint to add with this UPoint.
Returns
New UPoint with the sum of the 2 UPoints.

◆ operator+=()

auto KTech::UPoint::operator+= ( const UPoint & uPoint) -> UPoint&
inlineconstexpr

Add a UPoint to this UPoint.

Parameters
[in]uPointThe UPoint to add to this UPoint.
Returns
Self-reference (for function chaining).

◆ operator-()

auto KTech::UPoint::operator- ( const UPoint & uPoint) const -> UPoint
inlineconstexpr

Subtract UPoint from another.

Parameters
[in]uPointThe UPoint to subtract from this UPoint.
Returns
New UPoint with the difference between the 2 UPoints.

◆ operator-=()

auto KTech::UPoint::operator-= ( const UPoint & uPoint) -> UPoint&
inlineconstexpr

Subtract a UPoint from this UPoint.

Parameters
[in]uPointThe UPoint to subtract from this UPoint.
Returns
Self-reference (for function chaining).

◆ operator==()

auto KTech::UPoint::operator== ( const UPoint & uPoint) const -> bool
inlineconstexpr

Compare 2 UPoints.

Parameters
[in]uPointThe UPoint to compare with this UPoint.
Returns
true: the X and Y axes are equal. false: they are unequal.

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