HI there,
I've been trying to implement a class of a ball i was given by an tutor but am having troubles.
She gave me:

class TBall
double _radius; // defines the radius of the ball
TVector _position; // defines the position of the ball
TVector _velocity; // defines the velocity v0 of the ball
// Constructors
TBall(const double& Radius, const TVector& Position, const
TVector& Velocity)
{_radius=Radius; _position=Position; _velocity=Velocity;};
// Selectors
double GetBallRadius() const {return _radius;};
TVector GetBallPosition() const {return _position;};
TVector GetBallVelocity() const {return _velocity;};
void DrawBall(); // Draws the ball
void CalculateVelocity(const TVector& velocity, const double&
seconds); // Assigns the ball a velocity
TVector CalcDistanceTravelled(const double& seconds) const;
// Calculates the distance traveled
void MoveBall(const double& seconds); // Moves the ball


#include "tball.h"

// Assign default values for the attributes
// of the ball
_radius = 4.0;
_position = TVector(1.0, 1.0, 1.0);
_velocity = TVector(0.1, 0.0, 0.0);

void TBall::DrawBall()
_position.Y(), _position.Z());
glutSolidSphere(_radius, 20, 20);

Both the code segements have no errors within them (i have all the associated vector,matrix etc header files.
I believe my problem is how to implement it within the display loop.
I use &TBall::DrawBall; But the ball doesnt seem to appear. Has ayone got any advice on how i get this to work?

Is this clear? i hope it is.

Thanks in advance from me!

Edited 6 Years Ago by thehivetyrant: n/a

Well &TBall::DrawBall; is just a pointer to a function.

To actually call it, you need say TBall::DrawBall()

Maybe even

TBall theBall;
// init code
This article has been dead for over six months. Start a new discussion instead.