示例#1
0
int main()
{
	//Vetor de opções do menu principal. Pode ser expandido, contanto que seja adaptada a variavel NUM_OPT
	char* options[] = {
			"Jogar",
			"Sair"
			};

	//String que monta a tela de apresentação do menu inicial.
	char title[] = 
"	===========================================================\n\
			PSYCHO TETRIS MEGA BETA\n\
	===========================================================";


	//String que monta a tela de game over.
	char gameover[] = 
"	===========================================================\n\
				GAMEOVER\n\
	===========================================================";

	int opt;
	inicializa_ncurses();
	if((opt = menu(options, NUM_OPT, title)) != 1)
	{
		start_game(opt);
		game_over(gameover);
	}

	finaliza_ncurses();
	return 0;
}
示例#2
0
文件: main.c 项目: lfmc/ps
int main(){
  inicia_ncurses();
  WINDOW* game = cria_tela();
  enable_keypad(game);
  cria_borda(game);
  tela_inicio(game);
  mostra_tela(game);
  int i;
  i = pega_input(game);
  formata_tela(game);
  cria_borda(game);
  tela_jogo(game);
  tp_peca peca = nova_peca();
  while(i!='q'){
    if(fim_do_movimento(game, &peca)){
      peca = nova_peca();
    }
    escreve_peca(game, peca);
    mostra_tela(game);
    apaga_peca(game, peca);
    if(movimento_valido(game, &peca, i)){
      mover_peca(&peca, i);
    }
    escreve_peca(game, peca);
    mostra_tela(game);
    i = pega_input(game);
    if(fim_do_movimento(game,  &peca)&&limite_superior(&peca)){
      break;
    }
  }
  formata_tela(game);
  cria_borda(game);
  tela_fim(game);
  mostra_tela(game);
  i = pega_input(game);
  finaliza_ncurses();
  return 0;
}