#ifndef CSECTIONBOARD_H
#define CSECTIONBOARD_H

class CSectionBoard : public CWindowSection
{
  CBoard board;
  CTexture* textureboard;
  CTexture* texturechess;
  std::string FileBoard;
  std::string FileChess;

  // For when a piece is dragged
  CBasePiece* MotionPiece;
  float OffsetX, OffsetY;
  float MotionPosX, MotionPosY;
  CMove CurrentMove;

 public:
  CBoard& GetBoard() { return board; }

  CSectionBoard(CWindow* parent,
                const std::string& boardfile,
                const std::string& chessfile,
                const CBoard& theboard = CBoard());
  virtual ~CSectionBoard()
    {
      if (textureboard)
        delete textureboard;
      if (texturechess)
        delete texturechess;
    }

  void LoadTexture(void);

  void Display(void);
  void Mouse(int button, int state, int x, int y);
  void Motion(int x, int y);

  virtual void SetProjection(void) { gluOrtho2D(0,8,0,8); }
};

#endif
