[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: 2 Player mode



Well, SDL could have a memory file class. I don't know. But why is something like the string class not usable? All you need is something which grows on write and can then be read in again. When the network code receives the data, it knows the size of the buffer, as it is part of the header.

Regards
Henk

Jens Granseuer wrote:

On 07.10.2006 14:57, Jens Granseuer wrote:

class NetBuffer : public MemBuffer {
public:
 NetBuffer( int size );
 ~NetBuffer( void );

 int Size( void ) const { return size; }
 void *GetData( void ) const { return buffer; }

private:
 int size;
 void *buffer;
}


It looks like to do this properly we need NetBuffer to allocate
memory dynamically (so we can do history->Save( NetBuffer )).
However, the standard STL classes (vector, string) are not really
suited for this purpose since we also need raw data access for
the SDL_net API. Do we really need to implement our own buffer
class? Any clever ideas?

Jens


-- ------------------------------------------------------------------------- Henk Jonas Palm OS ® certified developer

  metaview@xxxxxx                                   www.metaviewsoft.de
-------------------------------------------------------------------------