void render_game(GameData* data, DrawConfig* config){ /* * Clear the window prior to any rendering */ render_clear(config); /* * Draw all componenets of the came */ render_background(data,config); render_all_pipes(data,config); render_score(data,config); render_bird(data,config); /* * Render GameOver message if the user has lost */ if(is_gameover(data)){ render_gameover_message(data,config); } /* * Update the users view to reflect changes */ SDL_RenderPresent(config->renderer); }
void loop() { is_diff_game_mode(); // different game modes movePaddle(); render_ball(); render_right_wall(); render_score(); render_lives(); lBtn2 = GPIOPinRead(BTN2Port, BTN2); if (lBtn2 == BTN2) { render_credits(); } ballMove(); OrbitOledUpdate(); oledReset(); }
t_game showGameOver(t_game game) { game.Gscreen = loadTexture( "/../../../images/background/main_menu.png", game.Grenderer ); game.begin.surface_play = TTF_RenderText_Solid(game.text.font, "GAME OVER", game.text.color); game.begin.play_with_2 = SDL_CreateTextureFromSurface(game.Grenderer, game.begin.surface_play); game.begin.play_with_2_position = init_position(135, 180, 180, 500); SDL_Delay(50); game.begin.state = 1; if (game.Gplayer1.lives == -1) { write_score(game, game.Gplayer1); game = init_player(game); } set_hscore(&game, get_hscore(hscore_path())); render_hscore(&(game.text), game.Grenderer); render_score(&(game.Gplayer1), game.text, game.Grenderer); renderEnd(game); return (game); }
void render_scores() { render_score(PLAYER1_SCORE_X, PLAYER1_SCORE_Y, player1_points); render_score(PLAYER2_SCORE_X, PLAYER2_SCORE_Y, player2_points); }
void render() { clear(); render_game(); render_score(); }