//Temporarily moves to the yes-no panel and returns the click on button yes or no bool showConfirmMessage(char* pMessage){ byte vPreviousPanel = mCurrentPanel; gotoPanel(PANEL_YESNO); showMessage(pMessage, 10); bool vResult = false; //wait for input bool vChoosed = false; while (!vChoosed){ if (gettouch()){ Point p; p.v = mouseY; p.h = mouseX; ARDTButton* vB = getButtonAt (p); if (vB != 0 && vB->code == 'Y'){ vResult = true; vChoosed = true; } if (vB != 0 && vB->code == 'N'){ vResult = false; vChoosed = true; } } delay(50); } //go back to previous panel gotoPanel(vPreviousPanel); return vResult; }
//Start drawing the bees void beesFlight(bool pCheckSerial){ //while not touched, animate... while(!gettouch() && (!pCheckSerial || Serial.available() == 0)){ for(int i=0; i < BEES_COUNT; i++){ mBees[i].x = newRandBees(mBees[i].x, BEE_RAYON, 320-BEE_RAYON); mBees[i].y = newRandBees(mBees[i].y, BEE_RAYON, 240-BEE_RAYON); drawBee(mBees[i]); } delay(50); } }
//******************************************************************************* void DisplaySplashScreen(void) { COLOR bgColor; COLOR fontColor; int ii; int yTextLoc; #ifdef _STARTUPSCREEN_VERSION_ char startupMsg[128]; #endif #ifdef _STARTUPSCREEN_VERSION_ bgColor.red = 0; bgColor.green = 0; bgColor.blue = 0; fontColor.red = 0; fontColor.green = 255; fontColor.blue = 0; //* display the overall library version yTextLoc = 10; strcpy(startupMsg, kDisplayHardwareString); strcat(startupMsg, " "); strcat(startupMsg, kDisplayHardwareVersion); dispPutS(startupMsg, 5, yTextLoc, fontColor, bgColor); yTextLoc += kLinrSpacing; //* display the SubProcessing library version strcpy(startupMsg, "Arduino Procssing Library "); strcat(startupMsg, kSubP_VersionString); strcat(startupMsg, " "); #ifdef _SUBP_OPTION_GAMES_ strcat(startupMsg, "+G"); #endif #ifdef _SUBP_OPTION_KEYBOARD_ strcat(startupMsg, "+K"); #endif dispPutS(startupMsg, 5, yTextLoc, fontColor, bgColor); yTextLoc += kLinrSpacing; #endif #ifdef _DEBUG_RECTS_ dispColor(bgColor); ii = kSCREEN_Y_size / 2; ii -= 25; ii = kSCREEN_Y_size / 3; while (ii > 30) { fill(random(255), random(255), random(255)); stroke(random(255), random(255), random(255)); drawrect((kSCREEN_X_size / 2) - ii, (kSCREEN_Y_size / 2) - ii, (ii * 2), (ii * 2)); ii -= 10; } fill(0); stroke(255); #endif #ifdef _STARTUPSCREEN_LIQUIDWARE_ for (ii=0; ii<190; ii+=10) { //* this is the FADE color, how much to subtract from the actual colors //* 0 means none. bgColor.red = ii; bgColor.green = ii; bgColor.blue = ii; DisplayRLE_RGB(gLiquidWareLogo, &bgColor, false, kMatixTopOffset); #ifdef _STARTUPSCREEN_MATRIX_ if (ii > 100) { MatrixDisplay(kMatixTopOffset, 3); } #endif } #endif #ifdef _STARTUPSCREEN_MATRIX_ ii = 0; while(!serialAvailable() && (ii < 2000)) { MatrixDisplay(kMatixTopOffset, 2); ii++; gettouch(); if ((mouseX > 200) && (mouseY < 100)) { break; } } #endif #ifdef _SUBP_OPTION_7_SEGMENT_dontDisplay int xx, yy; // dispClearScreen(); xx = 10; yy = 50; for (ii=5; ii<30; ii += 4) { Display7SegmentString(xx, yy, "0123456789ABCDEF", ii); yy += (ii * 2); yy += 8; if (ii > 230) { break; } } while (true) { //* do nothing } #endif bgColor.red = 0; bgColor.green = 0; bgColor.blue = 0; dispColor(bgColor); // drawrect(0, yTextLoc, 320, 240); }
void loop() { while (!(touch_get_cursor(&m_point))) { //replace with code to get readings from arduino oil_temp=oil_temp + random(2); if (oil_temp > maxOilT) { oil_temp=100; } boost=boost + random(2); if (boost > maxBoost) { boost=0; } temp1 = temp1 + random(3); if (temp1 > maxT1) { temp1 = 0; } temp2=temp2+random(3); if (temp2 > maxT2) { temp2 = 0; } accelx = accelx + .01; //accelx = ((float)random(-15, 15))/10.0; o_oil_temp = 0; o_boost = 0; //gauge on upper left side if (gauge == 1) { oil_temp_gauge(oil_temp, o_oil_temp); } else if (gauge == 2) { boost_gauge(boost, o_boost); } else if (gauge == 3) { temp_gauge(temp1, temp2); } //update the bar graphs four_bar(oil_temp, boost, temp1, temp2); //update the accelerometer display accelDisplay(accelx); } //when a touch is detected get coords //go to mode of what is touched if it is boost or oilT //otherwise go to next display while (gettouch()) { //debounce hold //boost bar and word area if ((mouseX < 320) && (mouseX > 182) && (mouseY < 58) && (mouseY > 17)) { gauge = 2; gaugedrawswitch = 0; } //oil temp area if ((mouseX < 320) && (mouseX > 182) && (mouseY < 93) && (mouseY > 60)) { gauge = 1; gaugedrawswitch = 0; } //temp area //gauge face area if ((mouseX < 150) && (mouseX > 6) && (mouseY < 150) && (mouseY > 6)) { gauge++; gaugedrawswitch = 0; } //accelerometer area } }