Dependencies: 4DGL Rectangle mbed Screens
Revision 1:b8c8bc16d6a1, committed 2011-05-03
- Comitter:
- projetremote
- Date:
- Tue May 03 13:37:57 2011 +0000
- Parent:
- 0:55bfec6d748f
- Commit message:
Changed in this revision
diff -r 55bfec6d748f -r b8c8bc16d6a1 Screens.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Screens.lib Tue May 03 13:37:57 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/projetremote/code/Screens/#230bf719a4f0
diff -r 55bfec6d748f -r b8c8bc16d6a1 Screens/Screens.h --- a/Screens/Screens.h Tue May 03 13:36:16 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#include "mbed.h" -#include "TFT_4DGL.h" -#include "Rectangle.h" - -class Screens{ - protected : - char * infos[]; - TFT_4DGL * ecran; - Rectangle tab_rectangles[]; - public : - Screens(PinName Tx,PinName Rx,PinName rst); - Screens(TFT_4DGL * p); - - void background_color(int couleur); - - void rectangle(int x1, int y1 , int x2, int y2, int color); - - void deplace(Rectangle un_rec, int x, int y); - - void baudrate(int bauds); - }; \ No newline at end of file
diff -r 55bfec6d748f -r b8c8bc16d6a1 Screens/main.cpp --- a/Screens/main.cpp Tue May 03 13:36:16 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -#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
diff -r 55bfec6d748f -r b8c8bc16d6a1 main.cpp --- a/main.cpp Tue May 03 13:36:16 2011 +0000 +++ b/main.cpp Tue May 03 13:37:57 2011 +0000 @@ -10,7 +10,7 @@ char s[500]; int x = 0, y = 0, status, xc = 0, yc = 0; - tmp.background_color(0xFFFFFF); // Fond blancs + ecran->background_color(0xFFFFFF); // Fond blancs //ecran->rectangle(0, 100 , 0, 100, BLACK); // ecran.rectangle(190, 0, 190,SIZE_Y, 0x000000); // cadre noir //ecran.pen_size(WIREFRAME);