00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef NET_PLAY_H
00019 #define NET_PLAY_H
00020
00021 #include <iostream>
00022 #include <string>
00023 #include "scourge.h"
00024 #include "net/gamestatehandler.h"
00025 #include "net/commands.h"
00026
00027 using namespace std;
00028
00029
00033 class NetPlay : public GameStateHandler,CommandInterpreter {
00034 private:
00035 Scourge *scourge;
00036 Window *mainWin;
00037 ScrollingList *messageList;
00038 TextField *chatText;
00039 int chatStrCount;
00040 char **chatStr;
00041 static const int MAX_CHAT_SIZE = 100;
00042 static const int CHAT_STR_LENGTH = 120;
00043
00044 public:
00045 NetPlay(Scourge *scourge);
00046 virtual ~NetPlay();
00047
00048 char *getGameState();
00049
00050 void chat(char *message);
00051 void logout();
00052 void ping(int frame);
00053 void processGameState(int frame, char *p);
00054 void handleUnknownMessage();
00055 void serverClosing();
00056 void character(char *bytes, int length);
00057 void addPlayer(Uint32 id, char *bytes, int length);
00058
00059 inline Window *getWindow() { return mainWin; }
00060
00061 bool handleEvent(Widget *widget, SDL_Event *event);
00062 };
00063
00064 #endif
00065