Ejemplo n.º 1
0
void drawGame( )
{
    cleanFrameBuffer( );
    drawSnake(snake);
    drawFruit(fruit);
    drawFrameBuffer( );
}
Ejemplo n.º 2
0
void		OPENGL_Nib::updateDraw(const Snake & s, const Fruit & f,
				       const std::pair<int, int>& map)
{
  glClear(GL_COLOR_BUFFER_BIT);
  draw_board(map);
  drawFruit(f);
  drawSnake(s);
  glFlush();
  SDL_GL_SwapBuffers();
}
Ejemplo n.º 3
0
// Draws 3 leaves around the end of a branch.. once upon a time
void terminatingLeaf(void) {
    if (!drawLeaves) {
        return;
    } // if
    
    if ( (rand() % 100)  < 2) {
        drawFruit();
    } else {
        pushMatrix();
        rotateBy( (rand() % 90), 0, 0, 1);
        rotateBy( -(rand() % 10), 0, 1, 0);
        drawLeaf();
        popMatrix();
    } // if-else
} // terminatingLeaf
Ejemplo n.º 4
0
void	Display::play()
{
  Map	*map	= _game->getMap();
  Snake	*snake	= _game->getSnake();

  Shader	colorShader("Shaders/couleur2D.vert", "Shaders/couleur2D.frag");

  colorShader.load();
  
  glClear(GL_COLOR_BUFFER_BIT);
  
  glUseProgram(colorShader.getProgramID());

  drawBackground();
  drawWalls();
  drawFruit(*map);
  
  drawSnake(*snake);

  glUseProgram(0);
  
  SDL_GL_SwapWindow(_window);
}