Home
 
 
30 April 2007 @ 06:32 pm
While typing up code and compiling the basic framework of things, I've developed the Client object a bit:

class Client {
	mID clientID;   // a unique identifier for the client
	ClientConn	conn;   // used for communicating with the server
	ClientModule	clientModule;   // the game data used by the server
	DisplayDevice	dDev;
	SoundDevice sDev;
	List	ClientThings;   // a list of ClientThings
	List    Gadgets;    // a list of displayed gadgets
	List    ClientMaps;       // a list of the ClientMaps for this game
	ClientMap*  currentMap; // the current map
	public:
// the usual stuff
	Client(HWND,char*);
	~Client();
// these are called by the OS-specific I/O handling code
	void    LeftClick(unsigned int, unsigned int,unsigned int);
	void    RightClick(unsigned int, unsigned int, unsigned int);
	void    LeftRelease(unsigned int, unsigned int, unsigned int);
	void    RightRelease(unsigned int, unsigned int, unsigned int);
	void    MouseMove(unsigned int, unsigned int, unsigned int);
	void    KeyPress(unsigned int);
	void    KeyRelease(unsigned int);
//	void	findServer();
//	void    passData();
//	void    getData();
	void    draw();
};


As you can see, the mouse and keyboard member objects have been replaced with member functions that will be called by the OS-specific code (which will be kept in as small a set of OS-specific files as possible to maximize portability).

mID is an unsigned long integer, used for holding identifiers. Each Client will need an identifier (clientID) so that Servers can tell which client is which.

ClientConn is the way I'll be encapsulating OS-specific socket communications. conn is the instance of this class in the Client object.

ClientModule is a class for holding the data that the Client uses, and clientModule is the instance in the Client object.

The three List objects are for holding all of the objects, maps, and gadgets that the Client creates.