MiniEngine/SDLWrapper/Point.cpp

33 lines
424 B
C++
Raw Normal View History

#include "Point.h"
2017-07-31 00:18:10 +08:00
namespace MiniEngine
{
Point::Point(int X, int Y)
{
x = X;
y = Y;
}
Point::Point()
{
x = y = 0;
}
SDL_Point Point::toSDLPoint() const
{
SDL_Point p;
p.x = x;
p.y = y;
return p;
}
bool Point::inRect(const Rect& rect) const
{
auto p = toSDLPoint();
auto r = rect.toSDLRect();
return ( SDL_PointInRect(&p, &r) == SDL_TRUE );
}
2017-07-31 00:18:10 +08:00
} /// End of namespace MiniEngine