mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2025-09-01 06:20:15 +02:00
FT collision part4: ball to ball collision.
TBall uses multiple inheritance, interesting.
This commit is contained in:
parent
f521a03322
commit
c5acdcd524
15 changed files with 132 additions and 38 deletions
|
@ -625,7 +625,7 @@ TBall* TPinballTable::AddBall(float x, float y)
|
|||
{
|
||||
if (BallList.size() >= 20)
|
||||
return nullptr;
|
||||
ball = new TBall(this);
|
||||
ball = new TBall(this, -1);
|
||||
BallList.push_back(ball);
|
||||
}
|
||||
|
||||
|
@ -655,6 +655,16 @@ int TPinballTable::BallCountInRect(const RectF& rect)
|
|||
return count;
|
||||
}
|
||||
|
||||
int TPinballTable::BallCountInRect(const vector2& pos, float margin)
|
||||
{
|
||||
RectF rect{};
|
||||
rect.XMin = pos.X - margin;
|
||||
rect.XMax = pos.X + margin;
|
||||
rect.YMin = pos.Y - margin;
|
||||
rect.YMax = pos.Y + margin;
|
||||
return BallCountInRect(rect);
|
||||
}
|
||||
|
||||
void TPinballTable::EndGame_timeout(int timerId, void* caller)
|
||||
{
|
||||
auto table = static_cast<TPinballTable*>(caller);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue