Original Post
For you who want to load the member-data into a class instead of a struct.
For a struct you just load the raw data into a buffer and then:
struct Object *object = (struct Object *) buffer;
After malloced *object to the right size.
For a class you just pass the raw buffer data to a loading member-function:
void Object::LoadData(void *buffer)
{
position = (Position) *buffer;
// or:
memcpy(buffer,&position,sizeof(position));
buffer += sizeof(position); // count up the buffer *pointer
memcpy(buffer,∠,sizeof(angle));
}
Hope you get what I mean.
-------------------------------
Anton Karlsson
Klingis Entertainment
Games with silly humor
Aleph One (Marathon Open Source) | My Homepage
Packa bajs med winzip!
Just dreaming wont make you (more) skilled in game programming/development.