QTfrontend/game.h
changeset 31 99888245a4e8
parent 28 59f7db859b8a
child 32 78bff13b11c0
equal deleted inserted replaced
30:794e98e11b66 31:99888245a4e8
    37 #include <QObject>
    37 #include <QObject>
    38 #include <QTcpServer>
    38 #include <QTcpServer>
    39 #include <QTcpSocket>
    39 #include <QTcpSocket>
    40 #include <QByteArray>
    40 #include <QByteArray>
    41 #include <QString>
    41 #include <QString>
       
    42 #include <QDir>
    42 #include "team.h"
    43 #include "team.h"
    43 #include "rndstr.h"
    44 #include "rndstr.h"
    44 
    45 
    45 #define IPC_PORT 46631
    46 #define IPC_PORT 46631
    46 #define MAXMSGCHARS 255
    47 #define MAXMSGCHARS 255
    49 class HWGame : public QObject
    50 class HWGame : public QObject
    50 {
    51 {
    51 	Q_OBJECT
    52 	Q_OBJECT
    52 public:
    53 public:
    53 	HWGame(int Resolution, bool Fullscreen);
    54 	HWGame(int Resolution, bool Fullscreen);
    54 	void Start();
       
    55 	void AddTeam(const QString & team);
    55 	void AddTeam(const QString & team);
    56 	void PlayDemo(const QString & demofilename);
    56 	void PlayDemo(const QString & demofilename);
       
    57 	void StartLocal();
       
    58 	void StartNet(const QString & netseed);
       
    59 
       
    60 signals:
       
    61 	void SendNet(const QByteArray & msg);
       
    62 
       
    63 public slots:
       
    64 	void FromNet(const QByteArray & msg);
       
    65 	void LocalCFG(const QString & teamname);
    57 
    66 
    58 private:
    67 private:
    59     enum GameType {
    68     enum GameType {
    60         gtLocal = 1,
    69         gtLocal = 1,
    61         gtDemo  = 2,
    70         gtDemo  = 2,
    73 	QByteArray * demo;
    82 	QByteArray * demo;
    74 	QByteArray * toSendBuf;
    83 	QByteArray * toSendBuf;
    75 	int vid_Resolution;
    84 	int vid_Resolution;
    76 	bool vid_Fullscreen;
    85 	bool vid_Fullscreen;
    77 	GameType gameType;
    86 	GameType gameType;
       
    87 	QDir cfgdir;
    78 
    88 
       
    89 	void Start();
    79 	void SendConfig();
    90 	void SendConfig();
    80 	void SendTeamConfig(int index);
    91 	void SendTeamConfig(int index);
    81 	void ParseMessage();
    92 	void ParseMessage();
    82 	void SendIPC(const char * msg, quint8 len);
    93 	void SendIPC(const char * msg, quint8 len);
    83 	void SendIPC(const QByteArray & buf);
    94 	void SendIPC(const QByteArray & buf);
    84 	void SendIPCRaw(const char * msg, quint32 len);
    95 	void RawSendIPC(const QByteArray & buf);
    85 	void SaveDemo(const QString & filename);
    96 	void SaveDemo(const QString & filename);
    86 	QString GetThemeBySeed();
    97 	QString GetThemeBySeed();
    87 
    98 
    88 private slots:
    99 private slots:
    89 	void NewConnection();
   100 	void NewConnection();