home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////////////////////////////////
- //
- // This file is part of the Atari graphical interface for GNU Chess,
- // and is Copyright 1992 by Warwick W. Allison.
- //
- // You are free to copy and modify these sources, provided you acknowledge
- // the origin by retaining this notice, and adhere to the conditions
- // of the CHESS General Public License described in the main chess file
- // gnuchess.cc.
- //
- //////////////////////////////////////////////////////////////////////////////
-
- #include "Piece.h"
- #include "gnuchess.h"
-
-
- Incarnation **RankImage;
- static const NumRanks=7; // no_piece up to king
-
- GamePiece::GamePiece() :
- Image(NumRanks*2)
- {
- int p=0;
-
- for (int c=0; c<2; c++) {
- for (int r=0; r<NumRanks; r++) {
- Image.SetImage(p,RankImage[p]);
- p++;
- }
- }
- }
-
- void GamePiece::Colour(bool isblack)
- {
- IsBlack=isblack;
- }
-
- void GamePiece::Rank(int R)
- {
- rank=R;
- }
-
- void GamePiece::Draw(int x,int y)
- {
- Image.ShapeTo((IsBlack ? NumRanks : 0) + rank);
-
- Image.MoveTo(x,y);
- Image.Draw();
- }
-
-
- GamePiece *Piece;
-
- void InitPiece(Screen& S)
- {
- int p=0;
-
- RankImage=new Incarnation* [NumRanks*2];
-
- for (int c=0; c<2; c++) {
- for (int r=0; r<NumRanks; r++) {
- RankImage[p]=new ColourIncarnation(23);
- RankImage[p]->GetImage(S,c*16,r*24+1);
- RankImage[p]->SetHotSpot(8,11);
- p++;
- }
- }
-
- Piece=new GamePiece();
- }
-