Exemple #1
0
void drawingThings() {
    makeScreenBlack();

    // draw the bricks
    for(int i=0;i<BRICKS_VERTICALLY;i++) {
      for(int ii=0;ii<BRICKS_HORIZONTALLY;ii++) {
        if(bricks[i][ii] != 0) {
          rectfill(screenBuffer, 
            ii*BRICK_WIDTH, i*BRICK_HEIGHT, 
            (ii+1)*BRICK_WIDTH-BRICK_GAP, (i+1)*BRICK_HEIGHT-BRICK_GAP, 
            makecol(255, 0, 0));
        }
      }
    }

    // draw the player
    circlefill(screenBuffer, 
          ball.x, ball.y, 
          8, makecol(255, 255, 0));

    // draw the player
    rectfill(screenBuffer, 
          playerPaddleEdgeX, PADDLE_POSITION_Y, 
          playerPaddleEdgeX+PADDLE_WIDTH, 
          PADDLE_POSITION_Y+PADDLE_HEIGHT, makecol(255, 255, 255));
          
    textprintf_ex(screenBuffer, font, 10, 10, makecol(255, 255, 0),
                    -1, "Player Position (playerPaddleEdgeX is %i)", playerPaddleEdgeX);
    textprintf_ex(screenBuffer, font, 10, 20, makecol(255, 255, 255),
                    -1, "ball (x,y) position is (%i, %i)", ball.x, ball.y);

}
Exemple #2
0
void drawThings() {
  makeScreenBlack();

  // draw rocks
  for(int i=0;i<ROCK_NUM;i++) {
    if( ast[i].life != 0 ) {
      circlefill(screenBuffer, 
            int(ast[i].x), int(ast[i].y), 
            int(ast[i].rad), 
            makecol(255, 255, 0));
    }
  }

  drawLine( &ship , makecol(255, 255, 0) );
  
  drawLine( &shot , makecol(0, 255, 0) );
}