94 lines
1.2 KiB
C++
94 lines
1.2 KiB
C++
#ifndef _COMMON_COORD_HPP_
|
|
#define _COMMON_COORD_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
|
|
class Coord : private COORD
|
|
{
|
|
public:
|
|
Coord(void);
|
|
Coord(const Coord &someCoord);
|
|
Coord(short x,short y);
|
|
virtual ~Coord();
|
|
Coord &operator=(const Coord &someCoord);
|
|
WORD operator==(const Coord &someCoord)const;
|
|
operator COORD&(void);
|
|
short x(void)const;
|
|
void x(short x);
|
|
short y(void)const;
|
|
void y(short y);
|
|
private:
|
|
};
|
|
|
|
inline
|
|
Coord::Coord(void)
|
|
{
|
|
COORD::X=0;
|
|
COORD::Y=0;
|
|
}
|
|
|
|
inline
|
|
Coord::Coord(const Coord &someCoord)
|
|
{
|
|
*this=someCoord;
|
|
}
|
|
|
|
inline
|
|
Coord::Coord(short x,short y)
|
|
{
|
|
COORD::X=x;
|
|
COORD::Y=y;
|
|
}
|
|
|
|
inline
|
|
Coord::~Coord()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Coord &Coord::operator=(const Coord &someCoord)
|
|
{
|
|
x(someCoord.x());
|
|
y(someCoord.y());
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
WORD Coord::operator==(const Coord &someCoord)const
|
|
{
|
|
return (x()==someCoord.x()&&
|
|
y()==someCoord.y());
|
|
}
|
|
|
|
inline
|
|
Coord::operator COORD&(void)
|
|
{
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
short Coord::x(void)const
|
|
{
|
|
return COORD::X;
|
|
}
|
|
|
|
inline
|
|
void Coord::x(short x)
|
|
{
|
|
COORD::X=x;
|
|
}
|
|
|
|
inline
|
|
short Coord::y(void)const
|
|
{
|
|
return COORD::Y;
|
|
}
|
|
|
|
inline
|
|
void Coord::y(short y)
|
|
{
|
|
COORD::Y=y;
|
|
}
|
|
#endif
|