diff --git a/Ball.h b/Ball.h index 520bae2..a0deac7 100644 --- a/Ball.h +++ b/Ball.h @@ -10,11 +10,16 @@ public: Ball() : GraphicsObject(&Ball::SetX, this) // pointer to self (specific instance) { instance_num = ++instance_counter; + // NOTE(dev): don't go above 100, please, for the sake of the example. + } + void GetXFromPhysicsSimulation() + { + x = instance_num + ((rand() % 10) * 100); // move around by ten, but keep single digit } static void SetX(int &x, void *instance) { Ball *ball = static_cast(instance); - ball->x = ball->instance_num; // prove we're accessing the right one + ball->GetXFromPhysicsSimulation(); return; }