| 1336 | } |
| 1337 | |
| 1338 | bool Tr2Sprite2dScene::IsInside( const Vector2& pointIn, const Vector2& topLeft, float width, float height, float radius ) |
| 1339 | { |
| 1340 | if( !IsInsideClipRect( pointIn ) ) |
| 1341 | { |
| 1342 | return false; |
| 1343 | } |
| 1344 | |
| 1345 | //local copy so we can manipulate it |
| 1346 | //this makes non-translation transforms easier to implement |
| 1347 | Vector2 point = pointIn; |
| 1348 | |
| 1349 | float top; |
| 1350 | float left; |
| 1351 | float bottom; |
| 1352 | float right; |
| 1353 | |
| 1354 | if( m_transformStack->empty() ) |
| 1355 | { |
| 1356 | left = topLeft.x; |
| 1357 | top = topLeft.y; |
| 1358 | right = left + width; |
| 1359 | bottom = top + height; |
| 1360 | } |
| 1361 | else |
| 1362 | { |
| 1363 | const TransformStackEntry& topEntry = m_transformStack->back(); |
| 1364 | |
| 1365 | if( topEntry.isTranslationOnly ) |
| 1366 | { |
| 1367 | left = topLeft.x + topEntry.translation.x; |
| 1368 | top = topLeft.y + topEntry.translation.y; |
| 1369 | right = left + width; |
| 1370 | bottom = top + height; |
| 1371 | } |
| 1372 | else |
| 1373 | { |
| 1374 | left = topLeft.x; |
| 1375 | top = topLeft.y; |
| 1376 | right = left + width; |
| 1377 | bottom = top + height; |
| 1378 | |
| 1379 | const Matrix& transform = topEntry.transform; |
| 1380 | |
| 1381 | //construct inverse, transform point by this, compare against |
| 1382 | // untransformed bounding rectangle |
| 1383 | Matrix inv = Inverse( transform ); |
| 1384 | |
| 1385 | TransformPoint( point, point, inv ); |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | if( point.x < left ) |
| 1390 | { |
| 1391 | return false; |
| 1392 | } |
| 1393 | if( point.x > right ) |
| 1394 | { |
| 1395 | return false; |