added IsPointInRectangle(point, rectangle) to System.ocg/Math.c

scancodes-fix
David Dormagen 2013-01-12 18:15:24 +01:00
parent 00d5ffea03
commit 7ba10ca3cf
1 changed files with 6 additions and 0 deletions

View File

@ -143,6 +143,12 @@ global func RectangleEnsureWithin(proplist first, proplist second)
return adjusted;
}
// checks whether a point {x, y} is in a normalized rectangle {x, y, w, h}
global func IsPointInRectangle(proplist point, proplist rectangle)
{
return (point.x >= rectangle.x && point.x <= rectangle.x + rectangle.w) && (point.y >= rectangle.y && point.y <= rectangle.w + rectangle.h);
}
//Moves param 'a' towards param 'b' by 'max' amount per frame
global func MoveTowards(int a, int b, int max)
{