void drawGame( ) { cleanFrameBuffer( ); drawSnake(snake); drawFruit(fruit); drawFrameBuffer( ); }
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(); }
// 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
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); }