Brahian Stiv Sanchez Giraldo / Mbed 2 deprecated tetrispon

Dependencies:   mbed

Revision:
3:8a8ff76e84bc
Parent:
2:15facba8b8b4
diff -r 15facba8b8b4 -r 8a8ff76e84bc funcion_matriz.h
--- a/funcion_matriz.h	Sat Nov 17 04:44:57 2018 +0000
+++ b/funcion_matriz.h	Sun Nov 18 04:56:35 2018 +0000
@@ -43,11 +43,6 @@
      mat_tmp1[i]= mat_tmp[i];
     }
 }
-void d_ale()
-  {
-      num=rand()%5+1;
-      mcol=4;
-      }
 void ingred_d() //Tipo de figuras
 {
 uint8_t  tf=dat[0];
@@ -76,13 +71,41 @@
   void mover_fig()//mueve la figura por medio de botones 
 {
     analogo();
-   
-    if(my>0.8)
+
+
+    if(mx<0.1)
+    {
+        int temp1 = mat_tmp[i+1]&(0x01); 
+        if(temp1==0)
+         {
+                for(int i=0;i<7;i++)
+                {
+                mat_tmp[i]=mat_tmp[i]>>1;
+                 }
+          }
+     } //mover figura a la derecha
+       
+   if(mx>0.9)
+    {
+        int temp2 = mat_tmp[i+2]&(0x80); 
+        if(temp2==0)
+            {
+                for(int i=0;i<7;i++)
+                {
+                    mat_tmp[i]=mat_tmp[i]<<1; 
+                }
+            }//mover figura a la izquierda
+         }
+   }
+
+void rotar_fig()
+{
+    analogo();
+    if(my>0.6)
     {
         grad++;
         if(grad<5)
         {
-        
             switch (grad)
             {
             case 1:
@@ -111,45 +134,25 @@
         {
             grad=0;
         }
-    }
-    if(mx<0.3)
-    {
-        int temp1 = mat_tmp[i+1]&(0x01); 
-        if(temp1==0)
-         {
-                for(int i=0;i<7;i++)
-                {
-                mat_tmp[i]=mat_tmp[i]>>1;
-                 }
-          }
-     } //mover figura a la derecha
-       
-    if(mx>0.8)
-    {
-        int temp2 = mat_tmp[i+2]&(0x80); 
-        if(temp2==0)
+    } 
+}
+
+void act_matrix(uint8_t*temp)//Evalua figura guardada y su espacio
+{ 
+      for (int i=0;i<9;i++)
+      {
+        save=*(temp+2)& mat_act[i];
+            if (save==0 )
             {
-                for(int i=0;i<7;i++)
-                {
-                    mat_tmp[i]=mat_tmp[i]<<1; //mover izquierda
-                }
-            }//mover figura a la izquierda
-     }
-}
-void act_matrix(uint8_t*  temp)//Evalua figura guardada y su espacio
-{ 
-      for (int i=0;i<9;i++){
-        save=*(temp+2)& mat_act[i];
-        if (save==0 )
-        {
-            fila=i+1;
-        }
-        if (save!=0)
-        {
-            fila=i;                                  
-        i=9;
-        }
-        }
+                fila=i+1;
+            }
+            if (save!=0)
+            {
+                fila=i;                                  
+                i=9;
+            }
+      }
+         
 }
  
 void guardar_mat(uint8_t *temp)//guarda la matriz
@@ -157,10 +160,20 @@
         mat_act[fila-3]=(*(temp+0))| mat_act[fila-3];
         mat_act[fila-2]=(*(temp+1))| mat_act[fila-2];
         mat_act[fila-1]=(*(temp+2))| mat_act[fila-1];
+       
 };
+void most_fail()
+{ 
+
+            if(j+1==7){
+                mat_act[i] = 0x00;
+                mat_act[i+1] = 0x00;}
+        
+        
+}
 void elim_lin()
 {
-    for(int i=0;i<9;i++){
+    for(i=0;i<9;i++){
         if(mat_act[i]==255){
             for(uint8_t a=i;a>=1;a--){
                 sendSPI(a,mat_act[a-1]);