d8b8403651
* Replace QPoint and QSize with Coord, a C++ class derived from COORD. * Replace QRect with SmallRect, a C++ class derived from SMALL_RECT. * Turn Win32Console into a non-QObject class.
57 lines
880 B
C
57 lines
880 B
C
#ifndef COORD_H
|
|
#define COORD_H
|
|
|
|
#include <windows.h>
|
|
|
|
struct Coord : COORD {
|
|
Coord()
|
|
{
|
|
X = 0;
|
|
Y = 0;
|
|
}
|
|
|
|
Coord(SHORT x, SHORT y)
|
|
{
|
|
X = x;
|
|
Y = y;
|
|
}
|
|
|
|
Coord(COORD other)
|
|
{
|
|
*(COORD*)this = other;
|
|
}
|
|
|
|
Coord(const Coord &other)
|
|
{
|
|
*(COORD*)this = *(const COORD*)&other;
|
|
}
|
|
|
|
Coord &operator=(const Coord &other)
|
|
{
|
|
*(COORD*)this = *(const COORD*)&other;
|
|
return *this;
|
|
}
|
|
|
|
bool operator==(const Coord &other) const
|
|
{
|
|
return X == other.X && Y == other.Y;
|
|
}
|
|
|
|
bool operator!=(const Coord &other) const
|
|
{
|
|
return !(*this == other);
|
|
}
|
|
|
|
Coord operator+(const Coord &other) const
|
|
{
|
|
return Coord(X + other.X, Y + other.Y);
|
|
}
|
|
|
|
bool isEmpty() const
|
|
{
|
|
return X <= 0 || Y <= 0;
|
|
}
|
|
};
|
|
|
|
#endif // COORD_H
|