00001
00002 #ifndef _CAR_WORLD_CLIENT_H_
00003 #define _CAR_WORLD_CLIENT_H_
00004
00005 namespace std {}
00006 using namespace std;
00007
00008 #include "H_Main.h"
00009
00010 #include "H_Input.h"
00011 #include "H_Prompt.h"
00012 #include "H_Variable.h"
00013 #include "H_Socket.h"
00014 #include "CarWorld.h"
00015
00016 #include <queue>
00017
00018 class CarWorldClient : public HglApplication
00019 {
00020 public:
00021 CarWorldClient(bool full_screen);
00022 virtual ~CarWorldClient();
00023
00024 const char* name();
00025
00026 void draw_init();
00027
00028 void key_down(SDLKey AHKey, char c);
00029 void resize(unsigned int width, unsigned int height);
00030 void on_idle(unsigned int elapsed_time);
00031
00032 void draw();
00033
00034
00035 void toggleconsole();
00036
00037 void set_r_mode(int mode);
00038 int get_r_mode();
00039
00040 void set_joystick(bool use_joystick);
00041 bool get_joystick();
00042
00043 void execute_cfg(const char *FileName);
00044 void pars_command(const char *value);
00045
00046 void bind(SDLKey key,const char *command);
00047
00048 void print_help();
00049 void print_version();
00050
00051
00052 void join(const char *host, short port);
00053
00054 void write_cfg(ostream &out);
00055 public:
00056 map<SDLKey,string> KeyBindings;
00057 private:
00058
00059 Hgl_streambuf hbuf;
00060 Hgl *m_Hgl;
00061
00062 bool IsPromptMode;
00063 map<string,HExecutable*> m_Executables;
00064
00065 HJoystick *RealJoystick;
00066 KeyJoystick *FakeJoystick;
00067 HJoystick *CurrentJoystick;
00068
00069 HSocClient *m_socket;
00070 int ID;
00071 void SendState();
00072 bool RecieveState();
00073 map<int,CWVehicle*> m_Opponents;
00074
00075 CWVehicle *m_Vehicle;
00076 CarWorld *m_CarWorld;
00077 };
00078
00079 #endif //_CAR_WORLD_CLIENT_H_