Ejemplo n.º 1
0
/** Main entry point for the game. I kept it as simple as I could. */
int main(int argc, char* argv[])
{
	global = new_globals();

	config_handle();

/* Windows doesnt support getopt_long(). Ill need to work around this somehow */
#if !OS_IS_WINDOWS
	args_handle(argc, argv);
#endif

	engine_init();
	atexit(engine_exit); /* no need to call it when quitting */

	game_s game = new_game();
	engine_draw(&game);

	while (!game.quit)
	{
		int c = engine_get_input(game.speed);

		game_handle_input(&game, c);
		game_update(&game);

		if (game.is_over)
			game = new_game();

		engine_draw(&game);
	}

	return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: hy0kl/yetris
/** Main entry point for the game. I kept it as simple as I could. */
int main(int argc, char* argv[])
{
	global = new_globals();

	config_handle();
	args_handle(argc, argv);

	engine_init();
	atexit(engine_exit); /* no need to call it when quitting */

	game_s game = new_game();
	engine_draw(&game);

	while (!game.quit)
	{
		int c = engine_get_input(game.speed);

		game_handle_input(&game, c);
		game_update(&game);

		/* THIS WILL BE UNCOMMENTED SOON */
		/* if (game.show_help) */
		/* { */
		/* 	engine_draw_help(); */
		/* 	engine_wait_for_keypress(); */
		/* 	game.show_help = false; */
		/* } */
		if (game.is_over)
		{
			game_over(&game);
			engine_draw_gameover(&game);
			engine_wait_for_keypress();
			game = new_game();
		}
		engine_draw(&game);
	}

	return EXIT_SUCCESS;
}