YourCityInvadedByAliens
Documentation for code of the game
ypos.h
Go to the documentation of this file.
1 #pragma once
2 
3 class YPos {
4  public:
5  YPos();
6  YPos(int x, int y);
7  int getX() const;
8  int getY() const;
9  void update(int x, int y);
10  void update(const YPos& coord);
11  void setX(int x);
12  void setY(int y);
13 
14  YPos& operator+=(const YPos& other);
15  YPos& operator-=(const YPos& other);
16  YPos operator+(const YPos& other) const;
17  YPos operator-(const YPos& other) const;
18  bool operator>(const YPos& other) const;
19  bool operator<(const YPos& other) const;
20 
21  bool isInsideRect(const YPos& topLeft, const YPos& bottomRight) const;
22  float getDistance(const YPos& pos) const;
23 
24  private:
25  int m_nX, m_nY;
26 };
YPos::operator<
bool operator<(const YPos &other) const
Definition: ypos.cpp:70
YPos::setX
void setX(int x)
Definition: ypos.cpp:34
YPos::getX
int getX() const
Definition: ypos.cpp:16
YPos::m_nY
int m_nY
Definition: ypos.h:25
YPos::isInsideRect
bool isInsideRect(const YPos &topLeft, const YPos &bottomRight) const
Definition: ypos.cpp:74
YPos::operator+=
YPos & operator+=(const YPos &other)
Definition: ypos.cpp:42
YPos::getDistance
float getDistance(const YPos &pos) const
Definition: ypos.cpp:83
YPos::m_nX
int m_nX
Definition: ypos.h:25
YPos::setY
void setY(int y)
Definition: ypos.cpp:38
YPos::operator>
bool operator>(const YPos &other) const
Definition: ypos.cpp:66
YPos::operator+
YPos operator+(const YPos &other) const
Definition: ypos.cpp:54
YPos::YPos
YPos()
Definition: ypos.cpp:6
YPos::update
void update(int x, int y)
Definition: ypos.cpp:24
YPos::getY
int getY() const
Definition: ypos.cpp:20
YPos
Definition: ypos.h:3
YPos::operator-
YPos operator-(const YPos &other) const
Definition: ypos.cpp:60
YPos::operator-=
YPos & operator-=(const YPos &other)
Definition: ypos.cpp:48