lab.cpp/Chess/dep/Pieces/PieceFactory.cpp

25 lines
572 B
C++

// #include "PieceFactory.h"
Piece& PieceFactory::create(PIECE_TYPE t, int x, int y){
Piece *p;
switch(t){
case ROI: p = new Roi(x, y); break;
case REINE: p = new Reine(x, y); break;
case CAVALIER: p = new Cavalier(x, y); break;
case FOU: p = new Fou(x, y); break;
case TOUR: p = new Tour(x, y); break;
case PION: p = new Pion(x, y); break;
}
/* DEBUG */
setfont(SKYBLUE, NORMAL);
cout << " [+] " << p->gett() << " at (" << p->getx() << "," << p->gety() << ")";
setfont();
cout << endl;
return *p;
}