public void Update(Window window, Bar bar1, Bar bar2, Ball ball) { //Disegno parte superiore del Ring this.DrawRectFilled (window, 10, 10, 255, 255, 255, window.width-20, 10); //Disegno parte inferiore del Ring this.DrawRectFilled (window, 10, window.height-20, 255, 255, 255, window.width-20, 10); //Disegno righe tratteggiate che separano il ring int k = 20; while(k < window.height-20) { this.DrawRectFilled(window, window.width/2, k, 255, 255, 255, 7, 30); k += 40; } //Disegno la Palla //this.DrawRectFilled (window, ball.GetX(), ball.GetY(), ball.GetR(), ball.GetG(), ball.GetB(), ball.GetWidht(), ball.GetHeight()); this.DrawCircle(window, ball.GetX(), ball.GetY(), ball.GetRaggio(), 255, 255, 255); //Disegno la barra del Player 1 this.DrawRectFilled (window, bar1.GetX(), bar1.GetY(), 255, 0, 0, bar1.GetWidht(), bar1.GetHeight()); //Disegno la Barra del Player 2 this.DrawRectFilled (window, bar2.GetX(), bar2.GetY(), 0, 255, 0, bar2.GetWidht(), bar2.GetHeight()); //Movimeto barra del Player 1 bar1.Move (window, ball); //Movimeto barra del Player 2 bar2.Move2 (window, ball, window.height); //Movimeto della Palla ball.Update (window.height, window.width); numb1.CurrentResultDec (window, bar1.GetPoints()); numb2.CurrentResult (window, bar1.GetPoints()); numb3.CurrentResultDec (window, bar2.GetPoints()); numb4.CurrentResult (window, bar2.GetPoints()); }
public void Update(Window window, Bar bar1, Bar bar2, Ball ball) { //Disegno parte superiore del Ring this.DrawRectFilled(window, 10, 10, 255, 255, 255, window.width - 20, 10); //Disegno parte inferiore del Ring this.DrawRectFilled(window, 10, window.height - 20, 255, 255, 255, window.width - 20, 10); //Disegno righe tratteggiate che separano il ring int k = 20; while (k < window.height - 20) { this.DrawRectFilled(window, window.width / 2, k, 255, 255, 255, 7, 30); k += 40; } //Disegno la Palla //this.DrawRectFilled (window, ball.GetX(), ball.GetY(), ball.GetR(), ball.GetG(), ball.GetB(), ball.GetWidht(), ball.GetHeight()); this.DrawCircle(window, ball.GetX(), ball.GetY(), ball.GetRaggio(), 255, 255, 255); //Disegno la barra del Player 1 this.DrawRectFilled(window, bar1.GetX(), bar1.GetY(), 255, 0, 0, bar1.GetWidht(), bar1.GetHeight()); //Disegno la Barra del Player 2 this.DrawRectFilled(window, bar2.GetX(), bar2.GetY(), 0, 255, 0, bar2.GetWidht(), bar2.GetHeight()); //Movimeto barra del Player 1 bar1.Move(window, ball); //Movimeto barra del Player 2 bar2.Move2(window, ball, window.height); //Movimeto della Palla ball.Update(window.height, window.width); numb1.CurrentResultDec(window, bar1.GetPoints()); numb2.CurrentResult(window, bar1.GetPoints()); numb3.CurrentResultDec(window, bar2.GetPoints()); numb4.CurrentResult(window, bar2.GetPoints()); }