| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2009 by The qGo Project * |
| 3 | * * |
| 4 | * This file is part of qGo. * |
| 5 | * * |
| 6 | * qGo is free software: you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/> * |
| 18 | * or write to the Free Software Foundation, Inc., * |
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | |
| 23 | #ifndef STONE_H |
| 24 | #define STONE_H |
| 25 | |
| 26 | #include "graphicsitemstypes.h" |
| 27 | |
| 28 | #include <QGraphicsItem> |
| 29 | #include <QtCore> |
| 30 | |
| 31 | class Stone : public QGraphicsPixmapItem |
| 32 | { |
| 33 | public: |
| 34 | Stone(QList<QPixmap> *a, QGraphicsScene *canvas, StoneColor c, int x, int y, bool has_shadow=false); |
| 35 | ~Stone() ; |
| 36 | |
| 37 | StoneColor getColor() const { return color; } |
| 38 | void setColor(StoneColor c=stoneBlack); |
| 39 | void toggleOneColorGo(bool oneColor) ; |
| 40 | int type() const { return RTTI_STONE; } |
| 41 | int posX() const { return myX; } |
| 42 | int posY() const { return myY; } |
| 43 | QGraphicsSimpleTextItem * getNum() {return moveNum;} |
| 44 | void setCoord(int x, int y) { myX = x; myY = y; } |
| 45 | void togglePixmap(QList<QPixmap> *a, bool showShadow = true); |
| 46 | |
| 47 | bool isDead() const { return dead; } |
| 48 | void setDead(bool b=true) { dead = b; seki = false;} |
| 49 | bool isSeki() const { return seki; } |
| 50 | void setSeki(bool b=true) { seki = b; dead = false; } |
| 51 | |
| 52 | void setPos(double x, double y); |
| 53 | void show(); |
| 54 | void hide(); |
| 55 | |
| 56 | bool checked; |
| 57 | |
| 58 | |
| 59 | |
| 60 | private: |
| 61 | StoneColor color; |
| 62 | int myX, myY; |
| 63 | bool dead, seki; |
| 64 | QList<QPixmap> *pixmapList; |
| 65 | QGraphicsSimpleTextItem *moveNum; |
| 66 | QGraphicsPixmapItem *shadow; |
| 67 | }; |
| 68 | |
| 69 | #endif |