Skip to main content
gamedev.net
🔒 Locked

Load Class Data From Buffer

Started by programering Nov 20, 2003 at 8:09 AM 0 replies 350+ views
Original Post
programering
programering
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.