-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListMove.cpp
More file actions
117 lines (103 loc) · 2.5 KB
/
ListMove.cpp
File metadata and controls
117 lines (103 loc) · 2.5 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "ListMove.h"
#include "AllegroWrap.h"
CListMove::CListMove()
:boxPlayerPosX(550)
,boxPlayerPosY(50)
,boxPosX(550)
,boxPosY(100)
,boxHeight(350)
{
_initVectorNoteStyle();
_initVectorNotePosition();
_initVectorNotePieces();
}
//-----------------------------------------------------------------
CListMove::~CListMove()
{
}
//----------------private functions------------------------------//
void CListMove::_initVectorNoteStyle()
{
noteStyle.resize(6);
noteStyle[EASY_MOVE] = " ";
noteStyle[SHOOTING] = ":";
noteStyle[SHORT_CASTLING] = "0-0";
noteStyle[LONG_CASTLING] = "0-0-0";
noteStyle[CHECK] = "+";
noteStyle[MAT] = "X";
};
void CListMove::_initVectorNotePosition()
{
notePosition.resize(9);
notePosition[0] = " ";
notePosition[1] = "a";
notePosition[2] = "b";
notePosition[3] = "c";
notePosition[4] = "d";
notePosition[5] = "e";
notePosition[6] = "f";
notePosition[7] = "g";
notePosition[8] = "h";
};
void CListMove::_initVectorNotePieces()
{
notePieces.resize(6);
notePieces[KING] = "K";
notePieces[QUEEN] = "Q";
notePieces[ROOK] = "R";
notePieces[BISHOP] = "B";
notePieces[KNIGHT] = "N";
notePieces[PAWN] = " ";
};
//---------------public functions--------------------------------//
void CListMove:: newNoteStruct()
{
note.clear();
};
//--------------set and get functions-----------------------------//
void CListMove::setNoteStruct(CPiece * aPiece, eMove aMove, int aCountMove, bool aCheck)
{
int noteCountMove = 1;
if((aCountMove % 2 == 0))
noteCountMove = aCountMove / 2;
else
noteCountMove = (aCountMove + 1) / 2;
sNote tempNote;
tempNote.piece = notePieces[aPiece->getPiece()];
tempNote.color = aPiece->getColor();
tempNote.notePositionX = notePosition[aPiece->getX()];
tempNote.notePositionY = 9 - aPiece->getY();
tempNote.move = aMove;
switch(aMove)
{
case LEGAL:
tempNote.noteStyle = noteStyle[EASY_MOVE];
break;
case SHOOT:
tempNote.noteStyle = noteStyle[SHOOTING];
break;
case CASTLING:
if(aPiece->getX() == 7)
tempNote.noteStyle = noteStyle[SHORT_CASTLING];
else
tempNote.noteStyle = noteStyle[LONG_CASTLING];
break;
default:
tempNote.noteStyle = "*";
break;
}
if(aCheck)
tempNote.noteStyle = noteStyle[CHECK];
note.push_back(tempNote);
};
vector<CListMove::sNote>&CListMove::getVectorNote()
{
return note;
};
//-------------draw functions----------------------------------//
void CListMove::draw()
{
CAllegroWrap & inst = CAllegroWrap::instance();
inst.drawRactangeleForNote();
inst.drawNote(this->getVectorNote());
};