home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / demos / ttt / build / piece.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-31  |  683 b   |  43 lines

  1. // -------- piece.cpp
  2.  
  3. #include "ttt.h"
  4.  
  5. int Piece::XYs[][2] = {
  6.     { lfx, tpy },
  7.     { mdx, tpy },
  8.     { btx, tpy },
  9.     { lfx, mdy },
  10.     { mdx, mdy },
  11.     { btx, mdy },
  12.     { lfx, bty },
  13.     { mdx, bty },
  14.     { btx, bty }
  15. };
  16.  
  17. void Piece::placemarker(int square, int piece)
  18. {
  19.     show_image(XYs[square-1][0], XYs[square-1][1], piece);
  20.     board->update(square, piece);
  21. }
  22. void Piece::drawline(int i)
  23. {
  24.     int x, y, line;
  25.     if (i < 3)    {
  26.         x = XYs[0][0]-7;
  27.         y = XYs[i*3][1]+20;
  28.         line = 3;
  29.     }
  30.     else if (i < 6)    {
  31.         x = XYs[i][0]+20;
  32.         y = XYs[0][1]-7;
  33.         line = 4;
  34.     }
  35.     else    {
  36.         x = XYs[0][0]+23;
  37.         y = XYs[0][1]+23;
  38.         line = i-1;
  39.     }
  40.     show_image(x, y, line);
  41.     board->update();
  42. }
  43.