Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
screen_coordinate.h
Go to the documentation of this file.
1#ifndef SCREEN_COORDINATE_H
2#define SCREEN_COORDINATE_H
3
4#include <iosfwd>
5
12{
13public:
14 explicit screen_coordinate(const int x = 0, const int y = 0);
15
16 int get_x() const noexcept { return m_x; }
17 int get_y() const noexcept { return m_y; }
18
19private:
20
21 int m_x;
22 int m_y;
23};
24
32double calc_angle_degrees(const screen_coordinate& from, const screen_coordinate& to);
33
41double calc_angle_degrees(const screen_coordinate& delta);
42
44double calc_distance(const screen_coordinate& a, const screen_coordinate& b) noexcept;
45
46std::string to_str(const screen_coordinate& c) noexcept;
47
48std::ostream& operator<<(std::ostream& os, const screen_coordinate& coordinat);
49
50bool operator==(const screen_coordinate& lhs, const screen_coordinate& rhs) noexcept;
51bool operator!=(const screen_coordinate& lhs, const screen_coordinate& rhs) noexcept;
52
55screen_coordinate operator*(const screen_coordinate& lhs, const double& factor) noexcept;
56screen_coordinate operator/(const screen_coordinate& lhs, const double& factor);
57
59
62
63#endif // SCREEN_COORDINATE_H
The coordinate on a screen.
Definition screen_coordinate.h:12
int get_x() const noexcept
Definition screen_coordinate.h:16
int get_y() const noexcept
Definition screen_coordinate.h:17
screen_coordinate operator+(const screen_coordinate &lhs, const screen_coordinate &rhs) noexcept
Definition screen_coordinate.cpp:139
void test_screen_coordinate()
Run the tests for the screen coordinat.
Definition screen_coordinate.cpp:33
bool operator==(const screen_coordinate &lhs, const screen_coordinate &rhs) noexcept
Definition screen_coordinate.cpp:178
bool operator!=(const screen_coordinate &lhs, const screen_coordinate &rhs) noexcept
Definition screen_coordinate.cpp:185
double calc_angle_degrees(const screen_coordinate &from, const screen_coordinate &to)
Calculate the angle in degrees.
Definition screen_coordinate.cpp:13
screen_coordinate operator-(const screen_coordinate &lhs, const screen_coordinate &rhs) noexcept
Definition screen_coordinate.cpp:147
screen_coordinate operator*(const screen_coordinate &lhs, const double &factor) noexcept
Definition screen_coordinate.cpp:155
std::string to_str(const screen_coordinate &c) noexcept
Definition screen_coordinate.cpp:123
std::ostream & operator<<(std::ostream &os, const screen_coordinate &coordinat)
Definition screen_coordinate.cpp:133
screen_coordinate operator/(const screen_coordinate &lhs, const double &factor)
Definition screen_coordinate.cpp:163
double calc_distance(const screen_coordinate &a, const screen_coordinate &b) noexcept
Calculate the Euclidean distance.
Definition screen_coordinate.cpp:27
screen_coordinate & operator+=(screen_coordinate &lhs, const screen_coordinate &rhs) noexcept
Definition screen_coordinate.cpp:172