- [x] Changer l'unicode en fonction du joueur
This commit is contained in:
parent
24d17141ef
commit
5bf6fc4e74
|
@ -4,9 +4,9 @@ A FAIRE
|
|||
- [ ] Timeout pour le jeu
|
||||
|
||||
- [ ] IA
|
||||
- [ ] Changer l'unicode en fonction du joueur
|
||||
|
||||
FAIT
|
||||
====
|
||||
- [x] Caracteres unicode pour les pieces
|
||||
- [x] Methode pour texte multicolore
|
||||
- [x] Changer l'unicode en fonction du joueur
|
|
@ -6,6 +6,5 @@ Cavalier::Cavalier(int x, int y) : Piece(CAVALIER, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Cavalier::getchar(){
|
||||
return "\u265E";
|
||||
return "\u2658";
|
||||
return (_player) ? "\u265E" : "\u2658";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,5 @@ Fou::Fou(int x, int y) : Piece(FOU, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Fou::getchar(){
|
||||
return "\u265D";
|
||||
return "\u2657";
|
||||
return (_player) ? "\u265D" : "\u2657";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// #include "Piece.h"
|
||||
|
||||
Piece::Piece(PIECE_TYPE t, int x, int y) : _t(t), _x(x), _y(y){
|
||||
Piece::Piece(PIECE_TYPE t, int x, int y) : _t(t), _x(x), _y(y), _player(true){
|
||||
}
|
||||
|
||||
// GETTERS
|
||||
|
@ -21,9 +21,13 @@ void Piece::move(const int x, const int y){
|
|||
_y = y;
|
||||
}
|
||||
|
||||
void Piece::setPlayer(bool first){
|
||||
_player = first;
|
||||
}
|
||||
|
||||
// OPERATEURS (SURCHARGE)
|
||||
ostream& operator<<(ostream& o, const Piece& p){
|
||||
return o << p._t << " at (" << p._x << "," << p._y << ")";
|
||||
ostream& operator<<(ostream& o, Piece& p){
|
||||
return o << p.getchar() << " at (" << p._x << "," << p._y << ")";
|
||||
}
|
||||
|
||||
// ABTRACT
|
||||
|
|
|
@ -54,15 +54,17 @@
|
|||
|
||||
// SETTERS
|
||||
void move(const int x, const int y);
|
||||
void setPlayer(bool first);
|
||||
|
||||
// OPERATEURS (SURCHARGE)
|
||||
friend ostream& operator<<(ostream& o, const Piece& p);
|
||||
friend ostream& operator<<(ostream& o, Piece& p);
|
||||
|
||||
// ABSTRACT
|
||||
virtual string getchar();
|
||||
|
||||
|
||||
protected:
|
||||
bool _player;
|
||||
PIECE_TYPE _t;
|
||||
int _x;
|
||||
int _y;
|
||||
|
|
|
@ -6,6 +6,5 @@ Pion::Pion(int x, int y) : Piece(PION, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Pion::getchar(){
|
||||
return "\u265F";
|
||||
return "\u2659";
|
||||
return (_player) ? "\u265F" : "\u2659";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,5 @@ Reine::Reine(int x, int y) : Piece(REINE, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Reine::getchar(){
|
||||
return "\u265B";
|
||||
return "\u2655";
|
||||
return (_player) ? "\u265B" : "\u2655";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,5 @@ Roi::Roi(int x, int y) : Piece(ROI, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Roi::getchar(){
|
||||
return "\u265A";
|
||||
return "\u2654";
|
||||
return (_player) ? "\u265A" : "\u2654";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,5 @@ Tour::Tour(int x, int y) : Piece(TOUR, x, y) {
|
|||
|
||||
// ABSTRACT
|
||||
string Tour::getchar(){
|
||||
return "\u265C";
|
||||
return "\u2656";
|
||||
return (_player) ? "\u265C" : "\u2656";
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ Piece* Player::at(const int x, const int y){
|
|||
}
|
||||
// SETTERS
|
||||
void Player::addPiece(Piece& p){
|
||||
// On definit a la piece si c'est P1 ou P2
|
||||
p.setPlayer(_first);
|
||||
|
||||
_pieces.push_back( &p );
|
||||
|
||||
/* DEBUG */
|
||||
|
|
|
@ -9,8 +9,10 @@ int main(){
|
|||
|
||||
// Message d'accueil
|
||||
clear_screen();
|
||||
cout << "Bievenue sur " << endl;
|
||||
sleep(1);
|
||||
multicolor("Bievenue sur Chess Colorful Console Game", BOLD);
|
||||
cout << endl << endl;
|
||||
cout << "by <xdrm-brackets>" << endl;
|
||||
sleep(3);
|
||||
|
||||
// On initialise la partie
|
||||
ctx.init();
|
||||
|
@ -173,7 +175,6 @@ void chess_input(int* origin, int* dest){
|
|||
cout << "Piece a deplacer (XN) : ";
|
||||
cin >> coord;
|
||||
Piece::decode(coord, origin);
|
||||
cout << endl;
|
||||
|
||||
cout << "Deplacer vers (XN) : ";
|
||||
cin >> coord;
|
||||
|
|
BIN
Chess/main.o
BIN
Chess/main.o
Binary file not shown.
Loading…
Reference in New Issue