예제 #1
0
파일: main.c 프로젝트: Gwagwa7/Arkanoid
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;
	}
}
예제 #2
0
파일: main.c 프로젝트: Swetha5/gnome-games
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));
    }
  }
}