Initial Commit
This commit is contained in:
149
common/GDIPOINT.HPP
Normal file
149
common/GDIPOINT.HPP
Normal file
@@ -0,0 +1,149 @@
|
||||
#ifndef _COMMON_GDIPOINT_HPP_
|
||||
#define _COMMON_GDIPOINT_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
|
||||
class GDIPoint : private POINT
|
||||
{
|
||||
public:
|
||||
GDIPoint(void);
|
||||
GDIPoint(int x,int y);
|
||||
GDIPoint(const GDIPoint &someGDIPoint);
|
||||
virtual ~GDIPoint();
|
||||
WORD operator==(const GDIPoint &someGDIPoint)const;
|
||||
GDIPoint operator+(const GDIPoint &someGDIPoint)const;
|
||||
GDIPoint &operator=(const GDIPoint &someGDIPoint);
|
||||
GDIPoint &operator-=(const GDIPoint &someGDIPoint);
|
||||
GDIPoint &operator+=(const GDIPoint &someGDIPoint);
|
||||
GDIPoint &operator++(void);
|
||||
GDIPoint operator++(int prefixDummy);
|
||||
GDIPoint &operator--(void);
|
||||
GDIPoint operator--(int prefixDummy);
|
||||
operator POINT&(void);
|
||||
int x(void)const;
|
||||
void x(int newx);
|
||||
int y(void)const;
|
||||
void y(int newy);
|
||||
void setPoint(int newx,int newy);
|
||||
int distance(const GDIPoint &someGDIPoint)const;
|
||||
POINT &getPOINT(void);
|
||||
private:
|
||||
};
|
||||
|
||||
inline
|
||||
GDIPoint::GDIPoint(void)
|
||||
{
|
||||
POINT::x=0;
|
||||
POINT::y=0;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint::GDIPoint(int x,int y)
|
||||
{
|
||||
POINT::x=x;
|
||||
POINT::y=y;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint::GDIPoint(const GDIPoint &someGDIPoint)
|
||||
{
|
||||
*this=someGDIPoint;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint::~GDIPoint()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
int GDIPoint::x(void)const
|
||||
{
|
||||
return POINT::x;
|
||||
}
|
||||
|
||||
inline
|
||||
void GDIPoint::x(int newx)
|
||||
{
|
||||
POINT::x=newx;
|
||||
}
|
||||
|
||||
inline
|
||||
int GDIPoint::y(void)const
|
||||
{
|
||||
return POINT::y;
|
||||
}
|
||||
|
||||
inline
|
||||
void GDIPoint::y(int newy)
|
||||
{
|
||||
POINT::y=newy;
|
||||
}
|
||||
|
||||
inline
|
||||
void GDIPoint::setPoint(int newx,int newy)
|
||||
{
|
||||
POINT::x=newx;
|
||||
POINT::y=newy;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD GDIPoint::operator==(const GDIPoint &someGDIPoint)const
|
||||
{
|
||||
return (x()==someGDIPoint.x()&&
|
||||
y()==someGDIPoint.y());
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint &GDIPoint::operator=(const GDIPoint &someGDIPoint)
|
||||
{
|
||||
x(someGDIPoint.x());
|
||||
y(someGDIPoint.y());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint &GDIPoint::operator-=(const GDIPoint &someGDIPoint)
|
||||
{
|
||||
x(x()-someGDIPoint.x());
|
||||
y(y()-someGDIPoint.y());
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint &GDIPoint::operator+=(const GDIPoint &someGDIPoint)
|
||||
{
|
||||
x(x()+someGDIPoint.x());
|
||||
y(y()+someGDIPoint.y());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint &GDIPoint::operator++(void)
|
||||
{
|
||||
x(x()+1);
|
||||
y(y()+1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
GDIPoint::operator POINT&(void)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
int GDIPoint::distance(const GDIPoint &someGDIPoint)const
|
||||
{
|
||||
int xDiff(someGDIPoint.x()-x());
|
||||
int yDiff(someGDIPoint.y()-y());
|
||||
return (xDiff*xDiff)+(yDiff*yDiff);
|
||||
}
|
||||
|
||||
inline
|
||||
POINT &GDIPoint::getPOINT(void)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user