Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int loop_game(struct player * pl, struct windowlist * list_win, struct timer * timer, struct obstaclelist * list_ob, struct bulletlist * list_bu)
- {
- /* Time between the start and now */
- /* TODO: Declare elapsed as float -> run functions every half second etc. */
- unsigned int elapsed = (unsigned int) (time(NULL) - timer->begin);
- /* If the elapsed time is different from the one stored in the timer struct ... */
- if (elapsed != timer->elapsed)
- {
- /* ... store it in the timer struct and update the timer displayed in the game window */
- timer->elapsed = elapsed;
- loop_timer_display(timer, list_win->win_game);
- loop_bullets(list_win->win_game, list_bu, pl, list_ob);
- loop_obstacles(list_win->win_game, list_ob, list_bu, pl);
- }
- /* Update information windows */
- set_info(list_win->win_ammo, pl->ammo);
- set_info(list_win->win_health, pl->health);
- set_info(list_win->win_score, pl->score);
- if (pl->health == 0)
- {
- /* Debug */
- fprintf(debuglog, "loop_game()\n\tThe player is dead! Returning 0\n");
- fflush(debuglog);
- return 0;
- }
- else
- {
- loop_player(list_win->win_game, list_win->win_health, pl, list_bu, list_ob);
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement