warzone2100/lib/betawidget/geom.c

19 lines
263 B
C

#include "geom.h"
bool pointInRect(point p, rect r)
{
return (r.topLeft.x < p.x
&& r.bottomRight.x > p.x
&& r.topLeft.y < p.y
&& r.bottomRight.y > p.y);
}
point pointAdd(point p, point q)
{
point r;
r.x = p.x + q.x;
r.y = p.y + q.y;
return r;
}