Dependents:   Telecommande_prologue

Revision:
0:7e26ffa50bc4
Child:
1:230bf719a4f0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 03 13:31:50 2011 +0000
@@ -0,0 +1,54 @@
+#include "mbed.h"
+#include "Screens.h"
+
+Screens :: Screens(PinName Tx,PinName Rx,PinName rst){
+    ecran = new TFT_4DGL(p13,p14,p15);
+    ecran->baudrate(128000);
+    infos['baud']="128000";
+    }
+    
+Screens :: Screens(TFT_4DGL * p){
+    ecran = p;
+    ecran->baudrate(128000);
+    infos['baud']="128000";
+    }
+    
+void Screens :: background_color(int couleur){
+    ecran->background_color(couleur);
+    //_ecran.background_color(couleur);
+    }
+    
+void Screens :: rectangle(int x1, int y1 , int x2, int y2, int color) { 
+    //On regarde ce qu'il y avait avant de mettre le rectangle
+    int z = 0;
+    int back[abs(x1-x2) * abs(y1-y2)];
+    for(int i = x1 ; i <= x2; i++){
+        for(int j = y1; j <=y2; j++){
+            back[z]= ecran->read_pixel(i, j);
+            z++;
+            }
+        }
+    ecran->rectangle(x1,y1,x2,y2,color);
+    Rectangle un_rectangle(x1,y1,x2,y2,color,back);
+    tab_rectangles[sizeof(tab_rectangles)/sizeof(un_rectangle)] = un_rectangle;
+    }  
+    
+void Screens :: deplace(Rectangle lerectangle, int x, int y){
+     int x1 = lerectangle.getX1();
+     int x2 = lerectangle.getX2();
+     int y1 = lerectangle.getY1();
+     int y2 = lerectangle.getY2();
+     int *  val_color = lerectangle.getBack();
+     int z = 0;
+     for(int i = x1 ; i <= x2; i++){
+        for(int j = y1; j <=y2; j++){
+            ecran->pixel(i,j,val_color[z]);
+            z++;
+            }
+        }
+    }
+    
+void Screens :: baudrate(int bauds){
+    ecran->baudrate(bauds);
+     infos['baud']=(char*)bauds;
+    }
\ No newline at end of file