Exemplo n.º 1
0
void teste_DT_verificaNovaTela_Y () {
	Tela teste;

	teste = nova_tela();
	CU_ASSERT_TRUE(teste.y);
}
Exemplo n.º 2
0
void teste_DT_verificaNovaTela_invis () {
	Tela teste;

	teste = nova_tela();
	CU_ASSERT_TRUE(!teste->bloco[15][8].tipo);
}
Exemplo n.º 3
0
EXT_MOD_GAME void start_game(int difficulty)
{
	Tela *tela;
	Peca *peca, *prox_peca;
	int end=0, in;
	WINDOW* main;

	srand(time(NULL));
	tela = nova_tela();

	prox_peca = nova_peca(tela, -TELA_LARGURA/2, TELA_ALTURA/8-1);

	while(!end)
	{
		clock_t ini;
		peca = prox_peca;
		prox_peca = nova_peca(tela, -TELA_LARGURA/2, TELA_ALTURA/8-1);

		peca_move_x(peca, TELA_LARGURA);

		if(peca_touching(peca, tela, 's'))
		{
			deleta_peca(peca);
			break;
		}
		
		ini = clock();
		while(!end)
		{
			clock_t now;

			mostra_tela(tela);
			mostra_peca(peca);
			mostra_peca(prox_peca);
			refresh();

			in = pega_input(1);
			switch(in)
			{
				case 'S':
				case 's':
					if(!peca_touching(peca, tela, 's'))
						peca_move_y(peca, 1);		
				break;

				case 'A':
				case 'a':
					if(!peca_touching(peca, tela, 'a'))
						peca_move_x(peca, -1);
				break;

				case 'D':
				case 'd':
					if (!peca_touching(peca, tela, 'd'))
						peca_move_x(peca, 1);
				break;

				case ENTER:
					prende_peca(peca, tela);
				break;
				
				case 'q': 
				case 'Q':
					end = 1;
				break;

				case ESC:
					set_color(COR_TELA);
					mvaddstr(tela->y + TELA_ALTURA/2 -1, tela->x + TELA_LARGURA/2 + 2, "PAUSED");
					do {in = getch();}
					while(in != ESC && in!='q' && in!='Q');

					if(in == 'q' || in == 'Q')
					{
						end = 1;
						deleta_peca(peca);
					}
				break;		
			}
			clear();
			if(end) break;
			now = clock();
			if(now - ini > 5)
			{
				peca_move_y(peca, 1);
				ini = clock();
			}
			if(peca_touching(peca, tela, 's'))
			{
				prende_peca(peca, tela);
				deleta_peca(peca);
				break;
			}
		}

		if(endgame(tela))
		{
			end = 1;
			deleta_tela(tela);
		}
	}

}