Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/

Files at this revision

API Documentation at this revision

Comitter:
adelino
Date:
Sun Apr 05 13:54:48 2015 +0000
Parent:
0:65fd8b1cbf86
Commit message:
PicasoLib version 2

Changed in this revision

Button.cpp Show annotated file Show diff for this revision Revisions of this file
Button.h Show annotated file Show diff for this revision Revisions of this file
Buzzer.cpp Show annotated file Show diff for this revision Revisions of this file
Buzzer.h Show annotated file Show diff for this revision Revisions of this file
Circle.cpp Show annotated file Show diff for this revision Revisions of this file
Circle.h Show annotated file Show diff for this revision Revisions of this file
Diamond.cpp Show annotated file Show diff for this revision Revisions of this file
Diamond.h Show annotated file Show diff for this revision Revisions of this file
Digit3Led.cpp Show annotated file Show diff for this revision Revisions of this file
Digit3Led.h Show annotated file Show diff for this revision Revisions of this file
DigitLed.cpp Show annotated file Show diff for this revision Revisions of this file
DigitLed.h Show annotated file Show diff for this revision Revisions of this file
Ellipse.cpp Show annotated file Show diff for this revision Revisions of this file
Ellipse.h Show annotated file Show diff for this revision Revisions of this file
GraphicLed.cpp Show annotated file Show diff for this revision Revisions of this file
GraphicLed.h Show annotated file Show diff for this revision Revisions of this file
Isocele.cpp Show annotated file Show diff for this revision Revisions of this file
Isocele.h Show annotated file Show diff for this revision Revisions of this file
Keyboard.cpp Show annotated file Show diff for this revision Revisions of this file
Keyboard.h Show annotated file Show diff for this revision Revisions of this file
Label.cpp Show annotated file Show diff for this revision Revisions of this file
Label.h Show annotated file Show diff for this revision Revisions of this file
Nunchuk.cpp Show annotated file Show diff for this revision Revisions of this file
Nunchuk.h Show annotated file Show diff for this revision Revisions of this file
ObjetGraphic.cpp Show diff for this revision Revisions of this file
ObjetGraphic.h Show diff for this revision Revisions of this file
PicasoSerial.cpp Show annotated file Show diff for this revision Revisions of this file
PicasoSerial.h Show annotated file Show diff for this revision Revisions of this file
Player.cpp Show annotated file Show diff for this revision Revisions of this file
Player.h Show annotated file Show diff for this revision Revisions of this file
Rectangle.cpp Show annotated file Show diff for this revision Revisions of this file
Rectangle.h Show annotated file Show diff for this revision Revisions of this file
Scaler.cpp Show annotated file Show diff for this revision Revisions of this file
Scaler.h Show annotated file Show diff for this revision Revisions of this file
Screen.cpp Show annotated file Show diff for this revision Revisions of this file
Screen.h Show annotated file Show diff for this revision Revisions of this file
Segment.cpp Show annotated file Show diff for this revision Revisions of this file
Segment.h Show annotated file Show diff for this revision Revisions of this file
Slider.cpp Show annotated file Show diff for this revision Revisions of this file
Slider.h Show annotated file Show diff for this revision Revisions of this file
Sprite.cpp Show annotated file Show diff for this revision Revisions of this file
Sprite.h Show annotated file Show diff for this revision Revisions of this file
Switcher.cpp Show annotated file Show diff for this revision Revisions of this file
Switcher.h Show annotated file Show diff for this revision Revisions of this file
Triangle.cpp Show annotated file Show diff for this revision Revisions of this file
Triangle.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Button.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,146 @@
+#include "Button.h"
+
+Button::Button(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,string _text,Font _font,
+               Color _colorText,Color _colorBtn,State _state):
+    Widget(mScreen,_id,_x,_y,0,0,_colorBtn)
+
+{
+    myText=_text;
+    myFont=_font;
+    myColorText=_colorText;
+
+    myState=_state;
+    myType=OBJ_BUTTON;
+
+    //
+    UINT16 largeur=0;
+    UINT16 hauteur=16;
+    UINT16 taille=0;
+    UINT16 incLargeur=12;
+
+    switch(_font) {
+            //
+        case FONT_2:
+            incLargeur=8;
+            hauteur=8;
+            largeur=8;
+            break;
+
+            //
+        case FONT_3:
+            incLargeur=8;
+            hauteur=12;
+            largeur=8;
+            break;
+            //
+        case FONT_1:
+            incLargeur=5;
+            hauteur=7;
+            largeur=5;
+            break;
+
+            //
+        default:
+            incLargeur=12;
+            hauteur=16;
+            largeur=8;
+            break;
+    }
+
+    //cherche taille
+
+    taille=_text.size();
+
+    largeur=taille*incLargeur;
+
+    if(largeur > incLargeur)
+        largeur=largeur-incLargeur;
+
+    myWidth=largeur+incLargeur+incLargeur;
+    myHeight=hauteur+incLargeur+incLargeur;
+
+    myScreen->addWidget((Widget*) this);
+
+    //
+
+}
+//--------------------------------------
+Button::~Button(void)
+{
+}
+//---------------------------------------
+void Button::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+
+    State state=getState();
+
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    switch(state) {
+            //
+        case BUTTON_STATE_PRESSED:
+            if(ps!=0) {
+                ps->draw_button(myText,myX,myY,myFont,BUTTON_STATE_PRESSED,myColor,WHITE);
+
+            }
+            ps=0;
+            return;
+            //
+        case BUTTON_STATE_RELEASED:
+            if(ps!=0) {
+                ps->draw_button(myText,myX,myY,myFont,BUTTON_STATE_RELEASED,myColor,myColorText);
+
+            }
+            ps=0;
+            return;
+            //
+        default:
+            break;
+    }
+}
+
+//-----------------------------------
+void Button::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//------------------------------------
+void Button::setState(State _state)
+{
+    if(myIsVisible==false)
+        return;
+
+    if(myState==_state)
+        return;
+
+    myState=_state;
+
+    this->draw();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Button.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,39 @@
+#ifndef BUTTON_H
+#define BUTTON_H
+
+#include "Screen.h"
+
+class Button:public Widget
+{
+public:
+    /** Construct a Button
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _x up left
+    * @params _y up left
+    * @params _text
+    * @params _font
+    * @params _colorText
+    * @params _colorBtn
+    * @params _state BUTTON_STATE_PRESSED or BUTTON_STATE_RELEASED,
+    */
+    Button(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,string _text,Font _font,
+           Color _colorText,Color _colorBtn,State _state);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Button(void);
+
+    //setter
+    void setInvisible(bool _state);
+    //
+    void setState(State _state);
+
+protected:
+    string myText;
+    Font myFont;
+    Color myColorText;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Buzzer.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,561 @@
+#include "mbed.h"
+#include "Buzzer.h"
+
+const int tab_A[]= {NOTE_A3,NOTE_A4,NOTE_A5,NOTE_A6,NOTE_A7};
+
+const int tab_AS[]= {NOTE_AS3,NOTE_AS4,NOTE_AS5,NOTE_AS6,NOTE_AS7};
+
+const int tab_B[]= {NOTE_B3,NOTE_B4,NOTE_B5,NOTE_B6,NOTE_B7};
+
+const int tab_BS[]= {NOTE_C3,NOTE_C4,NOTE_C5,NOTE_C6,NOTE_C7};
+
+const int tab_C[]= {NOTE_C3,NOTE_C4,NOTE_C5,NOTE_C6,NOTE_C7};
+
+const int tab_CS[]= {NOTE_CS3,NOTE_CS4,NOTE_CS5,NOTE_CS6,NOTE_CS7};
+
+const int tab_D[]= {NOTE_D3,NOTE_D4,NOTE_D5,NOTE_D6,NOTE_D7};
+
+const int tab_DS[]= {NOTE_DS3,NOTE_DS4,NOTE_DS5,NOTE_DS6,NOTE_DS7};
+
+const int tab_E[]= {NOTE_E3,NOTE_E4,NOTE_E5,NOTE_E6,NOTE_E7};
+
+const int tab_ES[]= {NOTE_F3,NOTE_F4,NOTE_F5,NOTE_F6,NOTE_F7};
+
+const int tab_F[]= {NOTE_F3,NOTE_F4,NOTE_F5,NOTE_F6,NOTE_F7};
+
+const int tab_FS[]= {NOTE_FS3,NOTE_FS4,NOTE_FS5,NOTE_FS6,NOTE_FS7};
+
+const int tab_G[]= {NOTE_G3,NOTE_G4,NOTE_G5,NOTE_G6,NOTE_G7};
+
+const int tab_GS[]= {NOTE_GS3,NOTE_GS4,NOTE_GS5,NOTE_GS6,NOTE_GS7};
+
+#define isDigit(n)   (n>='0' && n <= '9')
+
+//------------------------------
+Note::Note(char _note,bool _isSharp,char _octave,int _duration):
+    myNoteChar(_note),myIsSharp(_isSharp),myOctave(_octave),myDuration(_duration)
+{
+    myPeriod_us=calculatePeriod_us();
+}
+//--------------------------------
+Note::Note(char* str,int _duration):myDuration(_duration)
+{
+    parse(str);
+    myPeriod_us=calculatePeriod_us();
+}
+//--------------------------------
+void Note::parse(const char* _str)
+{
+    int i=0;
+
+    for(i=0; i<3; i++) {
+        switch(_str[i]) {
+                //
+            case 'R':
+                myNoteChar='R';
+                break;
+                
+            case 'r':
+             myNoteChar='R';
+                break;
+            
+                //
+            case 'A':
+                myNoteChar='A';
+                break;
+            case 'a':
+                 myNoteChar='A';
+                break;
+                //
+                //
+            case 'B':
+                myNoteChar='B';
+                break;
+                //
+                case 'b':
+                myNoteChar='B';
+                break;
+                //
+            case 'C':
+                myNoteChar='C';
+                break;
+            case 'c':
+                myNoteChar='C';
+                break;
+                //
+            case 'D':
+                myNoteChar='D';
+                break;
+            case 'd':
+                myNoteChar='D';
+                break;
+                //
+                //
+            case 'E':
+                myNoteChar='E';
+                break;
+                //
+               case 'e':
+               myNoteChar='E';
+                break;
+                //
+            case 'F':
+                myNoteChar='F';
+                break;
+                //
+            case 'f':
+                myNoteChar='F';
+                break;
+                //
+            case 'G':
+                myNoteChar='G';
+                break;
+                //
+                case 'g':
+                 myNoteChar='G';
+                break;
+                //
+            case '%':
+                myIsSharp=false;
+                break;
+                //
+                //
+            case '#':
+                myIsSharp=true;
+                break;
+                //
+                //
+            case '3':
+                myOctave=3;
+                break;
+                //
+                //
+            case '4':
+                myOctave=4;
+                break;
+                //
+                //
+            case '5':
+                myOctave=5;
+                break;
+                //
+                //
+            case '6':
+                myOctave=6;
+                break;
+                //
+                //
+            case '7':
+                myOctave=7;
+                break;
+
+            default:
+                myNoteChar='R';
+                break;
+        }
+        //
+    }
+    //
+
+}
+//--------------------------------
+int Note::calculatePeriod_us(void)
+{
+    switch(myNoteChar) {
+            //
+        case 'p':
+            return NOTE_R;
+            //
+        case 'R':
+            return NOTE_R;
+            //
+        case 'r':
+            return NOTE_R;
+            //
+        case 'A':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_A[myOctave-3];
+                } else {
+                    return tab_AS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'a':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_A[myOctave-3];
+                } else {
+                    return tab_AS[myOctave-3];
+                }
+            }
+            break;
+            //
+        case 'B':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_B[myOctave-3];
+                } else {
+                    return tab_BS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'b':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_B[myOctave-3];
+                } else {
+                    return tab_BS[myOctave-3];
+                }
+            }
+            break;
+            //
+        case 'C':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_C[myOctave-3];
+                } else {
+                    return tab_CS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'c':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_C[myOctave-3];
+                } else {
+                    return tab_CS[myOctave-3];
+                }
+            }
+            break;
+            //
+            //
+        case 'D':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_D[myOctave-3];
+                } else {
+                    return tab_DS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'd':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_D[myOctave-3];
+                } else {
+                    return tab_DS[myOctave-3];
+                }
+            }
+            break;
+            //
+        case 'E':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_E[myOctave-3];
+                } else {
+                    return tab_ES[myOctave-3];
+                }
+            }
+            break;
+            //
+             case 'e':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_E[myOctave-3];
+                } else {
+                    return tab_ES[myOctave-3];
+                }
+            }
+            break;
+            //
+        case 'F':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_F[myOctave-3];
+                } else {
+                    return tab_FS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'f':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_F[myOctave-3];
+                } else {
+                    return tab_FS[myOctave-3];
+                }
+            }
+            break;
+            //
+        case 'G':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_G[myOctave-3];
+                } else {
+                    return tab_GS[myOctave-3];
+                }
+            }
+            break;
+            //
+            case 'g':
+            //
+            if(myOctave >=3 && myOctave <=7) {
+                if(myIsSharp==false) {
+                    return tab_G[myOctave-3];
+                } else {
+                    return tab_GS[myOctave-3];
+                }
+            }
+            break;
+            //
+        default:
+            break;
+    }
+
+    return 0;
+}
+//--------------------------------
+int Note::getNotePeriod_us(void) const
+{
+    return this->myPeriod_us;
+}
+//---------------------------------
+bool Note::getIsSharp(void) const
+{
+    return this->myIsSharp;
+}
+//----------------------------------
+char Note::getNoteChar(void) const
+{
+    return this-> myNoteChar;
+}
+//----------------------------------
+char Note::getOctave(void) const
+{
+    return this->myOctave;  
+}
+//---------------------------------
+int Note::getDuration(void) const
+{
+    return this->myDuration;
+}
+//----------------------------------
+void Note::toString(char* buffer)
+{
+
+    buffer[0]= myNoteChar;
+    if(myIsSharp)
+        buffer[1]='#';
+    else
+        buffer[1]='%';
+
+    buffer[2]=myOctave+'0';
+
+    buffer[3]='\0';
+
+}
+//-----------------------------------
+
+
+Buzzer::Buzzer(PinName _pwmOut):PwmOut(_pwmOut)
+{
+    this->period_us(1);
+    this->pulsewidth_us(0);
+}
+//-----------------------------------
+void Buzzer::tone(const Note* _note)
+{
+    int mperiod = _note->getNotePeriod_us();
+
+    int dure=_note->getDuration();
+
+    this->period_us(mperiod);
+    this->pulsewidth_us(mperiod/2);
+
+    wait_ms(dure);
+    this->pulsewidth_us(0);
+
+
+    wait_ms(dure);
+
+}
+//-------------------------------------
+Buzzer::~Buzzer()
+{
+}
+//--------------------------------------
+Music::Music(const char* p)
+{
+    char defautDuree=4;
+    char defautOctave=6;
+    int bmp=63;
+
+    int ronde=0;
+    int dura=0;
+    int num=0;
+
+    char _note;
+    bool _issharp=false;
+    char _octave=0;
+
+    char newOctave=0;
+//
+    while(*p != ':')
+        p++;           //le titre
+
+    p++;    //skip :
+
+    //defaut duration
+    if(*p=='d') {
+        p++;
+        p++;    //skip d=
+
+
+        while(isDigit(*p)) {
+            num=(num*10)+(*p++-'0');
+        }
+        //
+        if(num >0)
+            defautDuree=num;
+        p++;    //skip ,
+    }
+    //
+    if(*p=='o') {
+        p++;
+        p++;    //skip o=
+
+        num=*p++ -'0';
+
+        if(num >=3 && num <=7)
+            defautOctave=num;
+
+        p++;    //skip ,
+
+    }
+    //
+    if(*p =='b') {
+        p++;
+        p++;    //skip b=
+        num=0;
+
+        while(isDigit(*p)) {
+            num=num*10+(*p++ -'0');
+        }
+        bmp=num;
+        p++;    //skip :
+    }
+    //
+    ronde=(60*500/bmp)*4;      // in ms
+
+    //les notes
+    while(*p) {
+        //ge t duration if available
+        num=0;
+        while(isDigit(*p)) {
+            num=(num*10)+(*p++ -'0');
+        }
+        if(num)
+            dura=ronde/num;
+        else
+            dura=ronde/defautDuree;
+        //la note
+        _note=*p;
+
+        p++;
+        //issharp
+        if(*p=='#') {
+            _issharp=true;
+            p++;
+        } else {
+            _issharp=false;
+
+        }
+        //un point ?
+        if(*p=='.') {
+            dura+=dura/2;
+            p++;
+        }
+        //
+        //nouvelle octave
+        if(isDigit(*p)) {
+            newOctave =*p - '0';
+            p++;
+        }
+
+        if(newOctave >0)
+            _octave=newOctave;
+
+        else {
+            _octave=defautOctave;
+        }
+
+        //
+        if(*p==',')
+        {
+        p++;
+         myTabNotes.push_back(new Note(_note,_issharp,_octave,dura));
+        }
+       
+        
+        
+
+    }   
+}
+//--------------------------------------
+int Music::getNumbersNotes(void) const
+{
+    return this->myTabNotes.size();
+}
+
+//--------------------------------------
+void  Music::play(Buzzer* _buzzer)
+{
+    /*
+        char buffer[10];
+        int duration=0;
+
+        for(int i=0; i< myTabNotes.size(); i++) {
+            myTabNotes[i]->toString(buffer);
+            duration=myTabNotes[i]->getDuration();
+
+            pc.printf(" %s:%d \n\r",buffer,duration);
+        }
+     */
+
+    for(int i=0; i< myTabNotes.size(); i++) {
+        _buzzer->tone(myTabNotes[i]);
+    }
+
+
+}
+//--------------------------------------
+Music::~Music()
+{
+    for(int i=0; i< myTabNotes.size(); i++) {
+        delete(myTabNotes[i]);
+        myTabNotes[i]=0;
+    }
+}
+//--------------------------------------
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Buzzer.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,210 @@
+#ifndef BUZZER_H
+#define BUZZER_H
+#include "mbed.h"
+#include <vector>
+
+/** This is a simple sound library for mbed.I use the RTTTL format
+http://en.wikipedia.org/wiki/Ring_Tone_Transfer_Language
+
+Example
+@code
+#include "Buzzer.h"
+
+char *song = "The Simpsons:d=4,o=5,b=160:c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g,8p,8p,8f#,8f#,8f#,8g,a#.,8c6,8c6,8c6,c6";
+
+Buzzer buzzer(p21);
+
+Music* pMusic=0;    //the song
+Note la("A#4",50);  //the sound
+
+int main()
+{
+   pMusic= new Music(song);
+   pMusic->play(&buzzer);
+
+   buzzer.tone(&la);
+   delete(pMusic);
+}
+@endcode
+*/
+
+// notes definition
+#define NOTE_R      0
+
+//octave 3
+#define NOTE_C3     7644
+#define NOTE_CS3    7215
+#define NOTE_D3     6810
+#define NOTE_DS3    6428
+#define NOTE_E3     6067
+#define NOTE_F3     5727
+#define NOTE_FS3    5405
+#define NOTE_G3     5102
+#define NOTE_GS3    4815
+#define NOTE_A3     4545
+#define NOTE_AS3    4290
+#define NOTE_B3     4049
+
+//octave 4
+#define NOTE_C4     3822
+#define NOTE_CS4    3607
+#define NOTE_D4     3405
+#define NOTE_DS4    3214
+#define NOTE_E4     3033
+#define NOTE_F4     2863
+#define NOTE_FS4    2702
+#define NOTE_G4     2551
+#define NOTE_GS4    2408
+#define NOTE_A4     2272
+#define NOTE_AS4    2145
+#define NOTE_B4     2024
+
+//octave 5
+#define NOTE_C5     1911
+#define NOTE_CS5    1804
+#define NOTE_D5     1702
+#define NOTE_DS5    1607
+#define NOTE_E5     1516
+#define NOTE_F5     1432
+#define NOTE_FS5    1351
+#define NOTE_G5     1275
+#define NOTE_GS5    1204
+#define NOTE_A5     1136
+#define NOTE_AS5    1072
+#define NOTE_B5     1012
+
+//octave 6
+#define NOTE_C6     956
+#define NOTE_CS6    903
+#define NOTE_D6     852
+#define NOTE_DS6    803
+#define NOTE_E6     759
+#define NOTE_F6     716
+#define NOTE_FS6    676
+#define NOTE_G6     638
+#define NOTE_GS6    602
+#define NOTE_A6     568
+#define NOTE_AS6    536
+#define NOTE_B6     506
+
+//octave 7
+#define NOTE_C7     477
+#define NOTE_CS7    451
+#define NOTE_D7     426
+#define NOTE_DS7    402
+#define NOTE_E7     379
+#define NOTE_F7     358
+#define NOTE_FS7    338
+#define NOTE_G7     319
+#define NOTE_GS7    301
+#define NOTE_A7     284
+#define NOTE_AS7    268
+#define NOTE_B7     253
+//------------------------------
+class Note
+{
+public:
+    /** Construct a Note (sound) object.
+       *
+       * @param _note the note in range (A,a,B,b,C,c,D,d,E,e,F,f)
+       * @param _isSharp exemple A4 or A#4
+       * @param _duration the time duration
+       */
+
+    Note(char _note,bool _isSharp,char _octave,int _duration);
+
+    /** Construct a Note (sound) object.
+        *
+        * @param str exemple "C%4" or "C#4"
+        * @param _duration the time duration
+        */
+
+    Note(char* str,int _duration);// exemple "C%4" or "C#4"
+
+
+//setter
+
+//getter
+
+    ///    @returns the note period (PwmOutput)
+    int getNotePeriod_us(void)const ;
+
+    ///    @returns is Sharp
+    bool getIsSharp(void) const;
+
+    ///    @returns the note char
+    char getNoteChar(void) const;
+
+    ///    @returns the octave
+    char getOctave(void) const;
+
+    ///    @returns the duartion in ms
+    int getDuration(void) const;
+
+    ///use in debugging
+    void toString(char* buffer);
+
+
+protected:
+
+    int calculatePeriod_us(void);
+
+    void parse(const char* _str);
+
+    char myNoteChar;
+    bool myIsSharp;
+    char myOctave;  // 3->5
+    int myPeriod_us;
+    int myDuration;
+
+};
+//----------------------------------
+
+
+class Buzzer:public PwmOut
+{
+public:
+    /** Construct a Buzzer object.
+           *
+           * @param _pwmOut select the PwmOutput
+           */
+
+    Buzzer(PinName _pwmOut);
+    //
+    ~Buzzer();
+
+    /// The Buzzer tone a simple sound
+    void tone(const Note* _note);
+
+
+protected:
+
+};
+
+
+//----------------------------------
+class Music
+{
+public:
+    /** Construct a Music  object.
+       *
+       * @param p the RTTTL song
+       */
+    Music(const char* p);
+
+    ~Music();
+
+    /// play the music
+    void  play(Buzzer* _buzzer);
+
+    ///    @returns the music lenght
+    int getNumbersNotes(void) const;
+
+protected:
+    int nbNotes;
+    vector<Note*> myTabNotes;
+
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Circle.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,154 @@
+#include "Circle.h"
+
+Circle::Circle(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radius,Color _color):
+    Sprite(mScreen,0,_xc-_radius,_yc-_radius,_radius+_radius,_radius+_radius,_color)
+{
+    myRadius=_radius;
+    myCenterX=_xc;
+    myCenterY=_yc;
+    myType=OBJ_CIRCLE;
+
+    myScreen->addWidget((Widget*) this);
+
+}
+//-----------------------------------------
+Circle::~Circle(void)
+{
+}
+//------------------------------------------
+void Circle::draw(void)
+{
+// isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColor);
+    }
+    ps=0;
+}
+//------------------------------------------
+void Circle::setCenterX(UINT16 _xcenter)
+{
+    this->myCenterX=_xcenter;
+}
+//------------------------------------------
+void Circle::setCenterY(UINT16 _ycenter)
+{
+    this->myCenterY=_ycenter;
+}
+//------------------------------------------
+UINT16 Circle::getCenterX(void) const
+{
+    return this->myCenterX;
+}
+//-------------------------------------------
+UINT16 Circle::getCenterY(void) const
+{
+    return this->myCenterY;
+}
+//--------------------------------------------
+void Circle::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_circle(myCenterX,myCenterY,myRadius,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//----------------------------------------------
+void Circle::setNewPosition(INT16 _xcnew,INT16 _ycnew)
+{
+    setNewPosition(_xcnew,_ycnew,true);
+}
+//---------------------------------------------
+void Circle::setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myCenterX==_xcnew && myCenterY==_ycnew)
+        return;
+    //
+    this->setInvisible(true); // colorie le cir avec couleur de la screen
+
+    myIsVisible=true;
+
+    if(isScreenLimits) {
+
+        //test Xmax
+        if(_xcnew+myRadius >= myXMoveMax) {
+            _xcnew=myXMoveMax-myRadius;
+
+            if(myState==STATE_ON)
+                myState=BUMP_RIGHT;
+        }
+
+        //test Xmin
+        if(_xcnew <= myRadius) {
+            _xcnew=myXMoveMin+myRadius;
+
+            if(myState==STATE_ON)
+                myState=BUMP_LEFT;
+        }
+        //test Ymax
+        if(_ycnew +myRadius >= myYMoveMax && _ycnew >0) {
+            _ycnew = myYMoveMax- myRadius;
+
+            if(myState==STATE_ON)
+                myState=BUMP_DOWN;
+        }
+        //test yminMin;
+        if(_ycnew <= myRadius) {
+            _ycnew=myYMoveMin+myRadius;
+
+            if(myState==STATE_ON)
+                myState=BUMP_UP;
+        }
+    }
+    //
+    myCenterX=_xcnew;
+    myCenterY=_ycnew;
+
+    myX=_xcnew-myRadius;
+    myY=_ycnew-myRadius;
+
+
+    this->draw();
+}
+//----------------------------------------------
+void Circle::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        elementUpdate();
+
+    float xcnew=myCenterX+mySpeedX*delta;
+    float ycnew=myCenterY+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xcnew,(INT16)ycnew,true);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Circle.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,50 @@
+#ifndef CIRCLE_H
+#define CIRCLE_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+class Circle:public Sprite
+{
+public:
+    /** Construct a filled Circle
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _xc the center x
+    * @params _yc the center y
+    * @params _radius
+    * @param _color the background color
+    * @params _isVisible
+    */
+    Circle(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radius,Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Circle(void);
+    //
+    void update(float delta);
+
+// getter
+    UINT16 getCenterX(void) const;
+    //
+    UINT16 getCenterY(void)const;
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits);
+    //
+    void setCenterX(UINT16 _xcenter);
+    //
+    void setCenterY(UINT16 _ycenter);
+
+protected:
+    UINT16 myRadius;
+    UINT16 myCenterX;
+    UINT16 myCenterY;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Diamond.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,157 @@
+#include "Diamond.h"
+
+Diamond::Diamond(Screen* mScreen,UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
+                 UINT16 x3,UINT16 y3,UINT16 x4,UINT16 y4,Color _color):
+
+    Sprite(mScreen,0,x1,y4,x3-x1,y2-y4,_color)
+{
+    myX1=x1;
+    myY1=y1;
+
+    myX2=x2;
+    myY2=y2;
+
+    myX3=x3;
+    myY3=y3;
+
+    myX4=x4;
+    myY4=y4;
+
+    myU1=x4-x1;
+    myU2=x2-x1;
+
+    myV1=y1-y4;
+    myV2=y3-y4;
+
+
+    myType=OBJ_DIAMOND;
+
+    myScreen->addWidget((Widget*) this);
+}
+//-----------------------------------------
+void Diamond::draw(void)
+{
+    // isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_diamond(myX1,myY1,myX2,myY2,myX3,myY3,myX4,myY4,myColor);
+    }
+    ps=0;
+}
+//-----------------------------------------
+Diamond::~Diamond(void)
+{
+}
+//----------------------------
+void Diamond::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        elementUpdate();
+    //
+    float xnew=myX+mySpeedX*delta;
+    float ynew=myY+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xnew,(INT16)ynew,true);
+}
+//-------------------------------
+void Diamond::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_diamond(myX1,myY1,myX2,myY2,myX3,myY3,myX4,myY4,c);
+            
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+        this->draw();
+    }
+}
+//--------------------------------
+void Diamond::setNewPosition(INT16 _xnew,INT16 _ynew)
+{
+   setNewPosition(_xnew,_ynew,true);
+}
+//---------------------------------
+void Diamond::setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myX==_xnew && myY==_ynew)
+        return;
+    setInvisible(true); // colorie le tri avec couleur de la screen
+
+    myIsVisible=true;
+
+if(isScreenLimits)
+{
+    //test Xmax
+    if(_xnew+myWidth >= myXMoveMax) {
+        _xnew=myXMoveMax-myWidth;
+
+        if(myState==STATE_ON)
+            myState=BUMP_RIGHT;
+    }
+    //
+    //test Xmin
+    if(_xnew <= myXMoveMin) {
+        _xnew=myXMoveMin;
+
+        if(myState==STATE_ON)
+            myState=BUMP_LEFT;
+    }
+    //test Ymax
+    if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
+        _ynew = myYMoveMax- myHeight;
+
+        if(myState==STATE_ON)
+            myState=BUMP_DOWN;
+    }
+    //test yminMin;
+    if(_ynew <= myYMoveMin) {
+        _ynew=myYMoveMin;
+
+        if(myState==STATE_ON)
+            myState=BUMP_UP;
+    }
+}
+    //
+    myX=_xnew;
+    myY=_ynew;
+
+    myX1=_xnew;
+    myY1=_ynew+myV1;
+
+    myX2=_xnew+myU2;
+    myY2=_ynew+myHeight;
+
+    myX3=_xnew+myWidth;
+    myY3=_ynew+myV2;
+
+    myX4=_xnew+myU1;
+    myY4=_ynew;
+
+    this->draw();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Diamond.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,50 @@
+#ifndef DIAMOND_H
+#define DIAMOND_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+
+class Diamond:public Sprite
+{
+public:
+    /** Construct a filled Diamond
+    *
+    * @param mScreen the pointer screen
+    * @params x1
+    * @params y1
+    * @params x2
+    * @params y2
+    * @params x3
+    * @params y3
+    * @params x4
+    * @params y4
+    * @param _color the background color
+    */
+    Diamond(Screen* mScreen,UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
+            UINT16 x3,UINT16 y3,UINT16 x4,UINT16 y4,Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Diamond(void);
+    //
+    void update(float delta);
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits);
+
+protected:
+    UINT16 myX1,myY1;
+    UINT16 myX2,myY2;
+    UINT16 myX3,myY3;
+    UINT16 myX4,myY4;
+    UINT16 myU1,myU2;
+    UINT16 myV1,myV2;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Digit3Led.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,163 @@
+#include "Digit3Led.h"
+
+Digit3Led::Digit3Led(Screen* mScreen,UINT16 _x,UINT16 _y,UINT8 _resolution):
+    Widget(mScreen,0,_x,_y,108,52,YELLOW)
+{
+    myColorBkg=YELLOW;
+    myColorSeg=RED;
+    myValue=0.0;
+    myResolution=_resolution;
+
+    myDigitLedCentaine= new DigitLed(mScreen,_x,_y,false);
+    myDigitLedDizaine=new DigitLed(mScreen,_x+36,_y,false);
+    myDigitLedUnite= new DigitLed(mScreen,_x+36+36,_y,false);
+
+
+    myType= OBJ_DIGITAL_3_LED;
+    myState=DIGIT_LED_STATE_ON;
+
+    myScreen->addWidget((Widget*) this);
+}
+//------------------------------------------
+Digit3Led::~Digit3Led(void)
+{
+    delete(myDigitLedCentaine);
+    myDigitLedCentaine=0;
+    delete(myDigitLedDizaine);
+    myDigitLedDizaine=0;
+    delete(myDigitLedUnite);
+    myDigitLedUnite=0;
+}
+//------------------------------------------
+void Digit3Led::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+
+    myDigitLedCentaine->draw();
+    myDigitLedDizaine->draw();
+    myDigitLedUnite->draw();
+
+}
+//------------------------------------------
+void Digit3Led::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+        PicasoSerial* ps=0;
+
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//-----------------------------------------
+void Digit3Led::setValue(float _value)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myValue==_value)
+        return;
+    //
+    myValue=_value;
+    UINT16 temp=0;
+
+    char centaine=0;
+    char dizaine=0;
+    char unite=0;
+
+    //the Pt?
+    switch(myResolution) {
+        case 1:     //xxx
+            temp=(UINT16)_value;
+            myDigitLedCentaine->setPtVisible(false);
+            myDigitLedDizaine->setPtVisible(false);
+            myDigitLedUnite->setPtVisible(false);
+            break;
+            //
+        case 10:    //xx.x
+            temp=(UINT16)(_value*10);
+            myDigitLedCentaine->setPtVisible(false);
+            myDigitLedDizaine->setPtVisible(true);
+            myDigitLedUnite->setPtVisible(false);
+            break;
+            //
+        case 100:   //x.xx
+            temp=(UINT16)(_value*100);
+            myDigitLedCentaine->setPtVisible(true);
+            myDigitLedDizaine->setPtVisible(false);
+            myDigitLedUnite->setPtVisible(false);
+            break;
+
+        default:
+            break;
+    }
+    //
+    if(temp <100) {
+        centaine=0;
+        myDigitLedCentaine->setInvisible(true);
+    } else {
+        myDigitLedCentaine->setInvisible(false);
+        centaine=(char)(temp/100);
+        temp=temp-(centaine*100);
+    }
+    //
+    if(temp <10) {
+        dizaine=0;
+    } else {
+        dizaine=(char)(temp/10);
+        temp=temp-(dizaine*10);
+    }
+    //
+    unite=(char)temp;
+
+    myDigitLedCentaine->setValue(centaine);
+    myDigitLedDizaine->setValue(dizaine);
+    myDigitLedUnite->setValue(unite);
+
+    this->draw();
+}
+//------------------------------------------
+void Digit3Led::setColorBkg(Color _colorBkg)
+{
+    if(myColorBkg==_colorBkg)
+        return;
+
+    myColorBkg=_colorBkg;
+    myDigitLedCentaine->setColorBkg(_colorBkg);
+    myDigitLedDizaine->setColorBkg(_colorBkg);
+    myDigitLedUnite->setColorBkg(_colorBkg);
+
+    this->draw();
+}
+//------------------------------------------
+void Digit3Led::setColorSeg(Color _colorSeg)
+{
+    if(myColorSeg==_colorSeg)
+        return;
+
+    myColorSeg=_colorSeg;
+    myDigitLedCentaine->setColorSeg(_colorSeg);
+    myDigitLedDizaine->setColorSeg(_colorSeg);
+    myDigitLedUnite->setColorSeg(_colorSeg);
+
+    this->draw();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Digit3Led.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,43 @@
+#ifndef DIGIT_3_LED_H
+#define DIGIT_3_LED_H
+
+#include "Screen.h"
+#include "DigitLed.h"
+
+class Digit3Led:public Widget
+{
+public:
+    /** Construct a 3 Digit Led [000]
+        *
+        * @param mScreen the pointer screen
+        * @params _x up left
+        * @params _y up left
+        * @params _resolution 1[000],10[00.0],100[0.00]
+        */
+    Digit3Led(Screen* mScreen,UINT16 _x,UINT16 _y,UINT8 _resolution);
+    //
+    virtual void draw(void);
+    //
+    virtual  ~Digit3Led(void);
+    //
+    void setInvisible(bool _state);
+    //
+    void setValue(float _value);
+    //
+    void setColorBkg(Color _colorBkg);
+    //
+    void setColorSeg(Color _colorSeg);
+
+protected:
+    Color myColorBkg;
+    Color myColorSeg;
+    float myValue;
+    UINT8 myResolution;
+
+    DigitLed* myDigitLedCentaine;
+    DigitLed* myDigitLedDizaine;
+    DigitLed* myDigitLedUnite;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DigitLed.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,274 @@
+#include "DigitLed.h"
+
+DigitLed::DigitLed(Screen* mScreen,UINT16 _x,UINT16 _y,bool _ptVisible):
+    Widget(mScreen,0,_x,_y,36,52,WHITE)
+{
+    myValue=0;
+    myColorBkg=YELLOW;
+    myColorSeg=RED;
+    myIncX=4;
+    myIncY=4;
+
+    isPtVisible=_ptVisible;
+
+    myType=OBJ_DIGIT_LED;
+    myState=DIGIT_LED_STATE_ON;
+
+    myScreen->addWidget((Widget*) this);
+}
+//-----------------------------------------
+DigitLed::~DigitLed(void)
+{
+}
+//-----------------------------------------
+void DigitLed::setColorBkg(Color _colorBkg)
+{
+    if(myColorBkg==_colorBkg)
+        return;
+
+    myColorBkg=_colorBkg;
+    this->draw();
+}
+//------------------------------------------
+void DigitLed::setColorSeg(Color _colorSeg)
+{
+    if(myColorSeg==_colorSeg)
+        return;
+
+    myColorSeg=_colorSeg;
+    this->draw();
+}
+//-----------------------------------------
+void DigitLed::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    //rec
+    if(ps!=0) {
+        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,myColorBkg);
+    }
+
+    if(isPtVisible)
+        draw_seg_pt(ps);
+
+    //
+    switch(myValue) {
+        case 0:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_e(ps);
+            draw_seg_f(ps);
+            break;
+            //
+        case 1:
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            break;
+            //
+        case 2:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_d(ps);
+            draw_seg_e(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 3:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 4:
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            draw_seg_f(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 5:
+            draw_seg_a(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_f(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 6:
+            draw_seg_a(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_e(ps);
+            draw_seg_f(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 7:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            break;
+            //
+        case 8:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_e(ps);
+            draw_seg_f(ps);
+            draw_seg_g(ps);
+            break;
+            //
+        case 9:
+            draw_seg_a(ps);
+            draw_seg_b(ps);
+            draw_seg_c(ps);
+            draw_seg_d(ps);
+            draw_seg_f(ps);
+            draw_seg_g(ps);
+            break;
+    }
+    ps=0;
+}
+//-----------------------------------------
+void DigitLed::setValue(char _value)
+{
+    if(myIsVisible==false)
+        return;
+
+    if(myValue==_value)
+        return;
+
+
+    if(_value >9)
+        _value=9;
+
+    myValue=_value;
+
+    this->draw();
+}
+//-----------------------------------------
+void DigitLed::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//-----------------------------------------
+void DigitLed::setPtVisible(bool _state)
+{
+    if(isPtVisible==_state)
+        return;
+
+    isPtVisible=_state;
+}
+//-----------------------------------------
+void DigitLed::draw_seg_a(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myIncX,
+                                  myY,
+                                  myX+7*myIncX,
+                                  myY+myIncY,
+                                  myColorSeg);
+}
+//------------------------------------------
+void DigitLed::draw_seg_b(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+6*myIncX,
+                                  myY,
+                                  myX+7*myIncX,
+                                  myY+5*myIncY,
+                                  myColorSeg);
+}
+//-------------------------------------------
+void DigitLed::draw_seg_c(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+6*myIncX,
+                                  myY+8*myIncY,
+                                  myX+7*myIncX,
+                                  myY+myHeight,
+                                  myColorSeg);
+}
+//--------------------------------------------
+void DigitLed::draw_seg_d(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myIncX,
+                                  myY+myHeight-myIncY,
+                                  myX+7*myIncX,
+                                  myY+myHeight,
+                                  myColorSeg);
+}
+//-----------------------------------------
+void DigitLed::draw_seg_e(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myIncX,
+                                  myY+myHeight-5*myIncY,
+                                  myX+2*myIncX,
+                                  myY+myHeight,
+                                  myColorSeg);
+}
+//-----------------------------------------
+void DigitLed::draw_seg_f(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myIncX,
+                                  myY,
+                                  myX+2*myIncX,
+                                  myY+5*myIncY,
+                                  myColorSeg);
+}
+//------------------------------------------
+void DigitLed::draw_seg_g(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myIncX,
+                                  myY+6*myIncY,
+                                  myX+7*myIncX,
+                                  myY+7*myIncY,
+                                  myColorSeg);
+}
+//------------------------------------------
+void DigitLed::draw_seg_pt(PicasoSerial* ps)
+{
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myWidth-myIncX,
+                                  myY+myHeight-myIncY,
+                                  myX+myWidth,
+                                  myY+myHeight,
+                                  myColorSeg);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DigitLed.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,53 @@
+#ifndef DIGIT_LED_H
+#define DIGIT_LED_H
+
+#include "Screen.h"
+
+class DigitLed:public Widget
+{
+public:
+    /** Construct a Digit Led
+        *
+        * @param mScreen the pointer screen
+        * @params _x up left
+        * @params _y up left
+        * @params _ptVisible
+        */
+    DigitLed(Screen* mScreen,UINT16 _x,UINT16 _y,bool _ptVisible);
+    //
+    virtual void draw(void);
+    //
+    virtual ~DigitLed(void);
+    //
+    void setInvisible(bool _state);
+    //
+    void setValue(char _value);
+    //
+    void setColorBkg(Color _colorBkg);
+    //
+    void setColorSeg(Color _colorSeg);
+    //
+    void setPtVisible(bool _state);
+
+protected:
+    char myValue;
+    Color myColorBkg;
+    Color myColorSeg;
+    UINT16 myIncX;
+    UINT16 myIncY;
+    bool isPtVisible;
+    //
+    void draw_seg_a(PicasoSerial* ps);
+    void draw_seg_b(PicasoSerial* ps);
+
+    void draw_seg_c(PicasoSerial* ps);
+
+    void draw_seg_d(PicasoSerial* ps);
+    void draw_seg_e(PicasoSerial* ps);
+    void draw_seg_f(PicasoSerial* ps);
+
+    void draw_seg_g(PicasoSerial* ps);
+    void draw_seg_pt(PicasoSerial* ps);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ellipse.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,153 @@
+#include "Ellipse.h"
+
+Ellipse::Ellipse(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radiusX,UINT16 _radiusY,Color _color):
+    Sprite(mScreen,0,_xc-_radiusX,_yc-_radiusY,_radiusX+_radiusX,_radiusY+_radiusY,_color)
+{
+    myCenterX=_xc;
+    myCenterY=_yc;
+    myRadiusX=_radiusX;
+    myRadiusY=_radiusY;
+
+    myType=OBJ_ELLIPSE;
+
+    myScreen->addWidget((Widget*) this);
+}
+//----------------------------------------------
+void Ellipse::draw(void)
+{
+    // isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_ellipse(myCenterX,myCenterY,myRadiusX,myRadiusY,myColor);
+    }
+    ps=0;
+}
+//----------------------------------------------
+void Ellipse::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        elementUpdate();
+
+    float xcnew=myCenterX+mySpeedX*delta;
+    float ycnew=myCenterY+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xcnew,(INT16)ycnew,true);
+
+}
+//-----------------------------------------------
+void Ellipse::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_ellipse(myCenterX,myCenterY,myRadiusX,myRadiusY,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//-----------------------------------------------
+void Ellipse::setNewPosition(INT16 _xcnew,INT16 _ycnew)
+{
+    setNewPosition(_xcnew,_ycnew,true);
+}
+//-----------------------------------------------
+void Ellipse::setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myCenterX==_xcnew && myCenterY==_ycnew)
+        return;
+    //
+    this->setInvisible(true); // colorie le cir avec couleur de la screen
+
+    myIsVisible=true;
+    if(isScreenLimits) {
+        //test Xmax
+        if(_xcnew+myRadiusX >= myXMoveMax) {
+            _xcnew=myXMoveMax-myRadiusX;
+
+            if(myState==STATE_ON)
+                myState=BUMP_RIGHT;
+        }
+
+        //test Xmin
+        if(_xcnew <= myRadiusX) {
+            _xcnew=myXMoveMin+myRadiusX;
+
+            if(myState==STATE_ON)
+                myState=BUMP_LEFT;
+        }
+        //test Ymax
+        if(_ycnew +myRadiusY >= myYMoveMax && _ycnew >0) {
+            _ycnew = myYMoveMax- myRadiusY;
+
+            if(myState==STATE_ON)
+                myState=BUMP_DOWN;
+        }
+        //test yminMin;
+        if(_ycnew <= myRadiusY) {
+            _ycnew=myYMoveMin+myRadiusY;
+
+            if(myState==STATE_ON)
+                myState=BUMP_UP;
+        }
+    }
+    //
+    myCenterX=_xcnew;
+    myCenterY=_ycnew;
+
+    myX=_xcnew-myRadiusX;
+    myY=_ycnew-myRadiusY;
+
+
+    this->draw();
+}
+//-----------------------------------------------
+Ellipse::~Ellipse(void)
+{
+}
+//----------------------------------------------
+UINT16 Ellipse::getCenterX(void) const
+{
+    return this->myCenterX;
+}
+//---------------------------------------------
+UINT16 Ellipse::getCenterY(void) const
+{
+    return this->myCenterY;
+}
+//----------------------------------------------
+void Ellipse::setCenterX(UINT16 _xcenter)
+{
+    myCenterX=_xcenter;
+}
+//----------------------------------------------
+void Ellipse::setCenterY(UINT16 _ycenter)
+{
+    myCenterY=_ycenter;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ellipse.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,51 @@
+#ifndef ELLIPSE_H
+#define ELLIPSE_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+class Ellipse:public Sprite
+{
+public:
+    /** Construct a filled Ellipse
+    *
+    * @param mScreen the pointer screen
+    * @params _xc the center x
+    * @params _yc the center y
+    * @params _radiusX
+    * @radius _radiusY
+    * @param _color the background color
+    */
+    Ellipse(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radiusX,UINT16 _radiusY,Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Ellipse(void);
+    //
+    void update(float delta);
+
+// getter
+    UINT16 getCenterX(void) const;
+    //
+    UINT16 getCenterY(void) const;
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits);
+    //
+    void setCenterX(UINT16 _xcenter);
+    //
+    void setCenterY(UINT16 _ycenter);
+
+
+protected:
+    UINT16 myCenterX;
+    UINT16 myCenterY;
+    UINT16 myRadiusX;
+    UINT16 myRadiusY;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GraphicLed.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,96 @@
+#include "GraphicLed.h"
+
+GraphicLed::GraphicLed(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radius,
+                       Color _colorOn,Color _colorOff,State _state):
+    Widget(mScreen,0,_xc-_radius,_yc-_radius,_radius+_radius,_radius+_radius,_colorOn)
+{
+    myColorOn=_colorOn;
+    myColorOff=_colorOff;
+    myRadius=_radius;
+    myCenterX=_xc;
+    myCenterY=_yc;
+
+    myState=_state;
+    myType=OBJ_LED;
+    myScreen->addWidget((Widget*) this);
+}
+//---------------------------------------
+GraphicLed::~GraphicLed(void)
+{
+}
+//---------------------------------------
+void GraphicLed::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+
+    UINT16 state=getState();
+
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    switch(state) {
+            //
+        case LED_STATE_ON:
+            if(ps!=0) {
+                ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColorOn);
+                ps->draw_circle(myCenterX,myCenterY,myRadius,BLACK);
+                ps=0;
+            }
+            return;
+            //
+        case LED_STATE_OFF:
+            if(ps!=0) {
+                ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColorOff);
+                ps->draw_circle(myCenterX,myCenterY,myRadius,BLACK);
+                ps=0;
+            }
+            return;
+            //
+        default:
+            break;
+    }
+    
+}
+//---------------------------------------
+void GraphicLed::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_circle(myCenterX,myCenterY,myRadius,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//---------------------------------------
+void GraphicLed::setState(State _state)
+{
+    if(myIsVisible==false)
+        return;
+
+    if(myState==_state)
+        return;
+
+    myState=_state;
+
+    this->draw();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GraphicLed.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,41 @@
+#ifndef GRAPHIC_LED_H
+#define GRAPHIC_LED_H
+
+#include "Screen.h"
+
+class GraphicLed:public Widget
+{
+public:
+    /** Construct a filled Circle
+        *
+        * @param mScreen the pointer screen
+        * @params _xc center
+        * @params _yc center
+        * @params _radius
+        * @params _colorOn
+        * @params _colorOff
+        * @params _state LED_STATE_ON or LED_STATE_OFF,
+        */
+        
+    GraphicLed(Screen* mScreen,UINT16 _xc,UINT16 _yc,UINT16 _radius,
+               Color _colorOn,Color _colorOff,State _state);
+    //
+    virtual void draw(void);
+    //
+    virtual ~GraphicLed(void);
+
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setState(State _state);
+
+protected:
+    Color myColorOn;
+    Color myColorOff;
+    UINT16 myRadius;
+    UINT16 myCenterX;
+    UINT16 myCenterY;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Isocele.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,307 @@
+#include "Isocele.h"
+
+void Isocele::updateOrientation(void)
+{
+    switch(myOrientation) {
+            //
+        case Isocele::ORIENTATION_UP:
+            mySpeedX=0.0;
+            mySpeedY=-mySpeed;
+
+            myX=myXcenter-myRadius;
+            myY=myYcenter-myRadius;
+            myWidth=myRadius+myRadius;
+            myHeight=myRadius;
+
+            myX1=myXcenter;
+            myY1=myYcenter-myRadius;
+
+            myX2=myXcenter-myRadius;
+            myY2=myYcenter;
+
+            myX3=myXcenter+myRadius;
+            myY3=myYcenter;
+            break;
+
+            //
+        case Isocele::ORIENTATION_RIGHT:
+            mySpeedX=mySpeed;
+            mySpeedY=0.0;
+
+            myX=myXcenter;
+            myY=myYcenter-myRadius;
+            myWidth=myRadius;
+            myHeight=myRadius+myRadius;
+
+            myX1=myXcenter;
+            myY1=myYcenter-myRadius;
+
+            myX2=myXcenter;
+            myY2=myYcenter+myRadius;
+
+            myX3=myXcenter+myRadius;
+            myY3=myYcenter;
+            break;
+
+            //
+        case Isocele::ORIENTATION_DOWN:
+            mySpeedX=0.0;
+            mySpeedY=mySpeed;
+
+            myX=myXcenter-myRadius;
+            myY=myYcenter;
+            myWidth=myRadius+myRadius;
+            myHeight=myRadius;
+
+            myX1=myXcenter-myRadius;
+            myY1=myYcenter;
+
+            myX2=myXcenter;
+            myY2=myYcenter+myRadius;
+
+            myX3=myXcenter+myRadius;
+            myY3=myYcenter;
+            break;
+
+            //
+        case Isocele::ORIENTATION_LEFT:
+            mySpeedX=-mySpeed;
+            mySpeedY=0.0;
+
+            myX=myXcenter-myRadius;
+            myY=myYcenter-myRadius;
+            myWidth=myRadius;
+            myHeight=myRadius+myRadius;
+
+            myX1=myXcenter-myRadius;
+            myY1=myYcenter;
+
+            myX2=myXcenter;
+            myY2=myYcenter+myRadius;
+
+            myX3=myXcenter;
+            myY3=myYcenter-myRadius;
+            break;
+
+            //
+        default:
+            break;
+
+    }
+
+}
+//--------------------------------------------
+Isocele::Isocele(Screen* mScreen,UINT16 xc,UINT16 yc,UINT16 radius,int orientation,float _speed,
+                 Color color): 
+                 Sprite(mScreen,0,xc-radius,yc-radius,radius+radius,radius,color)
+{
+    myXcenter=xc;
+    myYcenter=yc;
+    myRadius=radius;
+    myOrientation=orientation;
+    mySpeed=_speed;
+
+    updateOrientation();
+
+    myIsUpdateAutomatic=false;
+
+    myType=OBJ_ISOCELE;
+
+    myScreen->addWidget((Widget*) this);
+}
+//--------------------------------------------
+void Isocele::draw(void)
+{
+    // isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,myColor);
+        //
+        //ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,BLACK);
+    }
+    ps=0;
+}
+//---------------------------------------------
+Isocele::~Isocele(void)
+{
+}
+//--------------------------------------------
+void Isocele:: setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+         PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,c);
+            //ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+        this->draw();
+    }
+}
+//------------------------------------------
+void Isocele::setNewPosition(INT16 _xcnew,INT16 _ycnew)
+{
+    setNewPosition(_xcnew,_ycnew,true);
+}
+//-------------------------------------------
+void Isocele::setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myXcenter==_xcnew && myYcenter==_ycnew)
+        return;
+    //
+    this->setInvisible(true); 
+
+    myIsVisible=true;
+if(isScreenLimits)
+{
+
+    //test Xmax
+    if(_xcnew+myRadius >= myXMoveMax) {
+        _xcnew=myXMoveMax-myRadius;
+
+        if(myState==STATE_ON)
+            myState=BUMP_RIGHT;
+    }
+
+    //test Xmin
+    if(_xcnew <= myRadius) {
+        _xcnew=myXMoveMin+myRadius;
+
+        if(myState==STATE_ON)
+            myState=BUMP_LEFT;
+    }
+    //test Ymax
+    if(_ycnew +myRadius >= myYMoveMax && _ycnew >0) {
+        _ycnew = myYMoveMax- myRadius;
+
+        if(myState==STATE_ON)
+            myState=BUMP_DOWN;
+    }
+    //test yminMin;
+    if(_ycnew <= myRadius) {
+        _ycnew=myYMoveMin+myRadius;
+
+        if(myState==STATE_ON)
+            myState=BUMP_UP;
+    }
+}
+    //
+    myXcenter=_xcnew;
+    myYcenter=_ycnew;
+
+    updateOrientation();
+
+    this->draw();
+}
+//--------------------------------------------
+void Isocele::myElementUpdate(void)
+{
+    switch(myState) {
+            //
+        case BUMP_DOWN:
+            setInvertSpeedY();
+            myState=STATE_ON;
+            myOrientation=Isocele::ORIENTATION_UP;
+            break;
+            //
+        case BUMP_LEFT:
+            setInvertSpeedX();
+            myState=STATE_ON;
+            myOrientation=Isocele::ORIENTATION_RIGHT;
+            break;
+            //
+        case BUMP_RIGHT:
+            setInvertSpeedX();
+            myState=STATE_ON;
+            myOrientation=Isocele::ORIENTATION_LEFT;
+            break;
+            //
+        case BUMP_UP:
+            setInvertSpeedY();
+            myState=STATE_ON;
+            myOrientation=Isocele::ORIENTATION_DOWN;
+            break;
+            //
+        case STATE_OFF:
+            break;
+            //
+        default:
+            break;
+    }
+}
+//--------------------------------------------
+void Isocele::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        myElementUpdate();
+    //
+    float xnew=myXcenter+mySpeedX*delta;
+    float ynew=myYcenter+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xnew,(INT16)ynew,true);
+
+}
+//--------------------------------------------
+void Isocele::setOrientation(int _orientation)
+{
+    myOrientation=_orientation;
+
+}
+//--------------------------------------------
+int Isocele::getOrientation(void) const
+{
+    return this->myOrientation;
+}
+//--------------------------------------------
+UINT16 Isocele::getXcenter(void) const
+{
+    return this->myXcenter;
+}
+//--------------------------------------------
+UINT16 Isocele::getYcenter(void) const
+{
+    return this->myYcenter;
+}
+//--------------------------------------------
+void Isocele::turnLeft(void)
+{
+    myOrientation+=1;
+
+    if(myOrientation >Isocele::ORIENTATION_RIGHT)
+        myOrientation=ORIENTATION_UP;
+
+}
+//--------------------------------------------
+void Isocele::turnRight(void)
+{
+    myOrientation-=1;
+
+    if(myOrientation <Isocele::ORIENTATION_UP)
+        myOrientation=ORIENTATION_RIGHT;
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Isocele.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,55 @@
+#ifndef ISOCELE_H
+#define ISOCELE_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+class Isocele:public Sprite
+{
+public:
+    Isocele(Screen* mScreen,UINT16 xc,UINT16 yc,UINT16 radius,int orientation,float _speed,Color color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Isocele(void);
+    //
+    void setOrientation(int _orientation);
+    //
+    void turnLeft(void);
+    //
+    void turnRight(void);
+    //
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits);
+    //
+    void update(float delta);
+    //
+    int getOrientation(void) const;
+    //
+    UINT16 getXcenter(void) const;
+    //
+    UINT16 getYcenter(void) const;
+
+    static const int ORIENTATION_UP=0;
+    static const int ORIENTATION_LEFT=1;
+    static const int ORIENTATION_DOWN=2;
+    static const int ORIENTATION_RIGHT=3;
+
+protected:
+    UINT16 myXcenter;
+    UINT16 myYcenter;
+    UINT16 myRadius;
+    int myOrientation;
+
+    UINT16 myX1,myY1;
+    UINT16 myX2,myY2;
+    UINT16 myX3,myY3;
+    float mySpeed;
+
+    void updateOrientation(void);
+    void myElementUpdate(void);
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,608 @@
+#include "Keyboard.h"
+
+//
+Keyboard::Keyboard(Screen* pscreen,string titre,Nunchuk* pnunchuk,Buzzer* pbuzzer,float sampleTime):myScreen(pscreen),myTitre(titre),
+    myBuzzer(pbuzzer),myNunchuk(pnunchuk),mySampleTime(sampleTime)
+{
+    myBeep= new Note("F%4",50);
+    myEnter=false;
+
+    myIndice=0;
+    myPointeur=0;
+
+    initialisation();
+
+    createScreen();
+}
+//------------------------------------------------
+Keyboard::Keyboard(Screen* pscreen,string titre,Buzzer* pbuzzer):myScreen(pscreen),myTitre(titre),myBuzzer(pbuzzer)
+{
+    myNunchuk=NULL;
+    mySampleTime=0.1;
+
+    myBeep= new Note("F%4",50);
+    myEnter=false;
+
+    myIndice=0;
+    myPointeur=0;
+
+    initialisation();
+
+    createScreen();
+}
+//------------------------------------------------
+void Keyboard::initialisation(void)
+{
+    myMessage.event=EVENT_NO_ACTIVITY;
+    myMessage.objId=0;
+    myMessage.posiX=0;
+    myMessage.posiY=0;
+
+    for(int i=0; i<50; i++) {
+        myBuffer[i]='\0';
+    }
+    //
+    for(int i=0; i<40; i++) {
+        myTabBtn[i]=0;
+    }
+    myString="";
+
+    pLabelTitre=0;
+    pLabel=0;
+
+    pBtn_0=0;
+    pBtn_1=0;
+    pBtn_2=0;
+    pBtn_3=0;
+    pBtn_4=0;
+    pBtn_5=0;
+    pBtn_6=0;
+    pBtn_7=0;
+    pBtn_8=0;
+    pBtn_9=0;
+
+    pBtn_A=0;
+    pBtn_B=0;
+    pBtn_C=0;
+    pBtn_D=0;
+    pBtn_E=0;
+    pBtn_F=0;
+    pBtn_G=0;
+    pBtn_H=0;
+    pBtn_I=0;
+    pBtn_J=0;
+
+    pBtn_K=0;
+    pBtn_L=0;
+    pBtn_M=0;
+    pBtn_N=0;
+    pBtn_O=0;
+    pBtn_P=0;
+    pBtn_Q=0;
+    pBtn_R=0;
+    pBtn_S=0;
+    pBtn_T=0;
+    pBtn_U=0;
+
+    pBtn_V=0;
+    pBtn_W=0;
+    pBtn_X=0;
+    pBtn_Y=0;
+    pBtn_Z=0;
+
+    pBtn_Point=0;
+
+    pBtn_Esp=0;
+    pBtn_Del=0;
+    pBtn_Ok=0;
+}
+//------------------------------------------------
+Keyboard::~Keyboard(void)
+{
+    myTicker.detach();
+
+    if(myScreen!=NULL)
+        delete myScreen;
+
+    if(myBeep!=NULL)
+        delete myBeep;
+
+}
+//------------------------------------------------
+bool Keyboard::isEnterPressed(void)
+{
+    return myEnter;
+}
+//------------------------------------------------
+void Keyboard::loop(void)
+{
+
+    if(myNunchuk==NULL) {
+
+        TouchEvent event=myScreen->getTouchEvent(&myMessage);//EVENT_NO_ACTIVITY EVENT_PRESS EVENT_RELEASE EVENT_MOVE
+
+        if(event>0) {
+            myScreen->getProcessMessage(&myMessage);
+            affiche();
+
+        }
+    }
+    //
+    else {
+        myNunchuk->process();
+        actionNunchuk();
+    }
+
+}
+//------------------------------------------------
+void Keyboard::draw(void)
+{
+    myScreen->drawAllWidget();
+
+    wait(0.1);
+
+    myTicker.attach(this,&Keyboard::loop,mySampleTime);
+}
+//------------------------------------------------
+//int Keyboard::getString(char* str)
+string  Keyboard::getString(void)
+{
+    myString="";
+
+    for(int i=0; i<myIndice; i++) {
+        myString+=myBuffer[i];
+    }
+
+    return myString;
+    /*
+    for(int i=0; i<myIndice; i++) {
+        str[i]=myBuffer[i];
+    }
+
+    return myIndice;
+    */
+}
+
+//-------------------------------------------------
+void Keyboard::createScreen(void)
+{
+    UINT16 w=22;
+    UINT16 h=25;
+
+    UINT16 sx=5;
+    UINT16 sy=150;
+
+    myPointeur=0;
+
+    //---------------------
+    pLabelTitre= new Label(myScreen,5,5,myTitre,FONT_3,BLACK,YELLOW);
+    //---------------------
+    pLabel= new Label(myScreen,5,40,"_",FONT_3,BLACK,YELLOW);
+
+    //
+    pBtn_0= new Button(myScreen,BTN_0_ID,sx,sy,"0",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_0;
+    myPointeur++;
+    sx+=w;
+    //
+    pBtn_1= new Button(myScreen,BTN_1_ID,sx,sy,"1",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_1;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_2= new Button(myScreen,BTN_2_ID,sx,sy,"2",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_2;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_3= new Button(myScreen,BTN_3_ID,sx,sy,"3",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_3;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_4= new Button(myScreen,BTN_4_ID,sx,sy,"4",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_4;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_5= new Button(myScreen,BTN_5_ID,sx,sy,"5",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_5;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_6= new Button(myScreen,BTN_6_ID,sx,sy,"6",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_6;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_7= new Button(myScreen,BTN_7_ID,sx,sy,"7",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_7;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_8= new Button(myScreen,BTN_8_ID,sx,sy,"8",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_8;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_9= new Button(myScreen,BTN_9_ID,sx,sy,"9",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_9;
+    myPointeur++;
+
+    //----
+    sx=5;
+    sy+=h+5;
+    pBtn_A= new Button(myScreen,BTN_A_ID,sx,sy,"A",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_A;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_Z= new Button(myScreen,BTN_Z_ID,sx,sy,"Z",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Z;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_E= new Button(myScreen,BTN_E_ID,sx,sy,"E",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_E;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_R= new Button(myScreen,BTN_R_ID,sx,sy,"R",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_R;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_T= new Button(myScreen,BTN_T_ID,sx,sy,"T",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_T;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_Y= new Button(myScreen,BTN_Y_ID,sx,sy,"Y",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Y;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_U= new Button(myScreen,BTN_U_ID,sx,sy,"U",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_U;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_I= new Button(myScreen,BTN_I_ID,sx,sy,"I",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_I;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_O= new Button(myScreen,BTN_O_ID,sx,sy,"O",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_O;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_P= new Button(myScreen,BTN_P_ID,sx,sy,"P",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_P;
+    myPointeur++;
+    //------------------------------
+    sx=5;
+    sy+=h;
+
+    sx+=w/2;
+    pBtn_Q= new Button(myScreen,BTN_Q_ID,sx,sy,"Q",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Q;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_S= new Button(myScreen,BTN_S_ID,sx,sy,"S",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_S;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_D= new Button(myScreen,BTN_D_ID,sx,sy,"D",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_D;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_F= new Button(myScreen,BTN_F_ID,sx,sy,"F",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_F;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_G= new Button(myScreen,BTN_G_ID,sx,sy,"G",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_G;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_H= new Button(myScreen,BTN_H_ID,sx,sy,"H",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_H;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_J= new Button(myScreen,BTN_J_ID,sx,sy,"J",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_J;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_K= new Button(myScreen,BTN_K_ID,sx,sy,"K",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_K;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_L= new Button(myScreen,BTN_L_ID,sx,sy,"L",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_L;
+    myPointeur++;
+    //----------------
+    sx=5;
+    sy+=h;
+
+    sx+=w;
+
+    pBtn_W= new Button(myScreen,BTN_W_ID,sx,sy,"W",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_W;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_X= new Button(myScreen,BTN_X_ID,sx,sy,"X",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_X;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_C= new Button(myScreen,BTN_C_ID,sx,sy,"C",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_C;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_V= new Button(myScreen,BTN_V_ID,sx,sy,"V",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_V;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_B= new Button(myScreen,BTN_B_ID,sx,sy,"B",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_B;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_N= new Button(myScreen,BTN_N_ID,sx,sy,"N",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_N;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_M= new Button(myScreen,BTN_M_ID,sx,sy,"M",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_M;
+    myPointeur++;
+    sx+=w;
+
+    pBtn_Point=new Button(myScreen,BTN_POINT_ID,sx,sy,".",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Point;
+    myPointeur++;
+    //-------------------
+    sx=5;
+    sy+=h+5;
+
+    pBtn_Del=new Button(myScreen,BTN_DEL_ID,sx,sy,"Suppr",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Del;
+    myPointeur++;
+    sx+=3*w;
+
+    pBtn_Esp= new Button(myScreen,BTN_ESP_ID,sx,sy," Espace ",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Esp;
+    myPointeur++;
+    sx+=4*w;
+
+    pBtn_Ok=new Button(myScreen,BTN_OK_ID,sx,sy,"Enter",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED);
+    myTabBtn[myPointeur]=pBtn_Ok;
+
+    //
+    myPointeur=10;
+
+}
+//--------------------------------------------------
+void Keyboard::affiche(void)
+{
+    UINT16 id=myMessage.objId;
+
+    static Button* pb=NULL;
+
+    if(myMessage.event==EVENT_PRESS && id>0) {
+        if(myBuzzer!=NULL)
+            myBuzzer->tone(myBeep);
+
+        pb=(Button*)myScreen->getWidgetById(id);
+
+        if(pb!=NULL) {
+            pb->setState(BUTTON_STATE_RELEASED);
+            wait(0.1);
+            pb->setState(BUTTON_STATE_PRESSED);
+        }
+
+        if(myIndice >50 || myIndice<0)
+            myIndice=0;
+
+        //
+        afficheById(id);
+
+    }
+}
+//--------------------------------------------------
+void Keyboard::afficheById(UINT16 id)
+{
+    char str='_';
+
+//les nombres
+    if(id>=10 && id<20) {
+        str='0'+(id-10);
+
+        myBuffer[myIndice]=str;
+        myIndice++;
+
+        myBuffer[myIndice]='_';
+        //pLabel->setNewText(myBuffer,myIndice-1);
+        pLabel->setNewText(myBuffer);
+        return;
+
+    }
+//
+//les lettres
+    if(id>=100 && id<126) {
+        str='A'+(id-100);
+
+        myBuffer[myIndice]=str;
+        myIndice++;
+
+        myBuffer[myIndice]='_';
+        //pLabel->setNewText(myBuffer,myIndice-1);
+        pLabel->setNewText(myBuffer);
+        return;
+    }
+//
+//le point
+    if(id==BTN_POINT_ID) {
+        str='.';
+        myBuffer[myIndice]=str;
+        myIndice++;
+
+        myBuffer[myIndice]='_';
+        // pLabel->setNewText(myBuffer,myIndice-1);
+        pLabel->setNewText(myBuffer);
+
+        return;
+    }
+//
+//l'espace
+    if(id==BTN_ESP_ID) {
+        str=' ';
+
+        myBuffer[myIndice]=str;
+        myIndice++;
+
+        myBuffer[myIndice]='_';
+        // pLabel->setNewText(myBuffer,myIndice-1);
+        pLabel->setNewText(myBuffer);
+        return;
+    }
+//
+//enter
+    if(id==BTN_OK_ID) {
+        myEnter=true;
+        return;
+    }
+
+//Supp
+    if(id==BTN_DEL_ID) {
+        if(myIndice>=0)
+            myIndice--;
+
+        myBuffer[myIndice]='_';
+        //pLabel->setNewText(myBuffer,myIndice-1);
+        pLabel->setNewText(myBuffer);
+    }
+}
+
+//--------------------------------------------------
+void Keyboard::actionNunchuk(void)
+{
+
+    static bool isZ=false;
+    static Button* pb=myTabBtn[10];
+
+
+    signed char posX=myNunchuk->getJoyX();
+
+    signed char valZ=myNunchuk->getBtnZ();
+
+    signed char valC=myNunchuk->getBtnC();
+
+
+    //
+    switch(valC) {
+        case 1:
+            myEnter=true;
+            return;
+            //
+        case 0:
+            myEnter=false;
+            break;
+    }
+    //
+    ////////////////////////
+    switch(valZ) {
+        case 1:
+            if(isZ==false) {
+                if(myPointeur==39) {
+                    myEnter=true;
+                    return;
+                }
+
+                pb=myTabBtn[myPointeur];
+
+                UINT16 id=pb->getId();
+
+                afficheById(id);
+
+
+                isZ=true;
+            }
+            break;
+
+            //
+        case 0:
+            isZ=false;
+            break;
+
+            //
+        default:
+            break;
+    }
+    //
+
+
+    //
+    switch(posX) {
+        case -1:
+            myPointeur--;
+            if(myPointeur<0)
+                myPointeur=39;
+
+            pb=myTabBtn[myPointeur];
+
+            if(pb!=NULL) {
+                pb->setState(BUTTON_STATE_RELEASED);
+                wait(0.1);
+                pb->setState(BUTTON_STATE_PRESSED);
+            }
+
+            break;
+
+            //
+        case 1:
+            myPointeur++;
+
+            if(myPointeur>39)
+                myPointeur=0;
+
+            pb=myTabBtn[myPointeur];
+
+            if(pb!=NULL) {
+                pb->setState(BUTTON_STATE_RELEASED);
+                wait(0.1);
+                pb->setState(BUTTON_STATE_PRESSED);
+            }
+
+            break;
+
+            //
+        case 0:
+
+            if(pb!=NULL ) {
+                pb->setState(BUTTON_STATE_RELEASED);
+                wait(0.1);
+                pb->setState(BUTTON_STATE_PRESSED);
+                wait(0.1);
+            }
+            break;
+
+            //
+        default:
+            break;
+    }
+
+    //
+}
+//--------------------------------------------------
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,157 @@
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+
+#include "mbed.h"
+#include "Screen.h"
+#include "Button.h"
+#include "Label.h"
+#include "PicasoSerial.h"
+#include "Nunchuk.h"
+#include "Buzzer.h"
+#include <string>
+
+#define BTN_0_ID    10
+#define BTN_1_ID    11
+#define BTN_2_ID    12
+#define BTN_3_ID    13
+#define BTN_4_ID    14
+#define BTN_5_ID    15
+#define BTN_6_ID    16
+#define BTN_7_ID    17
+#define BTN_8_ID    18
+#define BTN_9_ID    19
+
+#define BTN_A_ID    100
+#define BTN_B_ID    101
+#define BTN_C_ID    102
+#define BTN_D_ID    103
+#define BTN_E_ID    104
+#define BTN_F_ID    105
+#define BTN_G_ID    106
+#define BTN_H_ID    107
+#define BTN_I_ID    108
+#define BTN_J_ID    109
+#define BTN_K_ID    110
+#define BTN_L_ID    111
+#define BTN_M_ID    112
+#define BTN_N_ID    113
+#define BTN_O_ID    114
+#define BTN_P_ID    115
+#define BTN_Q_ID    116
+#define BTN_R_ID    117
+#define BTN_S_ID    118
+#define BTN_T_ID    119
+#define BTN_U_ID    120
+#define BTN_V_ID    121
+#define BTN_W_ID    122
+#define BTN_X_ID    123
+#define BTN_Y_ID    124
+#define BTN_Z_ID    125
+
+#define BTN_ESP_ID  200
+#define BTN_DEL_ID  201
+#define BTN_OK_ID   202
+#define BTN_POINT_ID    203
+
+
+class Keyboard
+{
+public:
+    Keyboard(Screen* pscreen,string titre="Keyboard",Nunchuk* pnunchuk=NULL,Buzzer* pbuzzer=NULL,
+             float sampleTime=0.1);
+
+    Keyboard(Screen* pscreen,string titre="Keyboard",Buzzer* pbuzzer=NULL);
+
+    virtual ~Keyboard(void);
+
+    bool isEnterPressed(void);
+
+    void draw(void);
+
+    //int getString(char* str);
+
+    string getString(void);
+
+private:
+    Screen* myScreen;
+    string myTitre;
+    Buzzer* myBuzzer;
+    Nunchuk* myNunchuk;
+
+    float mySampleTime;
+
+    GraphicMessage myMessage;
+
+    Ticker myTicker;
+
+    void loop(void);
+
+    char myBuffer[50];
+    string myString;
+
+    bool myEnter;
+    int myIndice;
+    int myPointeur;
+
+    Note* myBeep;
+
+    void createScreen(void);
+    void affiche(void);
+
+    void initialisation(void);
+    void actionNunchuk(void);
+    void afficheById(UINT16 id);
+
+    Label* pLabelTitre;
+    Label* pLabel;
+
+    Button* pBtn_0;
+    Button* pBtn_1;
+    Button* pBtn_2;
+    Button* pBtn_3;
+    Button* pBtn_4;
+    Button* pBtn_5;
+    Button* pBtn_6;
+    Button* pBtn_7;
+    Button* pBtn_8;
+    Button* pBtn_9;
+
+    Button* pBtn_A;
+    Button* pBtn_B;
+    Button* pBtn_C;
+    Button* pBtn_D;
+    Button* pBtn_E;
+    Button* pBtn_F;
+    Button* pBtn_G;
+    Button* pBtn_H;
+    Button* pBtn_I;
+    Button* pBtn_J;
+
+    Button* pBtn_K;
+    Button* pBtn_L;
+    Button* pBtn_M;
+    Button* pBtn_N;
+    Button* pBtn_O;
+    Button* pBtn_P;
+    Button* pBtn_Q;
+    Button* pBtn_R;
+    Button* pBtn_S;
+    Button* pBtn_T;
+    Button* pBtn_U;
+
+    Button* pBtn_V;
+    Button* pBtn_W;
+    Button* pBtn_X;
+    Button* pBtn_Y;
+    Button* pBtn_Z;
+
+    Button* pBtn_Point;
+
+    Button* pBtn_Esp;
+    Button* pBtn_Del;
+    Button* pBtn_Ok;
+
+    Button* myTabBtn[40];
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Label.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,151 @@
+#include "Label.h"
+
+Label::Label(Screen* mScreen,UINT16 _x,UINT16 _y,string _text,Font _font,Color _colorText,Color _colorBkg):
+    Widget(mScreen,0,_x,_y,10,10,_colorBkg)
+
+{
+    myText=_text;
+    myFont=_font;
+    myColorText=_colorText;
+
+    myType=OBJ_LABEL;
+
+    //
+    UINT16 largeur=0;
+    UINT16 hauteur=16;
+    UINT16 taille=0;
+    UINT16 incLargeur=12;
+
+    switch(_font) {
+            //
+        case FONT_2:
+            incLargeur=8;
+            hauteur=8;
+            largeur=8;
+            break;
+
+            //
+        case FONT_3:
+            incLargeur=8;
+            hauteur=12;
+            largeur=8;
+            break;
+            //
+        case FONT_1:
+            incLargeur=5;
+            hauteur=7;
+            largeur=5;
+            break;
+
+            //
+        default:
+            incLargeur=12;
+            hauteur=16;
+            largeur=8;
+            break;
+    }
+    //cherche taille
+    
+    taille=_text.size();
+    largeur=incLargeur*taille;
+    
+    if(largeur > incLargeur)
+        largeur=largeur-incLargeur;
+
+    myWidth=largeur;
+    myHeight=hauteur;
+
+    myScreen->addWidget((Widget*) this);
+}
+//-----------------------------------------------------
+Label::~Label(void)
+{
+}
+//-----------------------------------------------------
+void Label::draw(void)
+{
+    // isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+
+        ps->draw_string(myText,myX,myY,myFont,myColorText,myColor);
+    }
+    ps=0;
+}
+//------------------------------------------------------
+void Label::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+        
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+        this->draw();
+    }
+}
+//-------------------------------------------------------
+void Label::setNewText(string _newText)
+{
+
+    UINT16 hauteur=16;
+    UINT16 incLargeur=12;
+    UINT16 taille=0;
+
+    switch(myFont) {
+            //
+        case FONT_2:
+            incLargeur=8;
+            hauteur=8;
+            break;
+
+            //
+        case FONT_3:
+            incLargeur=8;
+            hauteur=12;
+            break;
+            //
+        case FONT_1:
+            incLargeur=5;
+            hauteur=7;
+            break;
+
+            //
+        default:
+            incLargeur=12;
+            hauteur=16;
+            break;
+    }
+    
+    taille=_newText.size();
+    
+    myWidth=taille*incLargeur;
+    myHeight=hauteur;
+    myText=_newText;
+
+    setInvisible(true);
+    setInvisible(false);
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Label.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,40 @@
+#ifndef LABEL_H
+#define LABEL_H
+
+#include "Screen.h"
+
+class Label:public Widget
+{
+public:
+    /** Construct a label
+        *
+        * @param mScreen the pointer screen
+        * @params _x
+        * @params _y
+        * @params _text
+        * @params _font
+        * @params _colorText
+        * @params _colorBkg
+        */
+
+    Label(Screen* mScreen,UINT16 _x,UINT16 _y,
+          string _text,Font _font,Color _colorText,Color _colorBkg);
+
+    //
+    virtual void draw(void);
+    //
+    virtual ~Label(void);
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewText(string _newText);
+
+protected:
+    string myText;
+    Font myFont;
+    Color myColorText;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Nunchuk.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,173 @@
+#include "Nunchuk.h"
+
+Nunchuk::Nunchuk(PinName sda,PinName scl,float mTe):myI2C(sda,scl)
+{
+    periodeTe=mTe;
+    myI2C.frequency(100000);
+
+    this->joyX=0x00;
+    this->joyY=0x00;
+    this->accX=0;
+    this->accY=0;
+    this->accZ=0;
+    this->btnC=false;
+    this->btnZ=false;
+
+    setup();
+
+    if(periodeTe>0)
+        myTicker.attach(this,&Nunchuk::process,periodeTe);
+}
+//-----------------------
+Nunchuk::~Nunchuk(void)
+{
+    if(periodeTe>0)
+        myTicker.detach();
+}
+//-----------------------
+void Nunchuk::process(void)
+{
+    bool res=false;
+    static char datas[6];
+
+    int i=0;
+
+    res=request();  //demande une mesure
+    if(res==false) {
+        return ;   //pb
+    }
+
+    if(myI2C.read(ADRESSE,datas,6)==0) {
+        res=true;
+
+        for(i=0; i<6; i++) {
+            datas[i]=decode(datas[i]);
+        }
+
+        //
+        if(datas[0] < 100)
+            joyX=-1;
+        else if(datas[0] >200)
+            joyX=1;
+        else
+            joyX=0;
+        //
+        if(datas[1] <100)
+            joyY=-1;
+        else if(datas[1] >140)
+            joyY=1;
+        else
+            joyY=0;
+        //
+        accX=datas[2]<<2;
+        accY=datas[3]<<2;
+        accZ=datas[4]<<2;
+
+        //btnZ
+        if(datas[5] & 0x01)
+            btnZ=false;
+        else
+            btnZ=true;
+
+
+        //btnC
+        if(datas[5]& 0x02)
+            btnC=false;
+        else
+            btnC=true;
+
+        accX+=(datas[5]>>2) & 0x0003;
+        accY+=(datas[5]>>4) & 0x0003;
+        accZ+=(datas[5]>>6) & 0x0003;
+
+
+    } else {
+        res=false;
+        joyX=0;
+        joyY=0;
+
+        accX=0;
+        accY=0;
+        accZ=0;
+        btnZ=false;
+        btnC=false;
+    }
+
+}
+//-----------------------
+bool Nunchuk::setup(void)
+{
+    char cmd[2];
+    bool res=false;
+
+    cmd[0]=0x40;
+    cmd[1]=0x00;
+
+    if(myI2C.write(ADRESSE,cmd,2)==0) {
+        res=true;
+    } else {
+        res=false;
+    }
+    return res;
+}
+//----------------------------
+bool Nunchuk::request(void)
+{
+    bool res=false;
+    char cmd[1]= {0x00};
+
+    if(myI2C.write(ADRESSE,cmd,1)==0) {
+        res=true;
+        wait(0.001);
+
+    } else {
+        res=false;
+    }
+
+    return res;
+}
+//-----------------------------
+float Nunchuk::getPeriodeTe(void)
+{
+    return periodeTe;
+}
+//-----------------------------
+char Nunchuk::decode(char data)
+{
+    return (data^0x17)+0x17;
+}
+//------------------------------
+signed char Nunchuk::getJoyX(void)
+{
+    return joyX;
+}
+//-------------------------------
+signed char Nunchuk::getJoyY(void)
+{
+    return joyY;
+}
+//--------------------------------
+int Nunchuk::getAccX(void)
+{
+    return accX;
+}
+//------------------------------
+int Nunchuk::getAccY(void)
+{
+    return accY;
+}
+//----------------------------
+int Nunchuk::getAccZ(void)
+{
+    return accZ;
+}
+//-----------------------------
+bool Nunchuk::getBtnC(void)
+{
+    return btnC;
+}
+//-------------------------------
+bool Nunchuk::getBtnZ(void)
+{
+    return btnZ;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Nunchuk.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,118 @@
+#ifndef NUNCHUK_H
+#define NUNCHUK_H
+
+#include "mbed.h"
+
+/** Class to interface with a Nintendo wii Nunchuk.
+Exemple
+@code
+#include "mbed.h"
+#include "Nunchuk.h"
+
+Serial pc(USBTX,USBRX);
+Nunchuk device(p28,p27,0.05);
+int main()
+{
+while(1) {
+
+ pc.printf("> :%d : %d : %d: %d \r\n",device.getJoyX(),device.getJoyY(),device.getAccX(),device.getBtnZ());
+
+ wait(1);
+        }
+}
+@endcode
+ */
+
+class Nunchuk
+{
+
+public:
+    /** Construct a Nunchuk object.
+        *
+        * @param sda I2C channel to use.
+        * @param scl I2C channel
+        * @param mTe the sampling time for the internal Ticker
+        * if @param mTe=0 start a new acquisition manually without internal Ticker
+        */
+    Nunchuk(PinName sda,PinName scl,float mTe=0);
+
+    ~Nunchuk(void);
+
+    /// start a new acquisition manually without internal Ticker
+    void process(void);
+
+    /// Get the joyStick position
+    ///    @returns -1: joyStick in left position
+    ///    @returns +1: joyStick in righ position
+    ///    @returns 0: center position
+
+
+    signed char getJoyX(void);
+
+    //! Get the joyStick position
+    //!   @returns -1: joyStick in left position
+    //!   @returns +1: joyStick in righ position
+    //!   @returns 0: center position
+
+    signed char getJoyY(void);
+
+    /** @returns The acceleration in axis X (10 bits)
+    */
+    int getAccX(void);
+
+    /** @returns The acceleration in axis Y (10 bits)
+    */
+    int getAccY(void);
+
+    /** @returns The acceleration in axis Z (10 bits)
+    */
+    int getAccZ(void);
+
+
+    //! @returns true if button C pressed
+
+    bool getBtnC(void);
+
+
+    //! @returns true if button  Z pressed
+
+    bool getBtnZ(void);
+
+    /** @returns The sampling period
+    */
+    float getPeriodeTe(void);
+
+
+
+protected:
+    I2C myI2C;
+    //
+    Ticker myTicker;
+    //
+    bool setup(void);
+    //
+    bool request(void);
+    //
+    char decode(char data);
+    //
+
+
+
+//datas
+    static const int ADRESSE=0xA4;
+    signed char joyX;  //-1    0   +1
+    signed char joyY;  //-1    0   +1
+
+    int accX;
+    int accY;
+    int accZ;
+
+    bool btnC;
+    bool btnZ;
+
+    float periodeTe;
+
+
+};
+
+#endif
\ No newline at end of file
--- a/ObjetGraphic.cpp	Sun Jul 06 10:36:27 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2608 +0,0 @@
-
-#include "ObjetGraphic.h"
-
-PicasoSerial* ps=0;
-
-Screen::Screen(PicasoSerial* serial,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _colorBkg):
-    myXpos(_x),myYpos(_y),myWidth(_w),myHeight(_h),myColorBkg(_colorBkg)
-{
-    mySerial=serial;
-}
-//------------------------------------
-Screen::~Screen(void)
-{
-    ps=0;
-
-    for(int i=0; i<myVectorObjet.size(); i++) {
-        delete  myVectorObjet[i];
-        myVectorObjet[i]=0;
-    }
-}
-//------------------------------------
-UINT16 Screen::getXpos(void)
-{
-    return this->myXpos;
-}
-//----------------------------------
-UINT16 Screen::getYpos(void)
-{
-    return this->myYpos;
-}
-//------------------------------------
-UINT16 Screen::getWidth(void)
-{
-    return this->myWidth;
-}
-//-------------------------------------
-UINT16 Screen::getHeight(void)
-{
-    return this->myHeight;
-}
-//------------------------------------
-void Screen::drawObj(ObjetHeader* pObj)
-{
-    pObj->draw();
-
-}
-//------------------------------------
-void Screen::drawAll(void)
-{
-    mySerial->draw_filled_rectangle(myXpos,myYpos,myXpos+myWidth,myYpos+myHeight,myColorBkg);
-
-    //
-    for(int i=0; i<myVectorObjet.size(); i++) {
-        drawObj(myVectorObjet[i]);
-    }
-}
-//-------------------------------------
-void Screen::drawCells(void)
-{
-    for(int i=1; i<3; i++) {
-        mySerial->draw_line(80*i,0,80*i,320,BLACK);
-    }
-    //
-    for(int i=1; i<4; i++) {
-        mySerial->draw_line(0,80*i,240,80*i,BLACK);
-    }
-
-}
-//-------------------------------------
-void Screen::addObj(ObjetHeader* pObj)
-{
-    myVectorObjet.push_back(pObj);
-}
-//---------------------------------------
-PicasoSerial* Screen::getPicasoSerial(void)
-{
-    return  mySerial;
-}
-//---------------------------------------
-Color Screen::getColorBkg(void)
-{
-    return myColorBkg;
-}
-//--------------------------------------
-bool Screen::isContent(ObjetHeader* pObj, UINT16 _x,UINT16 _y)
-{
-    UINT16 xd=pObj->getXpos();
-    UINT16 w=pObj->getWidth();
-    UINT16 xf=xd+w;
-
-    UINT16 yd=pObj->getYpos();
-    UINT16 h=pObj->getHeight();
-    UINT16 yf=yd+h;
-
-    if(_x >= xd && _x<= xf && _y>=yd && _y<= yf) {
-        return true;
-    }
-
-    return false;
-
-}
-//-------------------------------------
-ObjetHeader* Screen::getObjetPosition(UINT16 _x,UINT16 _y)
-{
-
-    if(myVectorObjet.size()==0)
-        return NULL;
-
-    //
-    for(int i=0; i<myVectorObjet.size(); i++) {
-        if(isContent(myVectorObjet[i],_x,_y))
-            return myVectorObjet[i];
-    }
-    return NULL;
-}
-//-------------------------------------
-ObjetHeader* Screen::getObjetById(UINT16 _id)
-{
-    if(myVectorObjet.size()==0)
-        return NULL;
-
-    //
-    for(int i=0; i<myVectorObjet.size(); i++) {
-        if((myVectorObjet[i]->getElementId())== _id)
-            return myVectorObjet[i];
-    }
-    return NULL;
-
-}
-//-------------------------------------
-TouchEvent Screen::getTouchEvent(GraphicMessage* msg)
-{
-    TouchEvent ev=EVENT_NO_ACTIVITY;
-    UINT16 xp=0;
-    UINT16 yp=0;
-
-    ev=mySerial->touch_get_status();
-
-    //
-    if(ev >EVENT_NO_ACTIVITY) {
-        xp=mySerial->touch_get_x();
-        yp=mySerial->touch_get_y();
-
-        msg->event=ev;
-        msg->posiX=xp;
-        msg->posiY=yp;
-        msg->objId=0;
-
-        return ev;
-    } else {
-        
-        msg->event=EVENT_NO_ACTIVITY;
-        msg->posiX=0;
-        msg->posiY=0;
-        msg->objId=0;
-    }
-    //
-    return ev;
-}
-//-------------------------------------
-void Screen::getProcessMessage(GraphicMessage* msg)
-{
-    UINT16 xt=msg->posiX;
-    UINT16 yt=msg->posiY;
-    UINT16 res=0;
-
-    ObjetHeader* obj=NULL;
-
-    obj=getObjetPosition(xt,yt);
-
-    if(obj!=NULL && obj->getIsVisible()==true) {
-        res=obj->getElementId();
-        msg->objId=res;
-    } else {
-        msg->objId=0;
-    }
-
-}
-//-------------------------------------
-//
-//
-//
-//---------------------------------------
-ObjetHeader::ObjetHeader(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color,bool _isVisible):
-    myScreen(mScreen),myElementId(_id),myX(_x),myY(_y),myWidth(_w),myHeight(_h),myColor(_color),myElementIsVisible(_isVisible)
-{
-
-    myElementState=STATE_ON;
-    myIsUpdateAutomatic=true;
-
-    myXMoveMin=myScreen->getXpos();
-    myYMoveMin=myScreen->getYpos();
-
-    myXMoveMax=myXMoveMin+myScreen->getWidth();
-    myYMoveMax= myYMoveMin+myScreen->getHeight();
-
-    mySpeedX=0.0;
-    mySpeedY=0.0;
-}
-//-------------------------------------
-ObjetHeader::~ObjetHeader(void)
-{
-}
-//-------------------------------------
-void ObjetHeader::updateCellId(void)
-{
-    UINT16 cellX=myX/(ObjetHeader::CELL_DIM);
-    UINT16 cellY=myY/(ObjetHeader::CELL_DIM);
-
-    myCellId=cellX+(cellY*ObjetHeader::CELL_COL);
-}
-//-------------------------------------
-UINT16 ObjetHeader::getCellId(void)
-{
-    return this->myCellId;
-}
-//-------------------------------------
-void ObjetHeader::setUpdateAutomatic(bool _state)
-{
-    myIsUpdateAutomatic=_state;
-}
-//---------------------------------------
-bool ObjetHeader::getUpdateAutomatic(void)
-{
-    return this->myIsUpdateAutomatic;
-}
-//-------------------------------------
-bool ObjetHeader::overlapWith(ObjetHeader* pObj)
-{
-    return overlap(this,pObj);
-}
-//-------------------------------------
-bool ObjetHeader::overlap(ObjetHeader* pObj1,ObjetHeader* pObj2)
-{
-    UINT16 x1=pObj1->getXpos();
-    UINT16 x2=pObj2->getXpos();
-
-    UINT16 y1=pObj1->getYpos();
-    UINT16 y2=pObj2->getYpos();
-
-    UINT16 xa=pObj1->getXpos()+pObj1->getWidth();
-    UINT16 xb=pObj2->getXpos()+pObj2->getWidth();
-
-    UINT16 ya=pObj1->getYpos()+pObj1->getHeight();
-    UINT16 yb=pObj2->getYpos()+pObj2->getHeight();
-
-    //
-    if(x1 <xb && xa>x2 && y1<yb && ya>y2) {
-
-        return true;
-    } else {
-        return false;
-    }
-
-}
-//-------------------------------------
-void ObjetHeader::elementUpdate(void)
-{
-    switch(myElementState) {
-            //
-        case BUMP_DOWN:
-            setInvertSpeedY();
-            myElementState=STATE_ON;
-            break;
-            //
-        case BUMP_LEFT:
-            setInvertSpeedX();
-            myElementState=STATE_ON;
-            break;
-            //
-        case BUMP_RIGHT:
-            setInvertSpeedX();
-            myElementState=STATE_ON;
-            break;
-            //
-        case BUMP_UP:
-            setInvertSpeedY();
-            myElementState=STATE_ON;
-            break;
-            //
-        case STATE_OFF:
-            break;
-            //
-        default:
-            break;
-    }
-    //
-}
-//-------------------------------------
-void ObjetHeader::draw(void)
-{
-//to do
-}
-//-------------------------------------
-UINT16 ObjetHeader::getXpos(void)
-{
-    return this->myX;
-}
-//---------------------------------------
-UINT16 ObjetHeader::getYpos(void)
-{
-    return this->myY;
-}
-//----------------------------------------
-UINT16 ObjetHeader::getWidth(void)
-{
-    return this->myWidth;
-}
-//----------------------------------------
-UINT16 ObjetHeader::getHeight(void)
-{
-    return this->myHeight;
-}
-//----------------------------------------
-UINT16 ObjetHeader::getElementId(void)
-{
-    return this->myElementId;
-}
-//----------------------------------------
-GRAPHIC_OBJ_TYPE ObjetHeader::getElementType(void)
-{
-    return this->myElementType;
-}
-//----------------------------------------
-bool ObjetHeader::getIsVisible(void)
-{
-    return this->myElementIsVisible;
-}
-//----------------------------------------
-float ObjetHeader::getSpeedX(void)
-{
-    return this->mySpeedX;
-}
-//----------------------------------------
-float ObjetHeader::getSpeedY(void)
-{
-    return this->mySpeedY;
-}
-//----------------------------------------
-Color ObjetHeader::getColor(void)
-{
-    return myColor;
-}
-//----------------------------------------
-void ObjetHeader::setVisibility(bool _val)
-{
-    (this->myElementIsVisible)=_val;
-}
-//----------------------------------------
-State ObjetHeader::getElementState(void)
-{
-    return this->myElementState;
-}
-//----------------------------------------
-void ObjetHeader::setInvertSpeedX(void)
-{
-    mySpeedX=-(this->mySpeedX);
-}
-//----------------------------------------
-void ObjetHeader::setInvertSpeedY(void)
-{
-    mySpeedY=-(this->mySpeedY);
-}
-//----------------------------------------
-void ObjetHeader::setSpeedX(float _speedX)
-{
-    mySpeedX=_speedX;
-}
-//----------------------------------------
-void ObjetHeader::setSpeedY(float _speedY)
-{
-    mySpeedY=_speedY;
-}
-//----------------------------------------
-void ObjetHeader::setSpeedXY(float _speedX,float _speedY)
-{
-    mySpeedX=_speedX;
-    mySpeedY=_speedY;
-}
-//------------------------------------------
-void ObjetHeader::setColor(Color _color)
-{
-    myColor=_color;
-}
-//------------------------------------------
-void ObjetHeader::setElementState(State _state)
-{
-    myElementState=_state;
-}
-//------------------------------------------
-void ObjetHeader::setElementId(UINT16 _id)
-{
-    myElementId=_id;
-}
-//------------------------------------------
-void ObjetHeader::setXpos(UINT16 _xpos)
-{
-    this->myX=_xpos;
-}
-//------------------------------------------
-void ObjetHeader::setYpos(UINT16 _ypos)
-{
-    this->myY=_ypos;
-}
-//-------------------------------------------
-//
-//
-//
-//--------------------------------------------
-void Isocele::updateOrientation(void)
-{
-    switch(myOrientation) {
-            //
-        case Isocele::ORIENTATION_UP:
-            mySpeedX=0.0;
-            mySpeedY=-mySpeed;
-
-            myX=myXcenter-myRadius;
-            myY=myYcenter-myRadius;
-            myWidth=myRadius+myRadius;
-            myHeight=myRadius;
-
-            myX1=myXcenter;
-            myY1=myYcenter-myRadius;
-
-            myX2=myXcenter-myRadius;
-            myY2=myYcenter;
-
-            myX3=myXcenter+myRadius;
-            myY3=myYcenter;
-            break;
-
-            //
-        case Isocele::ORIENTATION_RIGHT:
-            mySpeedX=mySpeed;
-            mySpeedY=0.0;
-
-            myX=myXcenter;
-            myY=myYcenter-myRadius;
-            myWidth=myRadius;
-            myHeight=myRadius+myRadius;
-
-            myX1=myXcenter;
-            myY1=myYcenter-myRadius;
-
-            myX2=myXcenter;
-            myY2=myYcenter+myRadius;
-
-            myX3=myXcenter+myRadius;
-            myY3=myYcenter;
-            break;
-
-            //
-        case Isocele::ORIENTATION_DOWN:
-            mySpeedX=0.0;
-            mySpeedY=mySpeed;
-
-            myX=myXcenter-myRadius;
-            myY=myYcenter;
-            myWidth=myRadius+myRadius;
-            myHeight=myRadius;
-
-            myX1=myXcenter-myRadius;
-            myY1=myYcenter;
-
-            myX2=myXcenter;
-            myY2=myYcenter+myRadius;
-
-            myX3=myXcenter+myRadius;
-            myY3=myYcenter;
-            break;
-
-            //
-        case Isocele::ORIENTATION_LEFT:
-            mySpeedX=-mySpeed;
-            mySpeedY=0.0;
-
-            myX=myXcenter-myRadius;
-            myY=myYcenter-myRadius;
-            myWidth=myRadius;
-            myHeight=myRadius+myRadius;
-
-            myX1=myXcenter-myRadius;
-            myY1=myYcenter;
-
-            myX2=myXcenter;
-            myY2=myYcenter+myRadius;
-
-            myX3=myXcenter;
-            myY3=myYcenter-myRadius;
-            break;
-
-            //
-        default:
-            break;
-
-    }
-
-}
-//--------------------------------------------
-Isocele::Isocele(Screen* mScreen,UINT16 _id,UINT16 xc,UINT16 yc,UINT16 radius,int orientation,float _speed,
-                 Color color,bool isVisible): ObjetHeader(mScreen,_id,xc-radius,yc-radius,radius+radius,radius,color,isVisible)
-{
-    myXcenter=xc;
-    myYcenter=yc;
-    myRadius=radius;
-    myOrientation=orientation;
-    mySpeed=_speed;
-
-    updateOrientation();
-
-    myIsUpdateAutomatic=false;
-
-    myElementType=OBJ_ISOCELE;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//--------------------------------------------
-void Isocele::draw(void)
-{
-    // isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,myColor);
-        //
-        //ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,BLACK);
-    }
-}
-//---------------------------------------------
-Isocele::~Isocele(void)
-{
-}
-//--------------------------------------------
-void Isocele:: setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,c);
-            //ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-        this->draw();
-    }
-}
-//-------------------------------------------
-void Isocele::setNewPosition(INT16 _xcnew,INT16 _ycnew)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myXcenter==_xcnew && myYcenter==_ycnew)
-        return;
-    //
-    this->setInvisible(true); // colorie le cir avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xcnew+myRadius >= myXMoveMax) {
-        _xcnew=myXMoveMax-myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-    }
-
-    //test Xmin
-    if(_xcnew <= myRadius) {
-        _xcnew=myXMoveMin+myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-    }
-    //test Ymax
-    if(_ycnew +myRadius >= myYMoveMax && _ycnew >0) {
-        _ycnew = myYMoveMax- myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ycnew <= myRadius) {
-        _ycnew=myYMoveMin+myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-    }
-    //
-    myXcenter=_xcnew;
-    myYcenter=_ycnew;
-
-    updateOrientation();
-
-
-    this->draw();
-}
-//--------------------------------------------
-void Isocele::myElementUpdate(void)
-{
-    switch(myElementState) {
-            //
-        case BUMP_DOWN:
-            setInvertSpeedY();
-            myElementState=STATE_ON;
-            myOrientation=Isocele::ORIENTATION_UP;
-            break;
-            //
-        case BUMP_LEFT:
-            setInvertSpeedX();
-            myElementState=STATE_ON;
-            myOrientation=Isocele::ORIENTATION_RIGHT;
-            break;
-            //
-        case BUMP_RIGHT:
-            setInvertSpeedX();
-            myElementState=STATE_ON;
-            myOrientation=Isocele::ORIENTATION_LEFT;
-            break;
-            //
-        case BUMP_UP:
-            setInvertSpeedY();
-            myElementState=STATE_ON;
-            myOrientation=Isocele::ORIENTATION_DOWN;
-            break;
-            //
-        case STATE_OFF:
-            break;
-            //
-        default:
-            break;
-    }
-}
-//--------------------------------------------
-void Isocele::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        myElementUpdate();
-    //
-    float xnew=myXcenter+mySpeedX*delta;
-    float ynew=myYcenter+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xnew,(INT16)ynew);
-
-    updateCellId();
-}
-//--------------------------------------------
-void Isocele::setOrientation(int _orientation)
-{
-    myOrientation=_orientation;
-
-}
-//--------------------------------------------
-int Isocele::getOrientation(void)
-{
-    return this->myOrientation;
-}
-//--------------------------------------------
-UINT16 Isocele::getXcenter(void)
-{
-    return this->myXcenter;
-}
-//--------------------------------------------
-UINT16 Isocele::getYcenter(void)
-{
-    return this->myYcenter;
-}
-//--------------------------------------------
-void Isocele::turnLeft(void)
-{
-    myOrientation+=1;
-
-    if(myOrientation >Isocele::ORIENTATION_RIGHT)
-        myOrientation=ORIENTATION_UP;
-
-}
-//--------------------------------------------
-void Isocele::turnRight(void)
-{
-    myOrientation-=1;
-
-    if(myOrientation <Isocele::ORIENTATION_UP)
-        myOrientation=ORIENTATION_RIGHT;
-
-}
-//--------------------------------------------
-//
-//
-//
-Rectangle::Rectangle(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color,bool _isVisible):
-    ObjetHeader(mScreen,_id,_x,_y,_w,_h,_color,_isVisible)
-{
-    myElementType=OBJ_RECTANGLE;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//------------------------------------
-Rectangle::~Rectangle(void)
-{
-}
-//------------------------------------
-void Rectangle::draw(void)
-{
-    // isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,myColor);
-    }
-}
-//-------------------------------------
-void Rectangle::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-        this->draw();
-    }
-}
-//--------------------------------------
-void Rectangle::setNewPosition(INT16 _xnew,INT16 _ynew)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    //
-    if(myX==_xnew && myY==_ynew)
-        return;
-
-    setInvisible(true); // colorie le rec avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xnew+myWidth >= myXMoveMax) {
-        _xnew=myXMoveMax-myWidth;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-
-    }
-
-    //test Xmin
-    if(_xnew <= myXMoveMin) {
-        _xnew=myXMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-
-    }
-    //test Ymax
-    if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
-        _ynew = myYMoveMax- myHeight;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ynew <= myYMoveMin) {
-        _ynew=myYMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-
-    }
-    //
-    myX=_xnew;
-    myY=_ynew;
-
-
-    this->draw();
-}
-//--------------------------------------
-void Rectangle::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        elementUpdate();
-    //
-    float xnew=myX+mySpeedX*delta;
-    float ynew=myY+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xnew,(INT16)ynew);
-
-    updateCellId();
-}
-//-------------------------------------
-//
-//
-Circle::Circle(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radius,Color _color,bool _isVisible):
-    ObjetHeader(mScreen,_id,_xc-_radius,_yc-_radius,_radius+_radius,_radius+_radius,_color,_isVisible)
-{
-    myRadius=_radius;
-    myCenterX=_xc;
-    myCenterY=_yc;
-    myElementType=OBJ_CIRCLE;
-
-    myScreen->addObj((ObjetHeader*) this);
-
-}
-//-----------------------------------------
-Circle::~Circle(void)
-{
-}
-//------------------------------------------
-void Circle::draw(void)
-{
-// isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColor);
-    }
-}
-//------------------------------------------
-void Circle::setCenterX(UINT16 _xcenter)
-{
-    this->myCenterX=_xcenter;
-}
-//------------------------------------------
-void Circle::setCenterY(UINT16 _ycenter)
-{
-    this->myCenterY=_ycenter;
-}
-//------------------------------------------
-UINT16 Circle::getCenterX(void)
-{
-    return this->myCenterX;
-}
-//-------------------------------------------
-UINT16 Circle::getCenterY(void)
-{
-    return this->myCenterY;
-}
-//--------------------------------------------
-void Circle::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_circle(myCenterX,myCenterY,myRadius,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//---------------------------------------------
-void Circle::setNewPosition(INT16 _xcnew,INT16 _ycnew)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myCenterX==_xcnew && myCenterY==_ycnew)
-        return;
-    //
-    this->setInvisible(true); // colorie le cir avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xcnew+myRadius >= myXMoveMax) {
-        _xcnew=myXMoveMax-myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-    }
-
-    //test Xmin
-    if(_xcnew <= myRadius) {
-        _xcnew=myXMoveMin+myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-    }
-    //test Ymax
-    if(_ycnew +myRadius >= myYMoveMax && _ycnew >0) {
-        _ycnew = myYMoveMax- myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ycnew <= myRadius) {
-        _ycnew=myYMoveMin+myRadius;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-    }
-    //
-    myCenterX=_xcnew;
-    myCenterY=_ycnew;
-
-    myX=_xcnew-myRadius;
-    myY=_ycnew-myRadius;
-
-
-    this->draw();
-}
-//----------------------------------------------
-void Circle::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        elementUpdate();
-
-    float xcnew=myCenterX+mySpeedX*delta;
-    float ycnew=myCenterY+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xcnew,(INT16)ycnew);
-
-    updateCellId();
-}
-//----------------------------------------------
-//
-//
-//
-Ellipse::Ellipse(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radiusX,UINT16 _radiusY,Color _color,
-                 bool _isVisible):ObjetHeader(mScreen,_id,_xc-_radiusX,_yc-_radiusY,_radiusX+_radiusX,_radiusY+_radiusY,_color,_isVisible)
-{
-    myCenterX=_xc;
-    myCenterY=_yc;
-    myRadiusX=_radiusX;
-    myRadiusY=_radiusY;
-
-    myElementType=OBJ_ELLIPSE;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//----------------------------------------------
-void Ellipse::draw(void)
-{
-    // isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_ellipse(myCenterX,myCenterY,myRadiusX,myRadiusY,myColor);
-    }
-}
-//----------------------------------------------
-void Ellipse::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        elementUpdate();
-
-    float xcnew=myCenterX+mySpeedX*delta;
-    float ycnew=myCenterY+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xcnew,(INT16)ycnew);
-
-    updateCellId();
-}
-//-----------------------------------------------
-void Ellipse::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_ellipse(myCenterX,myCenterY,myRadiusX,myRadiusY,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//-----------------------------------------------
-void Ellipse::setNewPosition(INT16 _xcnew,INT16 _ycnew)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myCenterX==_xcnew && myCenterY==_ycnew)
-        return;
-    //
-    this->setInvisible(true); // colorie le cir avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xcnew+myRadiusX >= myXMoveMax) {
-        _xcnew=myXMoveMax-myRadiusX;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-    }
-
-    //test Xmin
-    if(_xcnew <= myRadiusX) {
-        _xcnew=myXMoveMin+myRadiusX;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-    }
-    //test Ymax
-    if(_ycnew +myRadiusY >= myYMoveMax && _ycnew >0) {
-        _ycnew = myYMoveMax- myRadiusY;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ycnew <= myRadiusY) {
-        _ycnew=myYMoveMin+myRadiusY;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-    }
-    //
-    myCenterX=_xcnew;
-    myCenterY=_ycnew;
-
-    myX=_xcnew-myRadiusX;
-    myY=_ycnew-myRadiusY;
-
-
-    this->draw();
-}
-//-----------------------------------------------
-Ellipse::~Ellipse(void)
-{
-}
-//----------------------------------------------
-UINT16 Ellipse::getCenterX(void)
-{
-    return this->myCenterX;
-}
-//---------------------------------------------
-UINT16 Ellipse::getCenterY(void)
-{
-    return this->myCenterY;
-}
-//----------------------------------------------
-void Ellipse::setCenterX(UINT16 _xcenter)
-{
-    myCenterX=_xcenter;
-}
-//----------------------------------------------
-void Ellipse::setCenterY(UINT16 _ycenter)
-{
-    myCenterY=_ycenter;
-}
-//----------------------------------------------
-//
-//
-//
-Triangle::Triangle(Screen* mScreen,UINT16 _id,UINT16 _x1,UINT16 _y1,
-                   UINT16 _x2,UINT16 _y2,
-                   UINT16 _x3,UINT16 _y3,Color _color,bool _isVisible):
-    ObjetHeader(mScreen,_id,_x2,_y1,_x3-_x2,_y3-_y1,_color,_isVisible)
-{
-    myX1=_x1;
-    myY1=_y1;
-    myX2=_x2;
-    myY2=_y2;
-    myX3=_x3;
-    myY3=_y3;
-    myU=_x1-_x2;
-    myV=_y2-_y1;
-
-    myElementType=OBJ_TRIANGLE;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//-----------------------------------------------
-Triangle::~Triangle(void)
-{
-}
-//-----------------------------------------------
-void Triangle::draw(void)
-{
-// isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,myColor);
-    }
-}
-//------------------------------------------------
-void Triangle::setInvisible(bool _state)
-{
-// element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-        this->draw();
-    }
-}
-//------------------------------------------------
-void Triangle::setNewPosition(INT16 _xnew,INT16 _ynew)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myX==_xnew && myY==_ynew)
-        return;
-    setInvisible(true); // colorie le tri avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xnew+myWidth >= myXMoveMax) {
-        _xnew=myXMoveMax-myWidth;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-    }
-    //
-    //test Xmin
-    if(_xnew <= myXMoveMin) {
-        _xnew=myXMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-    }
-    //test Ymax
-    if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
-        _ynew = myYMoveMax- myHeight;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ynew <= myYMoveMin) {
-        _ynew=myYMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-    }
-
-    //
-    myX=_xnew;
-    myY=_ynew;
-
-    myX1=_xnew+myU;
-    myY1=_ynew;
-
-    myX2=_xnew;
-    myY2=_ynew+myV;
-
-    myX3=_xnew+myWidth;
-    myY3=_ynew+myHeight;
-
-    this->draw();
-}
-//------------------------------------------------
-void Triangle::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        elementUpdate();
-    //
-    float xnew=myX+mySpeedX*delta;
-    float ynew=myY+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xnew,(INT16)ynew);
-
-    updateCellId();
-}
-//-------------------------------------------------
-//
-//
-Diamond::Diamond(Screen* mScreen,UINT16 _id,UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
-                 UINT16 x3,UINT16 y3,UINT16 x4,UINT16 y4,Color _color,bool _isVisible):ObjetHeader(mScreen,_id,x1,y4,x3-x1,y2-y4,_color,_isVisible)
-{
-    myX1=x1;
-    myY1=y1;
-
-    myX2=x2;
-    myY2=y2;
-
-    myX3=x3;
-    myY3=y3;
-
-    myX4=x4;
-    myY4=y4;
-
-    myU1=x4-x1;
-    myU2=x2-x1;
-
-    myV1=y1-y4;
-    myV2=y3-y4;
-
-
-    myElementType=OBJ_DIAMOND;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//-----------------------------------------
-void Diamond::draw(void)
-{
-    // isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_filled_diamond(myX1,myY1,myX2,myY2,myX3,myY3,myX4,myY4,myColor);
-    }
-}
-//-----------------------------------------
-Diamond::~Diamond(void)
-{
-}
-//----------------------------
-void Diamond::update(float delta)
-{
-    if(myIsUpdateAutomatic)
-        elementUpdate();
-    //
-    float xnew=myX+mySpeedX*delta;
-    float ynew=myY+mySpeedY*delta;
-
-    this->setNewPosition((INT16)xnew,(INT16)ynew);
-
-    updateCellId();
-}
-//-------------------------------
-void Diamond::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_diamond(myX1,myY1,myX2,myY2,myX3,myY3,myX4,myY4,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-        this->draw();
-    }
-}
-//---------------------------------
-void Diamond::setNewPosition(INT16 _xnew,INT16 _ynew)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myX==_xnew && myY==_ynew)
-        return;
-    setInvisible(true); // colorie le tri avec couleur de la screen
-
-    myElementIsVisible=true;
-
-    //test Xmax
-    if(_xnew+myWidth >= myXMoveMax) {
-        _xnew=myXMoveMax-myWidth;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_RIGHT;
-    }
-    //
-    //test Xmin
-    if(_xnew <= myXMoveMin) {
-        _xnew=myXMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_LEFT;
-    }
-    //test Ymax
-    if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
-        _ynew = myYMoveMax- myHeight;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_DOWN;
-    }
-    //test yminMin;
-    if(_ynew <= myYMoveMin) {
-        _ynew=myYMoveMin;
-
-        if(myElementState==STATE_ON)
-            myElementState=BUMP_UP;
-    }
-
-    //
-    myX=_xnew;
-    myY=_ynew;
-
-    myX1=_xnew;
-    myY1=_ynew+myV1;
-
-    myX2=_xnew+myU2;
-    myY2=_ynew+myHeight;
-
-    myX3=_xnew+myWidth;
-    myY3=_ynew+myV2;
-
-    myX4=_xnew+myU1;
-    myY4=_ynew;
-
-    this->draw();
-}
-//---------------------------------
-//
-//
-//
-Label::Label(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,
-             string _text,Font _font,Color _colorText,Color _colorBkg,
-             bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,10,10,_colorBkg,_isVisible)
-
-{
-    myText=_text;
-    myFont=_font;
-    myColorText=_colorText;
-
-    myElementType=OBJ_LABEL;
-
-    //
-    UINT16 largeur=0;
-    UINT16 hauteur=16;
-    UINT16 taille=0;
-    UINT16 incLargeur=12;
-
-    switch(_font) {
-            //
-        case FONT_2:
-            incLargeur=8;
-            hauteur=8;
-            largeur=8;
-            break;
-
-            //
-        case FONT_3:
-            incLargeur=8;
-            hauteur=12;
-            largeur=8;
-            break;
-            //
-        case FONT_1:
-            incLargeur=5;
-            hauteur=7;
-            largeur=5;
-            break;
-
-            //
-        default:
-            incLargeur=12;
-            hauteur=16;
-            largeur=8;
-            break;
-    }
-    //cherche taille
-    
-    /*
-    while(*_text) 
-    {
-        taille++;
-        largeur=largeur+incLargeur;
-        _text++;
-    }
-    _text=_text-taille;
-    
-    */
-    taille=_text.size();
-    largeur=incLargeur*taille;
-    
-    if(largeur > incLargeur)
-        largeur=largeur-incLargeur;
-
-    myWidth=largeur;
-    myHeight=hauteur;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//-----------------------------------------------------
-Label::~Label(void)
-{
-    //myText=0;
-}
-//-----------------------------------------------------
-void Label::draw(void)
-{
-    // isVisible ?
-    if(myElementIsVisible==false) {
-        return;
-    }
-    //
-
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-
-        ps->draw_string(myText,myX,myY,myFont,myColorText,myColor);
-    }
-}
-//------------------------------------------------------
-void Label::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-        this->draw();
-    }
-}
-//-------------------------------------------------------
-void Label::setNewText(string _newText)
-{
-    //if(myElementIsVisible==false)
-    //    return;
-
-    UINT16 hauteur=16;
-    UINT16 incLargeur=12;
-    UINT16 taille=0;
-
-    switch(myFont) {
-            //
-        case FONT_2:
-            incLargeur=8;
-            hauteur=8;
-            break;
-
-            //
-        case FONT_3:
-            incLargeur=8;
-            hauteur=12;
-            break;
-            //
-        case FONT_1:
-            incLargeur=5;
-            hauteur=7;
-            break;
-
-            //
-        default:
-            incLargeur=12;
-            hauteur=16;
-            break;
-    }
-    
-    taille=_newText.size();
-    
-    //myWidth=_nbChar*incLargeur;
-    myWidth=taille*incLargeur;
-    myHeight=hauteur;
-    myText=_newText;
-
-    setInvisible(true);
-    setInvisible(false);
-    // this->draw();
-}
-//-------------------------------------------------------
-GraphicLed::GraphicLed(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radius,
-                       Color _colorOn,Color _colorOff,State _state,
-                       bool _isVisible):ObjetHeader(mScreen,_id,_xc-_radius,_yc-_radius,_radius+_radius,_radius+_radius,_colorOn,_isVisible)
-{
-    myColorOn=_colorOn;
-    myColorOff=_colorOff;
-    myRadius=_radius;
-    myCenterX=_xc;
-    myCenterY=_yc;
-
-    myElementState=_state;
-    myElementType=OBJ_LED;
-    myScreen->addObj((ObjetHeader*) this);
-}
-//---------------------------------------
-GraphicLed::~GraphicLed(void)
-{
-}
-//---------------------------------------
-void GraphicLed::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    UINT16 state=getElementState();
-
-    //static PicasoSerial* ps=0;
-    ps=myScreen->getPicasoSerial();
-
-    switch(state) {
-            //
-        case LED_STATE_ON:
-            if(ps!=0) {
-                ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColorOn);
-                ps->draw_circle(myCenterX,myCenterY,myRadius,BLACK);
-            }
-            return;
-            //
-        case LED_STATE_OFF:
-            if(ps!=0) {
-                ps->draw_filled_circle(myCenterX,myCenterY,myRadius,myColorOff);
-                ps->draw_circle(myCenterX,myCenterY,myRadius,BLACK);
-            }
-            return;
-            //
-        default:
-            break;
-    }
-}
-//---------------------------------------
-void GraphicLed::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        //static PicasoSerial* ps=0;
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_circle(myCenterX,myCenterY,myRadius,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//---------------------------------------
-void GraphicLed::setState(State _state)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    if(myElementState==_state)
-        return;
-
-    myElementState=_state;
-
-    this->draw();
-}
-//---------------------------------------
-Button::Button(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,string _text,Font _font,
-               Color _colorText,Color _colorBtn,State _state,
-               bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,0,0,_colorBtn,_isVisible)
-
-{
-    myText=_text;
-    myFont=_font;
-    myColorText=_colorText;
-
-    myElementState=_state;
-    myElementType=OBJ_BUTTON;
-
-    //
-    UINT16 largeur=0;
-    UINT16 hauteur=16;
-    UINT16 taille=0;
-    UINT16 incLargeur=12;
-
-    switch(_font) {
-            //
-        case FONT_2:
-            incLargeur=8;
-            hauteur=8;
-            largeur=8;
-            break;
-
-            //
-        case FONT_3:
-            incLargeur=8;
-            hauteur=12;
-            largeur=8;
-            break;
-            //
-        case FONT_1:
-            incLargeur=5;
-            hauteur=7;
-            largeur=5;
-            break;
-
-            //
-        default:
-            incLargeur=12;
-            hauteur=16;
-            largeur=8;
-            break;
-    }
-    
-    //cherche taille
-    /*
-    while(*_text) {
-        taille++;
-        largeur=largeur+incLargeur;
-        _text++;
-    }
-    _text=_text-taille;
-    */
-    taille=_text.size();
-    
-    largeur=taille*incLargeur;
-    
-    if(largeur > incLargeur)
-        largeur=largeur-incLargeur;
-
-    myWidth=largeur+incLargeur+incLargeur;
-    myHeight=hauteur+incLargeur+incLargeur;
-
-    myScreen->addObj((ObjetHeader*) this);
-    
-    //
-    
-}
-//--------------------------------------
-Button::~Button(void)
-{
-}
-//---------------------------------------
-void Button::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    UINT16 state=getElementState();
-
-    ps=myScreen->getPicasoSerial();
-
-    switch(state) {
-            //
-        case BUTTON_STATE_PRESSED:
-            if(ps!=0) {
-                ps->draw_button(myText,myX,myY,myFont,BUTTON_STATE_PRESSED,myColor,WHITE);
-
-            }
-            return;
-            //
-        case BUTTON_STATE_RELEASED:
-            if(ps!=0) {
-                ps->draw_button(myText,myX,myY,myFont,BUTTON_STATE_RELEASED,myColor,myColorText);
-
-            }
-            return;
-            //
-        default:
-            break;
-    }
-}
-
-//-----------------------------------
-void Button::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//------------------------------------
-void Button::setState(State _state)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    if(myElementState==_state)
-        return;
-
-    myElementState=_state;
-
-    this->draw();
-}
-//-------------------------------------
-Slider::Slider(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,int _valMax,int _value,
-               Color _colorBkg,bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,_width,_height,_colorBkg,_isVisible)
-{
-
-    myValueMax=_valMax;
-    myValue=_value;
-
-    myElementType=OBJ_SLIDER;
-    myElementState=SLIDER_STATE_RELEASED;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//---------------------------------------
-Slider::~Slider(void)
-{
-}
-//---------------------------------------
-void Slider::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-
-
-    ps=myScreen->getPicasoSerial();
-
-    if(ps!=0) {
-        ps->draw_slider(0x0000,myX,myY,myX+myWidth,myY+myHeight,myColor,myValueMax,myValue);
-    }
-
-}
-//--------------------------------------
-void Slider::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//-------------------------------------
-int Slider::getValue(GraphicMessage* pmsg)
-{
-    TouchEvent msgEvent=pmsg->event;
-
-    UINT16 xn=pmsg->posiX;
-
-
-    if(myElementIsVisible==false)
-        return 0;
-    //
-
-    if(msgEvent==EVENT_RELEASE) {
-        myElementState=SLIDER_STATE_RELEASED;
-    }
-    //
-    if(msgEvent==EVENT_MOVE) {
-        myElementState=SLIDER_STATE_MOVE;
-        UINT16 dis=xn-myX;
-        UINT16 a=dis*myValueMax;
-        myValue=(a/myWidth);
-
-        this->draw();
-    }
-    return myValue;
-}
-//-------------------------------------
-Input::Input(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,float _valMin,float _valInc,
-             float _valMax,bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,_width,_height,WHITE,_isVisible)
-{
-    myValMin=_valMin;
-    myValInc=_valInc;
-    myValMax=_valMax;
-    myValue=0.0;
-    myColorBkg=WHITE;
-    myColorCursorUp=BLUE;
-    myColorCursorDown=BLUE;
-
-    myElementType=OBJ_INPUT;
-    myElementState=INPUT_STATE_RELEASED;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//-------------------------------------
-Input::~Input(void)
-{
-}
-//-------------------------------------
-void Input::setColorBkg(Color _color)
-{
-    myColorBkg=_color;
-    this->draw();
-}
-//--------------------------------------
-void Input::setColorCursorUp(Color _color)
-{
-    myColorCursorUp=_color;
-    this->draw();
-}
-//-------------------------------------
-void Input::setColorCursorDown(Color _color)
-{
-    myColorCursorDown=_color;
-    this->draw();
-}
-//-------------------------------------
-void Input::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    ps=myScreen->getPicasoSerial();
-
-    //rect up
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight/2,myColorBkg);
-
-    //rect down
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX,myY+myHeight/2+3,myX+myWidth,myY+3+myHeight,myColorBkg);
-
-    //fleche up
-    UINT16 x1=myX+myWidth/2;
-    UINT16 y1=myY;
-
-    UINT16 x2=myX+myWidth;
-    UINT16 y2=myY+myHeight/2;
-
-    UINT16 x3=myX;
-    UINT16 y3=myY+myHeight/2;
-    if(ps!=0)
-        ps->draw_filled_triangle(x1,y1,x2,y2,x3,y3, myColorCursorUp);
-
-    //fleche down
-    x1=myX;
-    y1=myY+3+myHeight/2;
-
-    x2=myX+myWidth;
-    y2=y1;
-
-    x3=myX+myWidth/2;
-    y3=y2+myHeight/2;
-    if(ps!=0)
-        ps->draw_filled_triangle(x1,y1,x2,y2,x3,y3, myColorCursorDown);
-
-    //cadre
-    if(ps!=0)
-        ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight+3,BLACK);
-
-}
-//-------------------------------------
-void Input::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight+3,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//--------------------------------------
-float Input::getValue(GraphicMessage* msg)
-{
-    if(myElementIsVisible==false)
-        return 0.0;
-    float val=0.0;
-    //
-    TouchEvent ev=msg->event;
-    UINT16 yn=msg->posiY;
-
-    UINT16 y0=myY;
-    UINT16 ybut1=y0+myHeight/2;
-    UINT16 ybut2=y0+myHeight;
-    Color couleurUp=myColorCursorUp;
-    Color couleurDown=myColorCursorDown;
-
-    if(ev==EVENT_PRESS && myElementState==INPUT_STATE_RELEASED) {
-        //up ?
-        if(yn >= y0 && yn <= ybut1) {
-            myElementState=INPUT_STATE_PRESSED_UP;
-            setColorCursorUp(WHITE);
-            wait(0.1);
-            setColorCursorUp(couleurUp);
-
-            val=myValue+myValInc;
-            if(val >myValMax)
-                val=myValMax;
-
-            myValue=val;
-        }
-        //
-        //down?
-        if(yn >= ybut1 && yn <= ybut2) {
-            myElementState=INPUT_STATE_PRESSED_DOWN;
-            setColorCursorDown(WHITE);
-            wait(0.1);
-            setColorCursorDown(couleurDown);
-
-            val=myValue-myValInc;
-            if(val <myValMin)
-                val=myValMin;
-
-            myValue=val;
-        }
-    }
-    //
-    if(ev==EVENT_RELEASE || ev==EVENT_MOVE) {
-        myElementState=INPUT_STATE_RELEASED;
-    }
-
-    return myValue;
-}
-//--------------------------------------
-Switch::Switch(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,
-               bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,_width,_height,WHITE,_isVisible)
-{
-    myColorOn=GREEN;
-    myColorOff=RED;
-    myColorCursor=WHITE;
-
-    myElementType=OBJ_SWITCH;
-    myElementState=SWITCH_STATE_OFF;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//---------------------------------------
-Switch::~Switch(void)
-{
-}
-//---------------------------------------
-void Switch::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    ps=myScreen->getPicasoSerial();
-
-    State state=myElementState;
-
-    Color gauche=WHITE;
-    Color droite=WHITE;
-
-    switch(state) {
-            //
-        case SWITCH_STATE_ON:
-            droite=myColorOn;
-            gauche=myColorCursor;
-            break;
-
-            //
-        case SWITCH_STATE_OFF:
-            droite=myColorCursor;
-            gauche=myColorOff;
-            break;
-
-            //
-        default:
-            break;
-    }
-    //
-
-    //rect gauche
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX,myY,myX+myWidth/2,myY+myHeight,gauche);
-
-    //rect droite
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myWidth/2,myY,myX+myWidth,myY+myHeight,droite);
-
-    //cadre
-    if(ps!=0) {
-        ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,BLACK);
-        ps->draw_rectangle(myX,myY,myX+myWidth/2,myY+myHeight,BLACK);
-
-    }
-
-}
-//----------------------------------------
-void Switch::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//-----------------------------------------
-void Switch::setState(State _state)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    if(myElementState==_state)
-        return;
-
-    myElementState=_state;
-
-    this->draw();
-}
-//-----------------------------------------
-void Switch::changeState(GraphicMessage* msg)
-{
-    TouchEvent ev=msg->event;
-
-    if(myElementIsVisible==false)
-        return;
-
-    if(ev==EVENT_PRESS && myElementState==SWITCH_STATE_OFF) {
-        this->setState(SWITCH_STATE_ON);
-        return;
-    }
-    //
-    if(ev==EVENT_PRESS && myElementState==SWITCH_STATE_ON) {
-        this->setState(SWITCH_STATE_OFF);
-        return;
-    }
-    //
-    if(ev==EVENT_MOVE || ev==EVENT_RELEASE)
-        return;
-}
-//----------------------------------------
-DigitLed::DigitLed(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,bool _ptVisible,
-                   bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,36,52,WHITE,_isVisible)
-{
-    myValue=0;
-    myColorBkg=YELLOW;
-    myColorSeg=RED;
-    myIncX=4;
-    myIncY=4;
-
-    isPtVisible=_ptVisible;
-
-    myElementType=OBJ_DIGIT_LED;
-    myElementState=DIGIT_LED_STATE_ON;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//-----------------------------------------
-DigitLed::~DigitLed(void)
-{
-}
-//-----------------------------------------
-void DigitLed::setColorBkg(Color _colorBkg)
-{
-    if(myColorBkg==_colorBkg)
-        return;
-
-    myColorBkg=_colorBkg;
-    this->draw();
-}
-//------------------------------------------
-void DigitLed::setColorSeg(Color _colorSeg)
-{
-    if(myColorSeg==_colorSeg)
-        return;
-
-    myColorSeg=_colorSeg;
-    this->draw();
-}
-//-----------------------------------------
-void DigitLed::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    ps=myScreen->getPicasoSerial();
-
-    //rec
-    if(ps!=0) {
-        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,myColorBkg);
-    }
-
-    if(isPtVisible)
-        draw_seg_pt(ps);
-
-    //
-    switch(myValue) {
-        case 0:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_e(ps);
-            draw_seg_f(ps);
-            break;
-            //
-        case 1:
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            break;
-            //
-        case 2:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_d(ps);
-            draw_seg_e(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 3:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 4:
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            draw_seg_f(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 5:
-            draw_seg_a(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_f(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 6:
-            draw_seg_a(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_e(ps);
-            draw_seg_f(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 7:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            break;
-            //
-        case 8:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_e(ps);
-            draw_seg_f(ps);
-            draw_seg_g(ps);
-            break;
-            //
-        case 9:
-            draw_seg_a(ps);
-            draw_seg_b(ps);
-            draw_seg_c(ps);
-            draw_seg_d(ps);
-            draw_seg_f(ps);
-            draw_seg_g(ps);
-            break;
-    }
-
-}
-//-----------------------------------------
-void DigitLed::setValue(char _value)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    if(myValue==_value)
-        return;
-
-
-    if(_value >9)
-        _value=9;
-
-    myValue=_value;
-
-    this->draw();
-}
-//-----------------------------------------
-void DigitLed::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//-----------------------------------------
-void DigitLed::setPtVisible(bool _state)
-{
-    if(isPtVisible==_state)
-        return;
-
-    isPtVisible=_state;
-}
-//-----------------------------------------
-void DigitLed::draw_seg_a(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myIncX,
-                                  myY,
-                                  myX+7*myIncX,
-                                  myY+myIncY,
-                                  myColorSeg);
-}
-//------------------------------------------
-void DigitLed::draw_seg_b(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+6*myIncX,
-                                  myY,
-                                  myX+7*myIncX,
-                                  myY+5*myIncY,
-                                  myColorSeg);
-}
-//-------------------------------------------
-void DigitLed::draw_seg_c(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+6*myIncX,
-                                  myY+8*myIncY,
-                                  myX+7*myIncX,
-                                  myY+myHeight,
-                                  myColorSeg);
-}
-//--------------------------------------------
-void DigitLed::draw_seg_d(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myIncX,
-                                  myY+myHeight-myIncY,
-                                  myX+7*myIncX,
-                                  myY+myHeight,
-                                  myColorSeg);
-}
-//-----------------------------------------
-void DigitLed::draw_seg_e(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myIncX,
-                                  myY+myHeight-5*myIncY,
-                                  myX+2*myIncX,
-                                  myY+myHeight,
-                                  myColorSeg);
-}
-//-----------------------------------------
-void DigitLed::draw_seg_f(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myIncX,
-                                  myY,
-                                  myX+2*myIncX,
-                                  myY+5*myIncY,
-                                  myColorSeg);
-}
-//------------------------------------------
-void DigitLed::draw_seg_g(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myIncX,
-                                  myY+6*myIncY,
-                                  myX+7*myIncX,
-                                  myY+7*myIncY,
-                                  myColorSeg);
-}
-//------------------------------------------
-void DigitLed::draw_seg_pt(PicasoSerial* ps)
-{
-    if(ps!=0)
-        ps->draw_filled_rectangle(myX+myWidth-myIncX,
-                                  myY+myHeight-myIncY,
-                                  myX+myWidth,
-                                  myY+myHeight,
-                                  myColorSeg);
-}
-//-------------------------------------------
-Digit3Led::Digit3Led(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,
-                     UINT8 _resolution,bool _isVisible):ObjetHeader(mScreen,_id,_x,_y,108,52,YELLOW,_isVisible)
-{
-    myColorBkg=YELLOW;
-    myColorSeg=RED;
-    myValue=0.0;
-    myResolution=_resolution;
-
-    myDigitLedCentaine= new DigitLed(mScreen,_id,_x,_y,false,true);
-    myDigitLedDizaine=new DigitLed(mScreen,_id,_x+36,_y,false,true);
-    myDigitLedUnite= new DigitLed(mScreen,_id,_x+36+36,_y,false,true);
-
-
-    myElementType= OBJ_DIGITAL_3_LED;
-    myElementState=DIGIT_LED_STATE_ON;
-
-    myScreen->addObj((ObjetHeader*) this);
-}
-//------------------------------------------
-Digit3Led::~Digit3Led(void)
-{
-    delete(myDigitLedCentaine);
-    myDigitLedCentaine=0;
-    delete(myDigitLedDizaine);
-    myDigitLedDizaine=0;
-    delete(myDigitLedUnite);
-    myDigitLedUnite=0;
-}
-//------------------------------------------
-void Digit3Led::draw(void)
-{
-    if(myElementIsVisible==false)
-        return;
-
-    myDigitLedCentaine->draw();
-    myDigitLedDizaine->draw();
-    myDigitLedUnite->draw();
-
-}
-//------------------------------------------
-void Digit3Led::setInvisible(bool _state)
-{
-    // element devient invisible
-    if(_state==true) {
-        if(myElementIsVisible==false)
-            return;
-
-        myElementIsVisible=false;
-
-        Color c= myScreen->getColorBkg();
-
-        ps=myScreen->getPicasoSerial();
-
-        if(ps!=0) {
-            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
-        }
-    }
-
-    // element devient visible
-    else {
-        myElementIsVisible=true;
-
-
-        this->draw();
-    }
-}
-//-----------------------------------------
-void Digit3Led::setValue(float _value)
-{
-    if(myElementIsVisible==false)
-        return;
-    //
-    if(myValue==_value)
-        return;
-    //
-    myValue=_value;
-    UINT16 temp=0;
-
-    char centaine=0;
-    char dizaine=0;
-    char unite=0;
-
-    //the Pt?
-    switch(myResolution) {
-        case 1:     //xxx
-            temp=(UINT16)_value;
-            myDigitLedCentaine->setPtVisible(false);
-            myDigitLedDizaine->setPtVisible(false);
-            myDigitLedUnite->setPtVisible(false);
-            break;
-            //
-        case 10:    //xx.x
-            temp=(UINT16)(_value*10);
-            myDigitLedCentaine->setPtVisible(false);
-            myDigitLedDizaine->setPtVisible(true);
-            myDigitLedUnite->setPtVisible(false);
-            break;
-            //
-        case 100:   //x.xx
-            temp=(UINT16)(_value*100);
-            myDigitLedCentaine->setPtVisible(true);
-            myDigitLedDizaine->setPtVisible(false);
-            myDigitLedUnite->setPtVisible(false);
-            break;
-
-        default:
-            break;
-    }
-    //
-    if(temp <100) {
-        centaine=0;
-        myDigitLedCentaine->setInvisible(true);
-    } else {
-        myDigitLedCentaine->setInvisible(false);
-        centaine=(char)(temp/100);
-        temp=temp-(centaine*100);
-    }
-    //
-    if(temp <10) {
-        dizaine=0;
-    } else {
-        dizaine=(char)(temp/10);
-        temp=temp-(dizaine*10);
-    }
-    //
-    unite=(char)temp;
-
-    myDigitLedCentaine->setValue(centaine);
-    myDigitLedDizaine->setValue(dizaine);
-    myDigitLedUnite->setValue(unite);
-
-    this->draw();
-}
-//------------------------------------------
-void Digit3Led::setColorBkg(Color _colorBkg)
-{
-    if(myColorBkg==_colorBkg)
-        return;
-
-    myColorBkg=_colorBkg;
-    myDigitLedCentaine->setColorBkg(_colorBkg);
-    myDigitLedDizaine->setColorBkg(_colorBkg);
-    myDigitLedUnite->setColorBkg(_colorBkg);
-
-    this->draw();
-}
-//------------------------------------------
-void Digit3Led::setColorSeg(Color _colorSeg)
-{
-    if(myColorSeg==_colorSeg)
-        return;
-
-    myColorSeg=_colorSeg;
-    myDigitLedCentaine->setColorSeg(_colorSeg);
-    myDigitLedDizaine->setColorSeg(_colorSeg);
-    myDigitLedUnite->setColorSeg(_colorSeg);
-
-    this->draw();
-}
-//-----------------------------------------
\ No newline at end of file
--- a/ObjetGraphic.h	Sun Jul 06 10:36:27 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,755 +0,0 @@
-#ifndef OBJET_GRAPHIC_H
-#define OBJET_GRAPHIC_H
-
-#include "PicasoSerial.h"
-#include <vector>
-#include <string>
-
-/**
-* Library for 3.2'' uLcd Picaso Display
-* 4D system
-* The Objets
-* Picaso Serial Environment Command Set
-* http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/
-* @autor A.Decarvalho
-* 
-* 17/04/ 2014
-* 
-*/
-
-//-------------------------------------
-class ObjetHeader;
-//-------------------------------------
-//
-//
-class Screen
-{
-public:
-    /** Construct a Screen
-    *
-    * @param serial the PicasoSerial Obj
-    * @param _x the up left
-    * @params _y the up left
-    * @params _w the width
-    * @params _h the height
-    * @param _colorBkg the background color
-    */
-    // constructeur
-    Screen(PicasoSerial* serial,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _colorBkg);
-    //
-    ~Screen(void);
-    //
-    //! draw all objects
-    void drawAll(void);
-    //------------------------------
-    //! add a new Objet
-    void addObj(ObjetHeader* pObj);
-    //
-    //! draw a particular object
-    void drawObj(ObjetHeader* pObj);
-    //
-    //! @returns PicasoSerial the pointer to draw on the screen
-    PicasoSerial* getPicasoSerial(void);
-    //
-    void drawCells(void);
-
-//getter
-    UINT16 getXpos(void);
-    UINT16 getYpos(void);
-    UINT16 getWidth(void);
-    UINT16 getHeight(void);
-    Color getColorBkg(void);
-
-    bool isContent(ObjetHeader* pObj, UINT16 _x,UINT16 _y);
-
-    //-----------------------------------------------------
-    //! returns the Objet in [_x,_y] position
-    ObjetHeader* getObjetPosition(UINT16 _x,UINT16 _y);
-    
-    //! returns the Objet by Id
-    ObjetHeader* getObjetById(UINT16 _id);
-
-    //-----------------------------------------------------
-    //! returns the touch and update the GraphicMessage
-    TouchEvent getTouchEvent(GraphicMessage* msg);
-
-    //-------------------------------------------
-    //! update the identifier Id of the object being touched
-    void getProcessMessage(GraphicMessage* msg);
-
-protected:
-    PicasoSerial* mySerial;
-
-    UINT16 myXpos,myYpos,myWidth,myHeight;
-
-    Color myColorBkg;
-
-    vector<ObjetHeader*> myVectorObjet;
-};
-//
-//
-//--------------------------------------
-//
-//
-class ObjetHeader
-{
-public:
-    /** Construct a ObjetHeader the father
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _x the up left
-    * @params _y the up left
-    * @params _w the width
-    * @params _h the height
-    * @param _color the background color
-    * @params _isVisible
-    */
-// constructor
-    //
-    ObjetHeader(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color,bool _isVisible);
-    //
-    //! draw the obj
-    virtual void draw(void);
-    //
-    virtual ~ObjetHeader(void);
-    //
-    //! test a overlap
-    bool overlapWith(ObjetHeader* pObj);
-    //
-    static bool overlap(ObjetHeader* pObj1,ObjetHeader* pObj2);
-    //
-    static const UINT16 CELL_DIM=80;
-    static const UINT16 CELL_COL=3;
-    void updateCellId(void);
-
-
-//getter
-    UINT16 getXpos(void);
-    UINT16 getYpos(void);
-    UINT16 getWidth(void);
-    UINT16 getHeight(void);
-    UINT16 getElementId(void);
-    bool   getIsVisible(void);
-    State getElementState(void);
-
-    float getSpeedX(void);
-    float getSpeedY(void);
-
-    Color getColor(void);
-
-    UINT16 getCellId(void);
-
-//setter
-    void setColor(Color _color);
-    void setElementState(State _state);
-    void setElementId(UINT16 _id);
-    void setVisibility(bool _val);
-    void setInvertSpeedX(void);
-    void setInvertSpeedY(void);
-    void setSpeedX(float _speedX);
-    void setSpeedY(float _speedY);
-    void setSpeedXY(float _speedX,float _speedY);
-
-    void setXpos(UINT16 _xpos);
-    void setYpos(UINT16 _ypos);
-
-    GRAPHIC_OBJ_TYPE getElementType(void);
-
-    void setUpdateAutomatic(bool _state);
-    bool getUpdateAutomatic(void);
-
-protected:
-    Screen* myScreen;
-
-    void elementUpdate(void);
-
-    UINT16 myX,myY,myWidth,myHeight;
-    UINT16 myElementId;
-    GRAPHIC_OBJ_TYPE myElementType;
-
-    bool myElementIsVisible;
-    bool myIsUpdateAutomatic;
-    float mySpeedX,mySpeedY;
-
-    UINT16 myXMoveMin,myXMoveMax,myYMoveMin,myYMoveMax;
-    UINT16 myCellId;
-
-    State myElementState;
-    Color myColor;
-};
-//-----------------------------------------
-//
-//
-class Isocele:public ObjetHeader
-{
-public:
-    Isocele(Screen* mScreen,UINT16 _id,UINT16 xc,UINT16 yc,UINT16 radius,int orientation,float _speed,Color color,bool isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Isocele(void);
-    //
-    void setOrientation(int _orientation);
-    //
-    void turnLeft(void);
-    //
-    void turnRight(void);
-    //
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
-    //
-    void update(float delta);
-    //
-    int getOrientation(void);
-    //
-    UINT16 getXcenter(void);
-    //
-    UINT16 getYcenter(void);
-
-    static const int ORIENTATION_UP=0;
-    static const int ORIENTATION_LEFT=1;
-    static const int ORIENTATION_DOWN=2;
-    static const int ORIENTATION_RIGHT=3;
-
-protected:
-    UINT16 myXcenter;
-    UINT16 myYcenter;
-    UINT16 myRadius;
-    int myOrientation;
-
-    UINT16 myX1,myY1;
-    UINT16 myX2,myY2;
-    UINT16 myX3,myY3;
-    float mySpeed;
-
-    void updateOrientation(void);
-    void myElementUpdate(void);
-};
-//----------------------------------------
-//
-//
-class Rectangle:public ObjetHeader
-{
-public:
-    /** Construct a filled Rectangle
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _x the up left
-    * @params _y the up left
-    * @params _w the width
-    * @params _h the height
-    * @param _color the background color
-    * @params _isVisible
-    */
-    Rectangle(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Rectangle(void);
-    //
-    //! updating the position of the object, in the case of a game
-    void update(float delta);
-
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
-
-};
-//----------------------------------------
-//
-//
-class Circle:public ObjetHeader
-{
-public:
-    /** Construct a filled Circle
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _xc the center x
-    * @params _yc the center y
-    * @params _radius
-    * @param _color the background color
-    * @params _isVisible
-    */
-    Circle(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radius,Color _color,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Circle(void);
-    //
-    void update(float delta);
-
-// getter
-    UINT16 getCenterX(void);
-    //
-    UINT16 getCenterY(void);
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xnew,INT16 _ynew);
-    //
-    void setCenterX(UINT16 _xcenter);
-    //
-    void setCenterY(UINT16 _ycenter);
-
-protected:
-    UINT16 myRadius;
-    UINT16 myCenterX;
-    UINT16 myCenterY;
-};
-//-----------------------------------------
-//
-//
-class Ellipse:public ObjetHeader
-{
-public:
-    /** Construct a filled Ellipse
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _xc the center x
-    * @params _yc the center y
-    * @params _radiusX
-    * @radius _radiusY
-    * @param _color the background color
-    * @params _isVisible
-    */
-    Ellipse(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radiusX,UINT16 _radiusY,Color _color,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Ellipse(void);
-    //
-    void update(float delta);
-// getter
-    UINT16 getCenterX(void);
-    //
-    UINT16 getCenterY(void);
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
-    //
-    void setCenterX(UINT16 _xcenter);
-    //
-    void setCenterY(UINT16 _ycenter);
-
-
-protected:
-    UINT16 myCenterX;
-    UINT16 myCenterY;
-    UINT16 myRadiusX;
-    UINT16 myRadiusY;
-};
-//-----------------------------------------
-//
-//
-class Diamond:public ObjetHeader
-{
-public:
-    /** Construct a filled Diamond
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params x1
-    * @params y1
-    * @params x2
-    * @params y2
-    * @params x3
-    * @params y3
-    * @params x4
-    * @params y4
-    * @param _color the background color
-    * @params _isVisible
-    */
-    Diamond(Screen* mScreen,UINT16 _id,UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
-            UINT16 x3,UINT16 y3,UINT16 x4,UINT16 y4,Color _color,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Diamond(void);
-    //
-    void update(float delta);
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xnew,INT16 _ynew);
-
-protected:
-    UINT16 myX1,myY1;
-    UINT16 myX2,myY2;
-    UINT16 myX3,myY3;
-    UINT16 myX4,myY4;
-    UINT16 myU1,myU2;
-    UINT16 myV1,myV2;
-
-};
-//---------------------------------------
-//
-//
-class Triangle:public ObjetHeader
-{
-public:
-    /** Construct a filled  Triangle
-       *
-       * @param mScreen the pointer screen
-       * @param _id the identifier Id
-       * @params x1
-       * @params y1
-       * @params x2
-       * @params y2
-       * @params x3
-       * @params y3
-       * @param _color the background color
-       * @params _isVisible
-       */
-
-    Triangle(Screen* mScreen,UINT16 _id,UINT16 x1,UINT16 y1,
-             UINT16 x2,UINT16 y2,
-             UINT16 x3,UINT16 y3,
-             Color _color,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Triangle(void);
-    //
-    void update(float delta);
-
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewPosition(INT16 _xnew,INT16 _ynew);
-
-
-protected:
-    UINT16 myX1,myY1;
-    UINT16 myX2,myY2;
-    UINT16 myX3,myY3;
-    UINT16 myU,myV;
-};
-//------------------------------------------
-//
-//
-class Label:public ObjetHeader
-{
-public:
-    /** Construct a label
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _x
-        * @params _y
-        * @params _text
-        * @params _font
-        * @params _colorText
-        * @params _colorBkg
-        * @params _isVisible
-        */
-
-    Label(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,
-          string _text,Font _font,Color _colorText,Color _colorBkg,bool _isVisible);
-
-    //
-    virtual void draw(void);
-    //
-    virtual ~Label(void);
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setNewText(string _newText);
-
-protected:
-    string myText;
-    Font myFont;
-    Color myColorText;
-
-};
-//-------------------------------------------
-//
-//
-class GraphicLed:public ObjetHeader
-{
-public:
-    /** Construct a filled Circle
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _xc center
-        * @params _yc center
-        * @params _radius
-        * @params _colorOn
-        * @params _colorOff
-        * @params _state LED_STATE_ON or LED_STATE_OFF,
-        * @params _isVisible
-        */
-    GraphicLed(Screen* mScreen,UINT16 _id,UINT16 _xc,UINT16 _yc,UINT16 _radius,
-               Color _colorOn,Color _colorOff,State _state,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~GraphicLed(void);
-
-
-//setter
-    void setInvisible(bool _state);
-    //
-    void setState(State _state);
-
-protected:
-    Color myColorOn;
-    Color myColorOff;
-    UINT16 myRadius;
-    UINT16 myCenterX;
-    UINT16 myCenterY;
-};
-//------------------------------------------
-//
-//
-class Button:public ObjetHeader
-{
-public:
-    /** Construct a Button
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _x up left
-    * @params _y up left
-    * @params _text
-    * @params _font
-    * @params _colorText
-    * @params _colorBtn
-    * @params _state BUTTON_STATE_PRESSED or BUTTON_STATE_RELEASED,
-    * @params _isVisible
-    */
-    Button(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,string _text,Font _font,
-           Color _colorText,Color _colorBtn,State _state,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Button(void);
-
-    //setter
-    void setInvisible(bool _state);
-    //
-    void setState(State _state);
-
-protected:
-    string myText;
-    Font myFont;
-    Color myColorText;
-};
-//------------------------------------------
-//
-//
-class Slider:public ObjetHeader
-{
-public:
-    /** Construct a Slider
-    *
-    * @param mScreen the pointer screen
-    * @param _id the identifier Id
-    * @params _x up left
-    * @params _y up left
-    * @params _width
-    * @params _height
-    * @params _valMax
-    * @params _value
-    * @params _colorBkg
-    * @params _isVisible
-    */
-    Slider(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,int _valMax,int _value,
-           Color _colorBkg,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Slider(void);
-    //
-    void setInvisible(bool _state);
-    //
-    int getValue(GraphicMessage* pmsg);
-
-protected:
-    int myValueMax;
-    int myValue;
-};
-//------------------------------------------
-//
-//
-class Input:public ObjetHeader
-{
-public:
-    /** Construct a Input
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _x up left
-        * @params _y up left
-        * @params _width
-        * @params _height
-        * @params _valMin
-        * @params _valInc incrementing the value
-        * @params _valMax
-        * @params _isVisible
-        */
-    Input(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,float _valMin,float _valInc,
-          float _valMax,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Input(void);
-    //
-    void setInvisible(bool _state);
-    //
-    float getValue(GraphicMessage* msg);
-    //
-    void setColorBkg(Color _color);
-    //
-    void setColorCursorDown(Color _color);
-    //
-    void setColorCursorUp(Color _color);
-
-protected:
-    float myValMin;
-    float myValInc;
-    float myValMax;
-    float myValue;
-    Color myColorBkg;
-    Color myColorCursorUp;
-    Color myColorCursorDown;
-};
-//-----------------------------------------
-//
-//
-class Switch:public ObjetHeader
-{
-public:
-    /** Construct a Switch
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _x up left
-        * @params _y up left
-        * @params _width
-        * @params _height
-        * @params _isVisible
-        */
-    Switch(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~Switch(void);
-    //
-    void setInvisible(bool _state);
-    //
-    void setState(State _state);
-    //
-    void changeState(GraphicMessage* msg);
-
-protected:
-    Color myColorOn;
-    Color myColorOff;
-    Color myColorCursor;
-};
-//------------------------------------
-//
-//
-class DigitLed:public ObjetHeader
-{
-public:
-    /** Construct a Digit Led
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _x up left
-        * @params _y up left
-        * @params _ptVisible
-        * @params _isVisible
-        */
-    DigitLed(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,bool _ptVisible,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual ~DigitLed(void);
-    //
-    void setInvisible(bool _state);
-    //
-    void setValue(char _value);
-    //
-    void setColorBkg(Color _colorBkg);
-    //
-    void setColorSeg(Color _colorSeg);
-    //
-    void setPtVisible(bool _state);
-
-protected:
-    char myValue;
-    Color myColorBkg;
-    Color myColorSeg;
-    UINT16 myIncX;
-    UINT16 myIncY;
-    bool isPtVisible;
-    //
-    void draw_seg_a(PicasoSerial* ps);
-    void draw_seg_b(PicasoSerial* ps);
-
-    void draw_seg_c(PicasoSerial* ps);
-
-    void draw_seg_d(PicasoSerial* ps);
-    void draw_seg_e(PicasoSerial* ps);
-    void draw_seg_f(PicasoSerial* ps);
-
-    void draw_seg_g(PicasoSerial* ps);
-    void draw_seg_pt(PicasoSerial* ps);
-};
-//--------------------------------------------
-//
-//
-class Digit3Led:public ObjetHeader
-{
-public:
-    /** Construct a 3 Digit Led [000]
-        *
-        * @param mScreen the pointer screen
-        * @param _id the identifier Id
-        * @params _x up left
-        * @params _y up left
-        * @params _resolution 1[000],10[00.0],100[0.00]
-        * @params _isVisible
-        */
-    Digit3Led(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT8 _resolution,bool _isVisible);
-    //
-    virtual void draw(void);
-    //
-    virtual  ~Digit3Led(void);
-    //
-    void setInvisible(bool _state);
-    //
-    void setValue(float _value);
-    //
-    void setColorBkg(Color _colorBkg);
-    //
-    void setColorSeg(Color _colorSeg);
-
-protected:
-    Color myColorBkg;
-    Color myColorSeg;
-    float myValue;
-    UINT8 myResolution;
-
-    DigitLed* myDigitLedCentaine;
-    DigitLed* myDigitLedDizaine;
-    DigitLed* myDigitLedUnite;
-
-};
-//--------------------------------------------------------
-#endif
\ No newline at end of file
--- a/PicasoSerial.cpp	Sun Jul 06 10:36:27 2014 +0000
+++ b/PicasoSerial.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -59,7 +59,7 @@
     UINT8 msb = 0;
     UINT8 lsb = 0;
 
-   // TouchEvent res = EVENT_NO_ACTIVITY;
+    // TouchEvent res = EVENT_NO_ACTIVITY;
     UINT16 temp=0;
 
     unsigned char zecom[4] = "";
@@ -79,23 +79,22 @@
     lsb = get_gfx_char();
 
     temp=(msb << 8) + lsb;
-    
-    switch(temp)
-    {
+
+    switch(temp) {
         case 0:
-        return EVENT_NO_ACTIVITY;
-        
-        //
+            return EVENT_NO_ACTIVITY;
+
+            //
         case 1:
-        return EVENT_PRESS;
-        
-        //
+            return EVENT_PRESS;
+
+            //
         case 2:
-        return EVENT_RELEASE;
-        
-        //
+            return EVENT_RELEASE;
+
+            //
         case 3:
-        return EVENT_MOVE;
+            return EVENT_MOVE;
     }
 
     return EVENT_NO_ACTIVITY;
@@ -174,7 +173,7 @@
 {
     gfx_reset();
 
-    gfx_set_BackGroundColor(BLUE);
+    gfx_set_BackGroundColor(WHITE);
 
     touch_detect_region(0, 0, 240, 320);
     //
@@ -196,7 +195,7 @@
 //-------------------------------------------------
 void PicasoSerial::put_gfx_char(unsigned char data)
 {
-   
+
     while (this->writeable()==0); // buffer plein ?
 
     this->putc(data);
@@ -207,7 +206,7 @@
     while (this->readable()==0); // attendre data
 
     //return mySerial.getc();
-    
+
     return this->getc();
 }
 //----------------------------------------------------------------------
@@ -260,6 +259,20 @@
             break;
 
             //
+        case 128000:
+            zecom[2] = (GFX_BAUD_128000 >> 8) & 0xFF;
+            zecom[3] = GFX_BAUD_128000 & 0xFF;
+            mbaud = speed;
+
+            break;
+            //
+        case 256000:
+            zecom[2] = (GFX_BAUD_256000 >> 8) & 0xFF;
+            zecom[3] = GFX_BAUD_256000 & 0xFF;
+            mbaud = speed;
+            break;
+
+
         default:
             zecom[2] = (GFX_BAUD_9600 >> 8) & 0xFF;
             zecom[3] = GFX_BAUD_9600 & 0xFF;
@@ -675,7 +688,7 @@
     s = s - size;
     */
     taille=str.size();
-    
+
     zecom[0] = (CMD_BUTTON >> 8)&0xFF;
     zecom[1] = CMD_BUTTON & 0xFF;
 
@@ -865,20 +878,20 @@
 
 }
 //------------------------------------------------------------------------
- void PicasoSerial::draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,
-                                        UINT16 x3,UINT16 y3, 
-                                        UINT16 x4,UINT16 y4,Color color)
+void PicasoSerial::draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,
+                                UINT16 x3,UINT16 y3,
+                                UINT16 x4,UINT16 y4,Color color)
 {
     unsigned char zecom [22] = "";
     UINT16 nb=0x0004;
 
     zecom[0] = (CMD_POLYGON >> 8)&0xFF;
     zecom[1] = (CMD_POLYGON & 0xFF);
-    
+
     //n=4
     zecom[2]=(nb >> 8)&0xFF;
     zecom[3]=(nb & 0xFF);
-    
+
     // coord X1[msb:Lsb]
     zecom[4] = (x1 >> 8)& 0xFF;
     zecom[5] = (x1) & 0xFF;
@@ -890,7 +903,7 @@
     // coord X3[msb:lsb]
     zecom[8] = (x3 >> 8)& 0xFF;
     zecom[9] = (x3) & 0xFF;
-    
+
     //// coord X4[msb:lsb]
     zecom[10] = (x4 >> 8)& 0xFF;
     zecom[11] = (x4) & 0xFF;
@@ -898,7 +911,7 @@
     // coord Y1[msb:lsb]
     zecom[12] = (y1 >> 8) & 0xFF;
     zecom[13] = (y1) & 0xFF;
-    
+
     // coord Y2[msb:lsb]
     zecom[14] = (y2 >> 8) & 0xFF;
     zecom[15] = (y2) & 0xFF;
@@ -906,11 +919,11 @@
     // coord Y3[msb:lsb]
     zecom[16] = (y3 >> 8) & 0xFF;
     zecom[17] = (y3) & 0xFF;
-    
+
     // coord Y4[msb:lsb]
     zecom[18] = (y4 >> 8) & 0xFF;
     zecom[19] = (y4) & 0xFF;
-    
+
     // color
     zecom[20] = (color >> 8) & 0xFF;
     zecom[21] = color & 0xFF;
@@ -921,18 +934,18 @@
 }
 //------------------------------------------------------------------------------
 void PicasoSerial::draw_filled_diamond(UINT16 x1,UINT16 y1,UINT16 x2,UINT16 y2,
-                                        UINT16 x3,UINT16 y3, UINT16 x4,UINT16 y4,Color color)
+                                       UINT16 x3,UINT16 y3, UINT16 x4,UINT16 y4,Color color)
 {
     unsigned char zecom [22] = "";
     UINT16 nb=0x0004;
 
     zecom[0] = (CMD_FILLED_POLYGON >> 8)&0xFF;
     zecom[1] = (CMD_FILLED_POLYGON & 0xFF);
-    
+
     //n=4
     zecom[2]=(nb >> 8)&0xFF;
     zecom[3]=(nb & 0xFF);
-    
+
     // coord X1[msb:Lsb]
     zecom[4] = (x1 >> 8)& 0xFF;
     zecom[5] = (x1) & 0xFF;
@@ -944,7 +957,7 @@
     // coord X3[msb:lsb]
     zecom[8] = (x3 >> 8)& 0xFF;
     zecom[9] = (x3) & 0xFF;
-    
+
     //// coord X4[msb:lsb]
     zecom[10] = (x4 >> 8)& 0xFF;
     zecom[11] = (x4) & 0xFF;
@@ -952,7 +965,7 @@
     // coord Y1[msb:lsb]
     zecom[12] = (y1 >> 8) & 0xFF;
     zecom[13] = (y1) & 0xFF;
-    
+
     // coord Y2[msb:lsb]
     zecom[14] = (y2 >> 8) & 0xFF;
     zecom[15] = (y2) & 0xFF;
@@ -960,11 +973,11 @@
     // coord Y3[msb:lsb]
     zecom[16] = (y3 >> 8) & 0xFF;
     zecom[17] = (y3) & 0xFF;
-    
+
     // coord Y4[msb:lsb]
     zecom[18] = (y4 >> 8) & 0xFF;
     zecom[19] = (y4) & 0xFF;
-    
+
     // color
     zecom[20] = (color >> 8) & 0xFF;
     zecom[21] = color & 0xFF;
@@ -974,14 +987,14 @@
     wait_gfx_ack();
 }
 //---------------------------------------------
- void PicasoSerial::draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
-                            UINT16 yrad,Color color)
+void PicasoSerial::draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
+                                UINT16 yrad,Color color)
 {
     unsigned char zecom [12] = "";
-    
+
     zecom[0] = (CMD_ELLIPSE >> 8)&0xFF;
     zecom[1] = (CMD_ELLIPSE & 0xFF);
-    
+
     // coord Xc[msb:Lsb]
     zecom[2] = (xc >> 8)& 0xFF;
     zecom[3] = (xc) & 0xFF;
@@ -993,7 +1006,7 @@
     // coord Xrad[msb:lsb]
     zecom[6] = (xrad >> 8)& 0xFF;
     zecom[7] = (xrad) & 0xFF;
-    
+
     // coord Yrad[msb:lsb]
     zecom[8] = (yrad >> 8)& 0xFF;
     zecom[9] = (yrad) & 0xFF;
@@ -1008,13 +1021,13 @@
 }
 //----------------------------------
 void PicasoSerial::draw_filled_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,
-                            UINT16 yrad,Color color)
+                                       UINT16 yrad,Color color)
 {
-      unsigned char zecom [12] = "";
-    
+    unsigned char zecom [12] = "";
+
     zecom[0] = (CMD_FILLED_ELLIPSE >> 8)&0xFF;
     zecom[1] = (CMD_FILLED_ELLIPSE & 0xFF);
-    
+
     // coord Xc[msb:Lsb]
     zecom[2] = (xc >> 8)& 0xFF;
     zecom[3] = (xc) & 0xFF;
@@ -1026,7 +1039,7 @@
     // coord Xrad[msb:lsb]
     zecom[6] = (xrad >> 8)& 0xFF;
     zecom[7] = (xrad) & 0xFF;
-    
+
     // coord Yrad[msb:lsb]
     zecom[8] = (yrad >> 8)& 0xFF;
     zecom[9] = (yrad) & 0xFF;
--- a/PicasoSerial.h	Sun Jul 06 10:36:27 2014 +0000
+++ b/PicasoSerial.h	Sun Apr 05 13:54:48 2015 +0000
@@ -10,8 +10,8 @@
 * Picaso Serial Environment Command Set
 * http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/
 * @autor A.Decarvalho
-* 
-*17/04/ 2014
+*
+*17/02/ 2015
 */
 
 //--------------------
@@ -68,6 +68,8 @@
 #define GFX_BAUD_19200     0x0008
 #define GFX_BAUD_56000     11
 #define GFX_BAUD_115200    0x000D
+#define GFX_BAUD_128000  0x000E
+#define GFX_BAUD_256000  0x000F
 
 //-----------------
 typedef char* XCHAR;
@@ -78,23 +80,22 @@
 //--------------------
 // The States
 //--------------------
-typedef enum State State;
-enum State{
+enum State {
     BUTTON_STATE_PRESSED = 0,
     BUTTON_STATE_RELEASED=1,
     //
     LED_STATE_ON,
     LED_STATE_OFF,
     //
-    SWITCH_STATE_ON,
-    SWITCH_STATE_OFF,
+    SWITCHER_STATE_ON,
+    SWITCHER_STATE_OFF,
     //
     SLIDER_STATE_MOVE,
     SLIDER_STATE_RELEASED,
     //
-    INPUT_STATE_PRESSED_UP,
-    INPUT_STATE_PRESSED_DOWN,
-    INPUT_STATE_RELEASED,
+    SCALER_STATE_PRESSED_UP,
+    SCALER_STATE_PRESSED_DOWN,
+    SCALER_STATE_RELEASED,
     //
     LABEL_STATE_ON,
     //
@@ -111,8 +112,6 @@
 //------------
 // fonts uLCD
 //------------
-typedef enum Font Font;
-//
 enum Font {
     FONT_1 = 0x0000,
     FONT_2 = 0x0001,
@@ -121,8 +120,6 @@
 //-----------------
 // Colors for Obj
 //-----------------
-typedef enum Color Color;
-//
 enum Color {
     ALICEBLUE = 0xF7DF,ANTIQUEWHITE = 0xFF5A,AQUA = 0x07FF,
     AQUAMARINE = 0x7FFA,AZURE = 0xF7FF,BEIGE = 0xF7BB,
@@ -173,8 +170,6 @@
     YELLOWGREEN = 0x9E66
 };
 //------------------------------------------------------
-typedef enum TouchEvent TouchEvent;
-
 enum TouchEvent {
     EVENT_NO_ACTIVITY = 0x0000,
     EVENT_PRESS = 0x0001,
@@ -182,13 +177,13 @@
     EVENT_MOVE = 0x0003
 };
 //-------------------------------------------------------
-enum GRAPHIC_OBJ_TYPE {
+enum WIDGET_TYPE {
     OBJ_BUTTON=1,
     OBJ_LED,
     OBJ_LABEL,
-    OBJ_INPUT,
+    OBJ_SCALER,
     OBJ_SLIDER,
-    OBJ_SWITCH,
+    OBJ_SWITCHER,
     OBJ_DIGIT_LED,
     OBJ_DIGITAL_3_LED,
 
@@ -198,11 +193,10 @@
     OBJ_ELLIPSE,
     OBJ_DIAMOND,
     OBJ_ISOCELE,
+    OBJ_SEGMENT,
     OBJ_UNKNOW
 };
 //-------------------------------------------------------
-typedef struct GraphicMessage GraphicMessage;
-
 struct GraphicMessage {
     TouchEvent event;
     UINT16 objId;
@@ -362,8 +356,8 @@
 //-------------------------------
     void text_backround(Color color);
 //------------------------------
-   void text_putstring(string str);
-    
+    void text_putstring(string str);
+
 //-------------------------------
     void text_setFont(Font _font);
 //---------------------------------
@@ -378,7 +372,7 @@
         * @params color_bckg the background color
         */
     void draw_string(string str, UINT16 x, UINT16 y,Font _font,Color text_color,Color color_bckg);
-    
+
 //---------------------------------------------------------------------------------
     //! Draw a diamond [x1,y1],[x2,y2],[x3,y3],[x4,y4]
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Player.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,66 @@
+#include "Player.h"
+
+//----------------------------------------------
+Player::Player(string  _strName):myName(_strName)
+{
+    myLives=0;
+    myScore=0;
+    myCount=0;
+}
+//------------------------------------------------    
+Player::~Player(void)
+{
+}
+//------------------------------------------------
+string Player::getName(void)const
+{
+    /*
+    for(int i=0;i<10;i++)
+    {
+        str[i]=myName[i];
+    }
+    */
+    return myName;
+}
+//------------------------------------------------
+int Player::getLives(void) const
+{
+ return this->myLives;
+ }
+//-------------------------------------------------
+int Player::getScore(void) const
+{
+    return this->myScore;
+}
+//--------------------------------------------------
+int Player::getCount(void) const
+{
+ return this->myCount;
+}
+//-----------------------------------------------------
+void Player::setLives(int _lives)
+{
+    myLives=_lives;
+}
+//----------------------------------------------------
+void Player::setScore(int _score)
+{
+    myScore=_score;
+}
+//-----------------------------------------------------
+void Player::setCount(int _count)
+{
+    myCount=_count;
+}
+//-----------------------------------------------------
+void Player::incCount(void)
+{
+    myCount=myCount+1;
+}
+//-----------------------------------------------------
+void Player::decLives(void)
+{
+    myLives=myLives-1;
+    
+}
+//-----------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Player.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,38 @@
+#ifndef PLAYER_H
+#define PLYER_H
+
+#include "mbed.h"
+#include <string>
+
+class Player
+{
+public:
+
+    Player(string _strName="None");
+    
+    ~Player(void);
+    
+//setter et getter
+    int getLives(void) const;
+    int getScore(void) const;
+    int getCount(void) const;
+    string getName(void) const;
+    
+    
+    void setLives(int _lives);
+    void setScore(int _score);
+    void setCount(int _count);
+    
+    void decLives(void);
+    void incCount(void);
+
+protected:
+
+string myName;
+int myLives;
+int myScore;
+int myCount;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Rectangle.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,130 @@
+#include "Rectangle.h"
+
+
+Rectangle::Rectangle(Screen* mScreen,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color):
+    Sprite(mScreen,0,_x,_y,_w,_h,_color)
+
+{
+    myType=OBJ_RECTANGLE;
+
+    myScreen->addWidget((Widget*) this);
+}
+//------------------------------------
+Rectangle::~Rectangle(void)
+{
+
+}
+//------------------------------------
+void Rectangle::draw(void)
+{
+    // isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,myColor);
+    }
+}
+//-------------------------------------
+void Rectangle::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+        this->draw();
+    }
+}
+//--------------------------------------
+void Rectangle::setNewPosition(INT16 _xnew,INT16 _ynew)
+{
+    setNewPosition(_xnew,_ynew,true);
+}
+//--------------------------------------
+void Rectangle::setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+
+    //
+    if(myX==_xnew && myY==_ynew)
+        return;
+
+    setInvisible(true); // colorie le rec avec couleur de la screen
+
+    myIsVisible=true;
+
+    if(isScreenLimits) {
+        //test Xmax
+        if(_xnew+myWidth >= myXMoveMax) {
+            _xnew=myXMoveMax-myWidth;
+
+            if(myState==STATE_ON)
+                myState=BUMP_RIGHT;
+
+        }
+
+        //test Xmin
+        if(_xnew <= myXMoveMin) {
+            _xnew=myXMoveMin;
+
+            if(myState==STATE_ON)
+                myState=BUMP_LEFT;
+
+        }
+        //test Ymax
+        if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
+            _ynew = myYMoveMax- myHeight;
+
+            if(myState==STATE_ON)
+                myState=BUMP_DOWN;
+        }
+        //test yminMin;
+        if(_ynew <= myYMoveMin) {
+            _ynew=myYMoveMin;
+
+            if(myState==STATE_ON)
+                myState=BUMP_UP;
+
+        }
+    }
+    //
+    myX=_xnew;
+    myY=_ynew;
+
+
+    this->draw();
+}
+//--------------------------------------
+void Rectangle::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        elementUpdate();
+    //
+    float xnew=myX+mySpeedX*delta;
+    float ynew=myY+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xnew,(INT16)ynew,true);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Rectangle.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,41 @@
+#ifndef RECTANGLE_H
+#define RECTANGLE_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+class Rectangle:public Sprite
+{
+public:
+    /** Construct a filled Rectangle
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _x the up left
+    * @params _y the up left
+    * @params _w the width
+    * @params _h the height
+    * @param _color the background color
+    * @params _isVisible
+    */
+    Rectangle(Screen* mScreen,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Rectangle(void);
+    //
+    //! updating the position of the object, in the case of a game
+    void update(float delta);
+
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew);
+    //
+    void setNewPosition(INT16 _xcnew,INT16 _ycnew,bool isScreenLimits);
+
+};
+   
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Scaler.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,171 @@
+#include "Scaler.h"
+
+Scaler::Scaler(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,float _valMin,float _valInc,
+               float _valMax):
+    Widget(mScreen,_id,_x,_y,_width,_height,WHITE)
+{
+    myValMin=_valMin;
+    myValInc=_valInc;
+    myValMax=_valMax;
+    myValue=0.0;
+    myColorBkg=WHITE;
+    myColorCursorUp=BLUE;
+    myColorCursorDown=BLUE;
+
+    myType=OBJ_SCALER;
+    myState=SCALER_STATE_RELEASED;
+
+    myScreen->addWidget((Widget*) this);
+}
+//-------------------------------------
+Scaler::~Scaler(void)
+{
+}
+//-------------------------------------
+void Scaler::setColorBkg(Color _color)
+{
+    myColorBkg=_color;
+    this->draw();
+}
+//--------------------------------------
+void Scaler::setColorCursorUp(Color _color)
+{
+    myColorCursorUp=_color;
+    this->draw();
+}
+//-------------------------------------
+void Scaler::setColorCursorDown(Color _color)
+{
+    myColorCursorDown=_color;
+    this->draw();
+}
+//-------------------------------------
+void Scaler::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    //rect up
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight/2,myColorBkg);
+
+    //rect down
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX,myY+myHeight/2+3,myX+myWidth,myY+3+myHeight,myColorBkg);
+
+    //fleche up
+    UINT16 x1=myX+myWidth/2;
+    UINT16 y1=myY;
+
+    UINT16 x2=myX+myWidth;
+    UINT16 y2=myY+myHeight/2;
+
+    UINT16 x3=myX;
+    UINT16 y3=myY+myHeight/2;
+    if(ps!=0)
+        ps->draw_filled_triangle(x1,y1,x2,y2,x3,y3, myColorCursorUp);
+
+    //fleche down
+    x1=myX;
+    y1=myY+3+myHeight/2;
+
+    x2=myX+myWidth;
+    y2=y1;
+
+    x3=myX+myWidth/2;
+    y3=y2+myHeight/2;
+    if(ps!=0)
+        ps->draw_filled_triangle(x1,y1,x2,y2,x3,y3, myColorCursorDown);
+
+    //cadre
+    if(ps!=0)
+        ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight+3,BLACK);
+        
+    ps=0;
+
+}
+//-------------------------------------
+void Scaler::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight+3,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//--------------------------------------
+float Scaler::getValue(GraphicMessage* msg)
+{
+    if(myIsVisible==false)
+        return 0.0;
+        
+    float val=0.0;
+    //
+    TouchEvent ev=msg->event;
+    UINT16 yn=msg->posiY;
+
+    UINT16 y0=myY;
+    UINT16 ybut1=y0+myHeight/2;
+    UINT16 ybut2=y0+myHeight;
+    Color couleurUp=myColorCursorUp;
+    Color couleurDown=myColorCursorDown;
+
+    if(ev==EVENT_PRESS && myState==SCALER_STATE_RELEASED) {
+        //up ?
+        if(yn >= y0 && yn <= ybut1) {
+            myState=SCALER_STATE_PRESSED_UP;
+            setColorCursorUp(WHITE);
+            wait(0.1);
+            setColorCursorUp(couleurUp);
+
+            val=myValue+myValInc;
+            if(val >myValMax)
+                val=myValMax;
+
+            myValue=val;
+        }
+        //
+        //down?
+        if(yn >= ybut1 && yn <= ybut2) {
+            myState=SCALER_STATE_PRESSED_DOWN;
+            setColorCursorDown(WHITE);
+            wait(0.1);
+            setColorCursorDown(couleurDown);
+
+            val=myValue-myValInc;
+            if(val <myValMin)
+                val=myValMin;
+
+            myValue=val;
+        }
+    }
+    //
+    if(ev==EVENT_RELEASE || ev==EVENT_MOVE) {
+        myState=SCALER_STATE_RELEASED;
+    }
+
+    return myValue;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Scaler.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,47 @@
+#ifndef SCALER_H
+#define SCALER_H
+
+#include "Screen.h"
+
+class Scaler:public Widget
+{
+public:
+    /** Construct a Input
+        *
+        * @param mScreen the pointer screen
+        * @param _id the identifier Id
+        * @params _x up left
+        * @params _y up left
+        * @params _width
+        * @params _height
+        * @params _valMin
+        * @params _valInc incrementing the value
+        * @params _valMax
+        */
+    Scaler(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,float _valMin,float _valInc,
+          float _valMax);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Scaler(void);
+    //
+    void setInvisible(bool _state);
+    //
+    float getValue(GraphicMessage* msg);
+    //
+    void setColorBkg(Color _color);
+    //
+    void setColorCursorDown(Color _color);
+    //
+    void setColorCursorUp(Color _color);
+
+protected:
+    float myValMin;
+    float myValInc;
+    float myValMax;
+    float myValue;
+    Color myColorBkg;
+    Color myColorCursorUp;
+    Color myColorCursorDown;
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Screen.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,264 @@
+#include "Screen.h"
+
+Screen::Screen(PicasoSerial* serial,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _colorBkg):
+    myXpos(_x),myYpos(_y),myWidth(_w),myHeight(_h),myColorBkg(_colorBkg)
+{
+    mySerial=serial;
+}
+//------------------------------------
+Screen::~Screen(void)
+{
+
+
+    for(int i=0; i<myVectorObjet.size(); i++) {
+        delete  myVectorObjet[i];
+        myVectorObjet[i]=0;
+    }
+}
+//------------------------------------
+UINT16 Screen::getXpos(void) const
+{
+    return this->myXpos;
+}
+//----------------------------------
+UINT16 Screen::getYpos(void) const
+{
+    return this->myYpos;
+}
+//------------------------------------
+UINT16 Screen::getWidth(void) const
+{
+    return this->myWidth;
+}
+//-------------------------------------
+UINT16 Screen::getHeight(void) const
+{
+    return this->myHeight;
+}
+//------------------------------------
+void Screen::drawWidget(Widget* pObj)
+{
+    pObj->draw();
+
+}
+//------------------------------------
+void Screen::drawAllWidget(void)
+{
+    mySerial->draw_filled_rectangle(myXpos,myYpos,myXpos+myWidth,myYpos+myHeight,myColorBkg);
+
+    //
+    for(int i=0; i<myVectorObjet.size(); i++) {
+        drawWidget(myVectorObjet[i]);
+    }
+}
+//-------------------------------------
+void Screen::addWidget(Widget* pObj)
+{
+    myVectorObjet.push_back(pObj);
+}
+//---------------------------------------
+PicasoSerial* Screen::getPicasoSerial(void) const
+{
+    return  mySerial;
+}
+//---------------------------------------
+Color Screen::getColorBkg(void) const
+{
+    return myColorBkg;
+}
+//--------------------------------------
+bool Screen::isContent(Widget* pObj, UINT16 _x,UINT16 _y)
+{
+    UINT16 xd=pObj->getXposition();
+    UINT16 w=pObj->getWidth();
+    UINT16 xf=xd+w;
+
+    UINT16 yd=pObj->getYposition();
+    UINT16 h=pObj->getHeight();
+    UINT16 yf=yd+h;
+
+    if(_x >= xd && _x<= xf && _y>=yd && _y<= yf) {
+        return true;
+    }
+
+    return false;
+
+}
+//-------------------------------------
+Widget* Screen::getWidgetPosition(UINT16 _x,UINT16 _y)
+{
+
+    if(myVectorObjet.size()==0)
+        return NULL;
+
+    //
+    for(int i=0; i<myVectorObjet.size(); i++) {
+        if(isContent(myVectorObjet[i],_x,_y))
+            return myVectorObjet[i];
+    }
+    return NULL;
+}
+//-------------------------------------
+Widget* Screen::getWidgetById(UINT16 _id)
+{
+    if(myVectorObjet.size()==0)
+        return NULL;
+
+    //
+    for(int i=0; i<myVectorObjet.size(); i++) {
+        if((myVectorObjet[i]->getId())== _id)
+            return myVectorObjet[i];
+    }
+    return NULL;
+
+}
+//-------------------------------------
+TouchEvent Screen::getTouchEvent(GraphicMessage* msg)
+{
+    TouchEvent ev=EVENT_NO_ACTIVITY;
+    UINT16 xp=0;
+    UINT16 yp=0;
+
+    ev=mySerial->touch_get_status();
+
+    //
+    if(ev >EVENT_NO_ACTIVITY) {
+        xp=mySerial->touch_get_x();
+        yp=mySerial->touch_get_y();
+
+        msg->event=ev;
+        msg->posiX=xp;
+        msg->posiY=yp;
+        msg->objId=0;
+
+        return ev;
+    } else {
+
+        msg->event=EVENT_NO_ACTIVITY;
+        msg->posiX=0;
+        msg->posiY=0;
+        msg->objId=0;
+    }
+    //
+    return ev;
+}
+//-------------------------------------
+void Screen::getProcessMessage(GraphicMessage* msg)
+{
+    UINT16 xt=msg->posiX;
+    UINT16 yt=msg->posiY;
+    UINT16 res=0;
+
+    Widget* obj=NULL;
+
+    obj=getWidgetPosition(xt,yt);
+
+    if(obj!=NULL && obj->getIsVisible()==true) {
+        res=obj->getId();
+        msg->objId=res;
+    } else {
+        msg->objId=0;
+    }
+
+}
+//------------------------------------
+void Screen::setClear()
+{
+   mySerial->draw_filled_rectangle(myXpos,myYpos,myXpos+myWidth,myYpos+myHeight,myColorBkg); 
+}
+///////////////////////////////////////
+
+Widget::Widget(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color):
+    myScreen(mScreen),myId(_id),myX(_x),myY(_y),myWidth(_w),myHeight(_h),myColor(_color)
+{
+
+    myState=STATE_ON;
+    myIsVisible=true;
+}
+//-------------------------------------
+Widget::~Widget(void)
+{
+}
+//-------------------------------------
+//-------------------------------------
+void Widget::draw(void)
+{
+//to do
+}
+//-------------------------------------
+UINT16 Widget::getXposition(void) const
+{
+    return this->myX;
+}
+//---------------------------------------
+UINT16 Widget::getYposition(void) const
+{
+    return this->myY;
+}
+//----------------------------------------
+UINT16 Widget::getWidth(void) const
+{
+    return this->myWidth;
+}
+//----------------------------------------
+UINT16 Widget::getHeight(void) const
+{
+    return this->myHeight;
+}
+//----------------------------------------
+UINT16 Widget::getId(void) const
+{
+    return this->myId;
+}
+//----------------------------------------
+WIDGET_TYPE Widget::getType(void) const
+{
+    return this->myType;
+}
+//----------------------------------------
+bool Widget::getIsVisible(void) const
+{
+    return this->myIsVisible;
+}
+//----------------------------------------
+Color Widget::getColor(void) const
+{
+    return myColor;
+}
+//----------------------------------------
+void Widget::setVisibility(bool _val)
+{
+    (this->myIsVisible)=_val;
+}
+//----------------------------------------
+State Widget::getState(void) const
+{
+    return this->myState;
+}
+//------------------------------------------
+void Widget::setColor(Color _color)
+{
+    myColor=_color;
+}
+//------------------------------------------
+void Widget::setState(State _state)
+{
+    myState=_state;
+}
+//------------------------------------------
+void Widget::setId(UINT16 _id)
+{
+    myId=_id;
+}
+//------------------------------------------
+void Widget::setXposition(UINT16 _xpos)
+{
+    this->myX=_xpos;
+}
+//------------------------------------------
+void Widget::setYposition(UINT16 _ypos)
+{
+    this->myY=_ypos;
+}
+//----------------------------------------
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Screen.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,137 @@
+#ifndef SCREEN_H
+#define SCREEN_H
+
+#include "mbed.h"
+#include "PicasoSerial.h"
+#include <string>
+#include <vector>
+
+///
+class Widget;
+/////////
+
+class Screen
+{
+public:
+    /** Construct a Screen
+    *
+    * @param serial the PicasoSerial Obj
+    * @param _x the up left
+    * @params _y the up left
+    * @params _w the width
+    * @params _h the height
+    * @param _colorBkg the background color
+    */
+    // constructeur
+    Screen(PicasoSerial* serial,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _colorBkg);
+    //
+    virtual ~Screen(void);
+    //
+    //! draw all objects
+    void drawAllWidget(void);
+    //------------------------------
+    //! add a new Objet
+    void addWidget(Widget* pObj);
+    //
+    //! draw a particular object
+    void drawWidget(Widget* pObj);
+    //
+    //! @returns PicasoSerial the pointer to draw on the screen
+    PicasoSerial* getPicasoSerial(void) const;
+    //
+     void setClear();
+
+//getter
+    UINT16 getXpos(void) const;
+    UINT16 getYpos(void) const;
+    UINT16 getWidth(void) const;
+    UINT16 getHeight(void) const;
+    Color getColorBkg(void) const;
+
+    bool isContent(Widget* pObj, UINT16 _x,UINT16 _y);
+
+    //-----------------------------------------------------
+    //! returns the Objet in [_x,_y] position
+    Widget* getWidgetPosition(UINT16 _x,UINT16 _y);
+    
+    //! returns the Objet by Id
+    Widget* getWidgetById(UINT16 _id);
+
+    //-----------------------------------------------------
+    //! returns the touch and update the GraphicMessage
+    TouchEvent getTouchEvent(GraphicMessage* msg);
+
+    //-------------------------------------------
+    //! update the identifier Id of the object being touched
+    void getProcessMessage(GraphicMessage* msg);
+
+protected:
+    PicasoSerial* mySerial;
+
+    UINT16 myXpos,myYpos,myWidth,myHeight;
+
+    Color myColorBkg;
+
+    vector<Widget*> myVectorObjet;
+};
+
+///////////////////////////////
+class Widget
+{
+public:
+    /** Construct a Widget the father
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _x the up left
+    * @params _y the up left
+    * @params _w the width
+    * @params _h the height
+    * @param _color the background color
+    * @params _isVisible
+    */
+// constructor
+    //
+    Widget(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color);
+    //
+    //! draw the obj
+    virtual void draw(void);
+    //
+    virtual ~Widget(void);
+    //
+   
+    UINT16 getXposition(void) const;
+    UINT16 getYposition(void) const;
+    UINT16 getWidth(void) const;
+    UINT16 getHeight(void) const;
+    UINT16 getId(void) const;
+    bool   getIsVisible(void) const;
+    State getState(void) const;
+    Color getColor(void) const;
+
+
+    void setColor(Color _color);
+    void setState(State _state);
+    void setId(UINT16 _id);
+    void setVisibility(bool _val);
+    void setXposition(UINT16 _xpos);
+    void setYposition(UINT16 _ypos);
+   
+
+    WIDGET_TYPE getType(void) const;
+
+
+
+protected:
+    Screen* myScreen;
+
+    UINT16 myX,myY,myWidth,myHeight;
+    UINT16 myId;
+    WIDGET_TYPE myType;
+
+    bool myIsVisible;
+    
+    State myState;
+    Color myColor;
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Segment.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,74 @@
+#include "Segment.h"
+
+Segment::Segment(Screen* mScreen,UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2,Color _color):
+    Widget(mScreen,0,_x1,_y1,0,0,_color)
+{
+    myX1=_x1;
+    myY1=_y1;
+    myX2=_x2;
+    myY2=_y2;
+
+    myType=OBJ_SEGMENT;
+
+    myScreen->addWidget((Widget*)this);
+}
+//------------------------------------------
+void Segment::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_line(myX1,myY1,myX2,myY2,myColor);
+    }
+    ps=0;
+}
+//------------------------------------------
+Segment::~Segment(void)
+{
+}
+//-------------------------------------------
+void Segment::setInvisible(bool _state)
+{
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+        //
+        myIsVisible=false;
+        Color c=myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0)
+            ps->draw_line(myX1,myY1,myX2,myY2,c);
+            ps=0;
+    }
+    //
+    else {
+        myIsVisible=true;
+        this->draw();
+    }
+}
+//---------------------------------------------
+void Segment::setNewCoord(UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2)
+{
+    if(myIsVisible==false)
+        return;
+
+    if(myX1==_x1 && myY1==_y1 && myX2==_x2 && myY2==_y2)
+        return;
+
+    this->setInvisible(true);
+
+    myX1=_x1;
+    myY1=_y1;
+    myX2=_x2;
+    myY2=_y2;
+
+    this->setInvisible(false);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Segment.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,37 @@
+#ifndef SEGMENT_H
+#define SEGMENT_H
+
+#include "Screen.h"
+
+class Segment: public Widget
+{
+public:
+    /** Construct a Segment
+        *
+        * @param mScreen the pointer screen
+        * @param _id the identifier Id
+        * @params _x1 first point
+        * @params _y1
+        * @params _x2 second point
+        * @params _y2
+        * @params _color
+        * @params _isVisible
+        */
+    Segment(Screen* mScreen,UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2,Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Segment(void);
+    //
+    void setInvisible(bool _state);
+    //
+    void setNewCoord(UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2);
+
+protected:
+UINT16 myX1;
+UINT16 myY1;
+UINT16 myX2;
+UINT16 myY2;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Slider.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,89 @@
+#include "Slider.h"
+
+Slider::Slider(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,int _valMax,int _value,
+               Color _colorBkg):
+    Widget(mScreen,_id,_x,_y,_width,_height,_colorBkg)
+{
+
+    myValueMax=_valMax;
+    myValue=_value;
+
+    myType=OBJ_SLIDER;
+    myState=SLIDER_STATE_RELEASED;
+
+    myScreen->addWidget((Widget*) this);
+}
+//---------------------------------------
+Slider::~Slider(void)
+{
+}
+//---------------------------------------
+void Slider::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_slider(0x0000,myX,myY,myX+myWidth,myY+myHeight,myColor,myValueMax,myValue);
+    }
+    ps=0;
+
+}
+//--------------------------------------
+void Slider::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//-------------------------------------
+int Slider::getValue(GraphicMessage* pmsg)
+{
+    TouchEvent msgEvent=pmsg->event;
+
+    UINT16 xn=pmsg->posiX;
+
+
+    if(myIsVisible==false)
+        return 0;
+    //
+
+    if(msgEvent==EVENT_RELEASE) {
+        myState=SLIDER_STATE_RELEASED;
+    }
+    //
+    if(msgEvent==EVENT_MOVE) {
+        myState=SLIDER_STATE_MOVE;
+        UINT16 dis=xn-myX;
+        UINT16 a=dis*myValueMax;
+        myValue=(a/myWidth);
+
+        this->draw();
+    }
+    return myValue;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Slider.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,37 @@
+#ifndef SLIDER_H
+#define SLIDER_H
+
+#include "Screen.h"
+
+class Slider:public Widget
+{
+public:
+    /** Construct a Slider
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _x up left
+    * @params _y up left
+    * @params _width
+    * @params _height
+    * @params _valMax
+    * @params _value
+    * @params _colorBkg
+    */
+    Slider(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height,int _valMax,int _value,
+           Color _colorBkg);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Slider(void);
+    //
+    void setInvisible(bool _state);
+    //
+    int getValue(GraphicMessage* pmsg);
+
+protected:
+    int myValueMax;
+    int myValue;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sprite.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,137 @@
+#include "Sprite.h"
+
+Sprite::Sprite(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color):
+    Widget(mScreen,_id,_x,_y,_w,_h,_color)
+{
+
+    myIsUpdateAutomatic=true;
+
+    myXMoveMin=myScreen->getXpos();
+    myYMoveMin=myScreen->getYpos();
+
+    myXMoveMax=myXMoveMin+myScreen->getWidth();
+    myYMoveMax= myYMoveMin+myScreen->getHeight();
+
+    mySpeedX=0.0;
+    mySpeedY=0.0;
+}
+//-------------------------------------
+Sprite::~Sprite(void)
+{
+}
+
+//-------------------------------------
+void Sprite::setUpdateAutomatic(bool _state)
+{
+    myIsUpdateAutomatic=_state;
+}
+//---------------------------------------
+bool Sprite::getUpdateAutomatic(void) const
+{
+    return this->myIsUpdateAutomatic;
+}
+//-------------------------------------
+bool Sprite::overlapWith(Sprite* pObj)
+{
+    return overlap(this,pObj);
+}
+//-------------------------------------
+bool Sprite::overlap(Sprite* pObj1,Sprite* pObj2)
+{
+    UINT16 x1=pObj1->getXposition();
+    UINT16 x2=pObj2->getXposition();
+
+    UINT16 y1=pObj1->getYposition();
+    UINT16 y2=pObj2->getYposition();
+
+    UINT16 xa=pObj1->getXposition()+pObj1->getWidth();
+    UINT16 xb=pObj2->getXposition()+pObj2->getWidth();
+
+    UINT16 ya=pObj1->getYposition()+pObj1->getHeight();
+    UINT16 yb=pObj2->getYposition()+pObj2->getHeight();
+
+    //
+    if(x1 <xb && xa>x2 && y1<yb && ya>y2) {
+
+        return true;
+    } else {
+        return false;
+    }
+
+}
+//-------------------------------------
+void Sprite::elementUpdate(void)
+{
+    switch(myState) {
+            //
+        case BUMP_DOWN:
+            setInvertSpeedY();
+            myState=STATE_ON;
+            break;
+            //
+        case BUMP_LEFT:
+            setInvertSpeedX();
+            myState=STATE_ON;
+            break;
+            //
+        case BUMP_RIGHT:
+            setInvertSpeedX();
+            myState=STATE_ON;
+            break;
+            //
+        case BUMP_UP:
+            setInvertSpeedY();
+            myState=STATE_ON;
+            break;
+            //
+        case STATE_OFF:
+            break;
+            //
+        default:
+            break;
+    }
+    //
+}
+//-------------------------------------
+void Sprite::draw(void)
+{
+//to do
+}
+//----------------------------------------
+float Sprite::getSpeedX(void) const
+{
+    return this->mySpeedX;
+}
+//----------------------------------------
+float Sprite::getSpeedY(void) const
+{
+    return this->mySpeedY;
+}
+//----------------------------------------
+void Sprite::setInvertSpeedX(void)
+{
+    mySpeedX=-(this->mySpeedX);
+}
+//----------------------------------------
+void Sprite::setInvertSpeedY(void)
+{
+    mySpeedY=-(this->mySpeedY);
+}
+//----------------------------------------
+void Sprite::setSpeedX(float _speedX)
+{
+    mySpeedX=_speedX;
+}
+//----------------------------------------
+void Sprite::setSpeedY(float _speedY)
+{
+    mySpeedY=_speedY;
+}
+//----------------------------------------
+void Sprite::setSpeedXY(float _speedX,float _speedY)
+{
+    mySpeedX=_speedX;
+    mySpeedY=_speedY;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sprite.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,61 @@
+#ifndef SPRITE_H
+#define SPRITE_H
+
+#include "mbed.h"
+#include "Screen.h"
+
+
+class Sprite: public Widget
+{
+public:
+    /** Construct a Sprite
+    *
+    * @param mScreen the pointer screen
+    * @param _id the identifier Id
+    * @params _x the up left
+    * @params _y the up left
+    * @params _w the width
+    * @params _h the height
+    * @param _color the background color
+    */
+// constructor
+    //
+    Sprite(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _w,UINT16 _h,Color _color);
+
+    virtual ~Sprite();
+
+    virtual void draw(void);
+
+    //! test a overlap
+    bool overlapWith(Sprite* pObj);
+    //
+    static bool overlap(Sprite* pObj1,Sprite* pObj2);
+    //
+
+
+//getter
+    float getSpeedX(void) const;
+    float getSpeedY(void) const;
+
+//setter
+
+    void setInvertSpeedX(void);
+    void setInvertSpeedY(void);
+    void setSpeedX(float _speedX);
+    void setSpeedY(float _speedY);
+    void setSpeedXY(float _speedX,float _speedY);
+
+    void setUpdateAutomatic(bool _state);
+    bool getUpdateAutomatic(void) const;
+
+protected:
+    void elementUpdate(void);
+
+    bool myIsUpdateAutomatic;
+    float mySpeedX,mySpeedY;
+
+    UINT16 myXMoveMin,myXMoveMax,myYMoveMin,myYMoveMax;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Switcher.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,131 @@
+#include "Switcher.h"
+
+Switcher::Switcher(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height):
+    Widget(mScreen,_id,_x,_y,_width,_height,WHITE)
+{
+    myColorOn=GREEN;
+    myColorOff=RED;
+    myColorCursor=WHITE;
+
+    myType=OBJ_SWITCHER;
+    myState=SWITCHER_STATE_OFF;
+
+    myScreen->addWidget((Widget*) this);
+}
+//---------------------------------------
+Switcher::~Switcher(void)
+{
+}
+//---------------------------------------
+void Switcher::draw(void)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    State state=myState;
+
+    Color gauche=WHITE;
+    Color droite=WHITE;
+
+    switch(state) {
+            //
+        case SWITCHER_STATE_ON:
+            droite=myColorOn;
+            gauche=myColorCursor;
+            break;
+
+            //
+        case SWITCHER_STATE_OFF:
+            droite=myColorCursor;
+            gauche=myColorOff;
+            break;
+
+            //
+        default:
+            break;
+    }
+    //
+
+    //rect gauche
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX,myY,myX+myWidth/2,myY+myHeight,gauche);
+
+    //rect droite
+    if(ps!=0)
+        ps->draw_filled_rectangle(myX+myWidth/2,myY,myX+myWidth,myY+myHeight,droite);
+
+    //cadre
+    if(ps!=0) {
+        ps->draw_rectangle(myX,myY,myX+myWidth,myY+myHeight,BLACK);
+        ps->draw_rectangle(myX,myY,myX+myWidth/2,myY+myHeight,BLACK);
+
+    }
+    ps=0;
+
+}
+//----------------------------------------
+void Switcher::setInvisible(bool _state)
+{
+    // element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+        PicasoSerial* ps=0;
+
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_rectangle(myX,myY,myX+myWidth,myY+myHeight,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+
+        this->draw();
+    }
+}
+//-----------------------------------------
+void Switcher::setState(State _state)
+{
+    if(myIsVisible==false)
+        return;
+
+    if(myState==_state)
+        return;
+
+    myState=_state;
+
+    this->draw();
+}
+//-----------------------------------------
+void Switcher::changeState(GraphicMessage* msg)
+{
+    TouchEvent ev=msg->event;
+
+    if(myIsVisible==false)
+        return;
+
+    if(ev==EVENT_PRESS && myState==SWITCHER_STATE_OFF) {
+        this->setState(SWITCHER_STATE_ON);
+        return;
+    }
+    //
+    if(ev==EVENT_PRESS && myState==SWITCHER_STATE_ON) {
+        this->setState(SWITCHER_STATE_OFF);
+        return;
+    }
+    //
+    if(ev==EVENT_MOVE || ev==EVENT_RELEASE)
+        return;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Switcher.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,36 @@
+#ifndef SWITCHER_H
+#define SWITCHER_H
+
+#include "Screen.h"
+
+class Switcher:public Widget
+{
+public:
+    /** Construct a Switch
+        *
+        * @param mScreen the pointer screen
+        * @param _id the identifier Id
+        * @params _x up left
+        * @params _y up left
+        * @params _width
+        * @params _height
+        */
+    Switcher(Screen* mScreen,UINT16 _id,UINT16 _x,UINT16 _y,UINT16 _width,UINT16 _height);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Switcher(void);
+    //
+    void setInvisible(bool _state);
+    //
+    void setState(State _state);
+    //
+    void changeState(GraphicMessage* msg);
+
+protected:
+    Color myColorOn;
+    Color myColorOff;
+    Color myColorCursor;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Triangle.cpp	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,142 @@
+#include "Triangle.h"
+
+Triangle::Triangle(Screen* mScreen,UINT16 _x1,UINT16 _y1,
+                   UINT16 _x2,UINT16 _y2,
+                   UINT16 _x3,UINT16 _y3,Color _color):
+    Sprite(mScreen,0,_x2,_y1,_x3-_x2,_y3-_y1,_color)
+{
+    myX1=_x1;
+    myY1=_y1;
+    myX2=_x2;
+    myY2=_y2;
+    myX3=_x3;
+    myY3=_y3;
+    myU=_x1-_x2;
+    myV=_y2-_y1;
+
+    myType=OBJ_TRIANGLE;
+
+    myScreen->addWidget((Widget*) this);
+}
+//-----------------------------------------------
+Triangle::~Triangle(void)
+{
+}
+//-----------------------------------------------
+void Triangle::draw(void)
+{
+// isVisible ?
+    if(myIsVisible==false) {
+        return;
+    }
+    //
+    PicasoSerial* ps=0;
+    ps=myScreen->getPicasoSerial();
+
+    if(ps!=0) {
+        ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,myColor);
+    }
+    ps=0;
+}
+//------------------------------------------------
+void Triangle::setInvisible(bool _state)
+{
+// element devient invisible
+    if(_state==true) {
+        if(myIsVisible==false)
+            return;
+
+        myIsVisible=false;
+
+        Color c= myScreen->getColorBkg();
+
+        PicasoSerial* ps=0;
+        ps=myScreen->getPicasoSerial();
+
+        if(ps!=0) {
+            ps->draw_filled_triangle(myX1,myY1,myX2,myY2,myX3,myY3,c);
+        }
+        ps=0;
+    }
+
+    // element devient visible
+    else {
+        myIsVisible=true;
+
+        this->draw();
+    }
+}
+//------------------------------------------------
+void Triangle::setNewPosition(INT16 _xnew,INT16 _ynew)
+{
+    setNewPosition(_xnew,_ynew,true);
+}
+//------------------------------------------------
+void Triangle::setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits)
+{
+    if(myIsVisible==false)
+        return;
+    //
+    if(myX==_xnew && myY==_ynew)
+        return;
+    setInvisible(true); // colorie le tri avec couleur de la screen
+
+    myIsVisible=true;
+    if(isScreenLimits) {
+        //test Xmax
+        if(_xnew+myWidth >= myXMoveMax) {
+            _xnew=myXMoveMax-myWidth;
+
+            if(myState==STATE_ON)
+                myState=BUMP_RIGHT;
+        }
+        //
+        //test Xmin
+        if(_xnew <= myXMoveMin) {
+            _xnew=myXMoveMin;
+
+            if(myState==STATE_ON)
+                myState=BUMP_LEFT;
+        }
+        //test Ymax
+        if(_ynew +myHeight >= myYMoveMax && _ynew >0) {
+            _ynew = myYMoveMax- myHeight;
+
+            if(myState==STATE_ON)
+                myState=BUMP_DOWN;
+        }
+        //test yminMin;
+        if(_ynew <= myYMoveMin) {
+            _ynew=myYMoveMin;
+
+            if(myState==STATE_ON)
+                myState=BUMP_UP;
+        }
+    }
+    //
+    myX=_xnew;
+    myY=_ynew;
+
+    myX1=_xnew+myU;
+    myY1=_ynew;
+
+    myX2=_xnew;
+    myY2=_ynew+myV;
+
+    myX3=_xnew+myWidth;
+    myY3=_ynew+myHeight;
+
+    this->draw();
+}
+//------------------------------------------------
+void Triangle::update(float delta)
+{
+    if(myIsUpdateAutomatic)
+        elementUpdate();
+    //
+    float xnew=myX+mySpeedX*delta;
+    float ynew=myY+mySpeedY*delta;
+
+    this->setNewPosition((INT16)xnew,(INT16)ynew,true);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Triangle.h	Sun Apr 05 13:54:48 2015 +0000
@@ -0,0 +1,49 @@
+#ifndef TRIANGLE_H
+#define TRIANGLE_H
+
+#include "Screen.h"
+#include "Sprite.h"
+
+class Triangle:public Sprite
+{
+public:
+    /** Construct a filled  Triangle
+       *
+       * @param mScreen the pointer screen
+       * @params x1
+       * @params y1
+       * @params x2
+       * @params y2
+       * @params x3
+       * @params y3
+       * @param _color the background color
+       */
+
+    Triangle(Screen* mScreen,UINT16 x1,UINT16 y1,
+             UINT16 x2,UINT16 y2,
+             UINT16 x3,UINT16 y3,
+             Color _color);
+    //
+    virtual void draw(void);
+    //
+    virtual ~Triangle(void);
+    //
+    void update(float delta);
+
+
+//setter
+    void setInvisible(bool _state);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew);
+    //
+    void setNewPosition(INT16 _xnew,INT16 _ynew,bool isScreenLimits);
+
+
+protected:
+    UINT16 myX1,myY1;
+    UINT16 myX2,myY2;
+    UINT16 myX3,myY3;
+    UINT16 myU,myV;
+};
+
+#endif
\ No newline at end of file