コード例 #1
0
ファイル: game.cpp プロジェクト: Sabouh/CurvRecProject
deque<Board::ConstStackHandle>
Game::possibleDestinations(const Board::ConstStackHandle& ha) const
{
  deque<Board::ConstStackHandle> r;
  if (ha->hasPieces())
  {
    unsigned int h = ha->height();
    Board::Coord s = ha.stackCoord();
    Board::Coord d[6] = {
      Board::Coord(s.x()-h,s.y()),
      Board::Coord(s.x()+h,s.y()),
      Board::Coord(s.x()  ,s.y()-h),
      Board::Coord(s.x()  ,s.y()+h),
      Board::Coord(s.x()-h,s.y()-h),
      Board::Coord(s.x()+h,s.y()+h)
    };
    for (unsigned int i=0;i<6;++i)
    {
      if (Board::isValid(d[i]) &&
	  board_.stackAt(d[i])->hasPieces())
      {
	r.push_back(board_.stackAt(d[i]));
      }
    }
  }
 return r;
}
コード例 #2
0
void
Drawer::drawStatus(const Board::ConstStackHandle& s,QGLViewer* v) const
{
  startTexture();
  glPushMatrix();
  translateTo(s.stackCoord(),s->height()*pieceH+pieceH/2.0f);
  glColor3f(1.0f,1.0f,0.0f);
  v->renderText(0.5f*caseD,0.5f*caseD,0.0f,QString("%1").arg(s.stackStatus()));
  glPopMatrix();
  endTexture();
}
コード例 #3
0
void
Drawer::drawTransparentPiece(Color col,
			     const Board::ConstStackHandle& c,float a) const
{
  startTexture();
  glPushMatrix();
  translateTo(c.stackCoord(),c->height()*pieceH);
  glTranslatef(0.5f*caseD,0.5f*caseD,0.0f);
  drawPiece(col,a);
  glPopMatrix();
  endTexture();
}
コード例 #4
0
void
Drawer::highlight(const Board::ConstStackHandle& c) const
{
  glPushAttrib(GL_ENABLE_BIT);
  glDisable(GL_LIGHTING);
  startTexture();
  glPushMatrix();
  translateTo(c.stackCoord(),0.05f*pieceH+pieceH/2.0f);
  glScalef(caseD,caseD,pieceH);
  // glutWireCube(1.0f);
  glPopMatrix();
  endTexture();
  glPopAttrib();
}
コード例 #5
0
void
Drawer::draw(const Board::ConstStackHandle& c) const
{
  glPushMatrix();
  translateTo(c.stackCoord());
  startTexture("case.png");
  glColor3fv(boardColor);
  glNormal3fv(boardUpVector());
  glBegin(GL_QUADS);
  tessAndTexture(0.0f ,0.0f,caseD,caseD);
  glEnd();
  endTexture();
  glPopMatrix();
}
コード例 #6
0
void
Drawer::highlightPieces(const Board::ConstStackHandle& c) const
{
  glPushAttrib(GL_ENABLE_BIT);
  glDisable(GL_LIGHTING);
  startTexture();
  glPushMatrix();
  translateTo(c.stackCoord(),0.01f);
  glTranslatef(0.5f*caseD,0.5f*caseD,0.0f);
  glColor4f(0.0f,0.0f,0.3f,0.3f);
  drawHRing(pieceRMin, 1.2f*pieceRMax, 0.0f);
  glPopMatrix();
  endTexture();
  glPopAttrib();
}
コード例 #7
0
void
Drawer::drawPieces(const Board::ConstStackHandle& s) const
{
  startTexture();
  glPushMatrix();
  translateTo(s.stackCoord());
  glTranslatef(0.5f*caseD,0.5f*caseD,0.0f);
  for (Stack::const_iterator
	 iter = s->begin(),
	 istop= s->end();
       iter != istop;++iter)
  {
    drawPiece((*iter)->color());
    glTranslatef(0.0f,0.0f,pieceH);
  }
  glPopMatrix();
  endTexture();
}