Subversion Repositories QTron

Rev

Rev 37 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef CLIENT_H
#define CLIENT_H

#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QPoint>
#include <QtCore/QThread>

#include <QtNetwork/QTcpSocket>

class Client : public QThread
{
    Q_OBJECT
   
    public:
        Client(int sd);
        ~Client();
       
        bool isConnected();
       
        void run();
       
        bool doGo();
        bool checkReadyRead();
        void checkDisconnected();
        void checkPlayable();
       
        void updatePos();
        void reset();
       
        bool hasCollided(QList<Client *> clients);
       
        void sendText(QByteArray text);
        void write(QByteArray text);
       
        QString name;
        int colourRed;
        int colourGreen;
        int colourBlue;
       
        double x;
        double y;
        int angle;
        double speed;
       
        bool playing;
        bool crashed;
       
        QList<QPoint> linePoints;
        QList<Client *> clients;
       
        bool playedGo;
        QString peerAddress;
   
    private:
        QTcpSocket *socket;
       
        bool connected;
       
    signals:
        void chat(QString name, QString data);
};

int sign(float x);

#endif // CLIENT_H