void paintFrame(){ if(frameChanged()){ OrbitOledClear(); OrbitOledMoveTo((int)(g.x1),(int)g.y1); OrbitOledFillRect((int)(g.x1+guns1),(int)(g.y1+guns1)); // gy2=gy-((gsize2-gsize)/2); OrbitOledMoveTo((int)(g.x2),(int)g.y2); OrbitOledFillRect((int)(g.x2+guns2),(int)(g.y2+guns2)); OrbitOledUpdate(); for(int i=0;i<maxGeese;i++){ if(ge[i].valid){ OrbitOledMoveTo((int)ge[i].x,(int)ge[i].y); OrbitOledFillRect((int)ge[i].x+geeseSize,(int)ge[i].y+geeseSize); } } OrbitOledUpdate(); for(int i=0;i<maxBullet;i++){ if(b[i].valid){ OrbitOledMoveTo((int)b[i].x,(int)b[i].y); OrbitOledFillRect((int)b[i].x+bulletSize,(int)b[i].y+bulletSize); } } OrbitOledUpdate(); } }
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 drawCopter(Copter *copter) { int x = (int) copter->x; int y = (int) copter->y; OrbitOledMoveTo(x, y); OrbitOledPutBmp(CopterWidth, CopterHeight, CopterBmp); // OrbitOledDrawRect(16, 4); }
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); } }
void drawCave(GameState *state) { int i=0, j=0, x=0, c=0; for( i=0; i<MAX_HEIGHT; i++){ for( j=0; j<MAX_WIDTH; j++){ if(state->caveObject[i][j] == '#' ){ OrbitOledMoveTo(j,i); OrbitOledDrawPixel(); } } } }
void drawPusheen(){ OrbitOledMoveTo(12,0); OrbitOledPutBmp(52,32,pusheen); }