Пример #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();
  }
}
Пример #2
0
void
OrbitOledClear()
	{

	OrbitOledClearBuffer();
	OrbitOledUpdate();

}
Пример #3
0
void setup() {

    // Helper function found in functions.cpp

    deviceInit();
    pinMode(button1, INPUT_PULLUP);
    pinMode(button2, INPUT_PULLUP);

    // Reset OLED (function from functions.cpp)

    oledReset();
    OrbitOledUpdate();
}
Пример #4
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);
  } 
}
Пример #5
0
void loop() {

    is_diff_game_mode(); // different game modes

    movePaddle();
    render_ball();
    render_right_wall();
    render_score();
    render_lives();

    lBtn2 = GPIOPinRead(BTN2Port, BTN2);

    if (lBtn2 == BTN2)
    {
        render_credits();
    }

    ballMove();

    OrbitOledUpdate();
    oledReset();
}