Arcade Shooter
Point.h
1 
2 /* ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
3  ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
4  █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
5  ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
6  ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
7  ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
8  /vvvvvvvvvvvvvvvvvvv \=========================================,
9  `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
10  Katana Engine \/ © 2012 - Shuriken Studios LLC */
11 
12 #pragma once
13 
14 namespace KatanaEngine
15 {
16  class Vector2;
17 
19  class Point
20  {
21 
22  public:
23 
27  Point(const int x = 0, const int y = 0);
28  ~Point() { };
29 
30 
31  static const Point Origin;
37  void Set(const int x, const int y);
38 
43  void Set(const Point point);
44 
47  bool IsOrigin() const { return (X == 0 && Y == 0); }
48 
51  const Vector2 ToVector2() const;
52 
55  std::string ToString() const;
56 
58  void Display() const { std::cout << ToString() << std::endl; }
59 
60 
64  Point &operator= (const Point &point);
65 
69  Point &operator+=(const Point &point);
70 
74  Point &operator-=(const Point &point);
75 
79  const Point operator+(const Point &point) const;
80 
84  const Point operator-(const Point &point) const;
85 
89  bool operator==(const Point &point) const;
90 
94  bool operator!=(const Point &point) const;
95 
96 
97  int X;
98  int Y;
100  };
101 }
const Point operator-(const Point &point) const
Subtracts a point from another.
Definition: Point.cpp:76
bool operator==(const Point &point) const
Determines if two points are equal.
Definition: Point.cpp:81
bool operator!=(const Point &point) const
Determines if two points are not equal.
Definition: Point.cpp:86
std::string ToString() const
Gets a string representation of the point.
Definition: Point.cpp:37
Point & operator-=(const Point &point)
Subtracts a point.
Definition: Point.cpp:63
int X
The x-coordinate of the point.
Definition: Point.h:97
Point & operator+=(const Point &point)
Adds a point.
Definition: Point.cpp:55
int Y
The y-coordinate of the point.
Definition: Point.h:98
Point & operator=(const Point &point)
Assigns the reference of a point.
Definition: Point.cpp:44
Defines a vector with 2 components (x and y). This is additional information...
Definition: Vector2.h:18
void Display() const
Prints the point to the console.
Definition: Point.h:58
void Set(const int x, const int y)
Sets the components of the point.
Definition: Point.cpp:25
static const Point Origin
A point located at the origin.
Definition: Point.h:28
bool IsOrigin() const
Determines if the point is located at the origin.
Definition: Point.h:47
const Vector2 ToVector2() const
Converts the point into a vector.
Definition: Point.cpp:91
Defines a point in 2D space.
Definition: Point.h:19
Point(const int x=0, const int y=0)
Instantiates a new point object.
Definition: Point.cpp:19
const Point operator+(const Point &point) const
Adds two points.
Definition: Point.cpp:71
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition: Animation.cpp:14