i am having errors when i compile this code such as:
main_class.h(31) : error C2228: left of '.x' must have class/struct/union
1> type is 'float'
main_class.h(31) : error C2228: left of '.y' must have class/struct/union
1> type is 'float'
main_class.h(31) : error C2228: left of '.z' must have class/struct/union
This is my linked list code:
typedef struct position
{
float x, y, z;
}
position, rot;
class shape
{
private:
position pos;
float orientation;
float rate;
shape * next;
public:
void draw (void);
virtual void render();
void setNext(shape * n)
{
next = n;
};
shape* getNext(void)
{
return next;
};
};
void shape::draw (void)
{
glPushMatrix();
glTranslatef (pos.x, pos.y, pos.z);
glRotatef(orientation, orientation.x, orientation.y, orientation.z);
render();
glPopMatrix();
orientation += rate;
if (orientation >= 360)
{
orientation -= 360;
}
}
shape * p;
Any help or tip wouuld be much appreciated