static void app(t_game *game) { t_level *current; init_glfw(game); current = game->levels; while (current) { load_level(game, current); while (!glfwWindowShouldClose(game->window) && !game->win) { update_time(game); if (game->started && !game->paused) { do_gl_stuff(game); move_ball(game); check_collision(game); draw_stuff(game); check_game_state(game); glfwSwapBuffers(game->window); usleep(12500); } glfwPollEvents(); usleep(100); } current = current->next; } }
static void process_move3 (gint c) { play_sound (SOUND_DROP); vstr[++moves] = '1' + c; vstr[moves + 1] = '0'; check_game_state (); if (gameover) { score[winner]++; scorebox_update (); prompt_player (); } else { swap_player (); if (!is_player_human ()) { if (player == PLAYER1) { vstr[0] = vlevel[p.level[PLAYER1]]; } else { vstr[0] = vlevel[p.level[PLAYER2]]; } c = playgame (vstr, vboard) - 1; if (c < 0) gameover = TRUE; g_timeout_add (SPEED_DROP, (GSourceFunc) next_move, GINT_TO_POINTER (c)); } } }