-
Notifications
You must be signed in to change notification settings - Fork 1
/
mazeview.h
51 lines (46 loc) · 1.19 KB
/
mazeview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef MAZEVIEW_H
#define MAZEVIEW_H
#include <QObject>
#include <QWidget>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QList>
#include <QTimer>
#include "role.h"
#include "bullet.h"
#include <QTcpSocket>
#include <QGraphicsSimpleTextItem>
#include <QHostAddress>
class MazeView : public QGraphicsView
{
Q_OBJECT
public:
explicit MazeView(QGraphicsView *parent = 0);
~MazeView();
void setServerIp(QHostAddress address, qint16 port);
signals:
public slots:
private slots:
void onMoveTimerTimeout();
void onReadyRead();
void onTimeout();
protected:
void drawForeground(QPainter *painter, const QRectF &rect);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event){}
void mouseDoubleClickEvent(QMouseEvent *event){}
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event){}
void mouseReleaseEvent(QMouseEvent *event){}
private:
Role* findRole(const QString& token);
private:
QGraphicsScene scene_;
QList<Role*> roleList_;
QTcpSocket* socket_;
QTimer timer_;
QGraphicsSimpleTextItem ms_;
// QTimer moveTimer_;
// QPointF moveRolePointF_;
};
#endif // MAZEVIEW_H