Escolar Documentos
Profissional Documentos
Cultura Documentos
h"
#include <stdlib.h>
#include <time.h>
#include <sstream>
#include <string>
using namespace std;
using namespace miniwin;
struct figura {
coordenada orig;
coordenada perif[3];
int color;
void tablero_vacia(mapa& T) {
for (int i = 0; i < tan_columnas; i++) {
for (int j = 0; j < tan_filas; j++) {
T[i][j] = BLANCO;
}
}
}
void tablero_pinta(const mapa& T) {
for (int i = 0; i < tan_columnas; i++) {
for (int j = 0; j < tan_filas; j++) {
color(T[i][j]);
cuadrado(i, j);
}
}
}
if (T[c.x][c.y] != BLANCO) {
return true;
}
}
return false;
}
for(int i=0;i<tan_columnas;i++){
if(T[i][fila]==BLANCO)return false;
}
return true;
}
for(int i=0;i<tan_columnas;i++){
T[i][0]=BLANCO;
}
}
}
}
return cont;
}
color(BLANCO);
for (int i=18;i<25;i++){
rectangulo(i,i,tan_general*tan_columnas+8+i,tan_general*tan_filas+8+i);
}
for (int i=92;i<100;i++){
rectangulo(99-i,99-
i,tan_general*tan_columnas+100+i,tan_general*tan_columnas+220+i);
}
texto(tan_general*tan_columnas+50,20, "&&&&&&&&&&&&&&&&&&&&&&&");
texto(tan_general*tan_columnas+60,60, "& &");
texto(tan_general*tan_columnas+60,80, "& TETRIS &");
texto(tan_general*tan_columnas+60,100,"& &");
texto(tan_general*tan_columnas+60,140,"& INSTRUCCIONES: &");
texto(tan_general*tan_columnas+60,160,"& ROTAR: ESPACIO &");
texto(tan_general*tan_columnas+60,190,"& DESPLAZAMIENTO &");
texto(tan_general*tan_columnas+60,205,"& DERECHA:FLECHA D &");
texto(tan_general*tan_columnas+60,225,"& IZQUIERDA: FLECHA I &");
texto(tan_general*tan_columnas+60,240,"& ACELERAR: FLECHA AB &");
texto(tan_general*tan_columnas+60,280,"&&&&&&&&&&&&&&&&&&&&&&&");
texto(tan_general*tan_columnas+60,300," ");
texto(tan_general*tan_columnas+60,320,"$ $");
texto(tan_general*tan_columnas+60,335,"$ $");
texto(tan_general*tan_columnas+60,350,"$ $");
texto(tan_general*tan_columnas+58,380,"$ PUNTOS POR LINEA $");
texto(tan_general*tan_columnas+60,395,muestra_puntos(puntos));
texto(tan_general*tan_columnas+60,430,"Siguiente pieza");
pinta_pieza(P);
pinta_pieza(S);
refresca();
}
int main() {
srand(time(NULL));
vredimensiona(tan_general*tan_columnas + 200,tan_general*tan_filas + 70);
int freno;
int puntos=100;
mapa T;
tablero_vacia(T);
tablero_pinta(T);
figura copia;
figura cuadrada, siguiente;
pieza_nueva(cuadrada);
pieza_nueva(siguiente);
pinta_pieza(cuadrada);
refresca();
int t=tecla();
while (t!= ESCAPE){
copia=cuadrada;
if (freno>30){
freno=0;
t=ABAJO;
}
int x=cuadrada.orig.x;
int y=cuadrada.orig.y;
if (t==DERECHA) cuadrada.orig.x++;
if (cont>=1) puntos=puntos+cont;
cuadrada=siguiente;
pieza_nueva(siguiente);
cuadrada.orig.x=4;
cuadrada.orig.y=1;
}
borra();
}
if (t != NINGUNA){
borra();
tablero_pinta(T);
maquillaje(T,cuadrada,siguiente,puntos);
}
espera(20);
freno++;
t=tecla();
}
vcierra();
return 0;
}