-
Notifications
You must be signed in to change notification settings - Fork 0
/
Piece.h
58 lines (48 loc) · 1 KB
/
Piece.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
52
53
54
55
56
57
58
/**
* Header de Piece.cxx
*
* @file Piece.h
*/
#if !defined Piece_h
#define Piece_h
#include "Echiquier.h"
#include <QtWidgets>
#include <string>
#include <QObject>
class Echiquier;
/**
* Declaration d'une classe modélisant une piece de jeu d'echec.
*/
class Piece : public QWidget
{
Q_OBJECT
protected:
int m_x;
int m_y;
bool m_white;
bool m_clicked;
bool m_selected;
QPoint m_mousePos;
public:
Piece();
Piece(int x, int y, bool white, Echiquier* parent);
Piece(const Piece &autre);
~Piece();
void movePiece( int x, int y );
int x();
int y();
bool isWhite();
void setSelected(bool select);
bool mouvementLegal(Echiquier &e, int x, int y);
virtual bool mouvementValide( Echiquier & e, int x, int y );
protected:
virtual void paintEvent(QPaintEvent *);
void paintPiece(QString name);
signals:
void clickPiece();
void releasePiece();
public:
void mouseReleaseEvent ( QMouseEvent * e );
void mousePressEvent ( QMouseEvent * e );
};
#endif // !defined Piece_h