00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CHAT_H
00011 #define CHAT_H
00012
00013 #include <deque>
00014 #include <SDL/SDL.h>
00015 #include <adsofont.h>
00016 #include "view.h"
00017 #include "userinput.h"
00018
00019 using namespace std;
00020
00021 #define CHAT_LINE_WIDTH 80
00022 #define CHAT_EDIT_WIDTH 64
00023 #define CHAT_LINES 4
00024
00026 class Chat : public Overlay, public KeyboardHandler {
00027 deque<char*> display, recvBuffer, typeBuffer;
00028 char editLine[CHAT_LINE_WIDTH];
00029 int cursorPos;
00030
00031 int isTyping;
00032 int isViewing;
00033 int isPrinting;
00034
00035 int displayTime, cursorTimer;
00036 int viewTimer;
00037 int autoReplyEvent;
00038 int print_time, char_time;
00039
00040 public:
00041 void receive(char *);
00042 bool onKeyEvent(SDLKey key);
00043 void enable();
00044 void draw();
00045 void update();
00046 int isVisible(){ return isViewing; }
00047 Chat(){
00048 isTyping = 0;
00049 isViewing = 0;
00050 isPrinting = 0;
00051 displayTime = 0;
00052 cursorTimer = 0;
00053 viewTimer = 0;
00054 autoReplyEvent = 0;
00055 char_time = 20;
00056 }
00057 };
00058
00059 extern Chat chat;
00060
00061 #endif