Exemplo n.º 1
0
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();
  }
}
Exemplo n.º 2
0
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);
  } 
}
Exemplo n.º 3
0
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);
  } 
}
Exemplo n.º 4
0
void setup(){     //run once initialization code here, i.e. OledInit() will probably go here
  DeviceInit();
  score=0;
  showStrtScrn();
  calibratedAccel=getAccelY();
  switch(CheckSwitches()){
    case 0: maxBullet=5;break;
    case 1: maxBullet=4;break;
    case 2:maxBullet=3;break;
    case 3: maxBullet=2;break;
    default: maxBullet=5;
  };
  lives=4;
  updateLED(lives);
  initStuff();
  OrbitOledClear();
  OrbitOledSetFillPattern(OrbitOledGetStdPattern(1));
}
Exemplo n.º 5
0
void
OrbitOledInit()
	{

	/* Init the LM4F120 peripherals used to talk to the display.
	*/
	OrbitOledHostInit();

	/* Init the memory variables used to control access to the
	** display.
	*/
	OrbitOledDvrInit();

	/* Init the OLED display hardware.
	*/
	OrbitOledDevInit();

	/* Clear the display.
	*/
	OrbitOledClear();

}