void OrbitOledDvrInit() { int ib; /* Init the parameters for the default font */ dxcoOledFontCur = cbOledChar; dycoOledFontCur = 8; pbOledFontCur = rgbOledFont0; pbOledFontUser = rgbOledFontUser; for (ib = 0; ib < cbOledFontUser; ib++) { rgbOledFontUser[ib] = 0; } xchOledMax = ccolOledMax / dxcoOledFontCur; ychOledMax = crowOledMax / dycoOledFontCur; /* Set the default character cursor position. */ OrbitOledSetCursor(0, 0); /* Set the default foreground draw color and fill pattern */ clrOledCur = 0x01; pbOledPatCur = rgbFillPat; OrbitOledSetDrawMode(modOledSet); /* Default the character routines to automatically ** update the display. */ fOledCharUpdate = 1; }
void showStrtScrn(){ //Tested OrbitOledClear(); OrbitOledMoveTo(48,0); OrbitOledPutBmp(strtScrnW,strtScrnH,strtScrnBMP); // OrbitOledSetCursor(3,3); // OrbitOledPutString("START GAME"); OrbitOledSetCursor(0,3); OrbitOledPutString(" PRESS TO START "); // for(int t=0,c='3';t<3;t++,c--){ //show timer // OrbitOledSetCursor(14,3); // OrbitOledPutChar(c); // updateLED(4); // delay(400); // updateLED(0); // delay(200); // } long lBtn1; lBtn1 = GPIOPinRead(BTN1Port, BTN1); while(lBtn1!=BTN1){ updateLED(4); delay(100); updateLED(0); delay(100); lBtn1 = GPIOPinRead(BTN1Port, BTN1); } }
void displayScore () { char scoreStr[8]; if(score<0)score=0; //Dont wanna mock the user with negative scores if (score>highScore) { OrbitOledClear(); drawPusheen (); //Pusheen drawn on the right //Code for displaying high score on the left (columns 0 - 7) OrbitOledMoveTo(92, 0); OrbitOledDrawString("NEW"); OrbitOledMoveTo(88, 8); OrbitOledDrawString("HIGH"); OrbitOledMoveTo(84, 16); OrbitOledDrawString("SCORE"); OrbitOledMoveTo(84,24); sprintf(scoreStr, "%05d", score); OrbitOledDrawString (scoreStr); OrbitOledUpdate(); highScore=score; } else{ OrbitOledClear();; //Display the current score OrbitOledSetCursor (3, 2); OrbitOledPutString ("SCORE:"); OrbitOledSetCursor (10, 2); sprintf(scoreStr, "%05d", score); OrbitOledPutString (scoreStr); } long lBtn1; lBtn1 = GPIOPinRead(BTN1Port, BTN1); while(lBtn1!=BTN1){ updateLED(4); delay(100); updateLED(0); delay(100); lBtn1 = GPIOPinRead(BTN1Port, BTN1); } }