void rectTest() { uint32_t i,start; Rectangle rc; prompt("Rectangle test"); for(i=0,start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;i++) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getYmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); _gl->setForeground(rand()); _gl->fillRectangle(rc); } _gl->clearScreen(); for(i=0,start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;i++) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getYmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); _gl->setForeground(rand()); _gl->drawRectangle(rc); if(i % 1000 ==0) _gl->clearScreen(); } }
void rectTest() { int i; Rectangle rc; prompt("Rectangle test"); for(i=0;i<1500;i++) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getXmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); _gl->setForeground(rand()); _gl->fillRectangle(rc); } _gl->clearScreen(); for(i=0;i<10000;i++) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getXmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); _gl->setForeground(rand()); _gl->drawRectangle(rc); if(i % 1000 ==0) _gl->clearScreen(); } }
void rectTest() { Rectangle rc; uint32_t start; prompt("Rectangle test"); for(start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getXmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); if(rc.Width>0 && rc.Height>0) { _gl->setForeground(rand()); _gl->fillRectangle(rc); } } _gl->clearScreen(); for(start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;) { rc.X=(rand() % _gl->getXmax()/2); rc.Y=(rand() % _gl->getXmax()/2); rc.Width=rand() % (_gl->getXmax()-rc.X); rc.Height=rand() % (_gl->getYmax()-rc.Y); _gl->setForeground(rand()); _gl->drawRectangle(rc); } }
void drawBox(const char *label, int16_t X_location,int16_t Y_location , Rectangle* touchArea) { // create a touch button at location specified by location // and display the button on the screen with the specified label // touch button are constant size for now touchArea->X=X_location; touchArea->Y=Y_location; touchArea->Height=40; touchArea->Width=80; lcd->drawRectangle(*touchArea); // find the suitable location for the label and display it Size stringSize = lcd->measureString(*_font,label); Point labelLocation; labelLocation.X = touchArea->Width/2-stringSize.Width/2+X_location; labelLocation.Y = touchArea->Height/2-stringSize.Height/2+Y_location; // debug purpose: we want to make sure the location is still visible // even if it's too big for the box if (labelLocation.X > 0 && labelLocation.Y>0) *lcd << labelLocation << label; }