| 371 | } |
| 372 | |
| 373 | float Entity::intersectionArea(StaticObject* pobj) |
| 374 | { |
| 375 | float x11 = position.x + leftPadding; |
| 376 | float y11 = position.y + bottomPadding; |
| 377 | float x12 = position.x + size.x - rightPadding; |
| 378 | float y12 = position.y + size.y - topPadding; |
| 379 | float x21 = pobj->position.x; |
| 380 | float y21 = pobj->position.y; |
| 381 | float x22 = pobj->position.x + pobj->size.x; |
| 382 | float y22 = pobj->position.y + pobj->size.y; |
| 383 | |
| 384 | float x_overlap = std::max(0.0f, std::min(x12, x22) - std::max(x11, x21)); |
| 385 | float y_overlap = std::max(0.0f, std::min(y12, y22) - std::max(y11, y21)); |
| 386 | |
| 387 | return x_overlap * y_overlap; |
| 388 | } |
| 389 | |
| 390 | Player::Player() |
| 391 | { |
nothing calls this directly
no outgoing calls
no test coverage detected