-
Notifications
You must be signed in to change notification settings - Fork 0
/
telas.c
154 lines (120 loc) · 3.22 KB
/
telas.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "boleanos.h"
#include "porrinha.h"
void tela_todos_os_palitos(struct jogad jogadores[], int num, int kz)
{
char *nomes[4];
int i;
nomes[0] = "Jogador 1";
nomes[1] = "Bruno";
nomes[2] = "Rodrigo";
nomes[3] = "Iuri";
JANELA1();
for (i = 0; i <= num; i++) {
POS(4, i*19+5);
printf("%s", nomes[i]);
POS(5, i*19+5);
if (kz == TRUE) { // mostrar palitos dos outros jogadores
printf("Tinha %d na mao", jogadores[i].palitos);
} else {
if (i == 0) {
printf("Palitos na mao: %d", jogadores[0].palitos);
} else {
printf("Palitos na mao: ?");
}
;;
}
;;
if (jogadores[i].palpite >= 0) {
POS(6, i*19+5);
printf("Palpite: %d", jogadores[i].palpite);
}
desenha_palitos(8, i*19+5, jogadores[i].tpalitos);
}
}
//desenha n palitos na posicao linha, coluna
void desenha_palitos(int x, int y, int n)
{
int i, j;
for(i=0; i<n; i++)
{
POS(x, y+i*2);
printf("\x1B[4%cm ", VERMELHO);
for(j=1; j<=TAMANHO_PALITO; j++)
{
POS(x+j, y+i*2);
printf("\x1B[4%cm ", BRANCO);
}
}
printf("\x1B[4%cm ", AZUL);
return;
}
void desenha_janela(int x1, int y1, int x2, int y2, char cor_fundo)
{
int i, j;
for(i=y1; i<=y2; i++) //bordas superior e inferior
{
POS(x1, i);
printf("\x1B[4%cm ", BRANCO);
POS(x2, i);
printf("\x1B[4%cm ", BRANCO);
}
for(i=x1; i<=x2; i++)//bordas esquerda e direita
{
POS(i, y1);
printf("\x1B[4%cm ", BRANCO);
POS(i, y2);
printf("\x1B[4%cm ", BRANCO);
}
for(i=x1+1; i<=x2-1; i++)
{
for(j=y1+2; j<=y2-1; j++)
{
POS(i, j);
printf("\x1B[4%cm ", cor_fundo);
}
}
}
void tela_inicial()
{
int i = 4; // linha inicial
JANELA1();
POS(i++, 15);
printf(" PORRINHA FIGHT "); POS(i++,15);
printf(" "); POS(i++,15);
printf(" COMPONENTES "); POS(i++,15);
printf(" Allison da Costa "); POS(i++,15);
printf(" Bruno Cruz "); POS(i++,15);
printf(" Gabriel Dias "); POS(i++,15);
printf(" Iuri Gomes "); POS(i++,15);
printf(" Rafael Chacon "); POS(i++,15);
printf(" Rodrigo Pereira "); POS(i++,15);
JANELA2();
STATUS();
}
;;
void tela_saida()
{
LIMPAR_TELA();
desenha_janela(5,10,19,70, PRETO);
POS(7,23);
printf("OBRIGADO POR JOGAR PORRINHA FIGHT");
POS(23,0);
printf("\x1B[4%cm ", PRETO); //deixa o fundo preto
}
;;
void tela_rodada(int num)
{
POS (25,62);
printf("Rodada número [%2d]", num);
}
void tela_num_jogadores(int *num)
{
POS(18,5);
printf("Digite o número de oponentes (de 1 a 3): "); scanf("%d", num);
if (*num < 1 || *num > 3) {
POS (25,1);
printf("numero de jogadores invalido");
tela_num_jogadores(num);
}
;;
}