mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
33 lines
424 B
C++
33 lines
424 B
C++
#include "Point.h"
|
|
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 );
|
|
}
|
|
|
|
} /// End of namespace MiniEngine
|
|
|